From 289078551d364000d1813823a17cc753850c583e Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Sun, 26 Jan 2025 19:01:17 +0000 Subject: [PATCH 1/2] docs: broken (or ambiguous) markdown link PiperOrigin-RevId: 719886612 Source-Link: https://github.com/googleapis/googleapis/commit/8798ceff3f6fbcdce3186b67ce9339df337569d5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/9e1815b2b2d4d0f25bf0e3bcb0f2117279fb60c4 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNvbnRhaW5lci8uT3dsQm90LnlhbWwiLCJoIjoiOWUxODE1YjJiMmQ0ZDBmMjViZjBlM2JjYjBmMjExNzI3OWZiNjBjNCJ9 --- .../google-cloud-container/v1/.coveragerc | 13 + .../google-cloud-container/v1/.flake8 | 33 + .../google-cloud-container/v1/MANIFEST.in | 2 + .../google-cloud-container/v1/README.rst | 49 + .../v1/docs/_static/custom.css | 3 + .../google-cloud-container/v1/docs/conf.py | 376 + .../v1/docs/container_v1/cluster_manager.rst | 10 + .../v1/docs/container_v1/services_.rst | 6 + .../v1/docs/container_v1/types_.rst | 6 + .../google-cloud-container/v1/docs/index.rst | 7 + .../v1/google/cloud/container/__init__.py | 387 + .../google/cloud/container/gapic_version.py | 16 + .../v1/google/cloud/container/py.typed | 2 + .../v1/google/cloud/container_v1/__init__.py | 388 + .../cloud/container_v1/gapic_metadata.json | 538 + .../cloud/container_v1/gapic_version.py | 16 + .../v1/google/cloud/container_v1/py.typed | 2 + .../cloud/container_v1/services/__init__.py | 15 + .../services/cluster_manager/__init__.py | 22 + .../services/cluster_manager/async_client.py | 4768 +++ .../services/cluster_manager/client.py | 5097 ++++ .../services/cluster_manager/pagers.py | 166 + .../cluster_manager/transports/README.rst | 9 + .../cluster_manager/transports/__init__.py | 38 + .../cluster_manager/transports/base.py | 707 + .../cluster_manager/transports/grpc.py | 1247 + .../transports/grpc_asyncio.py | 1522 + .../cluster_manager/transports/rest.py | 5424 ++++ .../cluster_manager/transports/rest_base.py | 1575 + .../cloud/container_v1/types/__init__.py | 380 + .../container_v1/types/cluster_service.py | 10586 +++++++ .../google-cloud-container/v1/mypy.ini | 3 + .../google-cloud-container/v1/noxfile.py | 280 + ..._cluster_manager_cancel_operation_async.py | 49 + ...d_cluster_manager_cancel_operation_sync.py | 49 + ...ger_check_autopilot_compatibility_async.py | 51 + ...ager_check_autopilot_compatibility_sync.py | 51 + ...ster_manager_complete_ip_rotation_async.py | 51 + ...uster_manager_complete_ip_rotation_sync.py | 51 + ...anager_complete_node_pool_upgrade_async.py | 49 + ...manager_complete_node_pool_upgrade_sync.py | 49 + ...ed_cluster_manager_create_cluster_async.py | 51 + ...ted_cluster_manager_create_cluster_sync.py | 51 + ..._cluster_manager_create_node_pool_async.py | 51 + ...d_cluster_manager_create_node_pool_sync.py | 51 + ...ed_cluster_manager_delete_cluster_async.py | 51 + ...ted_cluster_manager_delete_cluster_sync.py | 51 + ..._cluster_manager_delete_node_pool_async.py | 51 + ...d_cluster_manager_delete_node_pool_sync.py | 51 + ...rated_cluster_manager_get_cluster_async.py | 51 + ...erated_cluster_manager_get_cluster_sync.py | 51 + ...cluster_manager_get_json_web_keys_async.py | 51 + ..._cluster_manager_get_json_web_keys_sync.py | 51 + ...ted_cluster_manager_get_node_pool_async.py | 51 + ...ated_cluster_manager_get_node_pool_sync.py | 51 + ...ted_cluster_manager_get_operation_async.py | 51 + ...ated_cluster_manager_get_operation_sync.py | 51 + ...cluster_manager_get_server_config_async.py | 51 + ..._cluster_manager_get_server_config_sync.py | 51 + ...ted_cluster_manager_list_clusters_async.py | 51 + ...ated_cluster_manager_list_clusters_sync.py | 51 + ...d_cluster_manager_list_node_pools_async.py | 51 + ...ed_cluster_manager_list_node_pools_sync.py | 51 + ...d_cluster_manager_list_operations_async.py | 51 + ...ed_cluster_manager_list_operations_sync.py | 51 + ...r_manager_list_usable_subnetworks_async.py | 52 + ...er_manager_list_usable_subnetworks_sync.py | 52 + ...anager_rollback_node_pool_upgrade_async.py | 51 + ...manager_rollback_node_pool_upgrade_sync.py | 51 + ...cluster_manager_set_addons_config_async.py | 51 + ..._cluster_manager_set_addons_config_sync.py | 51 + ...erated_cluster_manager_set_labels_async.py | 52 + ...nerated_cluster_manager_set_labels_sync.py | 52 + ...d_cluster_manager_set_legacy_abac_async.py | 52 + ...ed_cluster_manager_set_legacy_abac_sync.py | 52 + ...ted_cluster_manager_set_locations_async.py | 52 + ...ated_cluster_manager_set_locations_sync.py | 52 + ...uster_manager_set_logging_service_async.py | 52 + ...luster_manager_set_logging_service_sync.py | 52 + ...er_manager_set_maintenance_policy_async.py | 54 + ...ter_manager_set_maintenance_policy_sync.py | 54 + ...d_cluster_manager_set_master_auth_async.py | 52 + ...ed_cluster_manager_set_master_auth_sync.py | 52 + ...er_manager_set_monitoring_service_async.py | 52 + ...ter_manager_set_monitoring_service_sync.py | 52 + ...luster_manager_set_network_policy_async.py | 51 + ...cluster_manager_set_network_policy_sync.py | 51 + ...manager_set_node_pool_autoscaling_async.py | 51 + ..._manager_set_node_pool_autoscaling_sync.py | 51 + ..._manager_set_node_pool_management_async.py | 51 + ...r_manager_set_node_pool_management_sync.py | 51 + ...luster_manager_set_node_pool_size_async.py | 52 + ...cluster_manager_set_node_pool_size_sync.py | 52 + ...cluster_manager_start_ip_rotation_async.py | 51 + ..._cluster_manager_start_ip_rotation_sync.py | 51 + ...ed_cluster_manager_update_cluster_async.py | 51 + ...ted_cluster_manager_update_cluster_sync.py | 51 + ...ted_cluster_manager_update_master_async.py | 52 + ...ated_cluster_manager_update_master_sync.py | 52 + ..._cluster_manager_update_node_pool_async.py | 53 + ...d_cluster_manager_update_node_pool_sync.py | 53 + .../snippet_metadata_google.container.v1.json | 6053 ++++ .../v1/scripts/fixup_container_v1_keywords.py | 209 + .../google-cloud-container/v1/setup.py | 98 + .../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.13.txt | 6 + .../v1/testing/constraints-3.7.txt | 10 + .../v1/testing/constraints-3.8.txt | 6 + .../v1/testing/constraints-3.9.txt | 6 + .../v1/tests/__init__.py | 16 + .../v1/tests/unit/__init__.py | 16 + .../v1/tests/unit/gapic/__init__.py | 16 + .../tests/unit/gapic/container_v1/__init__.py | 16 + .../container_v1/test_cluster_manager.py | 24315 ++++++++++++++++ .../v1beta1/.coveragerc | 13 + .../google-cloud-container/v1beta1/.flake8 | 33 + .../v1beta1/MANIFEST.in | 2 + .../google-cloud-container/v1beta1/README.rst | 49 + .../v1beta1/docs/_static/custom.css | 3 + .../v1beta1/docs/conf.py | 376 + .../container_v1beta1/cluster_manager.rst | 10 + .../docs/container_v1beta1/services_.rst | 6 + .../v1beta1/docs/container_v1beta1/types_.rst | 6 + .../v1beta1/docs/index.rst | 7 + .../google/cloud/container/__init__.py | 407 + .../google/cloud/container/gapic_version.py | 16 + .../v1beta1/google/cloud/container/py.typed | 2 + .../cloud/container_v1beta1/__init__.py | 408 + .../container_v1beta1/gapic_metadata.json | 373 + .../cloud/container_v1beta1/gapic_version.py | 16 + .../google/cloud/container_v1beta1/py.typed | 2 + .../container_v1beta1/services/__init__.py | 15 + .../services/cluster_manager/__init__.py | 22 + .../services/cluster_manager/async_client.py | 4885 ++++ .../services/cluster_manager/client.py | 5189 ++++ .../services/cluster_manager/pagers.py | 166 + .../cluster_manager/transports/README.rst | 9 + .../cluster_manager/transports/__init__.py | 33 + .../cluster_manager/transports/base.py | 741 + .../cluster_manager/transports/grpc.py | 1274 + .../transports/grpc_asyncio.py | 1574 + .../cloud/container_v1beta1/types/__init__.py | 400 + .../types/cluster_service.py | 10986 +++++++ .../google-cloud-container/v1beta1/mypy.ini | 3 + .../google-cloud-container/v1beta1/noxfile.py | 280 + ..._cluster_manager_cancel_operation_async.py | 52 + ...d_cluster_manager_cancel_operation_sync.py | 52 + ...ger_check_autopilot_compatibility_async.py | 51 + ...ager_check_autopilot_compatibility_sync.py | 51 + ...ster_manager_complete_ip_rotation_async.py | 54 + ...uster_manager_complete_ip_rotation_sync.py | 54 + ...anager_complete_node_pool_upgrade_async.py | 49 + ...manager_complete_node_pool_upgrade_sync.py | 49 + ...ed_cluster_manager_create_cluster_async.py | 53 + ...ted_cluster_manager_create_cluster_sync.py | 53 + ..._cluster_manager_create_node_pool_async.py | 54 + ...d_cluster_manager_create_node_pool_sync.py | 54 + ...ed_cluster_manager_delete_cluster_async.py | 54 + ...ted_cluster_manager_delete_cluster_sync.py | 54 + ..._cluster_manager_delete_node_pool_async.py | 55 + ...d_cluster_manager_delete_node_pool_sync.py | 55 + ...rated_cluster_manager_get_cluster_async.py | 54 + ...erated_cluster_manager_get_cluster_sync.py | 54 + ...cluster_manager_get_json_web_keys_async.py | 51 + ..._cluster_manager_get_json_web_keys_sync.py | 51 + ...ted_cluster_manager_get_node_pool_async.py | 55 + ...ated_cluster_manager_get_node_pool_sync.py | 55 + ...ted_cluster_manager_get_operation_async.py | 54 + ...ated_cluster_manager_get_operation_sync.py | 54 + ...cluster_manager_get_server_config_async.py | 53 + ..._cluster_manager_get_server_config_sync.py | 53 + ...ted_cluster_manager_list_clusters_async.py | 53 + ...ated_cluster_manager_list_clusters_sync.py | 53 + ...ed_cluster_manager_list_locations_async.py | 52 + ...ted_cluster_manager_list_locations_sync.py | 52 + ...d_cluster_manager_list_node_pools_async.py | 54 + ...ed_cluster_manager_list_node_pools_sync.py | 54 + ...d_cluster_manager_list_operations_async.py | 53 + ...ed_cluster_manager_list_operations_sync.py | 53 + ...r_manager_list_usable_subnetworks_async.py | 53 + ...er_manager_list_usable_subnetworks_sync.py | 53 + ...anager_rollback_node_pool_upgrade_async.py | 55 + ...manager_rollback_node_pool_upgrade_sync.py | 55 + ...cluster_manager_set_addons_config_async.py | 54 + ..._cluster_manager_set_addons_config_sync.py | 54 + ...erated_cluster_manager_set_labels_async.py | 55 + ...nerated_cluster_manager_set_labels_sync.py | 55 + ...d_cluster_manager_set_legacy_abac_async.py | 55 + ...ed_cluster_manager_set_legacy_abac_sync.py | 55 + ...ted_cluster_manager_set_locations_async.py | 55 + ...ated_cluster_manager_set_locations_sync.py | 55 + ...uster_manager_set_logging_service_async.py | 55 + ...luster_manager_set_logging_service_sync.py | 55 + ...er_manager_set_maintenance_policy_async.py | 54 + ...ter_manager_set_maintenance_policy_sync.py | 54 + ...d_cluster_manager_set_master_auth_async.py | 55 + ...ed_cluster_manager_set_master_auth_sync.py | 55 + ...er_manager_set_monitoring_service_async.py | 55 + ...ter_manager_set_monitoring_service_sync.py | 55 + ...luster_manager_set_network_policy_async.py | 54 + ...cluster_manager_set_network_policy_sync.py | 54 + ...manager_set_node_pool_autoscaling_async.py | 55 + ..._manager_set_node_pool_autoscaling_sync.py | 55 + ..._manager_set_node_pool_management_async.py | 55 + ...r_manager_set_node_pool_management_sync.py | 55 + ...luster_manager_set_node_pool_size_async.py | 56 + ...cluster_manager_set_node_pool_size_sync.py | 56 + ...cluster_manager_start_ip_rotation_async.py | 54 + ..._cluster_manager_start_ip_rotation_sync.py | 54 + ...ed_cluster_manager_update_cluster_async.py | 54 + ...ted_cluster_manager_update_cluster_sync.py | 54 + ...ted_cluster_manager_update_master_async.py | 55 + ...ated_cluster_manager_update_master_sync.py | 55 + ..._cluster_manager_update_node_pool_async.py | 57 + ...d_cluster_manager_update_node_pool_sync.py | 57 + ...pet_metadata_google.container.v1beta1.json | 6110 ++++ .../fixup_container_v1beta1_keywords.py | 210 + .../google-cloud-container/v1beta1/setup.py | 98 + .../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.13.txt | 6 + .../v1beta1/testing/constraints-3.7.txt | 10 + .../v1beta1/testing/constraints-3.8.txt | 6 + .../v1beta1/testing/constraints-3.9.txt | 6 + .../v1beta1/tests/__init__.py | 16 + .../v1beta1/tests/unit/__init__.py | 16 + .../v1beta1/tests/unit/gapic/__init__.py | 16 + .../unit/gapic/container_v1beta1/__init__.py | 16 + .../container_v1beta1/test_cluster_manager.py | 15801 ++++++++++ 232 files changed, 121375 insertions(+) create mode 100644 owl-bot-staging/google-cloud-container/v1/.coveragerc create mode 100644 owl-bot-staging/google-cloud-container/v1/.flake8 create mode 100644 owl-bot-staging/google-cloud-container/v1/MANIFEST.in create mode 100644 owl-bot-staging/google-cloud-container/v1/README.rst create mode 100644 owl-bot-staging/google-cloud-container/v1/docs/_static/custom.css create mode 100644 owl-bot-staging/google-cloud-container/v1/docs/conf.py create mode 100644 owl-bot-staging/google-cloud-container/v1/docs/container_v1/cluster_manager.rst create mode 100644 owl-bot-staging/google-cloud-container/v1/docs/container_v1/services_.rst create mode 100644 owl-bot-staging/google-cloud-container/v1/docs/container_v1/types_.rst create mode 100644 owl-bot-staging/google-cloud-container/v1/docs/index.rst create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container/gapic_version.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container/py.typed create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_version.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/py.typed create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/async_client.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/client.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/pagers.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/README.rst create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/base.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest_base.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/cluster_service.py create mode 100644 owl-bot-staging/google-cloud-container/v1/mypy.ini create mode 100644 owl-bot-staging/google-cloud-container/v1/noxfile.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/snippet_metadata_google.container.v1.json create mode 100644 owl-bot-staging/google-cloud-container/v1/scripts/fixup_container_v1_keywords.py create mode 100644 owl-bot-staging/google-cloud-container/v1/setup.py create mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.10.txt create mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.11.txt create mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.12.txt create mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.13.txt create mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.7.txt create mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.8.txt create mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.9.txt create mode 100644 owl-bot-staging/google-cloud-container/v1/tests/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1/tests/unit/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/container_v1/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/container_v1/test_cluster_manager.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/.coveragerc create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/.flake8 create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/MANIFEST.in create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/README.rst create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/docs/_static/custom.css create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/docs/conf.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/cluster_manager.rst create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/services_.rst create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/types_.rst create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/docs/index.rst create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/gapic_version.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/py.typed create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_version.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/py.typed create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/async_client.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/client.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/pagers.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/README.rst create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/cluster_service.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/mypy.ini create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/noxfile.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_async.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_sync.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/snippet_metadata_google.container.v1beta1.json create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/scripts/fixup_container_v1beta1_keywords.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/setup.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.10.txt create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.11.txt create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.12.txt create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.13.txt create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.7.txt create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.8.txt create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.9.txt create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/tests/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/tests/unit/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/__init__.py create mode 100644 owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/test_cluster_manager.py diff --git a/owl-bot-staging/google-cloud-container/v1/.coveragerc b/owl-bot-staging/google-cloud-container/v1/.coveragerc new file mode 100644 index 000000000000..113f6dbccc9f --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/.coveragerc @@ -0,0 +1,13 @@ +[run] +branch = True + +[report] +show_missing = True +omit = + google/cloud/container/__init__.py + google/cloud/container/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/google-cloud-container/v1/.flake8 b/owl-bot-staging/google-cloud-container/v1/.flake8 new file mode 100644 index 000000000000..29227d4cf419 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1/MANIFEST.in b/owl-bot-staging/google-cloud-container/v1/MANIFEST.in new file mode 100644 index 000000000000..8ff819564a87 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/MANIFEST.in @@ -0,0 +1,2 @@ +recursive-include google/cloud/container *.py +recursive-include google/cloud/container_v1 *.py diff --git a/owl-bot-staging/google-cloud-container/v1/README.rst b/owl-bot-staging/google-cloud-container/v1/README.rst new file mode 100644 index 000000000000..4f18726b102d --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/README.rst @@ -0,0 +1,49 @@ +Python Client for Google Cloud Container 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 Container 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/google-cloud-container/v1/docs/_static/custom.css b/owl-bot-staging/google-cloud-container/v1/docs/_static/custom.css new file mode 100644 index 000000000000..06423be0b592 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/docs/_static/custom.css @@ -0,0 +1,3 @@ +dl.field-list > dt { + min-width: 100px +} diff --git a/owl-bot-staging/google-cloud-container/v1/docs/conf.py b/owl-bot-staging/google-cloud-container/v1/docs/conf.py new file mode 100644 index 000000000000..5a9f847ff28e --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/docs/conf.py @@ -0,0 +1,376 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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-container 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-container" +copyright = u"2023, 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 = 'en' + +# 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 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-container-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-container.tex", + u"google-cloud-container 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-container", + u"Google Cloud Container 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-container", + u"google-cloud-container Documentation", + author, + "google-cloud-container", + "GAPIC library for Google Cloud Container 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/google-cloud-container/v1/docs/container_v1/cluster_manager.rst b/owl-bot-staging/google-cloud-container/v1/docs/container_v1/cluster_manager.rst new file mode 100644 index 000000000000..dc27a3bd5897 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/docs/container_v1/cluster_manager.rst @@ -0,0 +1,10 @@ +ClusterManager +-------------------------------- + +.. automodule:: google.cloud.container_v1.services.cluster_manager + :members: + :inherited-members: + +.. automodule:: google.cloud.container_v1.services.cluster_manager.pagers + :members: + :inherited-members: diff --git a/owl-bot-staging/google-cloud-container/v1/docs/container_v1/services_.rst b/owl-bot-staging/google-cloud-container/v1/docs/container_v1/services_.rst new file mode 100644 index 000000000000..a98a2319ff3c --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/docs/container_v1/services_.rst @@ -0,0 +1,6 @@ +Services for Google Cloud Container v1 API +========================================== +.. toctree:: + :maxdepth: 2 + + cluster_manager diff --git a/owl-bot-staging/google-cloud-container/v1/docs/container_v1/types_.rst b/owl-bot-staging/google-cloud-container/v1/docs/container_v1/types_.rst new file mode 100644 index 000000000000..3ae28cbf51a9 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/docs/container_v1/types_.rst @@ -0,0 +1,6 @@ +Types for Google Cloud Container v1 API +======================================= + +.. automodule:: google.cloud.container_v1.types + :members: + :show-inheritance: diff --git a/owl-bot-staging/google-cloud-container/v1/docs/index.rst b/owl-bot-staging/google-cloud-container/v1/docs/index.rst new file mode 100644 index 000000000000..1aafbdaf8390 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/docs/index.rst @@ -0,0 +1,7 @@ +API Reference +------------- +.. toctree:: + :maxdepth: 2 + + container_v1/services_ + container_v1/types_ diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container/__init__.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container/__init__.py new file mode 100644 index 000000000000..d7806508d08e --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container/__init__.py @@ -0,0 +1,387 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.container import gapic_version as package_version + +__version__ = package_version.__version__ + + +from google.cloud.container_v1.services.cluster_manager.client import ClusterManagerClient +from google.cloud.container_v1.services.cluster_manager.async_client import ClusterManagerAsyncClient + +from google.cloud.container_v1.types.cluster_service import AcceleratorConfig +from google.cloud.container_v1.types.cluster_service import AdditionalNodeNetworkConfig +from google.cloud.container_v1.types.cluster_service import AdditionalPodNetworkConfig +from google.cloud.container_v1.types.cluster_service import AdditionalPodRangesConfig +from google.cloud.container_v1.types.cluster_service import AddonsConfig +from google.cloud.container_v1.types.cluster_service import AdvancedDatapathObservabilityConfig +from google.cloud.container_v1.types.cluster_service import AdvancedMachineFeatures +from google.cloud.container_v1.types.cluster_service import AuthenticatorGroupsConfig +from google.cloud.container_v1.types.cluster_service import Autopilot +from google.cloud.container_v1.types.cluster_service import AutopilotCompatibilityIssue +from google.cloud.container_v1.types.cluster_service import AutoprovisioningNodePoolDefaults +from google.cloud.container_v1.types.cluster_service import AutoUpgradeOptions +from google.cloud.container_v1.types.cluster_service import BestEffortProvisioning +from google.cloud.container_v1.types.cluster_service import BinaryAuthorization +from google.cloud.container_v1.types.cluster_service import BlueGreenSettings +from google.cloud.container_v1.types.cluster_service import CancelOperationRequest +from google.cloud.container_v1.types.cluster_service import CheckAutopilotCompatibilityRequest +from google.cloud.container_v1.types.cluster_service import CheckAutopilotCompatibilityResponse +from google.cloud.container_v1.types.cluster_service import ClientCertificateConfig +from google.cloud.container_v1.types.cluster_service import CloudRunConfig +from google.cloud.container_v1.types.cluster_service import Cluster +from google.cloud.container_v1.types.cluster_service import ClusterAutoscaling +from google.cloud.container_v1.types.cluster_service import ClusterUpdate +from google.cloud.container_v1.types.cluster_service import CompleteIPRotationRequest +from google.cloud.container_v1.types.cluster_service import CompleteNodePoolUpgradeRequest +from google.cloud.container_v1.types.cluster_service import CompliancePostureConfig +from google.cloud.container_v1.types.cluster_service import ConfidentialNodes +from google.cloud.container_v1.types.cluster_service import ConfigConnectorConfig +from google.cloud.container_v1.types.cluster_service import ContainerdConfig +from google.cloud.container_v1.types.cluster_service import ControlPlaneEndpointsConfig +from google.cloud.container_v1.types.cluster_service import CostManagementConfig +from google.cloud.container_v1.types.cluster_service import CreateClusterRequest +from google.cloud.container_v1.types.cluster_service import CreateNodePoolRequest +from google.cloud.container_v1.types.cluster_service import DailyMaintenanceWindow +from google.cloud.container_v1.types.cluster_service import DatabaseEncryption +from google.cloud.container_v1.types.cluster_service import DefaultSnatStatus +from google.cloud.container_v1.types.cluster_service import DeleteClusterRequest +from google.cloud.container_v1.types.cluster_service import DeleteNodePoolRequest +from google.cloud.container_v1.types.cluster_service import DesiredEnterpriseConfig +from google.cloud.container_v1.types.cluster_service import DnsCacheConfig +from google.cloud.container_v1.types.cluster_service import DNSConfig +from google.cloud.container_v1.types.cluster_service import EnterpriseConfig +from google.cloud.container_v1.types.cluster_service import EphemeralStorageLocalSsdConfig +from google.cloud.container_v1.types.cluster_service import FastSocket +from google.cloud.container_v1.types.cluster_service import Fleet +from google.cloud.container_v1.types.cluster_service import GatewayAPIConfig +from google.cloud.container_v1.types.cluster_service import GcePersistentDiskCsiDriverConfig +from google.cloud.container_v1.types.cluster_service import GcfsConfig +from google.cloud.container_v1.types.cluster_service import GcpFilestoreCsiDriverConfig +from google.cloud.container_v1.types.cluster_service import GcsFuseCsiDriverConfig +from google.cloud.container_v1.types.cluster_service import GetClusterRequest +from google.cloud.container_v1.types.cluster_service import GetJSONWebKeysRequest +from google.cloud.container_v1.types.cluster_service import GetJSONWebKeysResponse +from google.cloud.container_v1.types.cluster_service import GetNodePoolRequest +from google.cloud.container_v1.types.cluster_service import GetOpenIDConfigRequest +from google.cloud.container_v1.types.cluster_service import GetOpenIDConfigResponse +from google.cloud.container_v1.types.cluster_service import GetOperationRequest +from google.cloud.container_v1.types.cluster_service import GetServerConfigRequest +from google.cloud.container_v1.types.cluster_service import GkeBackupAgentConfig +from google.cloud.container_v1.types.cluster_service import GPUDriverInstallationConfig +from google.cloud.container_v1.types.cluster_service import GPUSharingConfig +from google.cloud.container_v1.types.cluster_service import HorizontalPodAutoscaling +from google.cloud.container_v1.types.cluster_service import HttpLoadBalancing +from google.cloud.container_v1.types.cluster_service import IdentityServiceConfig +from google.cloud.container_v1.types.cluster_service import ILBSubsettingConfig +from google.cloud.container_v1.types.cluster_service import IntraNodeVisibilityConfig +from google.cloud.container_v1.types.cluster_service import IPAllocationPolicy +from google.cloud.container_v1.types.cluster_service import Jwk +from google.cloud.container_v1.types.cluster_service import K8sBetaAPIConfig +from google.cloud.container_v1.types.cluster_service import KubernetesDashboard +from google.cloud.container_v1.types.cluster_service import LegacyAbac +from google.cloud.container_v1.types.cluster_service import LinuxNodeConfig +from google.cloud.container_v1.types.cluster_service import ListClustersRequest +from google.cloud.container_v1.types.cluster_service import ListClustersResponse +from google.cloud.container_v1.types.cluster_service import ListNodePoolsRequest +from google.cloud.container_v1.types.cluster_service import ListNodePoolsResponse +from google.cloud.container_v1.types.cluster_service import ListOperationsRequest +from google.cloud.container_v1.types.cluster_service import ListOperationsResponse +from google.cloud.container_v1.types.cluster_service import ListUsableSubnetworksRequest +from google.cloud.container_v1.types.cluster_service import ListUsableSubnetworksResponse +from google.cloud.container_v1.types.cluster_service import LocalNvmeSsdBlockConfig +from google.cloud.container_v1.types.cluster_service import LoggingComponentConfig +from google.cloud.container_v1.types.cluster_service import LoggingConfig +from google.cloud.container_v1.types.cluster_service import LoggingVariantConfig +from google.cloud.container_v1.types.cluster_service import MaintenanceExclusionOptions +from google.cloud.container_v1.types.cluster_service import MaintenancePolicy +from google.cloud.container_v1.types.cluster_service import MaintenanceWindow +from google.cloud.container_v1.types.cluster_service import ManagedPrometheusConfig +from google.cloud.container_v1.types.cluster_service import MasterAuth +from google.cloud.container_v1.types.cluster_service import MasterAuthorizedNetworksConfig +from google.cloud.container_v1.types.cluster_service import MaxPodsConstraint +from google.cloud.container_v1.types.cluster_service import MeshCertificates +from google.cloud.container_v1.types.cluster_service import MonitoringComponentConfig +from google.cloud.container_v1.types.cluster_service import MonitoringConfig +from google.cloud.container_v1.types.cluster_service import NetworkConfig +from google.cloud.container_v1.types.cluster_service import NetworkPolicy +from google.cloud.container_v1.types.cluster_service import NetworkPolicyConfig +from google.cloud.container_v1.types.cluster_service import NetworkTags +from google.cloud.container_v1.types.cluster_service import NodeConfig +from google.cloud.container_v1.types.cluster_service import NodeConfigDefaults +from google.cloud.container_v1.types.cluster_service import NodeKubeletConfig +from google.cloud.container_v1.types.cluster_service import NodeLabels +from google.cloud.container_v1.types.cluster_service import NodeManagement +from google.cloud.container_v1.types.cluster_service import NodeNetworkConfig +from google.cloud.container_v1.types.cluster_service import NodePool +from google.cloud.container_v1.types.cluster_service import NodePoolAutoConfig +from google.cloud.container_v1.types.cluster_service import NodePoolAutoscaling +from google.cloud.container_v1.types.cluster_service import NodePoolDefaults +from google.cloud.container_v1.types.cluster_service import NodePoolLoggingConfig +from google.cloud.container_v1.types.cluster_service import NodeTaint +from google.cloud.container_v1.types.cluster_service import NodeTaints +from google.cloud.container_v1.types.cluster_service import NotificationConfig +from google.cloud.container_v1.types.cluster_service import Operation +from google.cloud.container_v1.types.cluster_service import OperationProgress +from google.cloud.container_v1.types.cluster_service import ParallelstoreCsiDriverConfig +from google.cloud.container_v1.types.cluster_service import PodCIDROverprovisionConfig +from google.cloud.container_v1.types.cluster_service import PrivateClusterConfig +from google.cloud.container_v1.types.cluster_service import PrivateClusterMasterGlobalAccessConfig +from google.cloud.container_v1.types.cluster_service import RangeInfo +from google.cloud.container_v1.types.cluster_service import RayClusterLoggingConfig +from google.cloud.container_v1.types.cluster_service import RayClusterMonitoringConfig +from google.cloud.container_v1.types.cluster_service import RayOperatorConfig +from google.cloud.container_v1.types.cluster_service import RBACBindingConfig +from google.cloud.container_v1.types.cluster_service import RecurringTimeWindow +from google.cloud.container_v1.types.cluster_service import ReleaseChannel +from google.cloud.container_v1.types.cluster_service import ReservationAffinity +from google.cloud.container_v1.types.cluster_service import ResourceLabels +from google.cloud.container_v1.types.cluster_service import ResourceLimit +from google.cloud.container_v1.types.cluster_service import ResourceManagerTags +from google.cloud.container_v1.types.cluster_service import ResourceUsageExportConfig +from google.cloud.container_v1.types.cluster_service import RollbackNodePoolUpgradeRequest +from google.cloud.container_v1.types.cluster_service import SandboxConfig +from google.cloud.container_v1.types.cluster_service import SecondaryBootDisk +from google.cloud.container_v1.types.cluster_service import SecondaryBootDiskUpdateStrategy +from google.cloud.container_v1.types.cluster_service import SecretManagerConfig +from google.cloud.container_v1.types.cluster_service import SecurityBulletinEvent +from google.cloud.container_v1.types.cluster_service import SecurityPostureConfig +from google.cloud.container_v1.types.cluster_service import ServerConfig +from google.cloud.container_v1.types.cluster_service import ServiceExternalIPsConfig +from google.cloud.container_v1.types.cluster_service import SetAddonsConfigRequest +from google.cloud.container_v1.types.cluster_service import SetLabelsRequest +from google.cloud.container_v1.types.cluster_service import SetLegacyAbacRequest +from google.cloud.container_v1.types.cluster_service import SetLocationsRequest +from google.cloud.container_v1.types.cluster_service import SetLoggingServiceRequest +from google.cloud.container_v1.types.cluster_service import SetMaintenancePolicyRequest +from google.cloud.container_v1.types.cluster_service import SetMasterAuthRequest +from google.cloud.container_v1.types.cluster_service import SetMonitoringServiceRequest +from google.cloud.container_v1.types.cluster_service import SetNetworkPolicyRequest +from google.cloud.container_v1.types.cluster_service import SetNodePoolAutoscalingRequest +from google.cloud.container_v1.types.cluster_service import SetNodePoolManagementRequest +from google.cloud.container_v1.types.cluster_service import SetNodePoolSizeRequest +from google.cloud.container_v1.types.cluster_service import ShieldedInstanceConfig +from google.cloud.container_v1.types.cluster_service import ShieldedNodes +from google.cloud.container_v1.types.cluster_service import SoleTenantConfig +from google.cloud.container_v1.types.cluster_service import StartIPRotationRequest +from google.cloud.container_v1.types.cluster_service import StatefulHAConfig +from google.cloud.container_v1.types.cluster_service import StatusCondition +from google.cloud.container_v1.types.cluster_service import TimeWindow +from google.cloud.container_v1.types.cluster_service import UpdateClusterRequest +from google.cloud.container_v1.types.cluster_service import UpdateMasterRequest +from google.cloud.container_v1.types.cluster_service import UpdateNodePoolRequest +from google.cloud.container_v1.types.cluster_service import UpgradeAvailableEvent +from google.cloud.container_v1.types.cluster_service import UpgradeEvent +from google.cloud.container_v1.types.cluster_service import UpgradeInfoEvent +from google.cloud.container_v1.types.cluster_service import UsableSubnetwork +from google.cloud.container_v1.types.cluster_service import UsableSubnetworkSecondaryRange +from google.cloud.container_v1.types.cluster_service import UserManagedKeysConfig +from google.cloud.container_v1.types.cluster_service import VerticalPodAutoscaling +from google.cloud.container_v1.types.cluster_service import VirtualNIC +from google.cloud.container_v1.types.cluster_service import WindowsNodeConfig +from google.cloud.container_v1.types.cluster_service import WorkloadIdentityConfig +from google.cloud.container_v1.types.cluster_service import WorkloadMetadataConfig +from google.cloud.container_v1.types.cluster_service import WorkloadPolicyConfig +from google.cloud.container_v1.types.cluster_service import DatapathProvider +from google.cloud.container_v1.types.cluster_service import InTransitEncryptionConfig +from google.cloud.container_v1.types.cluster_service import IPv6AccessType +from google.cloud.container_v1.types.cluster_service import NodePoolUpdateStrategy +from google.cloud.container_v1.types.cluster_service import PrivateIPv6GoogleAccess +from google.cloud.container_v1.types.cluster_service import StackType +from google.cloud.container_v1.types.cluster_service import UpgradeResourceType + +__all__ = ('ClusterManagerClient', + 'ClusterManagerAsyncClient', + 'AcceleratorConfig', + 'AdditionalNodeNetworkConfig', + 'AdditionalPodNetworkConfig', + 'AdditionalPodRangesConfig', + 'AddonsConfig', + 'AdvancedDatapathObservabilityConfig', + 'AdvancedMachineFeatures', + 'AuthenticatorGroupsConfig', + 'Autopilot', + 'AutopilotCompatibilityIssue', + 'AutoprovisioningNodePoolDefaults', + 'AutoUpgradeOptions', + 'BestEffortProvisioning', + 'BinaryAuthorization', + 'BlueGreenSettings', + 'CancelOperationRequest', + 'CheckAutopilotCompatibilityRequest', + 'CheckAutopilotCompatibilityResponse', + 'ClientCertificateConfig', + 'CloudRunConfig', + 'Cluster', + 'ClusterAutoscaling', + 'ClusterUpdate', + 'CompleteIPRotationRequest', + 'CompleteNodePoolUpgradeRequest', + 'CompliancePostureConfig', + 'ConfidentialNodes', + 'ConfigConnectorConfig', + 'ContainerdConfig', + 'ControlPlaneEndpointsConfig', + 'CostManagementConfig', + 'CreateClusterRequest', + 'CreateNodePoolRequest', + 'DailyMaintenanceWindow', + 'DatabaseEncryption', + 'DefaultSnatStatus', + 'DeleteClusterRequest', + 'DeleteNodePoolRequest', + 'DesiredEnterpriseConfig', + 'DnsCacheConfig', + 'DNSConfig', + 'EnterpriseConfig', + 'EphemeralStorageLocalSsdConfig', + 'FastSocket', + 'Fleet', + 'GatewayAPIConfig', + 'GcePersistentDiskCsiDriverConfig', + 'GcfsConfig', + 'GcpFilestoreCsiDriverConfig', + 'GcsFuseCsiDriverConfig', + 'GetClusterRequest', + 'GetJSONWebKeysRequest', + 'GetJSONWebKeysResponse', + 'GetNodePoolRequest', + 'GetOpenIDConfigRequest', + 'GetOpenIDConfigResponse', + 'GetOperationRequest', + 'GetServerConfigRequest', + 'GkeBackupAgentConfig', + 'GPUDriverInstallationConfig', + 'GPUSharingConfig', + 'HorizontalPodAutoscaling', + 'HttpLoadBalancing', + 'IdentityServiceConfig', + 'ILBSubsettingConfig', + 'IntraNodeVisibilityConfig', + 'IPAllocationPolicy', + 'Jwk', + 'K8sBetaAPIConfig', + 'KubernetesDashboard', + 'LegacyAbac', + 'LinuxNodeConfig', + 'ListClustersRequest', + 'ListClustersResponse', + 'ListNodePoolsRequest', + 'ListNodePoolsResponse', + 'ListOperationsRequest', + 'ListOperationsResponse', + 'ListUsableSubnetworksRequest', + 'ListUsableSubnetworksResponse', + 'LocalNvmeSsdBlockConfig', + 'LoggingComponentConfig', + 'LoggingConfig', + 'LoggingVariantConfig', + 'MaintenanceExclusionOptions', + 'MaintenancePolicy', + 'MaintenanceWindow', + 'ManagedPrometheusConfig', + 'MasterAuth', + 'MasterAuthorizedNetworksConfig', + 'MaxPodsConstraint', + 'MeshCertificates', + 'MonitoringComponentConfig', + 'MonitoringConfig', + 'NetworkConfig', + 'NetworkPolicy', + 'NetworkPolicyConfig', + 'NetworkTags', + 'NodeConfig', + 'NodeConfigDefaults', + 'NodeKubeletConfig', + 'NodeLabels', + 'NodeManagement', + 'NodeNetworkConfig', + 'NodePool', + 'NodePoolAutoConfig', + 'NodePoolAutoscaling', + 'NodePoolDefaults', + 'NodePoolLoggingConfig', + 'NodeTaint', + 'NodeTaints', + 'NotificationConfig', + 'Operation', + 'OperationProgress', + 'ParallelstoreCsiDriverConfig', + 'PodCIDROverprovisionConfig', + 'PrivateClusterConfig', + 'PrivateClusterMasterGlobalAccessConfig', + 'RangeInfo', + 'RayClusterLoggingConfig', + 'RayClusterMonitoringConfig', + 'RayOperatorConfig', + 'RBACBindingConfig', + 'RecurringTimeWindow', + 'ReleaseChannel', + 'ReservationAffinity', + 'ResourceLabels', + 'ResourceLimit', + 'ResourceManagerTags', + 'ResourceUsageExportConfig', + 'RollbackNodePoolUpgradeRequest', + 'SandboxConfig', + 'SecondaryBootDisk', + 'SecondaryBootDiskUpdateStrategy', + 'SecretManagerConfig', + 'SecurityBulletinEvent', + 'SecurityPostureConfig', + 'ServerConfig', + 'ServiceExternalIPsConfig', + 'SetAddonsConfigRequest', + 'SetLabelsRequest', + 'SetLegacyAbacRequest', + 'SetLocationsRequest', + 'SetLoggingServiceRequest', + 'SetMaintenancePolicyRequest', + 'SetMasterAuthRequest', + 'SetMonitoringServiceRequest', + 'SetNetworkPolicyRequest', + 'SetNodePoolAutoscalingRequest', + 'SetNodePoolManagementRequest', + 'SetNodePoolSizeRequest', + 'ShieldedInstanceConfig', + 'ShieldedNodes', + 'SoleTenantConfig', + 'StartIPRotationRequest', + 'StatefulHAConfig', + 'StatusCondition', + 'TimeWindow', + 'UpdateClusterRequest', + 'UpdateMasterRequest', + 'UpdateNodePoolRequest', + 'UpgradeAvailableEvent', + 'UpgradeEvent', + 'UpgradeInfoEvent', + 'UsableSubnetwork', + 'UsableSubnetworkSecondaryRange', + 'UserManagedKeysConfig', + 'VerticalPodAutoscaling', + 'VirtualNIC', + 'WindowsNodeConfig', + 'WorkloadIdentityConfig', + 'WorkloadMetadataConfig', + 'WorkloadPolicyConfig', + 'DatapathProvider', + 'InTransitEncryptionConfig', + 'IPv6AccessType', + 'NodePoolUpdateStrategy', + 'PrivateIPv6GoogleAccess', + 'StackType', + 'UpgradeResourceType', +) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container/gapic_version.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container/gapic_version.py new file mode 100644 index 000000000000..558c8aab67c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.0.0" # {x-release-please-version} diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container/py.typed b/owl-bot-staging/google-cloud-container/v1/google/cloud/container/py.typed new file mode 100644 index 000000000000..d5b0e29f91b4 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-container package uses inline types. diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/__init__.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/__init__.py new file mode 100644 index 000000000000..a996173c43cf --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/__init__.py @@ -0,0 +1,388 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.container_v1 import gapic_version as package_version + +__version__ = package_version.__version__ + + +from .services.cluster_manager import ClusterManagerClient +from .services.cluster_manager import ClusterManagerAsyncClient + +from .types.cluster_service import AcceleratorConfig +from .types.cluster_service import AdditionalNodeNetworkConfig +from .types.cluster_service import AdditionalPodNetworkConfig +from .types.cluster_service import AdditionalPodRangesConfig +from .types.cluster_service import AddonsConfig +from .types.cluster_service import AdvancedDatapathObservabilityConfig +from .types.cluster_service import AdvancedMachineFeatures +from .types.cluster_service import AuthenticatorGroupsConfig +from .types.cluster_service import Autopilot +from .types.cluster_service import AutopilotCompatibilityIssue +from .types.cluster_service import AutoprovisioningNodePoolDefaults +from .types.cluster_service import AutoUpgradeOptions +from .types.cluster_service import BestEffortProvisioning +from .types.cluster_service import BinaryAuthorization +from .types.cluster_service import BlueGreenSettings +from .types.cluster_service import CancelOperationRequest +from .types.cluster_service import CheckAutopilotCompatibilityRequest +from .types.cluster_service import CheckAutopilotCompatibilityResponse +from .types.cluster_service import ClientCertificateConfig +from .types.cluster_service import CloudRunConfig +from .types.cluster_service import Cluster +from .types.cluster_service import ClusterAutoscaling +from .types.cluster_service import ClusterUpdate +from .types.cluster_service import CompleteIPRotationRequest +from .types.cluster_service import CompleteNodePoolUpgradeRequest +from .types.cluster_service import CompliancePostureConfig +from .types.cluster_service import ConfidentialNodes +from .types.cluster_service import ConfigConnectorConfig +from .types.cluster_service import ContainerdConfig +from .types.cluster_service import ControlPlaneEndpointsConfig +from .types.cluster_service import CostManagementConfig +from .types.cluster_service import CreateClusterRequest +from .types.cluster_service import CreateNodePoolRequest +from .types.cluster_service import DailyMaintenanceWindow +from .types.cluster_service import DatabaseEncryption +from .types.cluster_service import DefaultSnatStatus +from .types.cluster_service import DeleteClusterRequest +from .types.cluster_service import DeleteNodePoolRequest +from .types.cluster_service import DesiredEnterpriseConfig +from .types.cluster_service import DnsCacheConfig +from .types.cluster_service import DNSConfig +from .types.cluster_service import EnterpriseConfig +from .types.cluster_service import EphemeralStorageLocalSsdConfig +from .types.cluster_service import FastSocket +from .types.cluster_service import Fleet +from .types.cluster_service import GatewayAPIConfig +from .types.cluster_service import GcePersistentDiskCsiDriverConfig +from .types.cluster_service import GcfsConfig +from .types.cluster_service import GcpFilestoreCsiDriverConfig +from .types.cluster_service import GcsFuseCsiDriverConfig +from .types.cluster_service import GetClusterRequest +from .types.cluster_service import GetJSONWebKeysRequest +from .types.cluster_service import GetJSONWebKeysResponse +from .types.cluster_service import GetNodePoolRequest +from .types.cluster_service import GetOpenIDConfigRequest +from .types.cluster_service import GetOpenIDConfigResponse +from .types.cluster_service import GetOperationRequest +from .types.cluster_service import GetServerConfigRequest +from .types.cluster_service import GkeBackupAgentConfig +from .types.cluster_service import GPUDriverInstallationConfig +from .types.cluster_service import GPUSharingConfig +from .types.cluster_service import HorizontalPodAutoscaling +from .types.cluster_service import HttpLoadBalancing +from .types.cluster_service import IdentityServiceConfig +from .types.cluster_service import ILBSubsettingConfig +from .types.cluster_service import IntraNodeVisibilityConfig +from .types.cluster_service import IPAllocationPolicy +from .types.cluster_service import Jwk +from .types.cluster_service import K8sBetaAPIConfig +from .types.cluster_service import KubernetesDashboard +from .types.cluster_service import LegacyAbac +from .types.cluster_service import LinuxNodeConfig +from .types.cluster_service import ListClustersRequest +from .types.cluster_service import ListClustersResponse +from .types.cluster_service import ListNodePoolsRequest +from .types.cluster_service import ListNodePoolsResponse +from .types.cluster_service import ListOperationsRequest +from .types.cluster_service import ListOperationsResponse +from .types.cluster_service import ListUsableSubnetworksRequest +from .types.cluster_service import ListUsableSubnetworksResponse +from .types.cluster_service import LocalNvmeSsdBlockConfig +from .types.cluster_service import LoggingComponentConfig +from .types.cluster_service import LoggingConfig +from .types.cluster_service import LoggingVariantConfig +from .types.cluster_service import MaintenanceExclusionOptions +from .types.cluster_service import MaintenancePolicy +from .types.cluster_service import MaintenanceWindow +from .types.cluster_service import ManagedPrometheusConfig +from .types.cluster_service import MasterAuth +from .types.cluster_service import MasterAuthorizedNetworksConfig +from .types.cluster_service import MaxPodsConstraint +from .types.cluster_service import MeshCertificates +from .types.cluster_service import MonitoringComponentConfig +from .types.cluster_service import MonitoringConfig +from .types.cluster_service import NetworkConfig +from .types.cluster_service import NetworkPolicy +from .types.cluster_service import NetworkPolicyConfig +from .types.cluster_service import NetworkTags +from .types.cluster_service import NodeConfig +from .types.cluster_service import NodeConfigDefaults +from .types.cluster_service import NodeKubeletConfig +from .types.cluster_service import NodeLabels +from .types.cluster_service import NodeManagement +from .types.cluster_service import NodeNetworkConfig +from .types.cluster_service import NodePool +from .types.cluster_service import NodePoolAutoConfig +from .types.cluster_service import NodePoolAutoscaling +from .types.cluster_service import NodePoolDefaults +from .types.cluster_service import NodePoolLoggingConfig +from .types.cluster_service import NodeTaint +from .types.cluster_service import NodeTaints +from .types.cluster_service import NotificationConfig +from .types.cluster_service import Operation +from .types.cluster_service import OperationProgress +from .types.cluster_service import ParallelstoreCsiDriverConfig +from .types.cluster_service import PodCIDROverprovisionConfig +from .types.cluster_service import PrivateClusterConfig +from .types.cluster_service import PrivateClusterMasterGlobalAccessConfig +from .types.cluster_service import RangeInfo +from .types.cluster_service import RayClusterLoggingConfig +from .types.cluster_service import RayClusterMonitoringConfig +from .types.cluster_service import RayOperatorConfig +from .types.cluster_service import RBACBindingConfig +from .types.cluster_service import RecurringTimeWindow +from .types.cluster_service import ReleaseChannel +from .types.cluster_service import ReservationAffinity +from .types.cluster_service import ResourceLabels +from .types.cluster_service import ResourceLimit +from .types.cluster_service import ResourceManagerTags +from .types.cluster_service import ResourceUsageExportConfig +from .types.cluster_service import RollbackNodePoolUpgradeRequest +from .types.cluster_service import SandboxConfig +from .types.cluster_service import SecondaryBootDisk +from .types.cluster_service import SecondaryBootDiskUpdateStrategy +from .types.cluster_service import SecretManagerConfig +from .types.cluster_service import SecurityBulletinEvent +from .types.cluster_service import SecurityPostureConfig +from .types.cluster_service import ServerConfig +from .types.cluster_service import ServiceExternalIPsConfig +from .types.cluster_service import SetAddonsConfigRequest +from .types.cluster_service import SetLabelsRequest +from .types.cluster_service import SetLegacyAbacRequest +from .types.cluster_service import SetLocationsRequest +from .types.cluster_service import SetLoggingServiceRequest +from .types.cluster_service import SetMaintenancePolicyRequest +from .types.cluster_service import SetMasterAuthRequest +from .types.cluster_service import SetMonitoringServiceRequest +from .types.cluster_service import SetNetworkPolicyRequest +from .types.cluster_service import SetNodePoolAutoscalingRequest +from .types.cluster_service import SetNodePoolManagementRequest +from .types.cluster_service import SetNodePoolSizeRequest +from .types.cluster_service import ShieldedInstanceConfig +from .types.cluster_service import ShieldedNodes +from .types.cluster_service import SoleTenantConfig +from .types.cluster_service import StartIPRotationRequest +from .types.cluster_service import StatefulHAConfig +from .types.cluster_service import StatusCondition +from .types.cluster_service import TimeWindow +from .types.cluster_service import UpdateClusterRequest +from .types.cluster_service import UpdateMasterRequest +from .types.cluster_service import UpdateNodePoolRequest +from .types.cluster_service import UpgradeAvailableEvent +from .types.cluster_service import UpgradeEvent +from .types.cluster_service import UpgradeInfoEvent +from .types.cluster_service import UsableSubnetwork +from .types.cluster_service import UsableSubnetworkSecondaryRange +from .types.cluster_service import UserManagedKeysConfig +from .types.cluster_service import VerticalPodAutoscaling +from .types.cluster_service import VirtualNIC +from .types.cluster_service import WindowsNodeConfig +from .types.cluster_service import WorkloadIdentityConfig +from .types.cluster_service import WorkloadMetadataConfig +from .types.cluster_service import WorkloadPolicyConfig +from .types.cluster_service import DatapathProvider +from .types.cluster_service import InTransitEncryptionConfig +from .types.cluster_service import IPv6AccessType +from .types.cluster_service import NodePoolUpdateStrategy +from .types.cluster_service import PrivateIPv6GoogleAccess +from .types.cluster_service import StackType +from .types.cluster_service import UpgradeResourceType + +__all__ = ( + 'ClusterManagerAsyncClient', +'AcceleratorConfig', +'AdditionalNodeNetworkConfig', +'AdditionalPodNetworkConfig', +'AdditionalPodRangesConfig', +'AddonsConfig', +'AdvancedDatapathObservabilityConfig', +'AdvancedMachineFeatures', +'AuthenticatorGroupsConfig', +'AutoUpgradeOptions', +'Autopilot', +'AutopilotCompatibilityIssue', +'AutoprovisioningNodePoolDefaults', +'BestEffortProvisioning', +'BinaryAuthorization', +'BlueGreenSettings', +'CancelOperationRequest', +'CheckAutopilotCompatibilityRequest', +'CheckAutopilotCompatibilityResponse', +'ClientCertificateConfig', +'CloudRunConfig', +'Cluster', +'ClusterAutoscaling', +'ClusterManagerClient', +'ClusterUpdate', +'CompleteIPRotationRequest', +'CompleteNodePoolUpgradeRequest', +'CompliancePostureConfig', +'ConfidentialNodes', +'ConfigConnectorConfig', +'ContainerdConfig', +'ControlPlaneEndpointsConfig', +'CostManagementConfig', +'CreateClusterRequest', +'CreateNodePoolRequest', +'DNSConfig', +'DailyMaintenanceWindow', +'DatabaseEncryption', +'DatapathProvider', +'DefaultSnatStatus', +'DeleteClusterRequest', +'DeleteNodePoolRequest', +'DesiredEnterpriseConfig', +'DnsCacheConfig', +'EnterpriseConfig', +'EphemeralStorageLocalSsdConfig', +'FastSocket', +'Fleet', +'GPUDriverInstallationConfig', +'GPUSharingConfig', +'GatewayAPIConfig', +'GcePersistentDiskCsiDriverConfig', +'GcfsConfig', +'GcpFilestoreCsiDriverConfig', +'GcsFuseCsiDriverConfig', +'GetClusterRequest', +'GetJSONWebKeysRequest', +'GetJSONWebKeysResponse', +'GetNodePoolRequest', +'GetOpenIDConfigRequest', +'GetOpenIDConfigResponse', +'GetOperationRequest', +'GetServerConfigRequest', +'GkeBackupAgentConfig', +'HorizontalPodAutoscaling', +'HttpLoadBalancing', +'ILBSubsettingConfig', +'IPAllocationPolicy', +'IPv6AccessType', +'IdentityServiceConfig', +'InTransitEncryptionConfig', +'IntraNodeVisibilityConfig', +'Jwk', +'K8sBetaAPIConfig', +'KubernetesDashboard', +'LegacyAbac', +'LinuxNodeConfig', +'ListClustersRequest', +'ListClustersResponse', +'ListNodePoolsRequest', +'ListNodePoolsResponse', +'ListOperationsRequest', +'ListOperationsResponse', +'ListUsableSubnetworksRequest', +'ListUsableSubnetworksResponse', +'LocalNvmeSsdBlockConfig', +'LoggingComponentConfig', +'LoggingConfig', +'LoggingVariantConfig', +'MaintenanceExclusionOptions', +'MaintenancePolicy', +'MaintenanceWindow', +'ManagedPrometheusConfig', +'MasterAuth', +'MasterAuthorizedNetworksConfig', +'MaxPodsConstraint', +'MeshCertificates', +'MonitoringComponentConfig', +'MonitoringConfig', +'NetworkConfig', +'NetworkPolicy', +'NetworkPolicyConfig', +'NetworkTags', +'NodeConfig', +'NodeConfigDefaults', +'NodeKubeletConfig', +'NodeLabels', +'NodeManagement', +'NodeNetworkConfig', +'NodePool', +'NodePoolAutoConfig', +'NodePoolAutoscaling', +'NodePoolDefaults', +'NodePoolLoggingConfig', +'NodePoolUpdateStrategy', +'NodeTaint', +'NodeTaints', +'NotificationConfig', +'Operation', +'OperationProgress', +'ParallelstoreCsiDriverConfig', +'PodCIDROverprovisionConfig', +'PrivateClusterConfig', +'PrivateClusterMasterGlobalAccessConfig', +'PrivateIPv6GoogleAccess', +'RBACBindingConfig', +'RangeInfo', +'RayClusterLoggingConfig', +'RayClusterMonitoringConfig', +'RayOperatorConfig', +'RecurringTimeWindow', +'ReleaseChannel', +'ReservationAffinity', +'ResourceLabels', +'ResourceLimit', +'ResourceManagerTags', +'ResourceUsageExportConfig', +'RollbackNodePoolUpgradeRequest', +'SandboxConfig', +'SecondaryBootDisk', +'SecondaryBootDiskUpdateStrategy', +'SecretManagerConfig', +'SecurityBulletinEvent', +'SecurityPostureConfig', +'ServerConfig', +'ServiceExternalIPsConfig', +'SetAddonsConfigRequest', +'SetLabelsRequest', +'SetLegacyAbacRequest', +'SetLocationsRequest', +'SetLoggingServiceRequest', +'SetMaintenancePolicyRequest', +'SetMasterAuthRequest', +'SetMonitoringServiceRequest', +'SetNetworkPolicyRequest', +'SetNodePoolAutoscalingRequest', +'SetNodePoolManagementRequest', +'SetNodePoolSizeRequest', +'ShieldedInstanceConfig', +'ShieldedNodes', +'SoleTenantConfig', +'StackType', +'StartIPRotationRequest', +'StatefulHAConfig', +'StatusCondition', +'TimeWindow', +'UpdateClusterRequest', +'UpdateMasterRequest', +'UpdateNodePoolRequest', +'UpgradeAvailableEvent', +'UpgradeEvent', +'UpgradeInfoEvent', +'UpgradeResourceType', +'UsableSubnetwork', +'UsableSubnetworkSecondaryRange', +'UserManagedKeysConfig', +'VerticalPodAutoscaling', +'VirtualNIC', +'WindowsNodeConfig', +'WorkloadIdentityConfig', +'WorkloadMetadataConfig', +'WorkloadPolicyConfig', +) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_metadata.json b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_metadata.json new file mode 100644 index 000000000000..0183acedf64a --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_metadata.json @@ -0,0 +1,538 @@ + { + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "python", + "libraryPackage": "google.cloud.container_v1", + "protoPackage": "google.container.v1", + "schema": "1.0", + "services": { + "ClusterManager": { + "clients": { + "grpc": { + "libraryClient": "ClusterManagerClient", + "rpcs": { + "CancelOperation": { + "methods": [ + "cancel_operation" + ] + }, + "CheckAutopilotCompatibility": { + "methods": [ + "check_autopilot_compatibility" + ] + }, + "CompleteIPRotation": { + "methods": [ + "complete_ip_rotation" + ] + }, + "CompleteNodePoolUpgrade": { + "methods": [ + "complete_node_pool_upgrade" + ] + }, + "CreateCluster": { + "methods": [ + "create_cluster" + ] + }, + "CreateNodePool": { + "methods": [ + "create_node_pool" + ] + }, + "DeleteCluster": { + "methods": [ + "delete_cluster" + ] + }, + "DeleteNodePool": { + "methods": [ + "delete_node_pool" + ] + }, + "GetCluster": { + "methods": [ + "get_cluster" + ] + }, + "GetJSONWebKeys": { + "methods": [ + "get_json_web_keys" + ] + }, + "GetNodePool": { + "methods": [ + "get_node_pool" + ] + }, + "GetOperation": { + "methods": [ + "get_operation" + ] + }, + "GetServerConfig": { + "methods": [ + "get_server_config" + ] + }, + "ListClusters": { + "methods": [ + "list_clusters" + ] + }, + "ListNodePools": { + "methods": [ + "list_node_pools" + ] + }, + "ListOperations": { + "methods": [ + "list_operations" + ] + }, + "ListUsableSubnetworks": { + "methods": [ + "list_usable_subnetworks" + ] + }, + "RollbackNodePoolUpgrade": { + "methods": [ + "rollback_node_pool_upgrade" + ] + }, + "SetAddonsConfig": { + "methods": [ + "set_addons_config" + ] + }, + "SetLabels": { + "methods": [ + "set_labels" + ] + }, + "SetLegacyAbac": { + "methods": [ + "set_legacy_abac" + ] + }, + "SetLocations": { + "methods": [ + "set_locations" + ] + }, + "SetLoggingService": { + "methods": [ + "set_logging_service" + ] + }, + "SetMaintenancePolicy": { + "methods": [ + "set_maintenance_policy" + ] + }, + "SetMasterAuth": { + "methods": [ + "set_master_auth" + ] + }, + "SetMonitoringService": { + "methods": [ + "set_monitoring_service" + ] + }, + "SetNetworkPolicy": { + "methods": [ + "set_network_policy" + ] + }, + "SetNodePoolAutoscaling": { + "methods": [ + "set_node_pool_autoscaling" + ] + }, + "SetNodePoolManagement": { + "methods": [ + "set_node_pool_management" + ] + }, + "SetNodePoolSize": { + "methods": [ + "set_node_pool_size" + ] + }, + "StartIPRotation": { + "methods": [ + "start_ip_rotation" + ] + }, + "UpdateCluster": { + "methods": [ + "update_cluster" + ] + }, + "UpdateMaster": { + "methods": [ + "update_master" + ] + }, + "UpdateNodePool": { + "methods": [ + "update_node_pool" + ] + } + } + }, + "grpc-async": { + "libraryClient": "ClusterManagerAsyncClient", + "rpcs": { + "CancelOperation": { + "methods": [ + "cancel_operation" + ] + }, + "CheckAutopilotCompatibility": { + "methods": [ + "check_autopilot_compatibility" + ] + }, + "CompleteIPRotation": { + "methods": [ + "complete_ip_rotation" + ] + }, + "CompleteNodePoolUpgrade": { + "methods": [ + "complete_node_pool_upgrade" + ] + }, + "CreateCluster": { + "methods": [ + "create_cluster" + ] + }, + "CreateNodePool": { + "methods": [ + "create_node_pool" + ] + }, + "DeleteCluster": { + "methods": [ + "delete_cluster" + ] + }, + "DeleteNodePool": { + "methods": [ + "delete_node_pool" + ] + }, + "GetCluster": { + "methods": [ + "get_cluster" + ] + }, + "GetJSONWebKeys": { + "methods": [ + "get_json_web_keys" + ] + }, + "GetNodePool": { + "methods": [ + "get_node_pool" + ] + }, + "GetOperation": { + "methods": [ + "get_operation" + ] + }, + "GetServerConfig": { + "methods": [ + "get_server_config" + ] + }, + "ListClusters": { + "methods": [ + "list_clusters" + ] + }, + "ListNodePools": { + "methods": [ + "list_node_pools" + ] + }, + "ListOperations": { + "methods": [ + "list_operations" + ] + }, + "ListUsableSubnetworks": { + "methods": [ + "list_usable_subnetworks" + ] + }, + "RollbackNodePoolUpgrade": { + "methods": [ + "rollback_node_pool_upgrade" + ] + }, + "SetAddonsConfig": { + "methods": [ + "set_addons_config" + ] + }, + "SetLabels": { + "methods": [ + "set_labels" + ] + }, + "SetLegacyAbac": { + "methods": [ + "set_legacy_abac" + ] + }, + "SetLocations": { + "methods": [ + "set_locations" + ] + }, + "SetLoggingService": { + "methods": [ + "set_logging_service" + ] + }, + "SetMaintenancePolicy": { + "methods": [ + "set_maintenance_policy" + ] + }, + "SetMasterAuth": { + "methods": [ + "set_master_auth" + ] + }, + "SetMonitoringService": { + "methods": [ + "set_monitoring_service" + ] + }, + "SetNetworkPolicy": { + "methods": [ + "set_network_policy" + ] + }, + "SetNodePoolAutoscaling": { + "methods": [ + "set_node_pool_autoscaling" + ] + }, + "SetNodePoolManagement": { + "methods": [ + "set_node_pool_management" + ] + }, + "SetNodePoolSize": { + "methods": [ + "set_node_pool_size" + ] + }, + "StartIPRotation": { + "methods": [ + "start_ip_rotation" + ] + }, + "UpdateCluster": { + "methods": [ + "update_cluster" + ] + }, + "UpdateMaster": { + "methods": [ + "update_master" + ] + }, + "UpdateNodePool": { + "methods": [ + "update_node_pool" + ] + } + } + }, + "rest": { + "libraryClient": "ClusterManagerClient", + "rpcs": { + "CancelOperation": { + "methods": [ + "cancel_operation" + ] + }, + "CheckAutopilotCompatibility": { + "methods": [ + "check_autopilot_compatibility" + ] + }, + "CompleteIPRotation": { + "methods": [ + "complete_ip_rotation" + ] + }, + "CompleteNodePoolUpgrade": { + "methods": [ + "complete_node_pool_upgrade" + ] + }, + "CreateCluster": { + "methods": [ + "create_cluster" + ] + }, + "CreateNodePool": { + "methods": [ + "create_node_pool" + ] + }, + "DeleteCluster": { + "methods": [ + "delete_cluster" + ] + }, + "DeleteNodePool": { + "methods": [ + "delete_node_pool" + ] + }, + "GetCluster": { + "methods": [ + "get_cluster" + ] + }, + "GetJSONWebKeys": { + "methods": [ + "get_json_web_keys" + ] + }, + "GetNodePool": { + "methods": [ + "get_node_pool" + ] + }, + "GetOperation": { + "methods": [ + "get_operation" + ] + }, + "GetServerConfig": { + "methods": [ + "get_server_config" + ] + }, + "ListClusters": { + "methods": [ + "list_clusters" + ] + }, + "ListNodePools": { + "methods": [ + "list_node_pools" + ] + }, + "ListOperations": { + "methods": [ + "list_operations" + ] + }, + "ListUsableSubnetworks": { + "methods": [ + "list_usable_subnetworks" + ] + }, + "RollbackNodePoolUpgrade": { + "methods": [ + "rollback_node_pool_upgrade" + ] + }, + "SetAddonsConfig": { + "methods": [ + "set_addons_config" + ] + }, + "SetLabels": { + "methods": [ + "set_labels" + ] + }, + "SetLegacyAbac": { + "methods": [ + "set_legacy_abac" + ] + }, + "SetLocations": { + "methods": [ + "set_locations" + ] + }, + "SetLoggingService": { + "methods": [ + "set_logging_service" + ] + }, + "SetMaintenancePolicy": { + "methods": [ + "set_maintenance_policy" + ] + }, + "SetMasterAuth": { + "methods": [ + "set_master_auth" + ] + }, + "SetMonitoringService": { + "methods": [ + "set_monitoring_service" + ] + }, + "SetNetworkPolicy": { + "methods": [ + "set_network_policy" + ] + }, + "SetNodePoolAutoscaling": { + "methods": [ + "set_node_pool_autoscaling" + ] + }, + "SetNodePoolManagement": { + "methods": [ + "set_node_pool_management" + ] + }, + "SetNodePoolSize": { + "methods": [ + "set_node_pool_size" + ] + }, + "StartIPRotation": { + "methods": [ + "start_ip_rotation" + ] + }, + "UpdateCluster": { + "methods": [ + "update_cluster" + ] + }, + "UpdateMaster": { + "methods": [ + "update_master" + ] + }, + "UpdateNodePool": { + "methods": [ + "update_node_pool" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_version.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_version.py new file mode 100644 index 000000000000..558c8aab67c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.0.0" # {x-release-please-version} diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/py.typed b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/py.typed new file mode 100644 index 000000000000..d5b0e29f91b4 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-container package uses inline types. diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/__init__.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/__init__.py new file mode 100644 index 000000000000..8f6cf068242c --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/__init__.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/__init__.py new file mode 100644 index 000000000000..f3aa6cc7d359 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ClusterManagerClient +from .async_client import ClusterManagerAsyncClient + +__all__ = ( + 'ClusterManagerClient', + 'ClusterManagerAsyncClient', +) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/async_client.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/async_client.py new file mode 100644 index 000000000000..2b965387bb5e --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/async_client.py @@ -0,0 +1,4768 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 logging as std_logging +from collections import OrderedDict +import re +from typing import Dict, Callable, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union +import warnings + +from google.cloud.container_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_async as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + + +try: + OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore + +from google.cloud.container_v1.services.cluster_manager import pagers +from google.cloud.container_v1.types import cluster_service +from google.rpc import status_pb2 # type: ignore +from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import ClusterManagerGrpcAsyncIOTransport +from .client import ClusterManagerClient + +try: + from google.api_core import client_logging # type: ignore + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + +class ClusterManagerAsyncClient: + """Google Kubernetes Engine Cluster Manager v1""" + + _client: ClusterManagerClient + + # Copy defaults from the synchronous client for use here. + # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead. + DEFAULT_ENDPOINT = ClusterManagerClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = ClusterManagerClient.DEFAULT_MTLS_ENDPOINT + _DEFAULT_ENDPOINT_TEMPLATE = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE + _DEFAULT_UNIVERSE = ClusterManagerClient._DEFAULT_UNIVERSE + + ca_pool_path = staticmethod(ClusterManagerClient.ca_pool_path) + parse_ca_pool_path = staticmethod(ClusterManagerClient.parse_ca_pool_path) + crypto_key_version_path = staticmethod(ClusterManagerClient.crypto_key_version_path) + parse_crypto_key_version_path = staticmethod(ClusterManagerClient.parse_crypto_key_version_path) + topic_path = staticmethod(ClusterManagerClient.topic_path) + parse_topic_path = staticmethod(ClusterManagerClient.parse_topic_path) + common_billing_account_path = staticmethod(ClusterManagerClient.common_billing_account_path) + parse_common_billing_account_path = staticmethod(ClusterManagerClient.parse_common_billing_account_path) + common_folder_path = staticmethod(ClusterManagerClient.common_folder_path) + parse_common_folder_path = staticmethod(ClusterManagerClient.parse_common_folder_path) + common_organization_path = staticmethod(ClusterManagerClient.common_organization_path) + parse_common_organization_path = staticmethod(ClusterManagerClient.parse_common_organization_path) + common_project_path = staticmethod(ClusterManagerClient.common_project_path) + parse_common_project_path = staticmethod(ClusterManagerClient.parse_common_project_path) + common_location_path = staticmethod(ClusterManagerClient.common_location_path) + parse_common_location_path = staticmethod(ClusterManagerClient.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: + ClusterManagerAsyncClient: The constructed client. + """ + return ClusterManagerClient.from_service_account_info.__func__(ClusterManagerAsyncClient, 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: + ClusterManagerAsyncClient: The constructed client. + """ + return ClusterManagerClient.from_service_account_file.__func__(ClusterManagerAsyncClient, 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 ClusterManagerClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + + @property + def transport(self) -> ClusterManagerTransport: + """Returns the transport used by the client instance. + + Returns: + ClusterManagerTransport: The transport used by the client instance. + """ + return self._client.transport + + @property + def api_endpoint(self): + """Return the API endpoint used by the client instance. + + Returns: + str: The API endpoint used by the client instance. + """ + return self._client._api_endpoint + + @property + def universe_domain(self) -> str: + """Return the universe domain used by the client instance. + + Returns: + str: The universe domain used + by the client instance. + """ + return self._client._universe_domain + + get_transport_class = ClusterManagerClient.get_transport_class + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Optional[Union[str, ClusterManagerTransport, Callable[..., ClusterManagerTransport]]] = "grpc_asyncio", + client_options: Optional[ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the cluster manager async 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 (Optional[Union[str,ClusterManagerTransport,Callable[..., ClusterManagerTransport]]]): + The transport to use, or a Callable that constructs and returns a new transport to use. + If a Callable is given, it will be called with the same set of initialization + arguments as used in the ClusterManagerTransport constructor. + 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. + + 1. The ``api_endpoint`` property can be used to override the + default endpoint provided by the client when ``transport`` is + not explicitly provided. Only if this property is not set and + ``transport`` was not explicitly provided, the endpoint is + determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment + variable, which have one of the following values: + "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). + + 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide a client certificate for mTLS 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. + + 3. The ``universe_domain`` property can be used to override the + default "googleapis.com" universe. Note that ``api_endpoint`` + property still takes precedence; and ``universe_domain`` is + currently not supported for mTLS. + + 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. + """ + self._client = ClusterManagerClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.container_v1.ClusterManagerAsyncClient`.", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "universeDomain": getattr(self._client._transport._credentials, "universe_domain", ""), + "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}", + "credentialsInfo": getattr(self.transport._credentials, "get_cred_info", lambda: None)(), + } if hasattr(self._client._transport, "_credentials") else { + "serviceName": "google.container.v1.ClusterManager", + "credentialsType": None, + } + ) + + async def list_clusters(self, + request: Optional[Union[cluster_service.ListClustersRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListClustersResponse: + r"""Lists all clusters owned by a project in either the + specified zone or all zones. + + .. 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 import container_v1 + + async def sample_list_clusters(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.ListClustersRequest( + ) + + # Make the request + response = await client.list_clusters(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.ListClustersRequest, dict]]): + The request object. ListClustersRequest lists clusters. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides, or "-" for all zones. This + field has been deprecated and replaced by the parent + field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + parent (:class:`str`): + The parent (project and location) where the clusters + will be listed. Specified in the format + ``projects/*/locations/*``. Location "-" matches all + zones and all regions. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.ListClustersResponse: + ListClustersResponse is the result of + ListClustersRequest. + + """ + # 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([project_id, zone, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListClustersRequest): + request = cluster_service.ListClustersRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.list_clusters] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_cluster(self, + request: Optional[Union[cluster_service.GetClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Cluster: + r"""Gets the details of a specific cluster. + + .. 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 import container_v1 + + async def sample_get_cluster(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.GetClusterRequest( + ) + + # Make the request + response = await client.get_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.GetClusterRequest, dict]]): + The request object. GetClusterRequest gets the settings + of a cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster + to retrieve. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster) of the cluster to + retrieve. Specified in the format + ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Cluster: + A Google Kubernetes Engine cluster. + """ + # 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([project_id, zone, cluster_id, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetClusterRequest): + request = cluster_service.GetClusterRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.get_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_cluster(self, + request: Optional[Union[cluster_service.CreateClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster: Optional[cluster_service.Cluster] = None, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Creates a cluster, consisting of the specified number and type + of Google Compute Engine instances. + + By default, the cluster is created in the project's `default + network `__. + + One firewall is added for the cluster. After cluster creation, + the Kubelet creates routes for each node to allow the containers + on that node to communicate with all other instances in the + cluster. + + Finally, an entry is added to the project's global metadata + indicating which CIDR range the cluster is using. + + .. 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 import container_v1 + + async def sample_create_cluster(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CreateClusterRequest( + ) + + # Make the request + response = await client.create_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.CreateClusterRequest, dict]]): + The request object. CreateClusterRequest creates a + cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the parent field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster (:class:`google.cloud.container_v1.types.Cluster`): + Required. A `cluster + resource `__ + + This corresponds to the ``cluster`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + parent (:class:`str`): + The parent (project and location) where the cluster will + be created. Specified 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_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CreateClusterRequest): + request = cluster_service.CreateClusterRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster is not None: + request.cluster = cluster + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.create_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_cluster(self, + request: Optional[Union[cluster_service.UpdateClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + update: Optional[cluster_service.ClusterUpdate] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Updates the settings of a specific cluster. + + .. 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 import container_v1 + + async def sample_update_cluster(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.UpdateClusterRequest( + ) + + # Make the request + response = await client.update_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.UpdateClusterRequest, dict]]): + The request object. UpdateClusterRequest updates the + settings of a cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster + to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update (:class:`google.cloud.container_v1.types.ClusterUpdate`): + Required. A description of the + update. + + This corresponds to the ``update`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster) of the cluster to + update. Specified in the format + ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, update, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.UpdateClusterRequest): + request = cluster_service.UpdateClusterRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if update is not None: + request.update = update + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.update_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_node_pool(self, + request: Optional[Union[cluster_service.UpdateNodePoolRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Updates the version and/or image type for the + specified node pool. + + .. 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 import container_v1 + + async def sample_update_node_pool(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.UpdateNodePoolRequest( + node_version="node_version_value", + image_type="image_type_value", + ) + + # Make the request + response = await client.update_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.UpdateNodePoolRequest, dict]]): + The request object. UpdateNodePoolRequests update a node + pool's image and/or version. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.UpdateNodePoolRequest): + request = cluster_service.UpdateNodePoolRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.update_node_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_node_pool_autoscaling(self, + request: Optional[Union[cluster_service.SetNodePoolAutoscalingRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the autoscaling settings for the specified node + pool. + + .. 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 import container_v1 + + async def sample_set_node_pool_autoscaling(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetNodePoolAutoscalingRequest( + ) + + # Make the request + response = await client.set_node_pool_autoscaling(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.SetNodePoolAutoscalingRequest, dict]]): + The request object. SetNodePoolAutoscalingRequest sets + the autoscaler settings of a node pool. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNodePoolAutoscalingRequest): + request = cluster_service.SetNodePoolAutoscalingRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_node_pool_autoscaling] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_logging_service(self, + request: Optional[Union[cluster_service.SetLoggingServiceRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + logging_service: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the logging service for a specific cluster. + + .. 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 import container_v1 + + async def sample_set_logging_service(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetLoggingServiceRequest( + logging_service="logging_service_value", + ) + + # Make the request + response = await client.set_logging_service(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.SetLoggingServiceRequest, dict]]): + The request object. SetLoggingServiceRequest sets the + logging service of a cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster + to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + logging_service (:class:`str`): + Required. The logging service the cluster should use to + write logs. Currently available options: + + - ``logging.googleapis.com/kubernetes`` - The Cloud + Logging service with a Kubernetes-native resource + model + - ``logging.googleapis.com`` - The legacy Cloud Logging + service (no longer available as of GKE 1.15). + - ``none`` - no logs will be exported from the cluster. + + If left as an empty + string,\ ``logging.googleapis.com/kubernetes`` will be + used for GKE 1.14+ or ``logging.googleapis.com`` for + earlier versions. + + This corresponds to the ``logging_service`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster) of the cluster to + set logging. Specified in the format + ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, logging_service, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLoggingServiceRequest): + request = cluster_service.SetLoggingServiceRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if logging_service is not None: + request.logging_service = logging_service + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_logging_service] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_monitoring_service(self, + request: Optional[Union[cluster_service.SetMonitoringServiceRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + monitoring_service: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the monitoring service for a specific cluster. + + .. 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 import container_v1 + + async def sample_set_monitoring_service(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetMonitoringServiceRequest( + monitoring_service="monitoring_service_value", + ) + + # Make the request + response = await client.set_monitoring_service(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.SetMonitoringServiceRequest, dict]]): + The request object. SetMonitoringServiceRequest sets the + monitoring service of a cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster + to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + monitoring_service (:class:`str`): + Required. The monitoring service the cluster should use + to write metrics. Currently available options: + + - "monitoring.googleapis.com/kubernetes" - The Cloud + Monitoring service with a Kubernetes-native resource + model + - ``monitoring.googleapis.com`` - The legacy Cloud + Monitoring service (no longer available as of GKE + 1.15). + - ``none`` - No metrics will be exported from the + cluster. + + If left as an empty + string,\ ``monitoring.googleapis.com/kubernetes`` will + be used for GKE 1.14+ or ``monitoring.googleapis.com`` + for earlier versions. + + This corresponds to the ``monitoring_service`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster) of the cluster to + set monitoring. Specified in the format + ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, monitoring_service, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetMonitoringServiceRequest): + request = cluster_service.SetMonitoringServiceRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if monitoring_service is not None: + request.monitoring_service = monitoring_service + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_monitoring_service] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_addons_config(self, + request: Optional[Union[cluster_service.SetAddonsConfigRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + addons_config: Optional[cluster_service.AddonsConfig] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the addons for a specific cluster. + + .. 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 import container_v1 + + async def sample_set_addons_config(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetAddonsConfigRequest( + ) + + # Make the request + response = await client.set_addons_config(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.SetAddonsConfigRequest, dict]]): + The request object. SetAddonsConfigRequest sets the + addons associated with the cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster + to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + addons_config (:class:`google.cloud.container_v1.types.AddonsConfig`): + Required. The desired configurations + for the various addons available to run + in the cluster. + + This corresponds to the ``addons_config`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster) of the cluster to + set addons. Specified in the format + ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, addons_config, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetAddonsConfigRequest): + request = cluster_service.SetAddonsConfigRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if addons_config is not None: + request.addons_config = addons_config + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_addons_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_locations(self, + request: Optional[Union[cluster_service.SetLocationsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + locations: Optional[MutableSequence[str]] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the locations for a specific cluster. Deprecated. Use + `projects.locations.clusters.update `__ + instead. + + .. 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 import container_v1 + + async def sample_set_locations(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetLocationsRequest( + locations=['locations_value1', 'locations_value2'], + ) + + # Make the request + response = await client.set_locations(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.SetLocationsRequest, dict]]): + The request object. SetLocationsRequest sets the + locations of the cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster + to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + locations (:class:`MutableSequence[str]`): + Required. The desired list of Google Compute Engine + `zones `__ + in which the cluster's nodes should be located. Changing + the locations a cluster is in will result in nodes being + either created or removed from the cluster, depending on + whether locations are being added or removed. + + This list must always include the cluster's primary + zone. + + This corresponds to the ``locations`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster) of the cluster to + set locations. Specified in the format + ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + warnings.warn("ClusterManagerAsyncClient.set_locations is deprecated", + DeprecationWarning) + + # 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([project_id, zone, cluster_id, locations, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLocationsRequest): + request = cluster_service.SetLocationsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if name is not None: + request.name = name + if locations: + request.locations.extend(locations) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_locations] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_master(self, + request: Optional[Union[cluster_service.UpdateMasterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + master_version: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Updates the master for a specific cluster. + + .. 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 import container_v1 + + async def sample_update_master(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.UpdateMasterRequest( + master_version="master_version_value", + ) + + # Make the request + response = await client.update_master(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.UpdateMasterRequest, dict]]): + The request object. UpdateMasterRequest updates the + master of the cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster + to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + master_version (:class:`str`): + Required. The Kubernetes version to + change the master to. + Users may specify either explicit + versions offered by Kubernetes Engine or + version aliases, which have the + following behavior: + + - "latest": picks the highest valid + Kubernetes version + - "1.X": picks the highest valid + patch+gke.N patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N + patch in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit + Kubernetes version + - "-": picks the default Kubernetes + version + + This corresponds to the ``master_version`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster) of the cluster to + update. Specified in the format + ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, master_version, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.UpdateMasterRequest): + request = cluster_service.UpdateMasterRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if master_version is not None: + request.master_version = master_version + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.update_master] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_master_auth(self, + request: Optional[Union[cluster_service.SetMasterAuthRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets master auth materials. Currently supports + changing the admin password or a specific cluster, + either via password generation or explicitly setting the + password. + + .. 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 import container_v1 + + async def sample_set_master_auth(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetMasterAuthRequest( + action="SET_USERNAME", + ) + + # Make the request + response = await client.set_master_auth(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.SetMasterAuthRequest, dict]]): + The request object. SetMasterAuthRequest updates the + admin password of a cluster. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetMasterAuthRequest): + request = cluster_service.SetMasterAuthRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_master_auth] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_cluster(self, + request: Optional[Union[cluster_service.DeleteClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Deletes the cluster, including the Kubernetes + endpoint and all worker nodes. + + Firewalls and routes that were configured during cluster + creation are also deleted. + + Other Google Compute Engine resources that might be in + use by the cluster, such as load balancer resources, are + not deleted if they weren't present when the cluster was + initially created. + + .. 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 import container_v1 + + async def sample_delete_cluster(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.DeleteClusterRequest( + ) + + # Make the request + response = await client.delete_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.DeleteClusterRequest, dict]]): + The request object. DeleteClusterRequest deletes a + cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster + to delete. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster) of the cluster to + delete. Specified in the format + ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.DeleteClusterRequest): + request = cluster_service.DeleteClusterRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.delete_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_operations(self, + request: Optional[Union[cluster_service.ListOperationsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListOperationsResponse: + r"""Lists all operations in a project in a specific zone + or all zones. + + .. 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 import container_v1 + + async def sample_list_operations(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.ListOperationsRequest( + ) + + # Make the request + response = await client.list_operations(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.ListOperationsRequest, dict]]): + The request object. ListOperationsRequest lists + operations. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + to return operations for, or ``-`` for all zones. This + field has been deprecated and replaced by the parent + field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + parent (:class:`str`): + The parent (project and location) where the operations + will be listed. Specified in the format + ``projects/*/locations/*``. Location "-" matches all + zones and all regions. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.ListOperationsResponse: + ListOperationsResponse is the result + of ListOperationsRequest. + + """ + # 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([project_id, zone, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListOperationsRequest): + request = cluster_service.ListOperationsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.list_operations] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_operation(self, + request: Optional[Union[cluster_service.GetOperationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + operation_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Gets the specified operation. + + .. 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 import container_v1 + + async def sample_get_operation(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.GetOperationRequest( + ) + + # Make the request + response = await client.get_operation(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.GetOperationRequest, dict]]): + The request object. GetOperationRequest gets a single + operation. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + operation_id (:class:`str`): + Deprecated. The server-assigned ``name`` of the + operation. This field has been deprecated and replaced + by the name field. + + This corresponds to the ``operation_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, operation id) of the + operation to get. Specified in the format + ``projects/*/locations/*/operations/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, operation_id, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetOperationRequest): + request = cluster_service.GetOperationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if operation_id is not None: + request.operation_id = operation_id + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.get_operation] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def cancel_operation(self, + request: Optional[Union[cluster_service.CancelOperationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + operation_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> None: + r"""Cancels the specified operation. + + .. 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 import container_v1 + + async def sample_cancel_operation(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CancelOperationRequest( + ) + + # Make the request + await client.cancel_operation(request=request) + + Args: + request (Optional[Union[google.cloud.container_v1.types.CancelOperationRequest, dict]]): + The request object. CancelOperationRequest cancels a + single operation. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the operation resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + operation_id (:class:`str`): + Deprecated. The server-assigned ``name`` of the + operation. This field has been deprecated and replaced + by the name field. + + This corresponds to the ``operation_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, operation id) of the + operation to cancel. Specified in the format + ``projects/*/locations/*/operations/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + # 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([project_id, zone, operation_id, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CancelOperationRequest): + request = cluster_service.CancelOperationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if operation_id is not None: + request.operation_id = operation_id + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.cancel_operation] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + async def get_server_config(self, + request: Optional[Union[cluster_service.GetServerConfigRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ServerConfig: + r"""Returns configuration info about the Google + Kubernetes Engine service. + + .. 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 import container_v1 + + async def sample_get_server_config(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.GetServerConfigRequest( + ) + + # Make the request + response = await client.get_server_config(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.GetServerConfigRequest, dict]]): + The request object. Gets the current Kubernetes Engine + service configuration. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + to return operations for. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project and location) of the server config to + get, specified in the format ``projects/*/locations/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.ServerConfig: + Kubernetes Engine service + configuration. + + """ + # 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([project_id, zone, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetServerConfigRequest): + request = cluster_service.GetServerConfigRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.get_server_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_json_web_keys(self, + request: Optional[Union[cluster_service.GetJSONWebKeysRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.GetJSONWebKeysResponse: + r"""Gets the public component of the cluster signing keys + in JSON Web Key format. + + .. 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 import container_v1 + + async def sample_get_json_web_keys(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.GetJSONWebKeysRequest( + ) + + # Make the request + response = await client.get_json_web_keys(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.GetJSONWebKeysRequest, dict]]): + The request object. GetJSONWebKeysRequest gets the public component of the + keys used by the cluster to sign token requests. This + will be the jwks_uri for the discover document returned + by getOpenIDConfig. See the OpenID Connect Discovery 1.0 + specification for details. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.GetJSONWebKeysResponse: + GetJSONWebKeysResponse is a valid + JSON Web Key Set as specififed in rfc + 7517 + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetJSONWebKeysRequest): + request = cluster_service.GetJSONWebKeysRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.get_json_web_keys] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_node_pools(self, + request: Optional[Union[cluster_service.ListNodePoolsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListNodePoolsResponse: + r"""Lists the node pools for a cluster. + + .. 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 import container_v1 + + async def sample_list_node_pools(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.ListNodePoolsRequest( + ) + + # Make the request + response = await client.list_node_pools(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.ListNodePoolsRequest, dict]]): + The request object. ListNodePoolsRequest lists the node + pool(s) for a cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the parent field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the parent field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + parent (:class:`str`): + The parent (project, location, cluster name) where the + node pools will be listed. Specified in the format + ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.ListNodePoolsResponse: + ListNodePoolsResponse is the result + of ListNodePoolsRequest. + + """ + # 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([project_id, zone, cluster_id, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListNodePoolsRequest): + request = cluster_service.ListNodePoolsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.list_node_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_node_pool(self, + request: Optional[Union[cluster_service.GetNodePoolRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.NodePool: + r"""Retrieves the requested node pool. + + .. 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 import container_v1 + + async def sample_get_node_pool(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.GetNodePoolRequest( + ) + + # Make the request + response = await client.get_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.GetNodePoolRequest, dict]]): + The request object. GetNodePoolRequest retrieves a node + pool for a cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (:class:`str`): + Deprecated. The name of the node + pool. This field has been deprecated and + replaced by the name field. + + This corresponds to the ``node_pool_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster, node pool id) of + the node pool to get. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.NodePool: + NodePool contains the name and + configuration for a cluster's node pool. + Node pools are a set of nodes (i.e. + VM's), with a common configuration and + specification, under the control of the + cluster master. They may have a set of + Kubernetes labels applied to them, which + may be used to reference them during pod + scheduling. They may also be resized up + or down, to accommodate the workload. + + """ + # 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([project_id, zone, cluster_id, node_pool_id, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetNodePoolRequest): + request = cluster_service.GetNodePoolRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.get_node_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_node_pool(self, + request: Optional[Union[cluster_service.CreateNodePoolRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool: Optional[cluster_service.NodePool] = None, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Creates a node pool for a cluster. + + .. 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 import container_v1 + + async def sample_create_node_pool(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CreateNodePoolRequest( + ) + + # Make the request + response = await client.create_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.CreateNodePoolRequest, dict]]): + The request object. CreateNodePoolRequest creates a node + pool for a cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the parent field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the parent field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool (:class:`google.cloud.container_v1.types.NodePool`): + Required. The node pool to create. + This corresponds to the ``node_pool`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + parent (:class:`str`): + The parent (project, location, cluster name) where the + node pool will be created. Specified in the format + ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_pool, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CreateNodePoolRequest): + request = cluster_service.CreateNodePoolRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool is not None: + request.node_pool = node_pool + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.create_node_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_node_pool(self, + request: Optional[Union[cluster_service.DeleteNodePoolRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Deletes a node pool from a cluster. + + .. 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 import container_v1 + + async def sample_delete_node_pool(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.DeleteNodePoolRequest( + ) + + # Make the request + response = await client.delete_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.DeleteNodePoolRequest, dict]]): + The request object. DeleteNodePoolRequest deletes a node + pool for a cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (:class:`str`): + Deprecated. The name of the node pool + to delete. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``node_pool_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster, node pool id) of + the node pool to delete. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_pool_id, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.DeleteNodePoolRequest): + request = cluster_service.DeleteNodePoolRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.delete_node_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def complete_node_pool_upgrade(self, + request: Optional[Union[cluster_service.CompleteNodePoolUpgradeRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> None: + r"""CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + .. 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 import container_v1 + + async def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + await client.complete_node_pool_upgrade(request=request) + + Args: + request (Optional[Union[google.cloud.container_v1.types.CompleteNodePoolUpgradeRequest, dict]]): + The request object. CompleteNodePoolUpgradeRequest sets + the name of target node pool to complete + upgrade. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CompleteNodePoolUpgradeRequest): + request = cluster_service.CompleteNodePoolUpgradeRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.complete_node_pool_upgrade] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + async def rollback_node_pool_upgrade(self, + request: Optional[Union[cluster_service.RollbackNodePoolUpgradeRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Rolls back a previously Aborted or Failed NodePool + upgrade. This makes no changes if the last upgrade + successfully completed. + + .. 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 import container_v1 + + async def sample_rollback_node_pool_upgrade(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.RollbackNodePoolUpgradeRequest( + ) + + # Make the request + response = await client.rollback_node_pool_upgrade(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.RollbackNodePoolUpgradeRequest, dict]]): + The request object. RollbackNodePoolUpgradeRequest + rollbacks the previously Aborted or + Failed NodePool upgrade. This will be an + no-op if the last upgrade successfully + completed. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster + to rollback. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (:class:`str`): + Deprecated. The name of the node pool + to rollback. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``node_pool_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster, node pool id) of + the node poll to rollback upgrade. Specified in the + format + ``projects/*/locations/*/clusters/*/nodePools/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_pool_id, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.RollbackNodePoolUpgradeRequest): + request = cluster_service.RollbackNodePoolUpgradeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.rollback_node_pool_upgrade] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_node_pool_management(self, + request: Optional[Union[cluster_service.SetNodePoolManagementRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the NodeManagement options for a node pool. + + .. 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 import container_v1 + + async def sample_set_node_pool_management(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetNodePoolManagementRequest( + ) + + # Make the request + response = await client.set_node_pool_management(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.SetNodePoolManagementRequest, dict]]): + The request object. SetNodePoolManagementRequest sets the + node management properties of a node + pool. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNodePoolManagementRequest): + request = cluster_service.SetNodePoolManagementRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_node_pool_management] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_labels(self, + request: Optional[Union[cluster_service.SetLabelsRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets labels on a cluster. + + .. 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 import container_v1 + + async def sample_set_labels(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetLabelsRequest( + label_fingerprint="label_fingerprint_value", + ) + + # Make the request + response = await client.set_labels(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.SetLabelsRequest, dict]]): + The request object. SetLabelsRequest sets the Google + Cloud Platform labels on a Google + Container Engine cluster, which will in + turn set them for Google Compute Engine + resources used by that cluster + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLabelsRequest): + request = cluster_service.SetLabelsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_labels] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_legacy_abac(self, + request: Optional[Union[cluster_service.SetLegacyAbacRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + enabled: Optional[bool] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Enables or disables the ABAC authorization mechanism + on a cluster. + + .. 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 import container_v1 + + async def sample_set_legacy_abac(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetLegacyAbacRequest( + enabled=True, + ) + + # Make the request + response = await client.set_legacy_abac(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.SetLegacyAbacRequest, dict]]): + The request object. SetLegacyAbacRequest enables or + disables the ABAC authorization + mechanism for a cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster + to update. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + enabled (:class:`bool`): + Required. Whether ABAC authorization + will be enabled in the cluster. + + This corresponds to the ``enabled`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster name) of the + cluster to set legacy abac. Specified in the format + ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, enabled, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLegacyAbacRequest): + request = cluster_service.SetLegacyAbacRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if enabled is not None: + request.enabled = enabled + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_legacy_abac] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def start_ip_rotation(self, + request: Optional[Union[cluster_service.StartIPRotationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Starts master IP rotation. + + .. 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 import container_v1 + + async def sample_start_ip_rotation(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.StartIPRotationRequest( + ) + + # Make the request + response = await client.start_ip_rotation(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.StartIPRotationRequest, dict]]): + The request object. StartIPRotationRequest creates a new + IP for the cluster and then performs a + node upgrade on each node pool to point + to the new IP. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster name) of the + cluster to start IP rotation. Specified in the format + ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.StartIPRotationRequest): + request = cluster_service.StartIPRotationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.start_ip_rotation] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def complete_ip_rotation(self, + request: Optional[Union[cluster_service.CompleteIPRotationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Completes master IP rotation. + + .. 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 import container_v1 + + async def sample_complete_ip_rotation(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CompleteIPRotationRequest( + ) + + # Make the request + response = await client.complete_ip_rotation(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.CompleteIPRotationRequest, dict]]): + The request object. CompleteIPRotationRequest moves the + cluster master back into single-IP mode. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster name) of the + cluster to complete IP rotation. Specified in the format + ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CompleteIPRotationRequest): + request = cluster_service.CompleteIPRotationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.complete_ip_rotation] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_node_pool_size(self, + request: Optional[Union[cluster_service.SetNodePoolSizeRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the size for a specific node pool. The new size will be + used for all replicas, including future replicas created by + modifying + [NodePool.locations][google.container.v1.NodePool.locations]. + + .. 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 import container_v1 + + async def sample_set_node_pool_size(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetNodePoolSizeRequest( + node_count=1070, + ) + + # Make the request + response = await client.set_node_pool_size(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.SetNodePoolSizeRequest, dict]]): + The request object. SetNodePoolSizeRequest sets the size + of a node pool. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNodePoolSizeRequest): + request = cluster_service.SetNodePoolSizeRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_node_pool_size] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_network_policy(self, + request: Optional[Union[cluster_service.SetNetworkPolicyRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + network_policy: Optional[cluster_service.NetworkPolicy] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Enables or disables Network Policy for a cluster. + + .. 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 import container_v1 + + async def sample_set_network_policy(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetNetworkPolicyRequest( + ) + + # Make the request + response = await client.set_network_policy(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.SetNetworkPolicyRequest, dict]]): + The request object. SetNetworkPolicyRequest + enables/disables network policy for a + cluster. + project_id (:class:`str`): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + network_policy (:class:`google.cloud.container_v1.types.NetworkPolicy`): + Required. Configuration options for + the NetworkPolicy feature. + + This corresponds to the ``network_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster name) of the + cluster to set networking policy. Specified in the + format ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, network_policy, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNetworkPolicyRequest): + request = cluster_service.SetNetworkPolicyRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if network_policy is not None: + request.network_policy = network_policy + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_network_policy] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_maintenance_policy(self, + request: Optional[Union[cluster_service.SetMaintenancePolicyRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + maintenance_policy: Optional[cluster_service.MaintenancePolicy] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the maintenance policy for a cluster. + + .. 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 import container_v1 + + async def sample_set_maintenance_policy(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetMaintenancePolicyRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.set_maintenance_policy(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.SetMaintenancePolicyRequest, dict]]): + The request object. SetMaintenancePolicyRequest sets the + maintenance policy for a cluster. + project_id (:class:`str`): + Required. The Google Developers Console `project ID or + project + number `__. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. The name of the cluster to + update. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + maintenance_policy (:class:`google.cloud.container_v1.types.MaintenancePolicy`): + Required. The maintenance policy to + be set for the cluster. An empty field + clears the existing maintenance policy. + + This corresponds to the ``maintenance_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (:class:`str`): + The name (project, location, cluster name) of the + cluster to set maintenance policy. Specified in the + format ``projects/*/locations/*/clusters/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, maintenance_policy, 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetMaintenancePolicyRequest): + request = cluster_service.SetMaintenancePolicyRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if maintenance_policy is not None: + request.maintenance_policy = maintenance_policy + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_maintenance_policy] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_usable_subnetworks(self, + request: Optional[Union[cluster_service.ListUsableSubnetworksRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> pagers.ListUsableSubnetworksAsyncPager: + r"""Lists subnetworks that are usable for creating + clusters in a project. + + .. 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 import container_v1 + + async def sample_list_usable_subnetworks(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.ListUsableSubnetworksRequest( + ) + + # Make the request + page_result = client.list_usable_subnetworks(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.ListUsableSubnetworksRequest, dict]]): + The request object. ListUsableSubnetworksRequest requests + the list of usable subnetworks available + to a user for creating clusters. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.services.cluster_manager.pagers.ListUsableSubnetworksAsyncPager: + ListUsableSubnetworksResponse is the + response of + ListUsableSubnetworksRequest. + + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListUsableSubnetworksRequest): + request = cluster_service.ListUsableSubnetworksRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.list_usable_subnetworks] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # 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.ListUsableSubnetworksAsyncPager( + method=rpc, + request=request, + response=response, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def check_autopilot_compatibility(self, + request: Optional[Union[cluster_service.CheckAutopilotCompatibilityRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.CheckAutopilotCompatibilityResponse: + r"""Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + .. 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 import container_v1 + + async def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = await client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.CheckAutopilotCompatibilityRequest, dict]]): + The request object. CheckAutopilotCompatibilityRequest + requests getting the blockers for the + given operation in the cluster. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.CheckAutopilotCompatibilityResponse: + CheckAutopilotCompatibilityResponse + has a list of compatibility issues. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CheckAutopilotCompatibilityRequest): + request = cluster_service.CheckAutopilotCompatibilityRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.check_autopilot_compatibility] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def __aenter__(self) -> "ClusterManagerAsyncClient": + 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__ = ( + "ClusterManagerAsyncClient", +) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/client.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/client.py new file mode 100644 index 000000000000..f8cc3a3fb28c --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/client.py @@ -0,0 +1,5097 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 logging as std_logging +import os +import re +from typing import Dict, Callable, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast +import warnings + +from google.cloud.container_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, None] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object, None] # type: ignore + +try: + from google.api_core import client_logging # type: ignore + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + +from google.cloud.container_v1.services.cluster_manager import pagers +from google.cloud.container_v1.types import cluster_service +from google.rpc import status_pb2 # type: ignore +from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import ClusterManagerGrpcTransport +from .transports.grpc_asyncio import ClusterManagerGrpcAsyncIOTransport +from .transports.rest import ClusterManagerRestTransport + + +class ClusterManagerClientMeta(type): + """Metaclass for the ClusterManager 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[ClusterManagerTransport]] + _transport_registry["grpc"] = ClusterManagerGrpcTransport + _transport_registry["grpc_asyncio"] = ClusterManagerGrpcAsyncIOTransport + _transport_registry["rest"] = ClusterManagerRestTransport + + def get_transport_class(cls, + label: Optional[str] = None, + ) -> Type[ClusterManagerTransport]: + """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 ClusterManagerClient(metaclass=ClusterManagerClientMeta): + """Google Kubernetes Engine Cluster Manager v1""" + + @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") + + # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead. + DEFAULT_ENDPOINT = "container.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + _DEFAULT_ENDPOINT_TEMPLATE = "container.{UNIVERSE_DOMAIN}" + _DEFAULT_UNIVERSE = "googleapis.com" + + @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: + ClusterManagerClient: 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: + ClusterManagerClient: 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) -> ClusterManagerTransport: + """Returns the transport used by the client instance. + + Returns: + ClusterManagerTransport: 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 crypto_key_version_path(project: str,location: str,key_ring: str,crypto_key: str,crypto_key_version: str,) -> str: + """Returns a fully-qualified crypto_key_version string.""" + return "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}".format(project=project, location=location, key_ring=key_ring, crypto_key=crypto_key, crypto_key_version=crypto_key_version, ) + + @staticmethod + def parse_crypto_key_version_path(path: str) -> Dict[str,str]: + """Parses a crypto_key_version path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/keyRings/(?P.+?)/cryptoKeys/(?P.+?)/cryptoKeyVersions/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def topic_path(project: str,topic: str,) -> str: + """Returns a fully-qualified topic string.""" + return "projects/{project}/topics/{topic}".format(project=project, topic=topic, ) + + @staticmethod + def parse_topic_path(path: str) -> Dict[str,str]: + """Parses a topic path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/topics/(?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): + """Deprecated. 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. + """ + + warnings.warn("get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.", + DeprecationWarning) + 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 + + @staticmethod + def _read_environment_variables(): + """Returns the environment variables used by the client. + + Returns: + Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE, + GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables. + + Raises: + ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not + any of ["true", "false"]. + google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT + is not any of ["auto", "never", "always"]. + """ + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false").lower() + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower() + universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN") + 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`") + return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + + @staticmethod + def _get_client_cert_source(provided_cert_source, use_cert_flag): + """Return the client cert source to be used by the client. + + Args: + provided_cert_source (bytes): The client certificate source provided. + use_cert_flag (bool): A flag indicating whether to use the client certificate. + + Returns: + bytes or None: The client cert source to be used by the client. + """ + client_cert_source = None + if use_cert_flag: + if provided_cert_source: + client_cert_source = provided_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + return client_cert_source + + @staticmethod + def _get_api_endpoint(api_override, client_cert_source, universe_domain, use_mtls_endpoint): + """Return the API endpoint used by the client. + + Args: + api_override (str): The API endpoint override. If specified, this is always + the return value of this function and the other arguments are not used. + client_cert_source (bytes): The client certificate source used by the client. + universe_domain (str): The universe domain used by the client. + use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters. + Possible values are "always", "auto", or "never". + + Returns: + str: The API endpoint to be used by the client. + """ + if api_override is not None: + api_endpoint = api_override + elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): + _default_universe = ClusterManagerClient._DEFAULT_UNIVERSE + if universe_domain != _default_universe: + raise MutualTLSChannelError(f"mTLS is not supported in any universe other than {_default_universe}.") + api_endpoint = ClusterManagerClient.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=universe_domain) + return api_endpoint + + @staticmethod + def _get_universe_domain(client_universe_domain: Optional[str], universe_domain_env: Optional[str]) -> str: + """Return the universe domain used by the client. + + Args: + client_universe_domain (Optional[str]): The universe domain configured via the client options. + universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable. + + Returns: + str: The universe domain to be used by the client. + + Raises: + ValueError: If the universe domain is an empty string. + """ + universe_domain = ClusterManagerClient._DEFAULT_UNIVERSE + if client_universe_domain is not None: + universe_domain = client_universe_domain + elif universe_domain_env is not None: + universe_domain = universe_domain_env + if len(universe_domain.strip()) == 0: + raise ValueError("Universe Domain cannot be an empty string.") + return universe_domain + + def _validate_universe_domain(self): + """Validates client's and credentials' universe domains are consistent. + + Returns: + bool: True iff the configured universe domain is valid. + + Raises: + ValueError: If the configured universe domain is not valid. + """ + + # NOTE (b/349488459): universe validation is disabled until further notice. + return True + + @property + def api_endpoint(self): + """Return the API endpoint used by the client instance. + + Returns: + str: The API endpoint used by the client instance. + """ + return self._api_endpoint + + @property + def universe_domain(self) -> str: + """Return the universe domain used by the client instance. + + Returns: + str: The universe domain used by the client instance. + """ + return self._universe_domain + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Optional[Union[str, ClusterManagerTransport, Callable[..., ClusterManagerTransport]]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the cluster manager 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 (Optional[Union[str,ClusterManagerTransport,Callable[..., ClusterManagerTransport]]]): + The transport to use, or a Callable that constructs and returns a new transport. + If a Callable is given, it will be called with the same set of initialization + arguments as used in the ClusterManagerTransport constructor. + 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. + + 1. The ``api_endpoint`` property can be used to override the + default endpoint provided by the client when ``transport`` is + not explicitly provided. Only if this property is not set and + ``transport`` was not explicitly provided, the endpoint is + determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment + variable, which have one of the following values: + "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). + + 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide a client certificate for mTLS 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. + + 3. The ``universe_domain`` property can be used to override the + default "googleapis.com" universe. Note that the ``api_endpoint`` + property still takes precedence; and ``universe_domain`` is + currently not supported for mTLS. + + 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. + """ + self._client_options = client_options + if isinstance(self._client_options, dict): + self._client_options = client_options_lib.from_dict(self._client_options) + if self._client_options is None: + self._client_options = client_options_lib.ClientOptions() + self._client_options = cast(client_options_lib.ClientOptions, self._client_options) + + universe_domain_opt = getattr(self._client_options, 'universe_domain', None) + + self._use_client_cert, self._use_mtls_endpoint, self._universe_domain_env = ClusterManagerClient._read_environment_variables() + self._client_cert_source = ClusterManagerClient._get_client_cert_source(self._client_options.client_cert_source, self._use_client_cert) + self._universe_domain = ClusterManagerClient._get_universe_domain(universe_domain_opt, self._universe_domain_env) + self._api_endpoint = None # updated below, depending on `transport` + + # Initialize the universe domain validation. + self._is_universe_domain_valid = False + + if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER + # Setup logging. + client_logging.initialize_logging() + + api_key_value = getattr(self._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. + transport_provided = isinstance(transport, ClusterManagerTransport) + if transport_provided: + # transport is a ClusterManagerTransport instance. + if credentials or self._client_options.credentials_file or api_key_value: + raise ValueError("When providing a transport instance, " + "provide its credentials directly.") + if self._client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = cast(ClusterManagerTransport, transport) + self._api_endpoint = self._transport.host + + self._api_endpoint = (self._api_endpoint or + ClusterManagerClient._get_api_endpoint( + self._client_options.api_endpoint, + self._client_cert_source, + self._universe_domain, + self._use_mtls_endpoint)) + + if not transport_provided: + 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_init: Union[Type[ClusterManagerTransport], Callable[..., ClusterManagerTransport]] = ( + ClusterManagerClient.get_transport_class(transport) + if isinstance(transport, str) or transport is None + else cast(Callable[..., ClusterManagerTransport], transport) + ) + # initialize with the provided callable or the passed in class + self._transport = transport_init( + credentials=credentials, + credentials_file=self._client_options.credentials_file, + host=self._api_endpoint, + scopes=self._client_options.scopes, + client_cert_source_for_mtls=self._client_cert_source, + quota_project_id=self._client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + api_audience=self._client_options.api_audience, + ) + + if "async" not in str(self._transport): + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.container_v1.ClusterManagerClient`.", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "universeDomain": getattr(self._transport._credentials, "universe_domain", ""), + "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}", + "credentialsInfo": getattr(self.transport._credentials, "get_cred_info", lambda: None)(), + } if hasattr(self._transport, "_credentials") else { + "serviceName": "google.container.v1.ClusterManager", + "credentialsType": None, + } + ) + + def list_clusters(self, + request: Optional[Union[cluster_service.ListClustersRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListClustersResponse: + r"""Lists all clusters owned by a project in either the + specified zone or all zones. + + .. 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 import container_v1 + + def sample_list_clusters(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.ListClustersRequest( + ) + + # Make the request + response = client.list_clusters(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.ListClustersRequest, dict]): + The request object. ListClustersRequest lists clusters. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides, or "-" for all zones. This + field has been deprecated and replaced by the parent + field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + parent (str): + The parent (project and location) where the clusters + will be listed. Specified in the format + ``projects/*/locations/*``. Location "-" matches all + zones and all regions. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.ListClustersResponse: + ListClustersResponse is the result of + ListClustersRequest. + + """ + # 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([project_id, zone, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListClustersRequest): + request = cluster_service.ListClustersRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + 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_clusters] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_cluster(self, + request: Optional[Union[cluster_service.GetClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Cluster: + r"""Gets the details of a specific cluster. + + .. 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 import container_v1 + + def sample_get_cluster(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.GetClusterRequest( + ) + + # Make the request + response = client.get_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.GetClusterRequest, dict]): + The request object. GetClusterRequest gets the settings + of a cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster + to retrieve. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster) of the cluster to + retrieve. Specified in the format + ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Cluster: + A Google Kubernetes Engine cluster. + """ + # 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([project_id, zone, cluster_id, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetClusterRequest): + request = cluster_service.GetClusterRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + 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_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_cluster(self, + request: Optional[Union[cluster_service.CreateClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster: Optional[cluster_service.Cluster] = None, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Creates a cluster, consisting of the specified number and type + of Google Compute Engine instances. + + By default, the cluster is created in the project's `default + network `__. + + One firewall is added for the cluster. After cluster creation, + the Kubelet creates routes for each node to allow the containers + on that node to communicate with all other instances in the + cluster. + + Finally, an entry is added to the project's global metadata + indicating which CIDR range the cluster is using. + + .. 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 import container_v1 + + def sample_create_cluster(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CreateClusterRequest( + ) + + # Make the request + response = client.create_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.CreateClusterRequest, dict]): + The request object. CreateClusterRequest creates a + cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the parent field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster (google.cloud.container_v1.types.Cluster): + Required. A `cluster + resource `__ + + This corresponds to the ``cluster`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + parent (str): + The parent (project and location) where the cluster will + be created. Specified 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CreateClusterRequest): + request = cluster_service.CreateClusterRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster is not None: + request.cluster = cluster + 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.create_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_cluster(self, + request: Optional[Union[cluster_service.UpdateClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + update: Optional[cluster_service.ClusterUpdate] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Updates the settings of a specific cluster. + + .. 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 import container_v1 + + def sample_update_cluster(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.UpdateClusterRequest( + ) + + # Make the request + response = client.update_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.UpdateClusterRequest, dict]): + The request object. UpdateClusterRequest updates the + settings of a cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster + to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update (google.cloud.container_v1.types.ClusterUpdate): + Required. A description of the + update. + + This corresponds to the ``update`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster) of the cluster to + update. Specified in the format + ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, update, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.UpdateClusterRequest): + request = cluster_service.UpdateClusterRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if update is not None: + request.update = update + 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.update_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_node_pool(self, + request: Optional[Union[cluster_service.UpdateNodePoolRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Updates the version and/or image type for the + specified node pool. + + .. 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 import container_v1 + + def sample_update_node_pool(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.UpdateNodePoolRequest( + node_version="node_version_value", + image_type="image_type_value", + ) + + # Make the request + response = client.update_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.UpdateNodePoolRequest, dict]): + The request object. UpdateNodePoolRequests update a node + pool's image and/or version. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.UpdateNodePoolRequest): + request = cluster_service.UpdateNodePoolRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_node_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_node_pool_autoscaling(self, + request: Optional[Union[cluster_service.SetNodePoolAutoscalingRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the autoscaling settings for the specified node + pool. + + .. 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 import container_v1 + + def sample_set_node_pool_autoscaling(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetNodePoolAutoscalingRequest( + ) + + # Make the request + response = client.set_node_pool_autoscaling(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.SetNodePoolAutoscalingRequest, dict]): + The request object. SetNodePoolAutoscalingRequest sets + the autoscaler settings of a node pool. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNodePoolAutoscalingRequest): + request = cluster_service.SetNodePoolAutoscalingRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_node_pool_autoscaling] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_logging_service(self, + request: Optional[Union[cluster_service.SetLoggingServiceRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + logging_service: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the logging service for a specific cluster. + + .. 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 import container_v1 + + def sample_set_logging_service(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetLoggingServiceRequest( + logging_service="logging_service_value", + ) + + # Make the request + response = client.set_logging_service(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.SetLoggingServiceRequest, dict]): + The request object. SetLoggingServiceRequest sets the + logging service of a cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster + to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + logging_service (str): + Required. The logging service the cluster should use to + write logs. Currently available options: + + - ``logging.googleapis.com/kubernetes`` - The Cloud + Logging service with a Kubernetes-native resource + model + - ``logging.googleapis.com`` - The legacy Cloud Logging + service (no longer available as of GKE 1.15). + - ``none`` - no logs will be exported from the cluster. + + If left as an empty + string,\ ``logging.googleapis.com/kubernetes`` will be + used for GKE 1.14+ or ``logging.googleapis.com`` for + earlier versions. + + This corresponds to the ``logging_service`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster) of the cluster to + set logging. Specified in the format + ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, logging_service, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLoggingServiceRequest): + request = cluster_service.SetLoggingServiceRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if logging_service is not None: + request.logging_service = logging_service + 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.set_logging_service] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_monitoring_service(self, + request: Optional[Union[cluster_service.SetMonitoringServiceRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + monitoring_service: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the monitoring service for a specific cluster. + + .. 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 import container_v1 + + def sample_set_monitoring_service(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetMonitoringServiceRequest( + monitoring_service="monitoring_service_value", + ) + + # Make the request + response = client.set_monitoring_service(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.SetMonitoringServiceRequest, dict]): + The request object. SetMonitoringServiceRequest sets the + monitoring service of a cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster + to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + monitoring_service (str): + Required. The monitoring service the cluster should use + to write metrics. Currently available options: + + - "monitoring.googleapis.com/kubernetes" - The Cloud + Monitoring service with a Kubernetes-native resource + model + - ``monitoring.googleapis.com`` - The legacy Cloud + Monitoring service (no longer available as of GKE + 1.15). + - ``none`` - No metrics will be exported from the + cluster. + + If left as an empty + string,\ ``monitoring.googleapis.com/kubernetes`` will + be used for GKE 1.14+ or ``monitoring.googleapis.com`` + for earlier versions. + + This corresponds to the ``monitoring_service`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster) of the cluster to + set monitoring. Specified in the format + ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, monitoring_service, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetMonitoringServiceRequest): + request = cluster_service.SetMonitoringServiceRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if monitoring_service is not None: + request.monitoring_service = monitoring_service + 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.set_monitoring_service] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_addons_config(self, + request: Optional[Union[cluster_service.SetAddonsConfigRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + addons_config: Optional[cluster_service.AddonsConfig] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the addons for a specific cluster. + + .. 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 import container_v1 + + def sample_set_addons_config(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetAddonsConfigRequest( + ) + + # Make the request + response = client.set_addons_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.SetAddonsConfigRequest, dict]): + The request object. SetAddonsConfigRequest sets the + addons associated with the cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster + to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + addons_config (google.cloud.container_v1.types.AddonsConfig): + Required. The desired configurations + for the various addons available to run + in the cluster. + + This corresponds to the ``addons_config`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster) of the cluster to + set addons. Specified in the format + ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, addons_config, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetAddonsConfigRequest): + request = cluster_service.SetAddonsConfigRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if addons_config is not None: + request.addons_config = addons_config + 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.set_addons_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_locations(self, + request: Optional[Union[cluster_service.SetLocationsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + locations: Optional[MutableSequence[str]] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the locations for a specific cluster. Deprecated. Use + `projects.locations.clusters.update `__ + instead. + + .. 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 import container_v1 + + def sample_set_locations(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetLocationsRequest( + locations=['locations_value1', 'locations_value2'], + ) + + # Make the request + response = client.set_locations(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.SetLocationsRequest, dict]): + The request object. SetLocationsRequest sets the + locations of the cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster + to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + locations (MutableSequence[str]): + Required. The desired list of Google Compute Engine + `zones `__ + in which the cluster's nodes should be located. Changing + the locations a cluster is in will result in nodes being + either created or removed from the cluster, depending on + whether locations are being added or removed. + + This list must always include the cluster's primary + zone. + + This corresponds to the ``locations`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster) of the cluster to + set locations. Specified in the format + ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + warnings.warn("ClusterManagerClient.set_locations is deprecated", + DeprecationWarning) + + # 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([project_id, zone, cluster_id, locations, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLocationsRequest): + request = cluster_service.SetLocationsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if locations is not None: + request.locations = locations + 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.set_locations] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_master(self, + request: Optional[Union[cluster_service.UpdateMasterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + master_version: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Updates the master for a specific cluster. + + .. 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 import container_v1 + + def sample_update_master(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.UpdateMasterRequest( + master_version="master_version_value", + ) + + # Make the request + response = client.update_master(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.UpdateMasterRequest, dict]): + The request object. UpdateMasterRequest updates the + master of the cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster + to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + master_version (str): + Required. The Kubernetes version to + change the master to. + Users may specify either explicit + versions offered by Kubernetes Engine or + version aliases, which have the + following behavior: + + - "latest": picks the highest valid + Kubernetes version + - "1.X": picks the highest valid + patch+gke.N patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N + patch in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit + Kubernetes version + - "-": picks the default Kubernetes + version + + This corresponds to the ``master_version`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster) of the cluster to + update. Specified in the format + ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, master_version, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.UpdateMasterRequest): + request = cluster_service.UpdateMasterRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if master_version is not None: + request.master_version = master_version + 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.update_master] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_master_auth(self, + request: Optional[Union[cluster_service.SetMasterAuthRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets master auth materials. Currently supports + changing the admin password or a specific cluster, + either via password generation or explicitly setting the + password. + + .. 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 import container_v1 + + def sample_set_master_auth(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetMasterAuthRequest( + action="SET_USERNAME", + ) + + # Make the request + response = client.set_master_auth(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.SetMasterAuthRequest, dict]): + The request object. SetMasterAuthRequest updates the + admin password of a cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetMasterAuthRequest): + request = cluster_service.SetMasterAuthRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_master_auth] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_cluster(self, + request: Optional[Union[cluster_service.DeleteClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Deletes the cluster, including the Kubernetes + endpoint and all worker nodes. + + Firewalls and routes that were configured during cluster + creation are also deleted. + + Other Google Compute Engine resources that might be in + use by the cluster, such as load balancer resources, are + not deleted if they weren't present when the cluster was + initially created. + + .. 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 import container_v1 + + def sample_delete_cluster(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.DeleteClusterRequest( + ) + + # Make the request + response = client.delete_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.DeleteClusterRequest, dict]): + The request object. DeleteClusterRequest deletes a + cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster + to delete. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster) of the cluster to + delete. Specified in the format + ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.DeleteClusterRequest): + request = cluster_service.DeleteClusterRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + 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_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_operations(self, + request: Optional[Union[cluster_service.ListOperationsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListOperationsResponse: + r"""Lists all operations in a project in a specific zone + or all zones. + + .. 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 import container_v1 + + def sample_list_operations(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.ListOperationsRequest( + ) + + # Make the request + response = client.list_operations(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.ListOperationsRequest, dict]): + The request object. ListOperationsRequest lists + operations. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + to return operations for, or ``-`` for all zones. This + field has been deprecated and replaced by the parent + field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + parent (str): + The parent (project and location) where the operations + will be listed. Specified in the format + ``projects/*/locations/*``. Location "-" matches all + zones and all regions. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.ListOperationsResponse: + ListOperationsResponse is the result + of ListOperationsRequest. + + """ + # 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([project_id, zone, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListOperationsRequest): + request = cluster_service.ListOperationsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + 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_operations] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_operation(self, + request: Optional[Union[cluster_service.GetOperationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + operation_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Gets the specified operation. + + .. 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 import container_v1 + + def sample_get_operation(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.GetOperationRequest( + ) + + # Make the request + response = client.get_operation(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.GetOperationRequest, dict]): + The request object. GetOperationRequest gets a single + operation. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + operation_id (str): + Deprecated. The server-assigned ``name`` of the + operation. This field has been deprecated and replaced + by the name field. + + This corresponds to the ``operation_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, operation id) of the + operation to get. Specified in the format + ``projects/*/locations/*/operations/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, operation_id, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetOperationRequest): + request = cluster_service.GetOperationRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if operation_id is not None: + request.operation_id = operation_id + 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_operation] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def cancel_operation(self, + request: Optional[Union[cluster_service.CancelOperationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + operation_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> None: + r"""Cancels the specified operation. + + .. 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 import container_v1 + + def sample_cancel_operation(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CancelOperationRequest( + ) + + # Make the request + client.cancel_operation(request=request) + + Args: + request (Union[google.cloud.container_v1.types.CancelOperationRequest, dict]): + The request object. CancelOperationRequest cancels a + single operation. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the operation resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + operation_id (str): + Deprecated. The server-assigned ``name`` of the + operation. This field has been deprecated and replaced + by the name field. + + This corresponds to the ``operation_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, operation id) of the + operation to cancel. Specified in the format + ``projects/*/locations/*/operations/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + # 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([project_id, zone, operation_id, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CancelOperationRequest): + request = cluster_service.CancelOperationRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if operation_id is not None: + request.operation_id = operation_id + 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.cancel_operation] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + def get_server_config(self, + request: Optional[Union[cluster_service.GetServerConfigRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ServerConfig: + r"""Returns configuration info about the Google + Kubernetes Engine service. + + .. 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 import container_v1 + + def sample_get_server_config(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.GetServerConfigRequest( + ) + + # Make the request + response = client.get_server_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.GetServerConfigRequest, dict]): + The request object. Gets the current Kubernetes Engine + service configuration. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + to return operations for. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project and location) of the server config to + get, specified in the format ``projects/*/locations/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.ServerConfig: + Kubernetes Engine service + configuration. + + """ + # 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([project_id, zone, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetServerConfigRequest): + request = cluster_service.GetServerConfigRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + 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_server_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_json_web_keys(self, + request: Optional[Union[cluster_service.GetJSONWebKeysRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.GetJSONWebKeysResponse: + r"""Gets the public component of the cluster signing keys + in JSON Web Key format. + + .. 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 import container_v1 + + def sample_get_json_web_keys(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.GetJSONWebKeysRequest( + ) + + # Make the request + response = client.get_json_web_keys(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.GetJSONWebKeysRequest, dict]): + The request object. GetJSONWebKeysRequest gets the public component of the + keys used by the cluster to sign token requests. This + will be the jwks_uri for the discover document returned + by getOpenIDConfig. See the OpenID Connect Discovery 1.0 + specification for details. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.GetJSONWebKeysResponse: + GetJSONWebKeysResponse is a valid + JSON Web Key Set as specififed in rfc + 7517 + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetJSONWebKeysRequest): + request = cluster_service.GetJSONWebKeysRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_json_web_keys] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_node_pools(self, + request: Optional[Union[cluster_service.ListNodePoolsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListNodePoolsResponse: + r"""Lists the node pools for a cluster. + + .. 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 import container_v1 + + def sample_list_node_pools(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.ListNodePoolsRequest( + ) + + # Make the request + response = client.list_node_pools(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.ListNodePoolsRequest, dict]): + The request object. ListNodePoolsRequest lists the node + pool(s) for a cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the parent field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the parent field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + parent (str): + The parent (project, location, cluster name) where the + node pools will be listed. Specified in the format + ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.ListNodePoolsResponse: + ListNodePoolsResponse is the result + of ListNodePoolsRequest. + + """ + # 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([project_id, zone, cluster_id, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListNodePoolsRequest): + request = cluster_service.ListNodePoolsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + 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_node_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_node_pool(self, + request: Optional[Union[cluster_service.GetNodePoolRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.NodePool: + r"""Retrieves the requested node pool. + + .. 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 import container_v1 + + def sample_get_node_pool(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.GetNodePoolRequest( + ) + + # Make the request + response = client.get_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.GetNodePoolRequest, dict]): + The request object. GetNodePoolRequest retrieves a node + pool for a cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (str): + Deprecated. The name of the node + pool. This field has been deprecated and + replaced by the name field. + + This corresponds to the ``node_pool_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster, node pool id) of + the node pool to get. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.NodePool: + NodePool contains the name and + configuration for a cluster's node pool. + Node pools are a set of nodes (i.e. + VM's), with a common configuration and + specification, under the control of the + cluster master. They may have a set of + Kubernetes labels applied to them, which + may be used to reference them during pod + scheduling. They may also be resized up + or down, to accommodate the workload. + + """ + # 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([project_id, zone, cluster_id, node_pool_id, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetNodePoolRequest): + request = cluster_service.GetNodePoolRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + 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_node_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_node_pool(self, + request: Optional[Union[cluster_service.CreateNodePoolRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool: Optional[cluster_service.NodePool] = None, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Creates a node pool for a cluster. + + .. 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 import container_v1 + + def sample_create_node_pool(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CreateNodePoolRequest( + ) + + # Make the request + response = client.create_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.CreateNodePoolRequest, dict]): + The request object. CreateNodePoolRequest creates a node + pool for a cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the parent field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the parent field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool (google.cloud.container_v1.types.NodePool): + Required. The node pool to create. + This corresponds to the ``node_pool`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + parent (str): + The parent (project, location, cluster name) where the + node pool will be created. Specified in the format + ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_pool, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CreateNodePoolRequest): + request = cluster_service.CreateNodePoolRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool is not None: + request.node_pool = node_pool + 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.create_node_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_node_pool(self, + request: Optional[Union[cluster_service.DeleteNodePoolRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Deletes a node pool from a cluster. + + .. 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 import container_v1 + + def sample_delete_node_pool(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.DeleteNodePoolRequest( + ) + + # Make the request + response = client.delete_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.DeleteNodePoolRequest, dict]): + The request object. DeleteNodePoolRequest deletes a node + pool for a cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (str): + Deprecated. The name of the node pool + to delete. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``node_pool_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster, node pool id) of + the node pool to delete. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_pool_id, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.DeleteNodePoolRequest): + request = cluster_service.DeleteNodePoolRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + 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_node_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def complete_node_pool_upgrade(self, + request: Optional[Union[cluster_service.CompleteNodePoolUpgradeRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> None: + r"""CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + .. 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 import container_v1 + + def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + client.complete_node_pool_upgrade(request=request) + + Args: + request (Union[google.cloud.container_v1.types.CompleteNodePoolUpgradeRequest, dict]): + The request object. CompleteNodePoolUpgradeRequest sets + the name of target node pool to complete + upgrade. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CompleteNodePoolUpgradeRequest): + request = cluster_service.CompleteNodePoolUpgradeRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.complete_node_pool_upgrade] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + def rollback_node_pool_upgrade(self, + request: Optional[Union[cluster_service.RollbackNodePoolUpgradeRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Rolls back a previously Aborted or Failed NodePool + upgrade. This makes no changes if the last upgrade + successfully completed. + + .. 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 import container_v1 + + def sample_rollback_node_pool_upgrade(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.RollbackNodePoolUpgradeRequest( + ) + + # Make the request + response = client.rollback_node_pool_upgrade(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.RollbackNodePoolUpgradeRequest, dict]): + The request object. RollbackNodePoolUpgradeRequest + rollbacks the previously Aborted or + Failed NodePool upgrade. This will be an + no-op if the last upgrade successfully + completed. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster + to rollback. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (str): + Deprecated. The name of the node pool + to rollback. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``node_pool_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster, node pool id) of + the node poll to rollback upgrade. Specified in the + format + ``projects/*/locations/*/clusters/*/nodePools/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_pool_id, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.RollbackNodePoolUpgradeRequest): + request = cluster_service.RollbackNodePoolUpgradeRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + 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.rollback_node_pool_upgrade] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_node_pool_management(self, + request: Optional[Union[cluster_service.SetNodePoolManagementRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the NodeManagement options for a node pool. + + .. 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 import container_v1 + + def sample_set_node_pool_management(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetNodePoolManagementRequest( + ) + + # Make the request + response = client.set_node_pool_management(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.SetNodePoolManagementRequest, dict]): + The request object. SetNodePoolManagementRequest sets the + node management properties of a node + pool. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNodePoolManagementRequest): + request = cluster_service.SetNodePoolManagementRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_node_pool_management] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_labels(self, + request: Optional[Union[cluster_service.SetLabelsRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets labels on a cluster. + + .. 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 import container_v1 + + def sample_set_labels(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetLabelsRequest( + label_fingerprint="label_fingerprint_value", + ) + + # Make the request + response = client.set_labels(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.SetLabelsRequest, dict]): + The request object. SetLabelsRequest sets the Google + Cloud Platform labels on a Google + Container Engine cluster, which will in + turn set them for Google Compute Engine + resources used by that cluster + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLabelsRequest): + request = cluster_service.SetLabelsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_labels] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_legacy_abac(self, + request: Optional[Union[cluster_service.SetLegacyAbacRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + enabled: Optional[bool] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Enables or disables the ABAC authorization mechanism + on a cluster. + + .. 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 import container_v1 + + def sample_set_legacy_abac(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetLegacyAbacRequest( + enabled=True, + ) + + # Make the request + response = client.set_legacy_abac(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.SetLegacyAbacRequest, dict]): + The request object. SetLegacyAbacRequest enables or + disables the ABAC authorization + mechanism for a cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster + to update. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + enabled (bool): + Required. Whether ABAC authorization + will be enabled in the cluster. + + This corresponds to the ``enabled`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster name) of the + cluster to set legacy abac. Specified in the format + ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, enabled, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLegacyAbacRequest): + request = cluster_service.SetLegacyAbacRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if enabled is not None: + request.enabled = enabled + 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.set_legacy_abac] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def start_ip_rotation(self, + request: Optional[Union[cluster_service.StartIPRotationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Starts master IP rotation. + + .. 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 import container_v1 + + def sample_start_ip_rotation(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.StartIPRotationRequest( + ) + + # Make the request + response = client.start_ip_rotation(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.StartIPRotationRequest, dict]): + The request object. StartIPRotationRequest creates a new + IP for the cluster and then performs a + node upgrade on each node pool to point + to the new IP. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster name) of the + cluster to start IP rotation. Specified in the format + ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.StartIPRotationRequest): + request = cluster_service.StartIPRotationRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + 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.start_ip_rotation] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def complete_ip_rotation(self, + request: Optional[Union[cluster_service.CompleteIPRotationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Completes master IP rotation. + + .. 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 import container_v1 + + def sample_complete_ip_rotation(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CompleteIPRotationRequest( + ) + + # Make the request + response = client.complete_ip_rotation(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.CompleteIPRotationRequest, dict]): + The request object. CompleteIPRotationRequest moves the + cluster master back into single-IP mode. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster name) of the + cluster to complete IP rotation. Specified in the format + ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CompleteIPRotationRequest): + request = cluster_service.CompleteIPRotationRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + 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.complete_ip_rotation] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_node_pool_size(self, + request: Optional[Union[cluster_service.SetNodePoolSizeRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the size for a specific node pool. The new size will be + used for all replicas, including future replicas created by + modifying + [NodePool.locations][google.container.v1.NodePool.locations]. + + .. 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 import container_v1 + + def sample_set_node_pool_size(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetNodePoolSizeRequest( + node_count=1070, + ) + + # Make the request + response = client.set_node_pool_size(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.SetNodePoolSizeRequest, dict]): + The request object. SetNodePoolSizeRequest sets the size + of a node pool. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNodePoolSizeRequest): + request = cluster_service.SetNodePoolSizeRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_node_pool_size] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_network_policy(self, + request: Optional[Union[cluster_service.SetNetworkPolicyRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + network_policy: Optional[cluster_service.NetworkPolicy] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Enables or disables Network Policy for a cluster. + + .. 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 import container_v1 + + def sample_set_network_policy(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetNetworkPolicyRequest( + ) + + # Make the request + response = client.set_network_policy(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.SetNetworkPolicyRequest, dict]): + The request object. SetNetworkPolicyRequest + enables/disables network policy for a + cluster. + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and + replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + network_policy (google.cloud.container_v1.types.NetworkPolicy): + Required. Configuration options for + the NetworkPolicy feature. + + This corresponds to the ``network_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster name) of the + cluster to set networking policy. Specified in the + format ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, network_policy, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNetworkPolicyRequest): + request = cluster_service.SetNetworkPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if network_policy is not None: + request.network_policy = network_policy + 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.set_network_policy] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_maintenance_policy(self, + request: Optional[Union[cluster_service.SetMaintenancePolicyRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + maintenance_policy: Optional[cluster_service.MaintenancePolicy] = None, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the maintenance policy for a cluster. + + .. 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 import container_v1 + + def sample_set_maintenance_policy(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetMaintenancePolicyRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.set_maintenance_policy(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.SetMaintenancePolicyRequest, dict]): + The request object. SetMaintenancePolicyRequest sets the + maintenance policy for a cluster. + project_id (str): + Required. The Google Developers Console `project ID or + project + number `__. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. The name of the cluster to + update. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + maintenance_policy (google.cloud.container_v1.types.MaintenancePolicy): + Required. The maintenance policy to + be set for the cluster. An empty field + clears the existing maintenance policy. + + This corresponds to the ``maintenance_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + name (str): + The name (project, location, cluster name) of the + cluster to set maintenance policy. Specified in the + format ``projects/*/locations/*/clusters/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, maintenance_policy, 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetMaintenancePolicyRequest): + request = cluster_service.SetMaintenancePolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if maintenance_policy is not None: + request.maintenance_policy = maintenance_policy + 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.set_maintenance_policy] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_usable_subnetworks(self, + request: Optional[Union[cluster_service.ListUsableSubnetworksRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> pagers.ListUsableSubnetworksPager: + r"""Lists subnetworks that are usable for creating + clusters in a project. + + .. 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 import container_v1 + + def sample_list_usable_subnetworks(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.ListUsableSubnetworksRequest( + ) + + # Make the request + page_result = client.list_usable_subnetworks(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.container_v1.types.ListUsableSubnetworksRequest, dict]): + The request object. ListUsableSubnetworksRequest requests + the list of usable subnetworks available + to a user for creating clusters. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.services.cluster_manager.pagers.ListUsableSubnetworksPager: + ListUsableSubnetworksResponse is the + response of + ListUsableSubnetworksRequest. + + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListUsableSubnetworksRequest): + request = cluster_service.ListUsableSubnetworksRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_usable_subnetworks] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # 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.ListUsableSubnetworksPager( + method=rpc, + request=request, + response=response, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def check_autopilot_compatibility(self, + request: Optional[Union[cluster_service.CheckAutopilotCompatibilityRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.CheckAutopilotCompatibilityResponse: + r"""Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + .. 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 import container_v1 + + def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.CheckAutopilotCompatibilityRequest, dict]): + The request object. CheckAutopilotCompatibilityRequest + requests getting the blockers for the + given operation in the cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1.types.CheckAutopilotCompatibilityResponse: + CheckAutopilotCompatibilityResponse + has a list of compatibility issues. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CheckAutopilotCompatibilityRequest): + request = cluster_service.CheckAutopilotCompatibilityRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.check_autopilot_compatibility] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def __enter__(self) -> "ClusterManagerClient": + 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__ = ( + "ClusterManagerClient", +) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/pagers.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/pagers.py new file mode 100644 index 000000000000..6e073460eafd --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/pagers.py @@ -0,0 +1,166 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.api_core import gapic_v1 +from google.api_core import retry as retries +from google.api_core import retry_async as retries_async +from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator, Union +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] + OptionalAsyncRetry = Union[retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object, None] # type: ignore + OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore + +from google.cloud.container_v1.types import cluster_service + + +class ListUsableSubnetworksPager: + """A pager for iterating through ``list_usable_subnetworks`` requests. + + This class thinly wraps an initial + :class:`google.cloud.container_v1.types.ListUsableSubnetworksResponse` object, and + provides an ``__iter__`` method to iterate through its + ``subnetworks`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListUsableSubnetworks`` requests and continue to iterate + through the ``subnetworks`` field on the + corresponding responses. + + All the usual :class:`google.cloud.container_v1.types.ListUsableSubnetworksResponse` + 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[..., cluster_service.ListUsableSubnetworksResponse], + request: cluster_service.ListUsableSubnetworksRequest, + response: cluster_service.ListUsableSubnetworksResponse, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.container_v1.types.ListUsableSubnetworksRequest): + The initial request object. + response (google.cloud.container_v1.types.ListUsableSubnetworksResponse): + The initial response object. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + self._method = method + self._request = cluster_service.ListUsableSubnetworksRequest(request) + self._response = response + self._retry = retry + self._timeout = timeout + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[cluster_service.ListUsableSubnetworksResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, retry=self._retry, timeout=self._timeout, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[cluster_service.UsableSubnetwork]: + for page in self.pages: + yield from page.subnetworks + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListUsableSubnetworksAsyncPager: + """A pager for iterating through ``list_usable_subnetworks`` requests. + + This class thinly wraps an initial + :class:`google.cloud.container_v1.types.ListUsableSubnetworksResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``subnetworks`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListUsableSubnetworks`` requests and continue to iterate + through the ``subnetworks`` field on the + corresponding responses. + + All the usual :class:`google.cloud.container_v1.types.ListUsableSubnetworksResponse` + 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[cluster_service.ListUsableSubnetworksResponse]], + request: cluster_service.ListUsableSubnetworksRequest, + response: cluster_service.ListUsableSubnetworksResponse, + *, + retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.container_v1.types.ListUsableSubnetworksRequest): + The initial request object. + response (google.cloud.container_v1.types.ListUsableSubnetworksResponse): + The initial response object. + retry (google.api_core.retry.AsyncRetry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + self._method = method + self._request = cluster_service.ListUsableSubnetworksRequest(request) + self._response = response + self._retry = retry + self._timeout = timeout + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[cluster_service.ListUsableSubnetworksResponse]: + 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, retry=self._retry, timeout=self._timeout, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[cluster_service.UsableSubnetwork]: + async def async_generator(): + async for page in self.pages: + for response in page.subnetworks: + 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/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/README.rst b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/README.rst new file mode 100644 index 000000000000..4b8234a968af --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/README.rst @@ -0,0 +1,9 @@ + +transport inheritance structure +_______________________________ + +`ClusterManagerTransport` is the ABC for all transports. +- public child `ClusterManagerGrpcTransport` for sync gRPC transport (defined in `grpc.py`). +- public child `ClusterManagerGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). +- private child `_BaseClusterManagerRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). +- public child `ClusterManagerRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/__init__.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/__init__.py new file mode 100644 index 000000000000..f779c4fbc7cc --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/__init__.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ClusterManagerTransport +from .grpc import ClusterManagerGrpcTransport +from .grpc_asyncio import ClusterManagerGrpcAsyncIOTransport +from .rest import ClusterManagerRestTransport +from .rest import ClusterManagerRestInterceptor + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[ClusterManagerTransport]] +_transport_registry['grpc'] = ClusterManagerGrpcTransport +_transport_registry['grpc_asyncio'] = ClusterManagerGrpcAsyncIOTransport +_transport_registry['rest'] = ClusterManagerRestTransport + +__all__ = ( + 'ClusterManagerTransport', + 'ClusterManagerGrpcTransport', + 'ClusterManagerGrpcAsyncIOTransport', + 'ClusterManagerRestTransport', + 'ClusterManagerRestInterceptor', +) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/base.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/base.py new file mode 100644 index 000000000000..839d6d2f047b --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/base.py @@ -0,0 +1,707 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.container_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.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.container_v1.types import cluster_service +from google.protobuf import empty_pb2 # type: ignore + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) + + +class ClusterManagerTransport(abc.ABC): + """Abstract transport class for ClusterManager.""" + + AUTH_SCOPES = ( + 'https://www.googleapis.com/auth/cloud-platform', + ) + + DEFAULT_HOST: str = 'container.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 (default: 'container.googleapis.com'). + 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 not hasattr(self, "_ignore_credentials"): + self._ignore_credentials: bool = False + + # 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 and not self._ignore_credentials: + 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 + + @property + def host(self): + return self._host + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.list_clusters: gapic_v1.method.wrap_method( + self.list_clusters, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_cluster: gapic_v1.method.wrap_method( + self.get_cluster, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.create_cluster: gapic_v1.method.wrap_method( + self.create_cluster, + default_timeout=45.0, + client_info=client_info, + ), + self.update_cluster: gapic_v1.method.wrap_method( + self.update_cluster, + default_timeout=45.0, + client_info=client_info, + ), + self.update_node_pool: gapic_v1.method.wrap_method( + self.update_node_pool, + default_timeout=45.0, + client_info=client_info, + ), + self.set_node_pool_autoscaling: gapic_v1.method.wrap_method( + self.set_node_pool_autoscaling, + default_timeout=45.0, + client_info=client_info, + ), + self.set_logging_service: gapic_v1.method.wrap_method( + self.set_logging_service, + default_timeout=45.0, + client_info=client_info, + ), + self.set_monitoring_service: gapic_v1.method.wrap_method( + self.set_monitoring_service, + default_timeout=45.0, + client_info=client_info, + ), + self.set_addons_config: gapic_v1.method.wrap_method( + self.set_addons_config, + default_timeout=45.0, + client_info=client_info, + ), + self.set_locations: gapic_v1.method.wrap_method( + self.set_locations, + default_timeout=45.0, + client_info=client_info, + ), + self.update_master: gapic_v1.method.wrap_method( + self.update_master, + default_timeout=45.0, + client_info=client_info, + ), + self.set_master_auth: gapic_v1.method.wrap_method( + self.set_master_auth, + default_timeout=45.0, + client_info=client_info, + ), + self.delete_cluster: gapic_v1.method.wrap_method( + self.delete_cluster, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.list_operations: gapic_v1.method.wrap_method( + self.list_operations, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_operation: gapic_v1.method.wrap_method( + self.get_operation, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.cancel_operation: gapic_v1.method.wrap_method( + self.cancel_operation, + default_timeout=45.0, + client_info=client_info, + ), + self.get_server_config: gapic_v1.method.wrap_method( + self.get_server_config, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_json_web_keys: gapic_v1.method.wrap_method( + self.get_json_web_keys, + default_timeout=None, + client_info=client_info, + ), + self.list_node_pools: gapic_v1.method.wrap_method( + self.list_node_pools, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_node_pool: gapic_v1.method.wrap_method( + self.get_node_pool, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.create_node_pool: gapic_v1.method.wrap_method( + self.create_node_pool, + default_timeout=45.0, + client_info=client_info, + ), + self.delete_node_pool: gapic_v1.method.wrap_method( + self.delete_node_pool, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.complete_node_pool_upgrade: gapic_v1.method.wrap_method( + self.complete_node_pool_upgrade, + default_timeout=None, + client_info=client_info, + ), + self.rollback_node_pool_upgrade: gapic_v1.method.wrap_method( + self.rollback_node_pool_upgrade, + default_timeout=45.0, + client_info=client_info, + ), + self.set_node_pool_management: gapic_v1.method.wrap_method( + self.set_node_pool_management, + default_timeout=45.0, + client_info=client_info, + ), + self.set_labels: gapic_v1.method.wrap_method( + self.set_labels, + default_timeout=45.0, + client_info=client_info, + ), + self.set_legacy_abac: gapic_v1.method.wrap_method( + self.set_legacy_abac, + default_timeout=45.0, + client_info=client_info, + ), + self.start_ip_rotation: gapic_v1.method.wrap_method( + self.start_ip_rotation, + default_timeout=45.0, + client_info=client_info, + ), + self.complete_ip_rotation: gapic_v1.method.wrap_method( + self.complete_ip_rotation, + default_timeout=45.0, + client_info=client_info, + ), + self.set_node_pool_size: gapic_v1.method.wrap_method( + self.set_node_pool_size, + default_timeout=45.0, + client_info=client_info, + ), + self.set_network_policy: gapic_v1.method.wrap_method( + self.set_network_policy, + default_timeout=45.0, + client_info=client_info, + ), + self.set_maintenance_policy: gapic_v1.method.wrap_method( + self.set_maintenance_policy, + default_timeout=45.0, + client_info=client_info, + ), + self.list_usable_subnetworks: gapic_v1.method.wrap_method( + self.list_usable_subnetworks, + default_timeout=None, + client_info=client_info, + ), + self.check_autopilot_compatibility: gapic_v1.method.wrap_method( + self.check_autopilot_compatibility, + 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 list_clusters(self) -> Callable[ + [cluster_service.ListClustersRequest], + Union[ + cluster_service.ListClustersResponse, + Awaitable[cluster_service.ListClustersResponse] + ]]: + raise NotImplementedError() + + @property + def get_cluster(self) -> Callable[ + [cluster_service.GetClusterRequest], + Union[ + cluster_service.Cluster, + Awaitable[cluster_service.Cluster] + ]]: + raise NotImplementedError() + + @property + def create_cluster(self) -> Callable[ + [cluster_service.CreateClusterRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def update_cluster(self) -> Callable[ + [cluster_service.UpdateClusterRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def update_node_pool(self) -> Callable[ + [cluster_service.UpdateNodePoolRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_node_pool_autoscaling(self) -> Callable[ + [cluster_service.SetNodePoolAutoscalingRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_logging_service(self) -> Callable[ + [cluster_service.SetLoggingServiceRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_monitoring_service(self) -> Callable[ + [cluster_service.SetMonitoringServiceRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_addons_config(self) -> Callable[ + [cluster_service.SetAddonsConfigRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_locations(self) -> Callable[ + [cluster_service.SetLocationsRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def update_master(self) -> Callable[ + [cluster_service.UpdateMasterRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_master_auth(self) -> Callable[ + [cluster_service.SetMasterAuthRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def delete_cluster(self) -> Callable[ + [cluster_service.DeleteClusterRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def list_operations(self) -> Callable[ + [cluster_service.ListOperationsRequest], + Union[ + cluster_service.ListOperationsResponse, + Awaitable[cluster_service.ListOperationsResponse] + ]]: + raise NotImplementedError() + + @property + def get_operation(self) -> Callable[ + [cluster_service.GetOperationRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def cancel_operation(self) -> Callable[ + [cluster_service.CancelOperationRequest], + Union[ + empty_pb2.Empty, + Awaitable[empty_pb2.Empty] + ]]: + raise NotImplementedError() + + @property + def get_server_config(self) -> Callable[ + [cluster_service.GetServerConfigRequest], + Union[ + cluster_service.ServerConfig, + Awaitable[cluster_service.ServerConfig] + ]]: + raise NotImplementedError() + + @property + def get_json_web_keys(self) -> Callable[ + [cluster_service.GetJSONWebKeysRequest], + Union[ + cluster_service.GetJSONWebKeysResponse, + Awaitable[cluster_service.GetJSONWebKeysResponse] + ]]: + raise NotImplementedError() + + @property + def list_node_pools(self) -> Callable[ + [cluster_service.ListNodePoolsRequest], + Union[ + cluster_service.ListNodePoolsResponse, + Awaitable[cluster_service.ListNodePoolsResponse] + ]]: + raise NotImplementedError() + + @property + def get_node_pool(self) -> Callable[ + [cluster_service.GetNodePoolRequest], + Union[ + cluster_service.NodePool, + Awaitable[cluster_service.NodePool] + ]]: + raise NotImplementedError() + + @property + def create_node_pool(self) -> Callable[ + [cluster_service.CreateNodePoolRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def delete_node_pool(self) -> Callable[ + [cluster_service.DeleteNodePoolRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def complete_node_pool_upgrade(self) -> Callable[ + [cluster_service.CompleteNodePoolUpgradeRequest], + Union[ + empty_pb2.Empty, + Awaitable[empty_pb2.Empty] + ]]: + raise NotImplementedError() + + @property + def rollback_node_pool_upgrade(self) -> Callable[ + [cluster_service.RollbackNodePoolUpgradeRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_node_pool_management(self) -> Callable[ + [cluster_service.SetNodePoolManagementRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_labels(self) -> Callable[ + [cluster_service.SetLabelsRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_legacy_abac(self) -> Callable[ + [cluster_service.SetLegacyAbacRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def start_ip_rotation(self) -> Callable[ + [cluster_service.StartIPRotationRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def complete_ip_rotation(self) -> Callable[ + [cluster_service.CompleteIPRotationRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_node_pool_size(self) -> Callable[ + [cluster_service.SetNodePoolSizeRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_network_policy(self) -> Callable[ + [cluster_service.SetNetworkPolicyRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_maintenance_policy(self) -> Callable[ + [cluster_service.SetMaintenancePolicyRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def list_usable_subnetworks(self) -> Callable[ + [cluster_service.ListUsableSubnetworksRequest], + Union[ + cluster_service.ListUsableSubnetworksResponse, + Awaitable[cluster_service.ListUsableSubnetworksResponse] + ]]: + raise NotImplementedError() + + @property + def check_autopilot_compatibility(self) -> Callable[ + [cluster_service.CheckAutopilotCompatibilityRequest], + Union[ + cluster_service.CheckAutopilotCompatibilityResponse, + Awaitable[cluster_service.CheckAutopilotCompatibilityResponse] + ]]: + raise NotImplementedError() + + @property + def kind(self) -> str: + raise NotImplementedError() + + +__all__ = ( + 'ClusterManagerTransport', +) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc.py new file mode 100644 index 000000000000..1ee39197a675 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc.py @@ -0,0 +1,1247 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 json +import logging as std_logging +import pickle +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import grpc_helpers +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 +from google.protobuf.json_format import MessageToJson +import google.protobuf.message + +import grpc # type: ignore +import proto # type: ignore + +from google.cloud.container_v1.types import cluster_service +from google.protobuf import empty_pb2 # type: ignore +from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO + +try: + from google.api_core import client_logging # type: ignore + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER + def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": client_call_details.method, + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + + response = continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = dict([(k, str(v)) for k, v in response_metadata]) if response_metadata else None + result = response.result() + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response for {client_call_details.method}.", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + + +class ClusterManagerGrpcTransport(ClusterManagerTransport): + """gRPC backend transport for ClusterManager. + + Google Kubernetes Engine Cluster Manager v1 + + 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 = 'container.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[Union[grpc.Channel, Callable[..., 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 (default: 'container.googleapis.com'). + 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 a ``channel`` instance 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 a ``channel`` instance is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if a ``channel`` instance is provided. + channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]): + A ``Channel`` instance through which to make calls, or a Callable + that constructs and returns one. If set to None, ``self.create_channel`` + is used to create the channel. If a Callable is given, it will be called + with the same arguments as used in ``self.create_channel``. + 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 a ``channel`` instance 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 a ``channel`` instance 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] = {} + + 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 isinstance(channel, grpc.Channel): + # Ignore credentials if a channel was passed. + credentials = None + self._ignore_credentials = True + # 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: + # initialize with the provided callable or the default channel + channel_init = channel or type(self).create_channel + self._grpc_channel = channel_init( + 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), + ], + ) + + self._interceptor = _LoggingClientInterceptor() + self._logged_channel = grpc.intercept_channel(self._grpc_channel, self._interceptor) + + # Wrap messages. This must be done after self._logged_channel exists + self._prep_wrapped_messages(client_info) + + @classmethod + def create_channel(cls, + host: str = 'container.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 list_clusters(self) -> Callable[ + [cluster_service.ListClustersRequest], + cluster_service.ListClustersResponse]: + r"""Return a callable for the list clusters method over gRPC. + + Lists all clusters owned by a project in either the + specified zone or all zones. + + Returns: + Callable[[~.ListClustersRequest], + ~.ListClustersResponse]: + 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_clusters' not in self._stubs: + self._stubs['list_clusters'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/ListClusters', + request_serializer=cluster_service.ListClustersRequest.serialize, + response_deserializer=cluster_service.ListClustersResponse.deserialize, + ) + return self._stubs['list_clusters'] + + @property + def get_cluster(self) -> Callable[ + [cluster_service.GetClusterRequest], + cluster_service.Cluster]: + r"""Return a callable for the get cluster method over gRPC. + + Gets the details of a specific cluster. + + Returns: + Callable[[~.GetClusterRequest], + ~.Cluster]: + 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_cluster' not in self._stubs: + self._stubs['get_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/GetCluster', + request_serializer=cluster_service.GetClusterRequest.serialize, + response_deserializer=cluster_service.Cluster.deserialize, + ) + return self._stubs['get_cluster'] + + @property + def create_cluster(self) -> Callable[ + [cluster_service.CreateClusterRequest], + cluster_service.Operation]: + r"""Return a callable for the create cluster method over gRPC. + + Creates a cluster, consisting of the specified number and type + of Google Compute Engine instances. + + By default, the cluster is created in the project's `default + network `__. + + One firewall is added for the cluster. After cluster creation, + the Kubelet creates routes for each node to allow the containers + on that node to communicate with all other instances in the + cluster. + + Finally, an entry is added to the project's global metadata + indicating which CIDR range the cluster is using. + + Returns: + Callable[[~.CreateClusterRequest], + ~.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_cluster' not in self._stubs: + self._stubs['create_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/CreateCluster', + request_serializer=cluster_service.CreateClusterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['create_cluster'] + + @property + def update_cluster(self) -> Callable[ + [cluster_service.UpdateClusterRequest], + cluster_service.Operation]: + r"""Return a callable for the update cluster method over gRPC. + + Updates the settings of a specific cluster. + + Returns: + Callable[[~.UpdateClusterRequest], + ~.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_cluster' not in self._stubs: + self._stubs['update_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/UpdateCluster', + request_serializer=cluster_service.UpdateClusterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['update_cluster'] + + @property + def update_node_pool(self) -> Callable[ + [cluster_service.UpdateNodePoolRequest], + cluster_service.Operation]: + r"""Return a callable for the update node pool method over gRPC. + + Updates the version and/or image type for the + specified node pool. + + Returns: + Callable[[~.UpdateNodePoolRequest], + ~.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_node_pool' not in self._stubs: + self._stubs['update_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/UpdateNodePool', + request_serializer=cluster_service.UpdateNodePoolRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['update_node_pool'] + + @property + def set_node_pool_autoscaling(self) -> Callable[ + [cluster_service.SetNodePoolAutoscalingRequest], + cluster_service.Operation]: + r"""Return a callable for the set node pool autoscaling method over gRPC. + + Sets the autoscaling settings for the specified node + pool. + + Returns: + Callable[[~.SetNodePoolAutoscalingRequest], + ~.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 'set_node_pool_autoscaling' not in self._stubs: + self._stubs['set_node_pool_autoscaling'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetNodePoolAutoscaling', + request_serializer=cluster_service.SetNodePoolAutoscalingRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_node_pool_autoscaling'] + + @property + def set_logging_service(self) -> Callable[ + [cluster_service.SetLoggingServiceRequest], + cluster_service.Operation]: + r"""Return a callable for the set logging service method over gRPC. + + Sets the logging service for a specific cluster. + + Returns: + Callable[[~.SetLoggingServiceRequest], + ~.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 'set_logging_service' not in self._stubs: + self._stubs['set_logging_service'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetLoggingService', + request_serializer=cluster_service.SetLoggingServiceRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_logging_service'] + + @property + def set_monitoring_service(self) -> Callable[ + [cluster_service.SetMonitoringServiceRequest], + cluster_service.Operation]: + r"""Return a callable for the set monitoring service method over gRPC. + + Sets the monitoring service for a specific cluster. + + Returns: + Callable[[~.SetMonitoringServiceRequest], + ~.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 'set_monitoring_service' not in self._stubs: + self._stubs['set_monitoring_service'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetMonitoringService', + request_serializer=cluster_service.SetMonitoringServiceRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_monitoring_service'] + + @property + def set_addons_config(self) -> Callable[ + [cluster_service.SetAddonsConfigRequest], + cluster_service.Operation]: + r"""Return a callable for the set addons config method over gRPC. + + Sets the addons for a specific cluster. + + Returns: + Callable[[~.SetAddonsConfigRequest], + ~.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 'set_addons_config' not in self._stubs: + self._stubs['set_addons_config'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetAddonsConfig', + request_serializer=cluster_service.SetAddonsConfigRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_addons_config'] + + @property + def set_locations(self) -> Callable[ + [cluster_service.SetLocationsRequest], + cluster_service.Operation]: + r"""Return a callable for the set locations method over gRPC. + + Sets the locations for a specific cluster. Deprecated. Use + `projects.locations.clusters.update `__ + instead. + + Returns: + Callable[[~.SetLocationsRequest], + ~.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 'set_locations' not in self._stubs: + self._stubs['set_locations'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetLocations', + request_serializer=cluster_service.SetLocationsRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_locations'] + + @property + def update_master(self) -> Callable[ + [cluster_service.UpdateMasterRequest], + cluster_service.Operation]: + r"""Return a callable for the update master method over gRPC. + + Updates the master for a specific cluster. + + Returns: + Callable[[~.UpdateMasterRequest], + ~.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_master' not in self._stubs: + self._stubs['update_master'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/UpdateMaster', + request_serializer=cluster_service.UpdateMasterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['update_master'] + + @property + def set_master_auth(self) -> Callable[ + [cluster_service.SetMasterAuthRequest], + cluster_service.Operation]: + r"""Return a callable for the set master auth method over gRPC. + + Sets master auth materials. Currently supports + changing the admin password or a specific cluster, + either via password generation or explicitly setting the + password. + + Returns: + Callable[[~.SetMasterAuthRequest], + ~.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 'set_master_auth' not in self._stubs: + self._stubs['set_master_auth'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetMasterAuth', + request_serializer=cluster_service.SetMasterAuthRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_master_auth'] + + @property + def delete_cluster(self) -> Callable[ + [cluster_service.DeleteClusterRequest], + cluster_service.Operation]: + r"""Return a callable for the delete cluster method over gRPC. + + Deletes the cluster, including the Kubernetes + endpoint and all worker nodes. + + Firewalls and routes that were configured during cluster + creation are also deleted. + + Other Google Compute Engine resources that might be in + use by the cluster, such as load balancer resources, are + not deleted if they weren't present when the cluster was + initially created. + + Returns: + Callable[[~.DeleteClusterRequest], + ~.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_cluster' not in self._stubs: + self._stubs['delete_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/DeleteCluster', + request_serializer=cluster_service.DeleteClusterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['delete_cluster'] + + @property + def list_operations(self) -> Callable[ + [cluster_service.ListOperationsRequest], + cluster_service.ListOperationsResponse]: + r"""Return a callable for the list operations method over gRPC. + + Lists all operations in a project in a specific zone + or all zones. + + Returns: + Callable[[~.ListOperationsRequest], + ~.ListOperationsResponse]: + 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_operations' not in self._stubs: + self._stubs['list_operations'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/ListOperations', + request_serializer=cluster_service.ListOperationsRequest.serialize, + response_deserializer=cluster_service.ListOperationsResponse.deserialize, + ) + return self._stubs['list_operations'] + + @property + def get_operation(self) -> Callable[ + [cluster_service.GetOperationRequest], + cluster_service.Operation]: + r"""Return a callable for the get operation method over gRPC. + + Gets the specified operation. + + Returns: + Callable[[~.GetOperationRequest], + ~.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 'get_operation' not in self._stubs: + self._stubs['get_operation'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/GetOperation', + request_serializer=cluster_service.GetOperationRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['get_operation'] + + @property + def cancel_operation(self) -> Callable[ + [cluster_service.CancelOperationRequest], + empty_pb2.Empty]: + r"""Return a callable for the cancel operation method over gRPC. + + Cancels the specified operation. + + Returns: + Callable[[~.CancelOperationRequest], + ~.Empty]: + 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 'cancel_operation' not in self._stubs: + self._stubs['cancel_operation'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/CancelOperation', + request_serializer=cluster_service.CancelOperationRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['cancel_operation'] + + @property + def get_server_config(self) -> Callable[ + [cluster_service.GetServerConfigRequest], + cluster_service.ServerConfig]: + r"""Return a callable for the get server config method over gRPC. + + Returns configuration info about the Google + Kubernetes Engine service. + + Returns: + Callable[[~.GetServerConfigRequest], + ~.ServerConfig]: + 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_server_config' not in self._stubs: + self._stubs['get_server_config'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/GetServerConfig', + request_serializer=cluster_service.GetServerConfigRequest.serialize, + response_deserializer=cluster_service.ServerConfig.deserialize, + ) + return self._stubs['get_server_config'] + + @property + def get_json_web_keys(self) -> Callable[ + [cluster_service.GetJSONWebKeysRequest], + cluster_service.GetJSONWebKeysResponse]: + r"""Return a callable for the get json web keys method over gRPC. + + Gets the public component of the cluster signing keys + in JSON Web Key format. + + Returns: + Callable[[~.GetJSONWebKeysRequest], + ~.GetJSONWebKeysResponse]: + 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_json_web_keys' not in self._stubs: + self._stubs['get_json_web_keys'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/GetJSONWebKeys', + request_serializer=cluster_service.GetJSONWebKeysRequest.serialize, + response_deserializer=cluster_service.GetJSONWebKeysResponse.deserialize, + ) + return self._stubs['get_json_web_keys'] + + @property + def list_node_pools(self) -> Callable[ + [cluster_service.ListNodePoolsRequest], + cluster_service.ListNodePoolsResponse]: + r"""Return a callable for the list node pools method over gRPC. + + Lists the node pools for a cluster. + + Returns: + Callable[[~.ListNodePoolsRequest], + ~.ListNodePoolsResponse]: + 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_node_pools' not in self._stubs: + self._stubs['list_node_pools'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/ListNodePools', + request_serializer=cluster_service.ListNodePoolsRequest.serialize, + response_deserializer=cluster_service.ListNodePoolsResponse.deserialize, + ) + return self._stubs['list_node_pools'] + + @property + def get_node_pool(self) -> Callable[ + [cluster_service.GetNodePoolRequest], + cluster_service.NodePool]: + r"""Return a callable for the get node pool method over gRPC. + + Retrieves the requested node pool. + + Returns: + Callable[[~.GetNodePoolRequest], + ~.NodePool]: + 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_node_pool' not in self._stubs: + self._stubs['get_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/GetNodePool', + request_serializer=cluster_service.GetNodePoolRequest.serialize, + response_deserializer=cluster_service.NodePool.deserialize, + ) + return self._stubs['get_node_pool'] + + @property + def create_node_pool(self) -> Callable[ + [cluster_service.CreateNodePoolRequest], + cluster_service.Operation]: + r"""Return a callable for the create node pool method over gRPC. + + Creates a node pool for a cluster. + + Returns: + Callable[[~.CreateNodePoolRequest], + ~.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_node_pool' not in self._stubs: + self._stubs['create_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/CreateNodePool', + request_serializer=cluster_service.CreateNodePoolRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['create_node_pool'] + + @property + def delete_node_pool(self) -> Callable[ + [cluster_service.DeleteNodePoolRequest], + cluster_service.Operation]: + r"""Return a callable for the delete node pool method over gRPC. + + Deletes a node pool from a cluster. + + Returns: + Callable[[~.DeleteNodePoolRequest], + ~.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_node_pool' not in self._stubs: + self._stubs['delete_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/DeleteNodePool', + request_serializer=cluster_service.DeleteNodePoolRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['delete_node_pool'] + + @property + def complete_node_pool_upgrade(self) -> Callable[ + [cluster_service.CompleteNodePoolUpgradeRequest], + empty_pb2.Empty]: + r"""Return a callable for the complete node pool upgrade method over gRPC. + + CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + Returns: + Callable[[~.CompleteNodePoolUpgradeRequest], + ~.Empty]: + 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 'complete_node_pool_upgrade' not in self._stubs: + self._stubs['complete_node_pool_upgrade'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/CompleteNodePoolUpgrade', + request_serializer=cluster_service.CompleteNodePoolUpgradeRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['complete_node_pool_upgrade'] + + @property + def rollback_node_pool_upgrade(self) -> Callable[ + [cluster_service.RollbackNodePoolUpgradeRequest], + cluster_service.Operation]: + r"""Return a callable for the rollback node pool upgrade method over gRPC. + + Rolls back a previously Aborted or Failed NodePool + upgrade. This makes no changes if the last upgrade + successfully completed. + + Returns: + Callable[[~.RollbackNodePoolUpgradeRequest], + ~.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 'rollback_node_pool_upgrade' not in self._stubs: + self._stubs['rollback_node_pool_upgrade'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/RollbackNodePoolUpgrade', + request_serializer=cluster_service.RollbackNodePoolUpgradeRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['rollback_node_pool_upgrade'] + + @property + def set_node_pool_management(self) -> Callable[ + [cluster_service.SetNodePoolManagementRequest], + cluster_service.Operation]: + r"""Return a callable for the set node pool management method over gRPC. + + Sets the NodeManagement options for a node pool. + + Returns: + Callable[[~.SetNodePoolManagementRequest], + ~.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 'set_node_pool_management' not in self._stubs: + self._stubs['set_node_pool_management'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetNodePoolManagement', + request_serializer=cluster_service.SetNodePoolManagementRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_node_pool_management'] + + @property + def set_labels(self) -> Callable[ + [cluster_service.SetLabelsRequest], + cluster_service.Operation]: + r"""Return a callable for the set labels method over gRPC. + + Sets labels on a cluster. + + Returns: + Callable[[~.SetLabelsRequest], + ~.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 'set_labels' not in self._stubs: + self._stubs['set_labels'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetLabels', + request_serializer=cluster_service.SetLabelsRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_labels'] + + @property + def set_legacy_abac(self) -> Callable[ + [cluster_service.SetLegacyAbacRequest], + cluster_service.Operation]: + r"""Return a callable for the set legacy abac method over gRPC. + + Enables or disables the ABAC authorization mechanism + on a cluster. + + Returns: + Callable[[~.SetLegacyAbacRequest], + ~.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 'set_legacy_abac' not in self._stubs: + self._stubs['set_legacy_abac'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetLegacyAbac', + request_serializer=cluster_service.SetLegacyAbacRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_legacy_abac'] + + @property + def start_ip_rotation(self) -> Callable[ + [cluster_service.StartIPRotationRequest], + cluster_service.Operation]: + r"""Return a callable for the start ip rotation method over gRPC. + + Starts master IP rotation. + + Returns: + Callable[[~.StartIPRotationRequest], + ~.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 'start_ip_rotation' not in self._stubs: + self._stubs['start_ip_rotation'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/StartIPRotation', + request_serializer=cluster_service.StartIPRotationRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['start_ip_rotation'] + + @property + def complete_ip_rotation(self) -> Callable[ + [cluster_service.CompleteIPRotationRequest], + cluster_service.Operation]: + r"""Return a callable for the complete ip rotation method over gRPC. + + Completes master IP rotation. + + Returns: + Callable[[~.CompleteIPRotationRequest], + ~.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 'complete_ip_rotation' not in self._stubs: + self._stubs['complete_ip_rotation'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/CompleteIPRotation', + request_serializer=cluster_service.CompleteIPRotationRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['complete_ip_rotation'] + + @property + def set_node_pool_size(self) -> Callable[ + [cluster_service.SetNodePoolSizeRequest], + cluster_service.Operation]: + r"""Return a callable for the set node pool size method over gRPC. + + Sets the size for a specific node pool. The new size will be + used for all replicas, including future replicas created by + modifying + [NodePool.locations][google.container.v1.NodePool.locations]. + + Returns: + Callable[[~.SetNodePoolSizeRequest], + ~.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 'set_node_pool_size' not in self._stubs: + self._stubs['set_node_pool_size'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetNodePoolSize', + request_serializer=cluster_service.SetNodePoolSizeRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_node_pool_size'] + + @property + def set_network_policy(self) -> Callable[ + [cluster_service.SetNetworkPolicyRequest], + cluster_service.Operation]: + r"""Return a callable for the set network policy method over gRPC. + + Enables or disables Network Policy for a cluster. + + Returns: + Callable[[~.SetNetworkPolicyRequest], + ~.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 'set_network_policy' not in self._stubs: + self._stubs['set_network_policy'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetNetworkPolicy', + request_serializer=cluster_service.SetNetworkPolicyRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_network_policy'] + + @property + def set_maintenance_policy(self) -> Callable[ + [cluster_service.SetMaintenancePolicyRequest], + cluster_service.Operation]: + r"""Return a callable for the set maintenance policy method over gRPC. + + Sets the maintenance policy for a cluster. + + Returns: + Callable[[~.SetMaintenancePolicyRequest], + ~.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 'set_maintenance_policy' not in self._stubs: + self._stubs['set_maintenance_policy'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetMaintenancePolicy', + request_serializer=cluster_service.SetMaintenancePolicyRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_maintenance_policy'] + + @property + def list_usable_subnetworks(self) -> Callable[ + [cluster_service.ListUsableSubnetworksRequest], + cluster_service.ListUsableSubnetworksResponse]: + r"""Return a callable for the list usable subnetworks method over gRPC. + + Lists subnetworks that are usable for creating + clusters in a project. + + Returns: + Callable[[~.ListUsableSubnetworksRequest], + ~.ListUsableSubnetworksResponse]: + 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_usable_subnetworks' not in self._stubs: + self._stubs['list_usable_subnetworks'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/ListUsableSubnetworks', + request_serializer=cluster_service.ListUsableSubnetworksRequest.serialize, + response_deserializer=cluster_service.ListUsableSubnetworksResponse.deserialize, + ) + return self._stubs['list_usable_subnetworks'] + + @property + def check_autopilot_compatibility(self) -> Callable[ + [cluster_service.CheckAutopilotCompatibilityRequest], + cluster_service.CheckAutopilotCompatibilityResponse]: + r"""Return a callable for the check autopilot compatibility method over gRPC. + + Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + Returns: + Callable[[~.CheckAutopilotCompatibilityRequest], + ~.CheckAutopilotCompatibilityResponse]: + 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 'check_autopilot_compatibility' not in self._stubs: + self._stubs['check_autopilot_compatibility'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/CheckAutopilotCompatibility', + request_serializer=cluster_service.CheckAutopilotCompatibilityRequest.serialize, + response_deserializer=cluster_service.CheckAutopilotCompatibilityResponse.deserialize, + ) + return self._stubs['check_autopilot_compatibility'] + + def close(self): + self._logged_channel.close() + + @property + def kind(self) -> str: + return "grpc" + + +__all__ = ( + 'ClusterManagerGrpcTransport', +) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py new file mode 100644 index 000000000000..4b6f040acce9 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py @@ -0,0 +1,1522 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 inspect +import json +import pickle +import logging as std_logging +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 exceptions as core_exceptions +from google.api_core import retry_async as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message + +import grpc # type: ignore +import proto # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.container_v1.types import cluster_service +from google.protobuf import empty_pb2 # type: ignore +from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO +from .grpc import ClusterManagerGrpcTransport + +try: + from google.api_core import client_logging # type: ignore + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientAIOInterceptor(grpc.aio.UnaryUnaryClientInterceptor): # pragma: NO COVER + async def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": str(client_call_details.method), + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + response = await continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = await response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = dict([(k, str(v)) for k, v in response_metadata]) if response_metadata else None + result = await response + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response to rpc {client_call_details.method}.", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + + +class ClusterManagerGrpcAsyncIOTransport(ClusterManagerTransport): + """gRPC AsyncIO backend transport for ClusterManager. + + Google Kubernetes Engine Cluster Manager v1 + + 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 = 'container.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`. + 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 = 'container.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[Union[aio.Channel, Callable[..., 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 (default: 'container.googleapis.com'). + 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 a ``channel`` instance 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 a ``channel`` instance 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[Union[aio.Channel, Callable[..., aio.Channel]]]): + A ``Channel`` instance through which to make calls, or a Callable + that constructs and returns one. If set to None, ``self.create_channel`` + is used to create the channel. If a Callable is given, it will be called + with the same arguments as used in ``self.create_channel``. + 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 a ``channel`` instance 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 a ``channel`` instance 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] = {} + + 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 isinstance(channel, aio.Channel): + # Ignore credentials if a channel was passed. + credentials = None + self._ignore_credentials = True + # 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: + # initialize with the provided callable or the default channel + channel_init = channel or type(self).create_channel + self._grpc_channel = channel_init( + 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), + ], + ) + + self._interceptor = _LoggingClientAIOInterceptor() + self._grpc_channel._unary_unary_interceptors.append(self._interceptor) + self._logged_channel = self._grpc_channel + self._wrap_with_kind = "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters + # Wrap messages. This must be done after self._logged_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 list_clusters(self) -> Callable[ + [cluster_service.ListClustersRequest], + Awaitable[cluster_service.ListClustersResponse]]: + r"""Return a callable for the list clusters method over gRPC. + + Lists all clusters owned by a project in either the + specified zone or all zones. + + Returns: + Callable[[~.ListClustersRequest], + Awaitable[~.ListClustersResponse]]: + 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_clusters' not in self._stubs: + self._stubs['list_clusters'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/ListClusters', + request_serializer=cluster_service.ListClustersRequest.serialize, + response_deserializer=cluster_service.ListClustersResponse.deserialize, + ) + return self._stubs['list_clusters'] + + @property + def get_cluster(self) -> Callable[ + [cluster_service.GetClusterRequest], + Awaitable[cluster_service.Cluster]]: + r"""Return a callable for the get cluster method over gRPC. + + Gets the details of a specific cluster. + + Returns: + Callable[[~.GetClusterRequest], + Awaitable[~.Cluster]]: + 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_cluster' not in self._stubs: + self._stubs['get_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/GetCluster', + request_serializer=cluster_service.GetClusterRequest.serialize, + response_deserializer=cluster_service.Cluster.deserialize, + ) + return self._stubs['get_cluster'] + + @property + def create_cluster(self) -> Callable[ + [cluster_service.CreateClusterRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the create cluster method over gRPC. + + Creates a cluster, consisting of the specified number and type + of Google Compute Engine instances. + + By default, the cluster is created in the project's `default + network `__. + + One firewall is added for the cluster. After cluster creation, + the Kubelet creates routes for each node to allow the containers + on that node to communicate with all other instances in the + cluster. + + Finally, an entry is added to the project's global metadata + indicating which CIDR range the cluster is using. + + Returns: + Callable[[~.CreateClusterRequest], + 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_cluster' not in self._stubs: + self._stubs['create_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/CreateCluster', + request_serializer=cluster_service.CreateClusterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['create_cluster'] + + @property + def update_cluster(self) -> Callable[ + [cluster_service.UpdateClusterRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the update cluster method over gRPC. + + Updates the settings of a specific cluster. + + Returns: + Callable[[~.UpdateClusterRequest], + 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_cluster' not in self._stubs: + self._stubs['update_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/UpdateCluster', + request_serializer=cluster_service.UpdateClusterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['update_cluster'] + + @property + def update_node_pool(self) -> Callable[ + [cluster_service.UpdateNodePoolRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the update node pool method over gRPC. + + Updates the version and/or image type for the + specified node pool. + + Returns: + Callable[[~.UpdateNodePoolRequest], + 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_node_pool' not in self._stubs: + self._stubs['update_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/UpdateNodePool', + request_serializer=cluster_service.UpdateNodePoolRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['update_node_pool'] + + @property + def set_node_pool_autoscaling(self) -> Callable[ + [cluster_service.SetNodePoolAutoscalingRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set node pool autoscaling method over gRPC. + + Sets the autoscaling settings for the specified node + pool. + + Returns: + Callable[[~.SetNodePoolAutoscalingRequest], + 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 'set_node_pool_autoscaling' not in self._stubs: + self._stubs['set_node_pool_autoscaling'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetNodePoolAutoscaling', + request_serializer=cluster_service.SetNodePoolAutoscalingRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_node_pool_autoscaling'] + + @property + def set_logging_service(self) -> Callable[ + [cluster_service.SetLoggingServiceRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set logging service method over gRPC. + + Sets the logging service for a specific cluster. + + Returns: + Callable[[~.SetLoggingServiceRequest], + 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 'set_logging_service' not in self._stubs: + self._stubs['set_logging_service'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetLoggingService', + request_serializer=cluster_service.SetLoggingServiceRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_logging_service'] + + @property + def set_monitoring_service(self) -> Callable[ + [cluster_service.SetMonitoringServiceRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set monitoring service method over gRPC. + + Sets the monitoring service for a specific cluster. + + Returns: + Callable[[~.SetMonitoringServiceRequest], + 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 'set_monitoring_service' not in self._stubs: + self._stubs['set_monitoring_service'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetMonitoringService', + request_serializer=cluster_service.SetMonitoringServiceRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_monitoring_service'] + + @property + def set_addons_config(self) -> Callable[ + [cluster_service.SetAddonsConfigRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set addons config method over gRPC. + + Sets the addons for a specific cluster. + + Returns: + Callable[[~.SetAddonsConfigRequest], + 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 'set_addons_config' not in self._stubs: + self._stubs['set_addons_config'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetAddonsConfig', + request_serializer=cluster_service.SetAddonsConfigRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_addons_config'] + + @property + def set_locations(self) -> Callable[ + [cluster_service.SetLocationsRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set locations method over gRPC. + + Sets the locations for a specific cluster. Deprecated. Use + `projects.locations.clusters.update `__ + instead. + + Returns: + Callable[[~.SetLocationsRequest], + 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 'set_locations' not in self._stubs: + self._stubs['set_locations'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetLocations', + request_serializer=cluster_service.SetLocationsRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_locations'] + + @property + def update_master(self) -> Callable[ + [cluster_service.UpdateMasterRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the update master method over gRPC. + + Updates the master for a specific cluster. + + Returns: + Callable[[~.UpdateMasterRequest], + 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_master' not in self._stubs: + self._stubs['update_master'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/UpdateMaster', + request_serializer=cluster_service.UpdateMasterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['update_master'] + + @property + def set_master_auth(self) -> Callable[ + [cluster_service.SetMasterAuthRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set master auth method over gRPC. + + Sets master auth materials. Currently supports + changing the admin password or a specific cluster, + either via password generation or explicitly setting the + password. + + Returns: + Callable[[~.SetMasterAuthRequest], + 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 'set_master_auth' not in self._stubs: + self._stubs['set_master_auth'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetMasterAuth', + request_serializer=cluster_service.SetMasterAuthRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_master_auth'] + + @property + def delete_cluster(self) -> Callable[ + [cluster_service.DeleteClusterRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the delete cluster method over gRPC. + + Deletes the cluster, including the Kubernetes + endpoint and all worker nodes. + + Firewalls and routes that were configured during cluster + creation are also deleted. + + Other Google Compute Engine resources that might be in + use by the cluster, such as load balancer resources, are + not deleted if they weren't present when the cluster was + initially created. + + Returns: + Callable[[~.DeleteClusterRequest], + 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_cluster' not in self._stubs: + self._stubs['delete_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/DeleteCluster', + request_serializer=cluster_service.DeleteClusterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['delete_cluster'] + + @property + def list_operations(self) -> Callable[ + [cluster_service.ListOperationsRequest], + Awaitable[cluster_service.ListOperationsResponse]]: + r"""Return a callable for the list operations method over gRPC. + + Lists all operations in a project in a specific zone + or all zones. + + Returns: + Callable[[~.ListOperationsRequest], + Awaitable[~.ListOperationsResponse]]: + 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_operations' not in self._stubs: + self._stubs['list_operations'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/ListOperations', + request_serializer=cluster_service.ListOperationsRequest.serialize, + response_deserializer=cluster_service.ListOperationsResponse.deserialize, + ) + return self._stubs['list_operations'] + + @property + def get_operation(self) -> Callable[ + [cluster_service.GetOperationRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the get operation method over gRPC. + + Gets the specified operation. + + Returns: + Callable[[~.GetOperationRequest], + 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 'get_operation' not in self._stubs: + self._stubs['get_operation'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/GetOperation', + request_serializer=cluster_service.GetOperationRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['get_operation'] + + @property + def cancel_operation(self) -> Callable[ + [cluster_service.CancelOperationRequest], + Awaitable[empty_pb2.Empty]]: + r"""Return a callable for the cancel operation method over gRPC. + + Cancels the specified operation. + + Returns: + Callable[[~.CancelOperationRequest], + Awaitable[~.Empty]]: + 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 'cancel_operation' not in self._stubs: + self._stubs['cancel_operation'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/CancelOperation', + request_serializer=cluster_service.CancelOperationRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['cancel_operation'] + + @property + def get_server_config(self) -> Callable[ + [cluster_service.GetServerConfigRequest], + Awaitable[cluster_service.ServerConfig]]: + r"""Return a callable for the get server config method over gRPC. + + Returns configuration info about the Google + Kubernetes Engine service. + + Returns: + Callable[[~.GetServerConfigRequest], + Awaitable[~.ServerConfig]]: + 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_server_config' not in self._stubs: + self._stubs['get_server_config'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/GetServerConfig', + request_serializer=cluster_service.GetServerConfigRequest.serialize, + response_deserializer=cluster_service.ServerConfig.deserialize, + ) + return self._stubs['get_server_config'] + + @property + def get_json_web_keys(self) -> Callable[ + [cluster_service.GetJSONWebKeysRequest], + Awaitable[cluster_service.GetJSONWebKeysResponse]]: + r"""Return a callable for the get json web keys method over gRPC. + + Gets the public component of the cluster signing keys + in JSON Web Key format. + + Returns: + Callable[[~.GetJSONWebKeysRequest], + Awaitable[~.GetJSONWebKeysResponse]]: + 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_json_web_keys' not in self._stubs: + self._stubs['get_json_web_keys'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/GetJSONWebKeys', + request_serializer=cluster_service.GetJSONWebKeysRequest.serialize, + response_deserializer=cluster_service.GetJSONWebKeysResponse.deserialize, + ) + return self._stubs['get_json_web_keys'] + + @property + def list_node_pools(self) -> Callable[ + [cluster_service.ListNodePoolsRequest], + Awaitable[cluster_service.ListNodePoolsResponse]]: + r"""Return a callable for the list node pools method over gRPC. + + Lists the node pools for a cluster. + + Returns: + Callable[[~.ListNodePoolsRequest], + Awaitable[~.ListNodePoolsResponse]]: + 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_node_pools' not in self._stubs: + self._stubs['list_node_pools'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/ListNodePools', + request_serializer=cluster_service.ListNodePoolsRequest.serialize, + response_deserializer=cluster_service.ListNodePoolsResponse.deserialize, + ) + return self._stubs['list_node_pools'] + + @property + def get_node_pool(self) -> Callable[ + [cluster_service.GetNodePoolRequest], + Awaitable[cluster_service.NodePool]]: + r"""Return a callable for the get node pool method over gRPC. + + Retrieves the requested node pool. + + Returns: + Callable[[~.GetNodePoolRequest], + Awaitable[~.NodePool]]: + 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_node_pool' not in self._stubs: + self._stubs['get_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/GetNodePool', + request_serializer=cluster_service.GetNodePoolRequest.serialize, + response_deserializer=cluster_service.NodePool.deserialize, + ) + return self._stubs['get_node_pool'] + + @property + def create_node_pool(self) -> Callable[ + [cluster_service.CreateNodePoolRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the create node pool method over gRPC. + + Creates a node pool for a cluster. + + Returns: + Callable[[~.CreateNodePoolRequest], + 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_node_pool' not in self._stubs: + self._stubs['create_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/CreateNodePool', + request_serializer=cluster_service.CreateNodePoolRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['create_node_pool'] + + @property + def delete_node_pool(self) -> Callable[ + [cluster_service.DeleteNodePoolRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the delete node pool method over gRPC. + + Deletes a node pool from a cluster. + + Returns: + Callable[[~.DeleteNodePoolRequest], + 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_node_pool' not in self._stubs: + self._stubs['delete_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/DeleteNodePool', + request_serializer=cluster_service.DeleteNodePoolRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['delete_node_pool'] + + @property + def complete_node_pool_upgrade(self) -> Callable[ + [cluster_service.CompleteNodePoolUpgradeRequest], + Awaitable[empty_pb2.Empty]]: + r"""Return a callable for the complete node pool upgrade method over gRPC. + + CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + Returns: + Callable[[~.CompleteNodePoolUpgradeRequest], + Awaitable[~.Empty]]: + 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 'complete_node_pool_upgrade' not in self._stubs: + self._stubs['complete_node_pool_upgrade'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/CompleteNodePoolUpgrade', + request_serializer=cluster_service.CompleteNodePoolUpgradeRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['complete_node_pool_upgrade'] + + @property + def rollback_node_pool_upgrade(self) -> Callable[ + [cluster_service.RollbackNodePoolUpgradeRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the rollback node pool upgrade method over gRPC. + + Rolls back a previously Aborted or Failed NodePool + upgrade. This makes no changes if the last upgrade + successfully completed. + + Returns: + Callable[[~.RollbackNodePoolUpgradeRequest], + 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 'rollback_node_pool_upgrade' not in self._stubs: + self._stubs['rollback_node_pool_upgrade'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/RollbackNodePoolUpgrade', + request_serializer=cluster_service.RollbackNodePoolUpgradeRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['rollback_node_pool_upgrade'] + + @property + def set_node_pool_management(self) -> Callable[ + [cluster_service.SetNodePoolManagementRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set node pool management method over gRPC. + + Sets the NodeManagement options for a node pool. + + Returns: + Callable[[~.SetNodePoolManagementRequest], + 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 'set_node_pool_management' not in self._stubs: + self._stubs['set_node_pool_management'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetNodePoolManagement', + request_serializer=cluster_service.SetNodePoolManagementRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_node_pool_management'] + + @property + def set_labels(self) -> Callable[ + [cluster_service.SetLabelsRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set labels method over gRPC. + + Sets labels on a cluster. + + Returns: + Callable[[~.SetLabelsRequest], + 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 'set_labels' not in self._stubs: + self._stubs['set_labels'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetLabels', + request_serializer=cluster_service.SetLabelsRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_labels'] + + @property + def set_legacy_abac(self) -> Callable[ + [cluster_service.SetLegacyAbacRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set legacy abac method over gRPC. + + Enables or disables the ABAC authorization mechanism + on a cluster. + + Returns: + Callable[[~.SetLegacyAbacRequest], + 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 'set_legacy_abac' not in self._stubs: + self._stubs['set_legacy_abac'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetLegacyAbac', + request_serializer=cluster_service.SetLegacyAbacRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_legacy_abac'] + + @property + def start_ip_rotation(self) -> Callable[ + [cluster_service.StartIPRotationRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the start ip rotation method over gRPC. + + Starts master IP rotation. + + Returns: + Callable[[~.StartIPRotationRequest], + 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 'start_ip_rotation' not in self._stubs: + self._stubs['start_ip_rotation'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/StartIPRotation', + request_serializer=cluster_service.StartIPRotationRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['start_ip_rotation'] + + @property + def complete_ip_rotation(self) -> Callable[ + [cluster_service.CompleteIPRotationRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the complete ip rotation method over gRPC. + + Completes master IP rotation. + + Returns: + Callable[[~.CompleteIPRotationRequest], + 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 'complete_ip_rotation' not in self._stubs: + self._stubs['complete_ip_rotation'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/CompleteIPRotation', + request_serializer=cluster_service.CompleteIPRotationRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['complete_ip_rotation'] + + @property + def set_node_pool_size(self) -> Callable[ + [cluster_service.SetNodePoolSizeRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set node pool size method over gRPC. + + Sets the size for a specific node pool. The new size will be + used for all replicas, including future replicas created by + modifying + [NodePool.locations][google.container.v1.NodePool.locations]. + + Returns: + Callable[[~.SetNodePoolSizeRequest], + 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 'set_node_pool_size' not in self._stubs: + self._stubs['set_node_pool_size'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetNodePoolSize', + request_serializer=cluster_service.SetNodePoolSizeRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_node_pool_size'] + + @property + def set_network_policy(self) -> Callable[ + [cluster_service.SetNetworkPolicyRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set network policy method over gRPC. + + Enables or disables Network Policy for a cluster. + + Returns: + Callable[[~.SetNetworkPolicyRequest], + 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 'set_network_policy' not in self._stubs: + self._stubs['set_network_policy'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetNetworkPolicy', + request_serializer=cluster_service.SetNetworkPolicyRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_network_policy'] + + @property + def set_maintenance_policy(self) -> Callable[ + [cluster_service.SetMaintenancePolicyRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set maintenance policy method over gRPC. + + Sets the maintenance policy for a cluster. + + Returns: + Callable[[~.SetMaintenancePolicyRequest], + 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 'set_maintenance_policy' not in self._stubs: + self._stubs['set_maintenance_policy'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/SetMaintenancePolicy', + request_serializer=cluster_service.SetMaintenancePolicyRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_maintenance_policy'] + + @property + def list_usable_subnetworks(self) -> Callable[ + [cluster_service.ListUsableSubnetworksRequest], + Awaitable[cluster_service.ListUsableSubnetworksResponse]]: + r"""Return a callable for the list usable subnetworks method over gRPC. + + Lists subnetworks that are usable for creating + clusters in a project. + + Returns: + Callable[[~.ListUsableSubnetworksRequest], + Awaitable[~.ListUsableSubnetworksResponse]]: + 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_usable_subnetworks' not in self._stubs: + self._stubs['list_usable_subnetworks'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/ListUsableSubnetworks', + request_serializer=cluster_service.ListUsableSubnetworksRequest.serialize, + response_deserializer=cluster_service.ListUsableSubnetworksResponse.deserialize, + ) + return self._stubs['list_usable_subnetworks'] + + @property + def check_autopilot_compatibility(self) -> Callable[ + [cluster_service.CheckAutopilotCompatibilityRequest], + Awaitable[cluster_service.CheckAutopilotCompatibilityResponse]]: + r"""Return a callable for the check autopilot compatibility method over gRPC. + + Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + Returns: + Callable[[~.CheckAutopilotCompatibilityRequest], + Awaitable[~.CheckAutopilotCompatibilityResponse]]: + 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 'check_autopilot_compatibility' not in self._stubs: + self._stubs['check_autopilot_compatibility'] = self._logged_channel.unary_unary( + '/google.container.v1.ClusterManager/CheckAutopilotCompatibility', + request_serializer=cluster_service.CheckAutopilotCompatibilityRequest.serialize, + response_deserializer=cluster_service.CheckAutopilotCompatibilityResponse.deserialize, + ) + return self._stubs['check_autopilot_compatibility'] + + def _prep_wrapped_messages(self, client_info): + """ Precompute the wrapped methods, overriding the base class method to use async wrappers.""" + self._wrapped_methods = { + self.list_clusters: self._wrap_method( + self.list_clusters, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_cluster: self._wrap_method( + self.get_cluster, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.create_cluster: self._wrap_method( + self.create_cluster, + default_timeout=45.0, + client_info=client_info, + ), + self.update_cluster: self._wrap_method( + self.update_cluster, + default_timeout=45.0, + client_info=client_info, + ), + self.update_node_pool: self._wrap_method( + self.update_node_pool, + default_timeout=45.0, + client_info=client_info, + ), + self.set_node_pool_autoscaling: self._wrap_method( + self.set_node_pool_autoscaling, + default_timeout=45.0, + client_info=client_info, + ), + self.set_logging_service: self._wrap_method( + self.set_logging_service, + default_timeout=45.0, + client_info=client_info, + ), + self.set_monitoring_service: self._wrap_method( + self.set_monitoring_service, + default_timeout=45.0, + client_info=client_info, + ), + self.set_addons_config: self._wrap_method( + self.set_addons_config, + default_timeout=45.0, + client_info=client_info, + ), + self.set_locations: self._wrap_method( + self.set_locations, + default_timeout=45.0, + client_info=client_info, + ), + self.update_master: self._wrap_method( + self.update_master, + default_timeout=45.0, + client_info=client_info, + ), + self.set_master_auth: self._wrap_method( + self.set_master_auth, + default_timeout=45.0, + client_info=client_info, + ), + self.delete_cluster: self._wrap_method( + self.delete_cluster, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.list_operations: self._wrap_method( + self.list_operations, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_operation: self._wrap_method( + self.get_operation, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.cancel_operation: self._wrap_method( + self.cancel_operation, + default_timeout=45.0, + client_info=client_info, + ), + self.get_server_config: self._wrap_method( + self.get_server_config, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_json_web_keys: self._wrap_method( + self.get_json_web_keys, + default_timeout=None, + client_info=client_info, + ), + self.list_node_pools: self._wrap_method( + self.list_node_pools, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_node_pool: self._wrap_method( + self.get_node_pool, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.create_node_pool: self._wrap_method( + self.create_node_pool, + default_timeout=45.0, + client_info=client_info, + ), + self.delete_node_pool: self._wrap_method( + self.delete_node_pool, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.complete_node_pool_upgrade: self._wrap_method( + self.complete_node_pool_upgrade, + default_timeout=None, + client_info=client_info, + ), + self.rollback_node_pool_upgrade: self._wrap_method( + self.rollback_node_pool_upgrade, + default_timeout=45.0, + client_info=client_info, + ), + self.set_node_pool_management: self._wrap_method( + self.set_node_pool_management, + default_timeout=45.0, + client_info=client_info, + ), + self.set_labels: self._wrap_method( + self.set_labels, + default_timeout=45.0, + client_info=client_info, + ), + self.set_legacy_abac: self._wrap_method( + self.set_legacy_abac, + default_timeout=45.0, + client_info=client_info, + ), + self.start_ip_rotation: self._wrap_method( + self.start_ip_rotation, + default_timeout=45.0, + client_info=client_info, + ), + self.complete_ip_rotation: self._wrap_method( + self.complete_ip_rotation, + default_timeout=45.0, + client_info=client_info, + ), + self.set_node_pool_size: self._wrap_method( + self.set_node_pool_size, + default_timeout=45.0, + client_info=client_info, + ), + self.set_network_policy: self._wrap_method( + self.set_network_policy, + default_timeout=45.0, + client_info=client_info, + ), + self.set_maintenance_policy: self._wrap_method( + self.set_maintenance_policy, + default_timeout=45.0, + client_info=client_info, + ), + self.list_usable_subnetworks: self._wrap_method( + self.list_usable_subnetworks, + default_timeout=None, + client_info=client_info, + ), + self.check_autopilot_compatibility: self._wrap_method( + self.check_autopilot_compatibility, + default_timeout=None, + client_info=client_info, + ), + } + + def _wrap_method(self, func, *args, **kwargs): + if self._wrap_with_kind: # pragma: NO COVER + kwargs["kind"] = self.kind + return gapic_v1.method_async.wrap_method(func, *args, **kwargs) + + def close(self): + return self._logged_channel.close() + + @property + def kind(self) -> str: + return "grpc_asyncio" + + +__all__ = ( + 'ClusterManagerGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest.py new file mode 100644 index 000000000000..e40e09a9aafa --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest.py @@ -0,0 +1,5424 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 logging +import json # type: ignore + +from google.auth.transport.requests import AuthorizedSession # type: ignore +from google.auth import credentials as ga_credentials # type: ignore +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.api_core import rest_helpers +from google.api_core import rest_streaming +from google.api_core import gapic_v1 + +from google.protobuf import json_format + +from requests import __version__ as requests_version +import dataclasses +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + + +from google.cloud.container_v1.types import cluster_service +from google.protobuf import empty_pb2 # type: ignore + + +from .rest_base import _BaseClusterManagerRestTransport +from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object, None] # type: ignore + +try: + from google.api_core import client_logging # type: ignore + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = logging.getLogger(__name__) + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=f"requests@{requests_version}", +) + + +class ClusterManagerRestInterceptor: + """Interceptor for ClusterManager. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the ClusterManagerRestTransport. + + .. code-block:: python + class MyCustomClusterManagerInterceptor(ClusterManagerRestInterceptor): + def pre_cancel_operation(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def pre_check_autopilot_compatibility(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_check_autopilot_compatibility(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_complete_ip_rotation(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_complete_ip_rotation(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_complete_node_pool_upgrade(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def pre_create_cluster(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_create_cluster(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_create_node_pool(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_create_node_pool(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_delete_cluster(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_delete_cluster(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_delete_node_pool(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_delete_node_pool(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_get_cluster(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_cluster(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_get_json_web_keys(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_json_web_keys(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_get_node_pool(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_node_pool(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_get_operation(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_operation(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_get_server_config(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_server_config(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_list_clusters(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list_clusters(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_list_node_pools(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list_node_pools(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_list_operations(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list_operations(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_list_usable_subnetworks(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list_usable_subnetworks(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_rollback_node_pool_upgrade(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_rollback_node_pool_upgrade(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_set_addons_config(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_addons_config(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_set_labels(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_labels(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_set_legacy_abac(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_legacy_abac(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_set_locations(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_locations(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_set_logging_service(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_logging_service(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_set_maintenance_policy(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_maintenance_policy(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_set_master_auth(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_master_auth(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_set_monitoring_service(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_monitoring_service(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_set_network_policy(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_network_policy(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_set_node_pool_autoscaling(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_node_pool_autoscaling(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_set_node_pool_management(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_node_pool_management(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_set_node_pool_size(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_set_node_pool_size(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_start_ip_rotation(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_start_ip_rotation(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_update_cluster(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_update_cluster(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_update_master(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_update_master(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_update_node_pool(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_update_node_pool(self, response): + logging.log(f"Received response: {response}") + return response + + transport = ClusterManagerRestTransport(interceptor=MyCustomClusterManagerInterceptor()) + client = ClusterManagerClient(transport=transport) + + + """ + def pre_cancel_operation(self, request: cluster_service.CancelOperationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for cancel_operation + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def pre_check_autopilot_compatibility(self, request: cluster_service.CheckAutopilotCompatibilityRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.CheckAutopilotCompatibilityRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for check_autopilot_compatibility + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_check_autopilot_compatibility(self, response: cluster_service.CheckAutopilotCompatibilityResponse) -> cluster_service.CheckAutopilotCompatibilityResponse: + """Post-rpc interceptor for check_autopilot_compatibility + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_complete_ip_rotation(self, request: cluster_service.CompleteIPRotationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.CompleteIPRotationRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for complete_ip_rotation + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_complete_ip_rotation(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for complete_ip_rotation + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_complete_node_pool_upgrade(self, request: cluster_service.CompleteNodePoolUpgradeRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.CompleteNodePoolUpgradeRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for complete_node_pool_upgrade + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def pre_create_cluster(self, request: cluster_service.CreateClusterRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.CreateClusterRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for create_cluster + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_create_cluster(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for create_cluster + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_create_node_pool(self, request: cluster_service.CreateNodePoolRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.CreateNodePoolRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for create_node_pool + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_create_node_pool(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for create_node_pool + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_delete_cluster(self, request: cluster_service.DeleteClusterRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.DeleteClusterRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for delete_cluster + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_delete_cluster(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for delete_cluster + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_delete_node_pool(self, request: cluster_service.DeleteNodePoolRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.DeleteNodePoolRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for delete_node_pool + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_delete_node_pool(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for delete_node_pool + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_get_cluster(self, request: cluster_service.GetClusterRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.GetClusterRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for get_cluster + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_get_cluster(self, response: cluster_service.Cluster) -> cluster_service.Cluster: + """Post-rpc interceptor for get_cluster + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_get_json_web_keys(self, request: cluster_service.GetJSONWebKeysRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.GetJSONWebKeysRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for get_json_web_keys + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_get_json_web_keys(self, response: cluster_service.GetJSONWebKeysResponse) -> cluster_service.GetJSONWebKeysResponse: + """Post-rpc interceptor for get_json_web_keys + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_get_node_pool(self, request: cluster_service.GetNodePoolRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.GetNodePoolRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for get_node_pool + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_get_node_pool(self, response: cluster_service.NodePool) -> cluster_service.NodePool: + """Post-rpc interceptor for get_node_pool + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_get_operation(self, request: cluster_service.GetOperationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for get_operation + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_get_operation(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for get_operation + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_get_server_config(self, request: cluster_service.GetServerConfigRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.GetServerConfigRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for get_server_config + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_get_server_config(self, response: cluster_service.ServerConfig) -> cluster_service.ServerConfig: + """Post-rpc interceptor for get_server_config + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_list_clusters(self, request: cluster_service.ListClustersRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.ListClustersRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for list_clusters + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_list_clusters(self, response: cluster_service.ListClustersResponse) -> cluster_service.ListClustersResponse: + """Post-rpc interceptor for list_clusters + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_list_node_pools(self, request: cluster_service.ListNodePoolsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.ListNodePoolsRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for list_node_pools + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_list_node_pools(self, response: cluster_service.ListNodePoolsResponse) -> cluster_service.ListNodePoolsResponse: + """Post-rpc interceptor for list_node_pools + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_list_operations(self, request: cluster_service.ListOperationsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for list_operations + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_list_operations(self, response: cluster_service.ListOperationsResponse) -> cluster_service.ListOperationsResponse: + """Post-rpc interceptor for list_operations + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_list_usable_subnetworks(self, request: cluster_service.ListUsableSubnetworksRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.ListUsableSubnetworksRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for list_usable_subnetworks + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_list_usable_subnetworks(self, response: cluster_service.ListUsableSubnetworksResponse) -> cluster_service.ListUsableSubnetworksResponse: + """Post-rpc interceptor for list_usable_subnetworks + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_rollback_node_pool_upgrade(self, request: cluster_service.RollbackNodePoolUpgradeRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.RollbackNodePoolUpgradeRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for rollback_node_pool_upgrade + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_rollback_node_pool_upgrade(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for rollback_node_pool_upgrade + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_set_addons_config(self, request: cluster_service.SetAddonsConfigRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetAddonsConfigRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for set_addons_config + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_set_addons_config(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for set_addons_config + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_set_labels(self, request: cluster_service.SetLabelsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetLabelsRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for set_labels + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_set_labels(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for set_labels + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_set_legacy_abac(self, request: cluster_service.SetLegacyAbacRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetLegacyAbacRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for set_legacy_abac + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_set_legacy_abac(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for set_legacy_abac + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_set_locations(self, request: cluster_service.SetLocationsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for set_locations + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_set_locations(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for set_locations + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_set_logging_service(self, request: cluster_service.SetLoggingServiceRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetLoggingServiceRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for set_logging_service + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_set_logging_service(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for set_logging_service + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_set_maintenance_policy(self, request: cluster_service.SetMaintenancePolicyRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetMaintenancePolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for set_maintenance_policy + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_set_maintenance_policy(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for set_maintenance_policy + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_set_master_auth(self, request: cluster_service.SetMasterAuthRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetMasterAuthRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for set_master_auth + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_set_master_auth(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for set_master_auth + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_set_monitoring_service(self, request: cluster_service.SetMonitoringServiceRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetMonitoringServiceRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for set_monitoring_service + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_set_monitoring_service(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for set_monitoring_service + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_set_network_policy(self, request: cluster_service.SetNetworkPolicyRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetNetworkPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for set_network_policy + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_set_network_policy(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for set_network_policy + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_set_node_pool_autoscaling(self, request: cluster_service.SetNodePoolAutoscalingRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetNodePoolAutoscalingRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for set_node_pool_autoscaling + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_set_node_pool_autoscaling(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for set_node_pool_autoscaling + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_set_node_pool_management(self, request: cluster_service.SetNodePoolManagementRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetNodePoolManagementRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for set_node_pool_management + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_set_node_pool_management(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for set_node_pool_management + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_set_node_pool_size(self, request: cluster_service.SetNodePoolSizeRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetNodePoolSizeRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for set_node_pool_size + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_set_node_pool_size(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for set_node_pool_size + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_start_ip_rotation(self, request: cluster_service.StartIPRotationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.StartIPRotationRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for start_ip_rotation + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_start_ip_rotation(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for start_ip_rotation + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_update_cluster(self, request: cluster_service.UpdateClusterRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.UpdateClusterRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for update_cluster + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_update_cluster(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for update_cluster + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_update_master(self, request: cluster_service.UpdateMasterRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.UpdateMasterRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for update_master + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_update_master(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for update_master + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + def pre_update_node_pool(self, request: cluster_service.UpdateNodePoolRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.UpdateNodePoolRequest, Sequence[Tuple[str, Union[str, bytes]]]]: + """Pre-rpc interceptor for update_node_pool + + Override in a subclass to manipulate the request or metadata + before they are sent to the ClusterManager server. + """ + return request, metadata + + def post_update_node_pool(self, response: cluster_service.Operation) -> cluster_service.Operation: + """Post-rpc interceptor for update_node_pool + + Override in a subclass to manipulate the response + after it is returned by the ClusterManager server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class ClusterManagerRestStub: + _session: AuthorizedSession + _host: str + _interceptor: ClusterManagerRestInterceptor + + +class ClusterManagerRestTransport(_BaseClusterManagerRestTransport): + """REST backend synchronous transport for ClusterManager. + + Google Kubernetes Engine Cluster Manager v1 + + 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 JSON representations of protocol buffers over HTTP/1.1 + """ + + def __init__(self, *, + host: str = 'container.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = 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, + url_scheme: str = 'https', + interceptor: Optional[ClusterManagerRestInterceptor] = None, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to (default: 'container.googleapis.com'). + 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 ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` 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 are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + url_scheme=url_scheme, + api_audience=api_audience + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST) + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = interceptor or ClusterManagerRestInterceptor() + self._prep_wrapped_messages(client_info) + + class _CancelOperation(_BaseClusterManagerRestTransport._BaseCancelOperation, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.CancelOperation") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.CancelOperationRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ): + r"""Call the cancel operation method over HTTP. + + Args: + request (~.cluster_service.CancelOperationRequest): + The request object. CancelOperationRequest cancels a + single operation. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + + http_options = _BaseClusterManagerRestTransport._BaseCancelOperation._get_http_options() + + request, metadata = self._interceptor.pre_cancel_operation(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseCancelOperation._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseCancelOperation._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseCancelOperation._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.CancelOperation", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._CancelOperation._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + class _CheckAutopilotCompatibility(_BaseClusterManagerRestTransport._BaseCheckAutopilotCompatibility, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.CheckAutopilotCompatibility") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__(self, + request: cluster_service.CheckAutopilotCompatibilityRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.CheckAutopilotCompatibilityResponse: + r"""Call the check autopilot + compatibility method over HTTP. + + Args: + request (~.cluster_service.CheckAutopilotCompatibilityRequest): + The request object. CheckAutopilotCompatibilityRequest + requests getting the blockers for the + given operation in the cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.CheckAutopilotCompatibilityResponse: + CheckAutopilotCompatibilityResponse + has a list of compatibility issues. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseCheckAutopilotCompatibility._get_http_options() + + request, metadata = self._interceptor.pre_check_autopilot_compatibility(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseCheckAutopilotCompatibility._get_transcoded_request(http_options, request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseCheckAutopilotCompatibility._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.CheckAutopilotCompatibility", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "CheckAutopilotCompatibility", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._CheckAutopilotCompatibility._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.CheckAutopilotCompatibilityResponse() + pb_resp = cluster_service.CheckAutopilotCompatibilityResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_check_autopilot_compatibility(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.CheckAutopilotCompatibilityResponse.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.check_autopilot_compatibility", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "CheckAutopilotCompatibility", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _CompleteIPRotation(_BaseClusterManagerRestTransport._BaseCompleteIPRotation, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.CompleteIPRotation") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.CompleteIPRotationRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the complete ip rotation method over HTTP. + + Args: + request (~.cluster_service.CompleteIPRotationRequest): + The request object. CompleteIPRotationRequest moves the + cluster master back into single-IP mode. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseCompleteIPRotation._get_http_options() + + request, metadata = self._interceptor.pre_complete_ip_rotation(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseCompleteIPRotation._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseCompleteIPRotation._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseCompleteIPRotation._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.CompleteIPRotation", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "CompleteIPRotation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._CompleteIPRotation._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_complete_ip_rotation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.complete_ip_rotation", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "CompleteIPRotation", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _CompleteNodePoolUpgrade(_BaseClusterManagerRestTransport._BaseCompleteNodePoolUpgrade, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.CompleteNodePoolUpgrade") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.CompleteNodePoolUpgradeRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ): + r"""Call the complete node pool + upgrade method over HTTP. + + Args: + request (~.cluster_service.CompleteNodePoolUpgradeRequest): + The request object. CompleteNodePoolUpgradeRequest sets + the name of target node pool to complete + upgrade. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + + http_options = _BaseClusterManagerRestTransport._BaseCompleteNodePoolUpgrade._get_http_options() + + request, metadata = self._interceptor.pre_complete_node_pool_upgrade(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseCompleteNodePoolUpgrade._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseCompleteNodePoolUpgrade._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseCompleteNodePoolUpgrade._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.CompleteNodePoolUpgrade", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "CompleteNodePoolUpgrade", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._CompleteNodePoolUpgrade._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + class _CreateCluster(_BaseClusterManagerRestTransport._BaseCreateCluster, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.CreateCluster") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.CreateClusterRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the create cluster method over HTTP. + + Args: + request (~.cluster_service.CreateClusterRequest): + The request object. CreateClusterRequest creates a + cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseCreateCluster._get_http_options() + + request, metadata = self._interceptor.pre_create_cluster(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseCreateCluster._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseCreateCluster._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseCreateCluster._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.CreateCluster", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "CreateCluster", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._CreateCluster._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_create_cluster(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.create_cluster", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "CreateCluster", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _CreateNodePool(_BaseClusterManagerRestTransport._BaseCreateNodePool, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.CreateNodePool") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.CreateNodePoolRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the create node pool method over HTTP. + + Args: + request (~.cluster_service.CreateNodePoolRequest): + The request object. CreateNodePoolRequest creates a node + pool for a cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseCreateNodePool._get_http_options() + + request, metadata = self._interceptor.pre_create_node_pool(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseCreateNodePool._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseCreateNodePool._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseCreateNodePool._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.CreateNodePool", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "CreateNodePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._CreateNodePool._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_create_node_pool(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.create_node_pool", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "CreateNodePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _DeleteCluster(_BaseClusterManagerRestTransport._BaseDeleteCluster, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.DeleteCluster") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__(self, + request: cluster_service.DeleteClusterRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the delete cluster method over HTTP. + + Args: + request (~.cluster_service.DeleteClusterRequest): + The request object. DeleteClusterRequest deletes a + cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseDeleteCluster._get_http_options() + + request, metadata = self._interceptor.pre_delete_cluster(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseDeleteCluster._get_transcoded_request(http_options, request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseDeleteCluster._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.DeleteCluster", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "DeleteCluster", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._DeleteCluster._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_delete_cluster(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.delete_cluster", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "DeleteCluster", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _DeleteNodePool(_BaseClusterManagerRestTransport._BaseDeleteNodePool, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.DeleteNodePool") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__(self, + request: cluster_service.DeleteNodePoolRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the delete node pool method over HTTP. + + Args: + request (~.cluster_service.DeleteNodePoolRequest): + The request object. DeleteNodePoolRequest deletes a node + pool for a cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseDeleteNodePool._get_http_options() + + request, metadata = self._interceptor.pre_delete_node_pool(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseDeleteNodePool._get_transcoded_request(http_options, request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseDeleteNodePool._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.DeleteNodePool", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "DeleteNodePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._DeleteNodePool._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_delete_node_pool(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.delete_node_pool", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "DeleteNodePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _GetCluster(_BaseClusterManagerRestTransport._BaseGetCluster, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.GetCluster") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__(self, + request: cluster_service.GetClusterRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Cluster: + r"""Call the get cluster method over HTTP. + + Args: + request (~.cluster_service.GetClusterRequest): + The request object. GetClusterRequest gets the settings + of a cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Cluster: + A Google Kubernetes Engine cluster. + """ + + http_options = _BaseClusterManagerRestTransport._BaseGetCluster._get_http_options() + + request, metadata = self._interceptor.pre_get_cluster(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseGetCluster._get_transcoded_request(http_options, request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseGetCluster._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.GetCluster", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "GetCluster", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._GetCluster._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Cluster() + pb_resp = cluster_service.Cluster.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_get_cluster(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Cluster.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.get_cluster", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "GetCluster", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _GetJSONWebKeys(_BaseClusterManagerRestTransport._BaseGetJSONWebKeys, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.GetJSONWebKeys") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__(self, + request: cluster_service.GetJSONWebKeysRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.GetJSONWebKeysResponse: + r"""Call the get json web keys method over HTTP. + + Args: + request (~.cluster_service.GetJSONWebKeysRequest): + The request object. GetJSONWebKeysRequest gets the public component of the + keys used by the cluster to sign token requests. This + will be the jwks_uri for the discover document returned + by getOpenIDConfig. See the OpenID Connect Discovery 1.0 + specification for details. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.GetJSONWebKeysResponse: + GetJSONWebKeysResponse is a valid + JSON Web Key Set as specififed in rfc + 7517 + + """ + + http_options = _BaseClusterManagerRestTransport._BaseGetJSONWebKeys._get_http_options() + + request, metadata = self._interceptor.pre_get_json_web_keys(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseGetJSONWebKeys._get_transcoded_request(http_options, request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseGetJSONWebKeys._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.GetJSONWebKeys", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "GetJSONWebKeys", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._GetJSONWebKeys._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.GetJSONWebKeysResponse() + pb_resp = cluster_service.GetJSONWebKeysResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_get_json_web_keys(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.GetJSONWebKeysResponse.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.get_json_web_keys", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "GetJSONWebKeys", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _GetNodePool(_BaseClusterManagerRestTransport._BaseGetNodePool, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.GetNodePool") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__(self, + request: cluster_service.GetNodePoolRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.NodePool: + r"""Call the get node pool method over HTTP. + + Args: + request (~.cluster_service.GetNodePoolRequest): + The request object. GetNodePoolRequest retrieves a node + pool for a cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.NodePool: + NodePool contains the name and + configuration for a cluster's node pool. + Node pools are a set of nodes (i.e. + VM's), with a common configuration and + specification, under the control of the + cluster master. They may have a set of + Kubernetes labels applied to them, which + may be used to reference them during pod + scheduling. They may also be resized up + or down, to accommodate the workload. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseGetNodePool._get_http_options() + + request, metadata = self._interceptor.pre_get_node_pool(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseGetNodePool._get_transcoded_request(http_options, request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseGetNodePool._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.GetNodePool", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "GetNodePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._GetNodePool._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.NodePool() + pb_resp = cluster_service.NodePool.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_get_node_pool(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.NodePool.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.get_node_pool", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "GetNodePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _GetOperation(_BaseClusterManagerRestTransport._BaseGetOperation, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.GetOperation") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__(self, + request: cluster_service.GetOperationRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the get operation method over HTTP. + + Args: + request (~.cluster_service.GetOperationRequest): + The request object. GetOperationRequest gets a single + operation. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseGetOperation._get_http_options() + + request, metadata = self._interceptor.pre_get_operation(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseGetOperation._get_transcoded_request(http_options, request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseGetOperation._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.GetOperation", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._GetOperation._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_get_operation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.get_operation", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "GetOperation", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _GetServerConfig(_BaseClusterManagerRestTransport._BaseGetServerConfig, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.GetServerConfig") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__(self, + request: cluster_service.GetServerConfigRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.ServerConfig: + r"""Call the get server config method over HTTP. + + Args: + request (~.cluster_service.GetServerConfigRequest): + The request object. Gets the current Kubernetes Engine + service configuration. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.ServerConfig: + Kubernetes Engine service + configuration. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseGetServerConfig._get_http_options() + + request, metadata = self._interceptor.pre_get_server_config(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseGetServerConfig._get_transcoded_request(http_options, request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseGetServerConfig._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.GetServerConfig", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "GetServerConfig", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._GetServerConfig._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.ServerConfig() + pb_resp = cluster_service.ServerConfig.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_get_server_config(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.ServerConfig.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.get_server_config", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "GetServerConfig", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _ListClusters(_BaseClusterManagerRestTransport._BaseListClusters, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.ListClusters") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__(self, + request: cluster_service.ListClustersRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.ListClustersResponse: + r"""Call the list clusters method over HTTP. + + Args: + request (~.cluster_service.ListClustersRequest): + The request object. ListClustersRequest lists clusters. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.ListClustersResponse: + ListClustersResponse is the result of + ListClustersRequest. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseListClusters._get_http_options() + + request, metadata = self._interceptor.pre_list_clusters(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseListClusters._get_transcoded_request(http_options, request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseListClusters._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.ListClusters", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "ListClusters", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._ListClusters._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.ListClustersResponse() + pb_resp = cluster_service.ListClustersResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_list_clusters(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.ListClustersResponse.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.list_clusters", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "ListClusters", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _ListNodePools(_BaseClusterManagerRestTransport._BaseListNodePools, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.ListNodePools") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__(self, + request: cluster_service.ListNodePoolsRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.ListNodePoolsResponse: + r"""Call the list node pools method over HTTP. + + Args: + request (~.cluster_service.ListNodePoolsRequest): + The request object. ListNodePoolsRequest lists the node + pool(s) for a cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.ListNodePoolsResponse: + ListNodePoolsResponse is the result + of ListNodePoolsRequest. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseListNodePools._get_http_options() + + request, metadata = self._interceptor.pre_list_node_pools(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseListNodePools._get_transcoded_request(http_options, request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseListNodePools._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.ListNodePools", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "ListNodePools", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._ListNodePools._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.ListNodePoolsResponse() + pb_resp = cluster_service.ListNodePoolsResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_list_node_pools(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.ListNodePoolsResponse.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.list_node_pools", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "ListNodePools", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _ListOperations(_BaseClusterManagerRestTransport._BaseListOperations, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.ListOperations") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__(self, + request: cluster_service.ListOperationsRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.ListOperationsResponse: + r"""Call the list operations method over HTTP. + + Args: + request (~.cluster_service.ListOperationsRequest): + The request object. ListOperationsRequest lists + operations. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.ListOperationsResponse: + ListOperationsResponse is the result + of ListOperationsRequest. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseListOperations._get_http_options() + + request, metadata = self._interceptor.pre_list_operations(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseListOperations._get_transcoded_request(http_options, request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseListOperations._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.ListOperations", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._ListOperations._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.ListOperationsResponse() + pb_resp = cluster_service.ListOperationsResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_list_operations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.ListOperationsResponse.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.list_operations", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "ListOperations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _ListUsableSubnetworks(_BaseClusterManagerRestTransport._BaseListUsableSubnetworks, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.ListUsableSubnetworks") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + return response + + def __call__(self, + request: cluster_service.ListUsableSubnetworksRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.ListUsableSubnetworksResponse: + r"""Call the list usable subnetworks method over HTTP. + + Args: + request (~.cluster_service.ListUsableSubnetworksRequest): + The request object. ListUsableSubnetworksRequest requests + the list of usable subnetworks available + to a user for creating clusters. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.ListUsableSubnetworksResponse: + ListUsableSubnetworksResponse is the + response of + ListUsableSubnetworksRequest. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseListUsableSubnetworks._get_http_options() + + request, metadata = self._interceptor.pre_list_usable_subnetworks(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseListUsableSubnetworks._get_transcoded_request(http_options, request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseListUsableSubnetworks._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.ListUsableSubnetworks", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "ListUsableSubnetworks", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._ListUsableSubnetworks._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.ListUsableSubnetworksResponse() + pb_resp = cluster_service.ListUsableSubnetworksResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_list_usable_subnetworks(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.ListUsableSubnetworksResponse.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.list_usable_subnetworks", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "ListUsableSubnetworks", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _RollbackNodePoolUpgrade(_BaseClusterManagerRestTransport._BaseRollbackNodePoolUpgrade, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.RollbackNodePoolUpgrade") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.RollbackNodePoolUpgradeRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the rollback node pool + upgrade method over HTTP. + + Args: + request (~.cluster_service.RollbackNodePoolUpgradeRequest): + The request object. RollbackNodePoolUpgradeRequest + rollbacks the previously Aborted or + Failed NodePool upgrade. This will be an + no-op if the last upgrade successfully + completed. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseRollbackNodePoolUpgrade._get_http_options() + + request, metadata = self._interceptor.pre_rollback_node_pool_upgrade(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseRollbackNodePoolUpgrade._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseRollbackNodePoolUpgrade._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseRollbackNodePoolUpgrade._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.RollbackNodePoolUpgrade", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "RollbackNodePoolUpgrade", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._RollbackNodePoolUpgrade._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_rollback_node_pool_upgrade(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.rollback_node_pool_upgrade", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "RollbackNodePoolUpgrade", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _SetAddonsConfig(_BaseClusterManagerRestTransport._BaseSetAddonsConfig, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.SetAddonsConfig") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.SetAddonsConfigRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the set addons config method over HTTP. + + Args: + request (~.cluster_service.SetAddonsConfigRequest): + The request object. SetAddonsConfigRequest sets the + addons associated with the cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseSetAddonsConfig._get_http_options() + + request, metadata = self._interceptor.pre_set_addons_config(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseSetAddonsConfig._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseSetAddonsConfig._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseSetAddonsConfig._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.SetAddonsConfig", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetAddonsConfig", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._SetAddonsConfig._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_set_addons_config(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.set_addons_config", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetAddonsConfig", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _SetLabels(_BaseClusterManagerRestTransport._BaseSetLabels, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.SetLabels") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.SetLabelsRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the set labels method over HTTP. + + Args: + request (~.cluster_service.SetLabelsRequest): + The request object. SetLabelsRequest sets the Google + Cloud Platform labels on a Google + Container Engine cluster, which will in + turn set them for Google Compute Engine + resources used by that cluster + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseSetLabels._get_http_options() + + request, metadata = self._interceptor.pre_set_labels(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseSetLabels._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseSetLabels._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseSetLabels._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.SetLabels", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetLabels", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._SetLabels._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_set_labels(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.set_labels", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetLabels", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _SetLegacyAbac(_BaseClusterManagerRestTransport._BaseSetLegacyAbac, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.SetLegacyAbac") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.SetLegacyAbacRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the set legacy abac method over HTTP. + + Args: + request (~.cluster_service.SetLegacyAbacRequest): + The request object. SetLegacyAbacRequest enables or + disables the ABAC authorization + mechanism for a cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseSetLegacyAbac._get_http_options() + + request, metadata = self._interceptor.pre_set_legacy_abac(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseSetLegacyAbac._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseSetLegacyAbac._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseSetLegacyAbac._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.SetLegacyAbac", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetLegacyAbac", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._SetLegacyAbac._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_set_legacy_abac(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.set_legacy_abac", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetLegacyAbac", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _SetLocations(_BaseClusterManagerRestTransport._BaseSetLocations, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.SetLocations") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.SetLocationsRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the set locations method over HTTP. + + Args: + request (~.cluster_service.SetLocationsRequest): + The request object. SetLocationsRequest sets the + locations of the cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseSetLocations._get_http_options() + + request, metadata = self._interceptor.pre_set_locations(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseSetLocations._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseSetLocations._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseSetLocations._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.SetLocations", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._SetLocations._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_set_locations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.set_locations", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetLocations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _SetLoggingService(_BaseClusterManagerRestTransport._BaseSetLoggingService, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.SetLoggingService") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.SetLoggingServiceRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the set logging service method over HTTP. + + Args: + request (~.cluster_service.SetLoggingServiceRequest): + The request object. SetLoggingServiceRequest sets the + logging service of a cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseSetLoggingService._get_http_options() + + request, metadata = self._interceptor.pre_set_logging_service(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseSetLoggingService._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseSetLoggingService._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseSetLoggingService._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.SetLoggingService", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetLoggingService", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._SetLoggingService._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_set_logging_service(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.set_logging_service", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetLoggingService", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _SetMaintenancePolicy(_BaseClusterManagerRestTransport._BaseSetMaintenancePolicy, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.SetMaintenancePolicy") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.SetMaintenancePolicyRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the set maintenance policy method over HTTP. + + Args: + request (~.cluster_service.SetMaintenancePolicyRequest): + The request object. SetMaintenancePolicyRequest sets the + maintenance policy for a cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseSetMaintenancePolicy._get_http_options() + + request, metadata = self._interceptor.pre_set_maintenance_policy(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseSetMaintenancePolicy._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseSetMaintenancePolicy._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseSetMaintenancePolicy._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.SetMaintenancePolicy", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetMaintenancePolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._SetMaintenancePolicy._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_set_maintenance_policy(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.set_maintenance_policy", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetMaintenancePolicy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _SetMasterAuth(_BaseClusterManagerRestTransport._BaseSetMasterAuth, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.SetMasterAuth") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.SetMasterAuthRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the set master auth method over HTTP. + + Args: + request (~.cluster_service.SetMasterAuthRequest): + The request object. SetMasterAuthRequest updates the + admin password of a cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseSetMasterAuth._get_http_options() + + request, metadata = self._interceptor.pre_set_master_auth(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseSetMasterAuth._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseSetMasterAuth._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseSetMasterAuth._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.SetMasterAuth", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetMasterAuth", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._SetMasterAuth._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_set_master_auth(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.set_master_auth", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetMasterAuth", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _SetMonitoringService(_BaseClusterManagerRestTransport._BaseSetMonitoringService, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.SetMonitoringService") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.SetMonitoringServiceRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the set monitoring service method over HTTP. + + Args: + request (~.cluster_service.SetMonitoringServiceRequest): + The request object. SetMonitoringServiceRequest sets the + monitoring service of a cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseSetMonitoringService._get_http_options() + + request, metadata = self._interceptor.pre_set_monitoring_service(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseSetMonitoringService._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseSetMonitoringService._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseSetMonitoringService._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.SetMonitoringService", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetMonitoringService", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._SetMonitoringService._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_set_monitoring_service(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.set_monitoring_service", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetMonitoringService", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _SetNetworkPolicy(_BaseClusterManagerRestTransport._BaseSetNetworkPolicy, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.SetNetworkPolicy") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.SetNetworkPolicyRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the set network policy method over HTTP. + + Args: + request (~.cluster_service.SetNetworkPolicyRequest): + The request object. SetNetworkPolicyRequest + enables/disables network policy for a + cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseSetNetworkPolicy._get_http_options() + + request, metadata = self._interceptor.pre_set_network_policy(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseSetNetworkPolicy._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseSetNetworkPolicy._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseSetNetworkPolicy._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.SetNetworkPolicy", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetNetworkPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._SetNetworkPolicy._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_set_network_policy(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.set_network_policy", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetNetworkPolicy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _SetNodePoolAutoscaling(_BaseClusterManagerRestTransport._BaseSetNodePoolAutoscaling, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.SetNodePoolAutoscaling") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.SetNodePoolAutoscalingRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the set node pool autoscaling method over HTTP. + + Args: + request (~.cluster_service.SetNodePoolAutoscalingRequest): + The request object. SetNodePoolAutoscalingRequest sets + the autoscaler settings of a node pool. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseSetNodePoolAutoscaling._get_http_options() + + request, metadata = self._interceptor.pre_set_node_pool_autoscaling(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseSetNodePoolAutoscaling._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseSetNodePoolAutoscaling._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseSetNodePoolAutoscaling._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.SetNodePoolAutoscaling", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetNodePoolAutoscaling", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._SetNodePoolAutoscaling._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_set_node_pool_autoscaling(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.set_node_pool_autoscaling", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetNodePoolAutoscaling", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _SetNodePoolManagement(_BaseClusterManagerRestTransport._BaseSetNodePoolManagement, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.SetNodePoolManagement") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.SetNodePoolManagementRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the set node pool management method over HTTP. + + Args: + request (~.cluster_service.SetNodePoolManagementRequest): + The request object. SetNodePoolManagementRequest sets the + node management properties of a node + pool. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseSetNodePoolManagement._get_http_options() + + request, metadata = self._interceptor.pre_set_node_pool_management(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseSetNodePoolManagement._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseSetNodePoolManagement._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseSetNodePoolManagement._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.SetNodePoolManagement", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetNodePoolManagement", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._SetNodePoolManagement._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_set_node_pool_management(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.set_node_pool_management", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetNodePoolManagement", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _SetNodePoolSize(_BaseClusterManagerRestTransport._BaseSetNodePoolSize, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.SetNodePoolSize") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.SetNodePoolSizeRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the set node pool size method over HTTP. + + Args: + request (~.cluster_service.SetNodePoolSizeRequest): + The request object. SetNodePoolSizeRequest sets the size + of a node pool. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseSetNodePoolSize._get_http_options() + + request, metadata = self._interceptor.pre_set_node_pool_size(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseSetNodePoolSize._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseSetNodePoolSize._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseSetNodePoolSize._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.SetNodePoolSize", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetNodePoolSize", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._SetNodePoolSize._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_set_node_pool_size(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.set_node_pool_size", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "SetNodePoolSize", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _StartIPRotation(_BaseClusterManagerRestTransport._BaseStartIPRotation, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.StartIPRotation") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.StartIPRotationRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the start ip rotation method over HTTP. + + Args: + request (~.cluster_service.StartIPRotationRequest): + The request object. StartIPRotationRequest creates a new + IP for the cluster and then performs a + node upgrade on each node pool to point + to the new IP. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseStartIPRotation._get_http_options() + + request, metadata = self._interceptor.pre_start_ip_rotation(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseStartIPRotation._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseStartIPRotation._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseStartIPRotation._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.StartIPRotation", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "StartIPRotation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._StartIPRotation._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_start_ip_rotation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.start_ip_rotation", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "StartIPRotation", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _UpdateCluster(_BaseClusterManagerRestTransport._BaseUpdateCluster, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.UpdateCluster") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.UpdateClusterRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the update cluster method over HTTP. + + Args: + request (~.cluster_service.UpdateClusterRequest): + The request object. UpdateClusterRequest updates the + settings of a cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseUpdateCluster._get_http_options() + + request, metadata = self._interceptor.pre_update_cluster(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseUpdateCluster._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseUpdateCluster._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseUpdateCluster._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.UpdateCluster", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "UpdateCluster", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._UpdateCluster._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_update_cluster(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.update_cluster", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "UpdateCluster", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _UpdateMaster(_BaseClusterManagerRestTransport._BaseUpdateMaster, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.UpdateMaster") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.UpdateMasterRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the update master method over HTTP. + + Args: + request (~.cluster_service.UpdateMasterRequest): + The request object. UpdateMasterRequest updates the + master of the cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseUpdateMaster._get_http_options() + + request, metadata = self._interceptor.pre_update_master(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseUpdateMaster._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseUpdateMaster._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseUpdateMaster._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.UpdateMaster", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "UpdateMaster", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._UpdateMaster._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_update_master(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.update_master", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "UpdateMaster", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + class _UpdateNodePool(_BaseClusterManagerRestTransport._BaseUpdateNodePool, ClusterManagerRestStub): + def __hash__(self): + return hash("ClusterManagerRestTransport.UpdateNodePool") + + @staticmethod + def _get_response( + host, + metadata, + query_params, + session, + timeout, + transcoded_request, + body=None): + + uri = transcoded_request['uri'] + method = transcoded_request['method'] + headers = dict(metadata) + headers['Content-Type'] = 'application/json' + response = getattr(session, method)( + "{host}{uri}".format(host=host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + return response + + def __call__(self, + request: cluster_service.UpdateNodePoolRequest, *, + retry: OptionalRetry=gapic_v1.method.DEFAULT, + timeout: Optional[float]=None, + metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), + ) -> cluster_service.Operation: + r"""Call the update node pool method over HTTP. + + Args: + request (~.cluster_service.UpdateNodePoolRequest): + The request object. UpdateNodePoolRequests update a node + pool's image and/or version. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + ~.cluster_service.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + + http_options = _BaseClusterManagerRestTransport._BaseUpdateNodePool._get_http_options() + + request, metadata = self._interceptor.pre_update_node_pool(request, metadata) + transcoded_request = _BaseClusterManagerRestTransport._BaseUpdateNodePool._get_transcoded_request(http_options, request) + + body = _BaseClusterManagerRestTransport._BaseUpdateNodePool._get_request_body_json(transcoded_request) + + # Jsonify the query params + query_params = _BaseClusterManagerRestTransport._BaseUpdateNodePool._get_query_params_json(transcoded_request) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) + method = transcoded_request['method'] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.container_v1.ClusterManagerClient.UpdateNodePool", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "UpdateNodePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + + # Send the request + response = ClusterManagerRestTransport._UpdateNodePool._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = cluster_service.Operation() + pb_resp = cluster_service.Operation.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + + resp = self._interceptor.post_update_node_pool(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER + try: + response_payload = cluster_service.Operation.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.container_v1.ClusterManagerClient.update_node_pool", + extra = { + "serviceName": "google.container.v1.ClusterManager", + "rpcName": "UpdateNodePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp + + @property + def cancel_operation(self) -> Callable[ + [cluster_service.CancelOperationRequest], + empty_pb2.Empty]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CancelOperation(self._session, self._host, self._interceptor) # type: ignore + + @property + def check_autopilot_compatibility(self) -> Callable[ + [cluster_service.CheckAutopilotCompatibilityRequest], + cluster_service.CheckAutopilotCompatibilityResponse]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CheckAutopilotCompatibility(self._session, self._host, self._interceptor) # type: ignore + + @property + def complete_ip_rotation(self) -> Callable[ + [cluster_service.CompleteIPRotationRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CompleteIPRotation(self._session, self._host, self._interceptor) # type: ignore + + @property + def complete_node_pool_upgrade(self) -> Callable[ + [cluster_service.CompleteNodePoolUpgradeRequest], + empty_pb2.Empty]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CompleteNodePoolUpgrade(self._session, self._host, self._interceptor) # type: ignore + + @property + def create_cluster(self) -> Callable[ + [cluster_service.CreateClusterRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CreateCluster(self._session, self._host, self._interceptor) # type: ignore + + @property + def create_node_pool(self) -> Callable[ + [cluster_service.CreateNodePoolRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CreateNodePool(self._session, self._host, self._interceptor) # type: ignore + + @property + def delete_cluster(self) -> Callable[ + [cluster_service.DeleteClusterRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._DeleteCluster(self._session, self._host, self._interceptor) # type: ignore + + @property + def delete_node_pool(self) -> Callable[ + [cluster_service.DeleteNodePoolRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._DeleteNodePool(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_cluster(self) -> Callable[ + [cluster_service.GetClusterRequest], + cluster_service.Cluster]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetCluster(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_json_web_keys(self) -> Callable[ + [cluster_service.GetJSONWebKeysRequest], + cluster_service.GetJSONWebKeysResponse]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetJSONWebKeys(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_node_pool(self) -> Callable[ + [cluster_service.GetNodePoolRequest], + cluster_service.NodePool]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetNodePool(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_operation(self) -> Callable[ + [cluster_service.GetOperationRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetOperation(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_server_config(self) -> Callable[ + [cluster_service.GetServerConfigRequest], + cluster_service.ServerConfig]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetServerConfig(self._session, self._host, self._interceptor) # type: ignore + + @property + def list_clusters(self) -> Callable[ + [cluster_service.ListClustersRequest], + cluster_service.ListClustersResponse]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListClusters(self._session, self._host, self._interceptor) # type: ignore + + @property + def list_node_pools(self) -> Callable[ + [cluster_service.ListNodePoolsRequest], + cluster_service.ListNodePoolsResponse]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListNodePools(self._session, self._host, self._interceptor) # type: ignore + + @property + def list_operations(self) -> Callable[ + [cluster_service.ListOperationsRequest], + cluster_service.ListOperationsResponse]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListOperations(self._session, self._host, self._interceptor) # type: ignore + + @property + def list_usable_subnetworks(self) -> Callable[ + [cluster_service.ListUsableSubnetworksRequest], + cluster_service.ListUsableSubnetworksResponse]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListUsableSubnetworks(self._session, self._host, self._interceptor) # type: ignore + + @property + def rollback_node_pool_upgrade(self) -> Callable[ + [cluster_service.RollbackNodePoolUpgradeRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._RollbackNodePoolUpgrade(self._session, self._host, self._interceptor) # type: ignore + + @property + def set_addons_config(self) -> Callable[ + [cluster_service.SetAddonsConfigRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._SetAddonsConfig(self._session, self._host, self._interceptor) # type: ignore + + @property + def set_labels(self) -> Callable[ + [cluster_service.SetLabelsRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._SetLabels(self._session, self._host, self._interceptor) # type: ignore + + @property + def set_legacy_abac(self) -> Callable[ + [cluster_service.SetLegacyAbacRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._SetLegacyAbac(self._session, self._host, self._interceptor) # type: ignore + + @property + def set_locations(self) -> Callable[ + [cluster_service.SetLocationsRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._SetLocations(self._session, self._host, self._interceptor) # type: ignore + + @property + def set_logging_service(self) -> Callable[ + [cluster_service.SetLoggingServiceRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._SetLoggingService(self._session, self._host, self._interceptor) # type: ignore + + @property + def set_maintenance_policy(self) -> Callable[ + [cluster_service.SetMaintenancePolicyRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._SetMaintenancePolicy(self._session, self._host, self._interceptor) # type: ignore + + @property + def set_master_auth(self) -> Callable[ + [cluster_service.SetMasterAuthRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._SetMasterAuth(self._session, self._host, self._interceptor) # type: ignore + + @property + def set_monitoring_service(self) -> Callable[ + [cluster_service.SetMonitoringServiceRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._SetMonitoringService(self._session, self._host, self._interceptor) # type: ignore + + @property + def set_network_policy(self) -> Callable[ + [cluster_service.SetNetworkPolicyRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._SetNetworkPolicy(self._session, self._host, self._interceptor) # type: ignore + + @property + def set_node_pool_autoscaling(self) -> Callable[ + [cluster_service.SetNodePoolAutoscalingRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._SetNodePoolAutoscaling(self._session, self._host, self._interceptor) # type: ignore + + @property + def set_node_pool_management(self) -> Callable[ + [cluster_service.SetNodePoolManagementRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._SetNodePoolManagement(self._session, self._host, self._interceptor) # type: ignore + + @property + def set_node_pool_size(self) -> Callable[ + [cluster_service.SetNodePoolSizeRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._SetNodePoolSize(self._session, self._host, self._interceptor) # type: ignore + + @property + def start_ip_rotation(self) -> Callable[ + [cluster_service.StartIPRotationRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._StartIPRotation(self._session, self._host, self._interceptor) # type: ignore + + @property + def update_cluster(self) -> Callable[ + [cluster_service.UpdateClusterRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._UpdateCluster(self._session, self._host, self._interceptor) # type: ignore + + @property + def update_master(self) -> Callable[ + [cluster_service.UpdateMasterRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._UpdateMaster(self._session, self._host, self._interceptor) # type: ignore + + @property + def update_node_pool(self) -> Callable[ + [cluster_service.UpdateNodePoolRequest], + cluster_service.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._UpdateNodePool(self._session, self._host, self._interceptor) # type: ignore + + @property + def kind(self) -> str: + return "rest" + + def close(self): + self._session.close() + + +__all__=( + 'ClusterManagerRestTransport', +) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest_base.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest_base.py new file mode 100644 index 000000000000..4de83d8cbb75 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest_base.py @@ -0,0 +1,1575 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 json # type: ignore +from google.api_core import path_template +from google.api_core import gapic_v1 + +from google.protobuf import json_format +from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO + +import re +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union + + +from google.cloud.container_v1.types import cluster_service +from google.protobuf import empty_pb2 # type: ignore + + +class _BaseClusterManagerRestTransport(ClusterManagerTransport): + """Base REST backend transport for ClusterManager. + + Note: This class is not meant to be used directly. Use its sync and + async sub-classes instead. + + 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 JSON representations of protocol buffers over HTTP/1.1 + """ + + def __init__(self, *, + host: str = 'container.googleapis.com', + credentials: Optional[Any] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = 'https', + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + Args: + host (Optional[str]): + The hostname to connect to (default: 'container.googleapis.com'). + credentials (Optional[Any]): 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. + 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 are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError(f"Unexpected hostname structure: {host}") # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience + ) + + class _BaseCancelOperation: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/operations/{operation_id}:cancel', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.CancelOperationRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseCheckAutopilotCompatibility: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'get', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:checkAutopilotCompatibility', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.CheckAutopilotCompatibilityRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseCompleteIPRotation: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:completeIpRotation', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:completeIpRotation', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.CompleteIPRotationRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseCompleteNodePoolUpgrade: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:completeUpgrade', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.CompleteNodePoolUpgradeRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseCreateCluster: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{parent=projects/*/locations/*}/clusters', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.CreateClusterRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseCreateCluster._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseCreateNodePool: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{parent=projects/*/locations/*/clusters/*}/nodePools', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.CreateNodePoolRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseCreateNodePool._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseDeleteCluster: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'delete', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}', + }, + { + 'method': 'delete', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.DeleteClusterRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseDeleteNodePool: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'delete', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}', + }, + { + 'method': 'delete', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.DeleteNodePoolRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseGetCluster: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'get', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}', + }, + { + 'method': 'get', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.GetClusterRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseGetJSONWebKeys: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'get', + 'uri': '/v1/{parent=projects/*/locations/*/clusters/*}/jwks', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.GetJSONWebKeysRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseGetNodePool: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'get', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}', + }, + { + 'method': 'get', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.GetNodePoolRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseGetOperation: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'get', + 'uri': '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + 'method': 'get', + 'uri': '/v1/projects/{project_id}/zones/{zone}/operations/{operation_id}', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.GetOperationRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseGetServerConfig: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'get', + 'uri': '/v1/{name=projects/*/locations/*}/serverConfig', + }, + { + 'method': 'get', + 'uri': '/v1/projects/{project_id}/zones/{zone}/serverconfig', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.GetServerConfigRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseListClusters: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'get', + 'uri': '/v1/{parent=projects/*/locations/*}/clusters', + }, + { + 'method': 'get', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.ListClustersRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseListNodePools: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'get', + 'uri': '/v1/{parent=projects/*/locations/*/clusters/*}/nodePools', + }, + { + 'method': 'get', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.ListNodePoolsRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseListOperations: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'get', + 'uri': '/v1/{parent=projects/*/locations/*}/operations', + }, + { + 'method': 'get', + 'uri': '/v1/projects/{project_id}/zones/{zone}/operations', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.ListOperationsRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseListUsableSubnetworks: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'get', + 'uri': '/v1/{parent=projects/*}/aggregated/usableSubnetworks', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.ListUsableSubnetworksRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseRollbackNodePoolUpgrade: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:rollback', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}:rollback', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.RollbackNodePoolUpgradeRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseSetAddonsConfig: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setAddons', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/addons', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.SetAddonsConfigRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseSetAddonsConfig._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseSetLabels: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setResourceLabels', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/resourceLabels', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.SetLabelsRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseSetLabels._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseSetLegacyAbac: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setLegacyAbac', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/legacyAbac', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.SetLegacyAbacRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseSetLegacyAbac._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseSetLocations: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setLocations', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/locations', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.SetLocationsRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseSetLocations._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseSetLoggingService: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setLogging', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/logging', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.SetLoggingServiceRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseSetLoggingService._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseSetMaintenancePolicy: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setMaintenancePolicy', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMaintenancePolicy', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.SetMaintenancePolicyRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseSetMaintenancePolicy._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseSetMasterAuth: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setMasterAuth', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMasterAuth', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.SetMasterAuthRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseSetMasterAuth._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseSetMonitoringService: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setMonitoring', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/monitoring', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.SetMonitoringServiceRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseSetMonitoringService._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseSetNetworkPolicy: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setNetworkPolicy', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setNetworkPolicy', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.SetNetworkPolicyRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseSetNetworkPolicy._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseSetNodePoolAutoscaling: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setAutoscaling', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/autoscaling', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.SetNodePoolAutoscalingRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseSetNodePoolAutoscaling._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseSetNodePoolManagement: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setManagement', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setManagement', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.SetNodePoolManagementRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseSetNodePoolManagement._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseSetNodePoolSize: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setSize', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setSize', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.SetNodePoolSizeRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseSetNodePoolSize._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseStartIPRotation: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:startIpRotation', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:startIpRotation', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.StartIPRotationRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseUpdateCluster: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'put', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}', + 'body': '*', + }, + { + 'method': 'put', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.UpdateClusterRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseUpdateCluster._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseUpdateMaster: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'post', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:updateMaster', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/master', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.UpdateMasterRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseUpdateMaster._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + class _BaseUpdateNodePool: + def __hash__(self): # pragma: NO COVER + return NotImplementedError("__hash__ must be implemented.") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} + + @staticmethod + def _get_http_options(): + http_options: List[Dict[str, str]] = [{ + 'method': 'put', + 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}', + 'body': '*', + }, + { + 'method': 'post', + 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/update', + 'body': '*', + }, + ] + return http_options + + @staticmethod + def _get_transcoded_request(http_options, request): + pb_request = cluster_service.UpdateNodePoolRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + return transcoded_request + + @staticmethod + def _get_request_body_json(transcoded_request): + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request['body'], + use_integers_for_enums=True + ) + return body + @staticmethod + def _get_query_params_json(transcoded_request): + query_params = json.loads(json_format.MessageToJson( + transcoded_request['query_params'], + use_integers_for_enums=True, + )) + query_params.update(_BaseClusterManagerRestTransport._BaseUpdateNodePool._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + return query_params + + +__all__=( + '_BaseClusterManagerRestTransport', +) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/__init__.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/__init__.py new file mode 100644 index 000000000000..8478fdfc33d8 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/__init__.py @@ -0,0 +1,380 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 .cluster_service import ( + AcceleratorConfig, + AdditionalNodeNetworkConfig, + AdditionalPodNetworkConfig, + AdditionalPodRangesConfig, + AddonsConfig, + AdvancedDatapathObservabilityConfig, + AdvancedMachineFeatures, + AuthenticatorGroupsConfig, + Autopilot, + AutopilotCompatibilityIssue, + AutoprovisioningNodePoolDefaults, + AutoUpgradeOptions, + BestEffortProvisioning, + BinaryAuthorization, + BlueGreenSettings, + CancelOperationRequest, + CheckAutopilotCompatibilityRequest, + CheckAutopilotCompatibilityResponse, + ClientCertificateConfig, + CloudRunConfig, + Cluster, + ClusterAutoscaling, + ClusterUpdate, + CompleteIPRotationRequest, + CompleteNodePoolUpgradeRequest, + CompliancePostureConfig, + ConfidentialNodes, + ConfigConnectorConfig, + ContainerdConfig, + ControlPlaneEndpointsConfig, + CostManagementConfig, + CreateClusterRequest, + CreateNodePoolRequest, + DailyMaintenanceWindow, + DatabaseEncryption, + DefaultSnatStatus, + DeleteClusterRequest, + DeleteNodePoolRequest, + DesiredEnterpriseConfig, + DnsCacheConfig, + DNSConfig, + EnterpriseConfig, + EphemeralStorageLocalSsdConfig, + FastSocket, + Fleet, + GatewayAPIConfig, + GcePersistentDiskCsiDriverConfig, + GcfsConfig, + GcpFilestoreCsiDriverConfig, + GcsFuseCsiDriverConfig, + GetClusterRequest, + GetJSONWebKeysRequest, + GetJSONWebKeysResponse, + GetNodePoolRequest, + GetOpenIDConfigRequest, + GetOpenIDConfigResponse, + GetOperationRequest, + GetServerConfigRequest, + GkeBackupAgentConfig, + GPUDriverInstallationConfig, + GPUSharingConfig, + HorizontalPodAutoscaling, + HttpLoadBalancing, + IdentityServiceConfig, + ILBSubsettingConfig, + IntraNodeVisibilityConfig, + IPAllocationPolicy, + Jwk, + K8sBetaAPIConfig, + KubernetesDashboard, + LegacyAbac, + LinuxNodeConfig, + ListClustersRequest, + ListClustersResponse, + ListNodePoolsRequest, + ListNodePoolsResponse, + ListOperationsRequest, + ListOperationsResponse, + ListUsableSubnetworksRequest, + ListUsableSubnetworksResponse, + LocalNvmeSsdBlockConfig, + LoggingComponentConfig, + LoggingConfig, + LoggingVariantConfig, + MaintenanceExclusionOptions, + MaintenancePolicy, + MaintenanceWindow, + ManagedPrometheusConfig, + MasterAuth, + MasterAuthorizedNetworksConfig, + MaxPodsConstraint, + MeshCertificates, + MonitoringComponentConfig, + MonitoringConfig, + NetworkConfig, + NetworkPolicy, + NetworkPolicyConfig, + NetworkTags, + NodeConfig, + NodeConfigDefaults, + NodeKubeletConfig, + NodeLabels, + NodeManagement, + NodeNetworkConfig, + NodePool, + NodePoolAutoConfig, + NodePoolAutoscaling, + NodePoolDefaults, + NodePoolLoggingConfig, + NodeTaint, + NodeTaints, + NotificationConfig, + Operation, + OperationProgress, + ParallelstoreCsiDriverConfig, + PodCIDROverprovisionConfig, + PrivateClusterConfig, + PrivateClusterMasterGlobalAccessConfig, + RangeInfo, + RayClusterLoggingConfig, + RayClusterMonitoringConfig, + RayOperatorConfig, + RBACBindingConfig, + RecurringTimeWindow, + ReleaseChannel, + ReservationAffinity, + ResourceLabels, + ResourceLimit, + ResourceManagerTags, + ResourceUsageExportConfig, + RollbackNodePoolUpgradeRequest, + SandboxConfig, + SecondaryBootDisk, + SecondaryBootDiskUpdateStrategy, + SecretManagerConfig, + SecurityBulletinEvent, + SecurityPostureConfig, + ServerConfig, + ServiceExternalIPsConfig, + SetAddonsConfigRequest, + SetLabelsRequest, + SetLegacyAbacRequest, + SetLocationsRequest, + SetLoggingServiceRequest, + SetMaintenancePolicyRequest, + SetMasterAuthRequest, + SetMonitoringServiceRequest, + SetNetworkPolicyRequest, + SetNodePoolAutoscalingRequest, + SetNodePoolManagementRequest, + SetNodePoolSizeRequest, + ShieldedInstanceConfig, + ShieldedNodes, + SoleTenantConfig, + StartIPRotationRequest, + StatefulHAConfig, + StatusCondition, + TimeWindow, + UpdateClusterRequest, + UpdateMasterRequest, + UpdateNodePoolRequest, + UpgradeAvailableEvent, + UpgradeEvent, + UpgradeInfoEvent, + UsableSubnetwork, + UsableSubnetworkSecondaryRange, + UserManagedKeysConfig, + VerticalPodAutoscaling, + VirtualNIC, + WindowsNodeConfig, + WorkloadIdentityConfig, + WorkloadMetadataConfig, + WorkloadPolicyConfig, + DatapathProvider, + InTransitEncryptionConfig, + IPv6AccessType, + NodePoolUpdateStrategy, + PrivateIPv6GoogleAccess, + StackType, + UpgradeResourceType, +) + +__all__ = ( + 'AcceleratorConfig', + 'AdditionalNodeNetworkConfig', + 'AdditionalPodNetworkConfig', + 'AdditionalPodRangesConfig', + 'AddonsConfig', + 'AdvancedDatapathObservabilityConfig', + 'AdvancedMachineFeatures', + 'AuthenticatorGroupsConfig', + 'Autopilot', + 'AutopilotCompatibilityIssue', + 'AutoprovisioningNodePoolDefaults', + 'AutoUpgradeOptions', + 'BestEffortProvisioning', + 'BinaryAuthorization', + 'BlueGreenSettings', + 'CancelOperationRequest', + 'CheckAutopilotCompatibilityRequest', + 'CheckAutopilotCompatibilityResponse', + 'ClientCertificateConfig', + 'CloudRunConfig', + 'Cluster', + 'ClusterAutoscaling', + 'ClusterUpdate', + 'CompleteIPRotationRequest', + 'CompleteNodePoolUpgradeRequest', + 'CompliancePostureConfig', + 'ConfidentialNodes', + 'ConfigConnectorConfig', + 'ContainerdConfig', + 'ControlPlaneEndpointsConfig', + 'CostManagementConfig', + 'CreateClusterRequest', + 'CreateNodePoolRequest', + 'DailyMaintenanceWindow', + 'DatabaseEncryption', + 'DefaultSnatStatus', + 'DeleteClusterRequest', + 'DeleteNodePoolRequest', + 'DesiredEnterpriseConfig', + 'DnsCacheConfig', + 'DNSConfig', + 'EnterpriseConfig', + 'EphemeralStorageLocalSsdConfig', + 'FastSocket', + 'Fleet', + 'GatewayAPIConfig', + 'GcePersistentDiskCsiDriverConfig', + 'GcfsConfig', + 'GcpFilestoreCsiDriverConfig', + 'GcsFuseCsiDriverConfig', + 'GetClusterRequest', + 'GetJSONWebKeysRequest', + 'GetJSONWebKeysResponse', + 'GetNodePoolRequest', + 'GetOpenIDConfigRequest', + 'GetOpenIDConfigResponse', + 'GetOperationRequest', + 'GetServerConfigRequest', + 'GkeBackupAgentConfig', + 'GPUDriverInstallationConfig', + 'GPUSharingConfig', + 'HorizontalPodAutoscaling', + 'HttpLoadBalancing', + 'IdentityServiceConfig', + 'ILBSubsettingConfig', + 'IntraNodeVisibilityConfig', + 'IPAllocationPolicy', + 'Jwk', + 'K8sBetaAPIConfig', + 'KubernetesDashboard', + 'LegacyAbac', + 'LinuxNodeConfig', + 'ListClustersRequest', + 'ListClustersResponse', + 'ListNodePoolsRequest', + 'ListNodePoolsResponse', + 'ListOperationsRequest', + 'ListOperationsResponse', + 'ListUsableSubnetworksRequest', + 'ListUsableSubnetworksResponse', + 'LocalNvmeSsdBlockConfig', + 'LoggingComponentConfig', + 'LoggingConfig', + 'LoggingVariantConfig', + 'MaintenanceExclusionOptions', + 'MaintenancePolicy', + 'MaintenanceWindow', + 'ManagedPrometheusConfig', + 'MasterAuth', + 'MasterAuthorizedNetworksConfig', + 'MaxPodsConstraint', + 'MeshCertificates', + 'MonitoringComponentConfig', + 'MonitoringConfig', + 'NetworkConfig', + 'NetworkPolicy', + 'NetworkPolicyConfig', + 'NetworkTags', + 'NodeConfig', + 'NodeConfigDefaults', + 'NodeKubeletConfig', + 'NodeLabels', + 'NodeManagement', + 'NodeNetworkConfig', + 'NodePool', + 'NodePoolAutoConfig', + 'NodePoolAutoscaling', + 'NodePoolDefaults', + 'NodePoolLoggingConfig', + 'NodeTaint', + 'NodeTaints', + 'NotificationConfig', + 'Operation', + 'OperationProgress', + 'ParallelstoreCsiDriverConfig', + 'PodCIDROverprovisionConfig', + 'PrivateClusterConfig', + 'PrivateClusterMasterGlobalAccessConfig', + 'RangeInfo', + 'RayClusterLoggingConfig', + 'RayClusterMonitoringConfig', + 'RayOperatorConfig', + 'RBACBindingConfig', + 'RecurringTimeWindow', + 'ReleaseChannel', + 'ReservationAffinity', + 'ResourceLabels', + 'ResourceLimit', + 'ResourceManagerTags', + 'ResourceUsageExportConfig', + 'RollbackNodePoolUpgradeRequest', + 'SandboxConfig', + 'SecondaryBootDisk', + 'SecondaryBootDiskUpdateStrategy', + 'SecretManagerConfig', + 'SecurityBulletinEvent', + 'SecurityPostureConfig', + 'ServerConfig', + 'ServiceExternalIPsConfig', + 'SetAddonsConfigRequest', + 'SetLabelsRequest', + 'SetLegacyAbacRequest', + 'SetLocationsRequest', + 'SetLoggingServiceRequest', + 'SetMaintenancePolicyRequest', + 'SetMasterAuthRequest', + 'SetMonitoringServiceRequest', + 'SetNetworkPolicyRequest', + 'SetNodePoolAutoscalingRequest', + 'SetNodePoolManagementRequest', + 'SetNodePoolSizeRequest', + 'ShieldedInstanceConfig', + 'ShieldedNodes', + 'SoleTenantConfig', + 'StartIPRotationRequest', + 'StatefulHAConfig', + 'StatusCondition', + 'TimeWindow', + 'UpdateClusterRequest', + 'UpdateMasterRequest', + 'UpdateNodePoolRequest', + 'UpgradeAvailableEvent', + 'UpgradeEvent', + 'UpgradeInfoEvent', + 'UsableSubnetwork', + 'UsableSubnetworkSecondaryRange', + 'UserManagedKeysConfig', + 'VerticalPodAutoscaling', + 'VirtualNIC', + 'WindowsNodeConfig', + 'WorkloadIdentityConfig', + 'WorkloadMetadataConfig', + 'WorkloadPolicyConfig', + 'DatapathProvider', + 'InTransitEncryptionConfig', + 'IPv6AccessType', + 'NodePoolUpdateStrategy', + 'PrivateIPv6GoogleAccess', + 'StackType', + 'UpgradeResourceType', +) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/cluster_service.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/cluster_service.py new file mode 100644 index 000000000000..5f322137e8f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/cluster_service.py @@ -0,0 +1,10586 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 __future__ import annotations + +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 +from google.rpc import code_pb2 # type: ignore +from google.rpc import status_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.container.v1', + manifest={ + 'PrivateIPv6GoogleAccess', + 'UpgradeResourceType', + 'DatapathProvider', + 'NodePoolUpdateStrategy', + 'StackType', + 'IPv6AccessType', + 'InTransitEncryptionConfig', + 'LinuxNodeConfig', + 'WindowsNodeConfig', + 'NodeKubeletConfig', + 'NodeConfig', + 'AdvancedMachineFeatures', + 'NodeNetworkConfig', + 'AdditionalNodeNetworkConfig', + 'AdditionalPodNetworkConfig', + 'ShieldedInstanceConfig', + 'SandboxConfig', + 'GcfsConfig', + 'ReservationAffinity', + 'SoleTenantConfig', + 'ContainerdConfig', + 'NodeTaint', + 'NodeTaints', + 'NodeLabels', + 'ResourceLabels', + 'NetworkTags', + 'MasterAuth', + 'ClientCertificateConfig', + 'AddonsConfig', + 'HttpLoadBalancing', + 'HorizontalPodAutoscaling', + 'KubernetesDashboard', + 'NetworkPolicyConfig', + 'DnsCacheConfig', + 'PrivateClusterMasterGlobalAccessConfig', + 'PrivateClusterConfig', + 'AuthenticatorGroupsConfig', + 'CloudRunConfig', + 'ConfigConnectorConfig', + 'GcePersistentDiskCsiDriverConfig', + 'GcpFilestoreCsiDriverConfig', + 'GcsFuseCsiDriverConfig', + 'ParallelstoreCsiDriverConfig', + 'RayOperatorConfig', + 'GkeBackupAgentConfig', + 'StatefulHAConfig', + 'MasterAuthorizedNetworksConfig', + 'LegacyAbac', + 'NetworkPolicy', + 'BinaryAuthorization', + 'PodCIDROverprovisionConfig', + 'IPAllocationPolicy', + 'Cluster', + 'RBACBindingConfig', + 'UserManagedKeysConfig', + 'CompliancePostureConfig', + 'K8sBetaAPIConfig', + 'SecurityPostureConfig', + 'NodePoolAutoConfig', + 'NodePoolDefaults', + 'NodeConfigDefaults', + 'ClusterUpdate', + 'AdditionalPodRangesConfig', + 'RangeInfo', + 'DesiredEnterpriseConfig', + 'Operation', + 'OperationProgress', + 'CreateClusterRequest', + 'GetClusterRequest', + 'UpdateClusterRequest', + 'UpdateNodePoolRequest', + 'SetNodePoolAutoscalingRequest', + 'SetLoggingServiceRequest', + 'SetMonitoringServiceRequest', + 'SetAddonsConfigRequest', + 'SetLocationsRequest', + 'UpdateMasterRequest', + 'SetMasterAuthRequest', + 'DeleteClusterRequest', + 'ListClustersRequest', + 'ListClustersResponse', + 'GetOperationRequest', + 'ListOperationsRequest', + 'CancelOperationRequest', + 'ListOperationsResponse', + 'GetServerConfigRequest', + 'ServerConfig', + 'CreateNodePoolRequest', + 'DeleteNodePoolRequest', + 'ListNodePoolsRequest', + 'GetNodePoolRequest', + 'BlueGreenSettings', + 'NodePool', + 'NodeManagement', + 'BestEffortProvisioning', + 'AutoUpgradeOptions', + 'MaintenancePolicy', + 'MaintenanceWindow', + 'TimeWindow', + 'MaintenanceExclusionOptions', + 'RecurringTimeWindow', + 'DailyMaintenanceWindow', + 'SetNodePoolManagementRequest', + 'SetNodePoolSizeRequest', + 'CompleteNodePoolUpgradeRequest', + 'RollbackNodePoolUpgradeRequest', + 'ListNodePoolsResponse', + 'ClusterAutoscaling', + 'AutoprovisioningNodePoolDefaults', + 'ResourceLimit', + 'NodePoolAutoscaling', + 'SetLabelsRequest', + 'SetLegacyAbacRequest', + 'StartIPRotationRequest', + 'CompleteIPRotationRequest', + 'AcceleratorConfig', + 'GPUSharingConfig', + 'GPUDriverInstallationConfig', + 'WorkloadMetadataConfig', + 'SetNetworkPolicyRequest', + 'SetMaintenancePolicyRequest', + 'StatusCondition', + 'NetworkConfig', + 'GatewayAPIConfig', + 'ServiceExternalIPsConfig', + 'GetOpenIDConfigRequest', + 'GetOpenIDConfigResponse', + 'GetJSONWebKeysRequest', + 'Jwk', + 'GetJSONWebKeysResponse', + 'CheckAutopilotCompatibilityRequest', + 'AutopilotCompatibilityIssue', + 'CheckAutopilotCompatibilityResponse', + 'ReleaseChannel', + 'CostManagementConfig', + 'IntraNodeVisibilityConfig', + 'ILBSubsettingConfig', + 'DNSConfig', + 'MaxPodsConstraint', + 'WorkloadIdentityConfig', + 'IdentityServiceConfig', + 'MeshCertificates', + 'DatabaseEncryption', + 'ListUsableSubnetworksRequest', + 'ListUsableSubnetworksResponse', + 'UsableSubnetworkSecondaryRange', + 'UsableSubnetwork', + 'ResourceUsageExportConfig', + 'VerticalPodAutoscaling', + 'DefaultSnatStatus', + 'ShieldedNodes', + 'VirtualNIC', + 'FastSocket', + 'NotificationConfig', + 'ConfidentialNodes', + 'UpgradeEvent', + 'UpgradeInfoEvent', + 'UpgradeAvailableEvent', + 'SecurityBulletinEvent', + 'Autopilot', + 'WorkloadPolicyConfig', + 'LoggingConfig', + 'LoggingComponentConfig', + 'RayClusterLoggingConfig', + 'MonitoringConfig', + 'AdvancedDatapathObservabilityConfig', + 'RayClusterMonitoringConfig', + 'NodePoolLoggingConfig', + 'LoggingVariantConfig', + 'MonitoringComponentConfig', + 'ManagedPrometheusConfig', + 'Fleet', + 'ControlPlaneEndpointsConfig', + 'LocalNvmeSsdBlockConfig', + 'EphemeralStorageLocalSsdConfig', + 'ResourceManagerTags', + 'EnterpriseConfig', + 'SecretManagerConfig', + 'SecondaryBootDisk', + 'SecondaryBootDiskUpdateStrategy', + }, +) + + +class PrivateIPv6GoogleAccess(proto.Enum): + r"""PrivateIPv6GoogleAccess controls whether and how the pods can + communicate with Google Services through gRPC over IPv6. + + Values: + PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED (0): + Default value. Same as DISABLED + PRIVATE_IPV6_GOOGLE_ACCESS_DISABLED (1): + No private access to or from Google Services + PRIVATE_IPV6_GOOGLE_ACCESS_TO_GOOGLE (2): + Enables private IPv6 access to Google + Services from GKE + PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL (3): + Enables private IPv6 access to and from + Google Services + """ + PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED = 0 + PRIVATE_IPV6_GOOGLE_ACCESS_DISABLED = 1 + PRIVATE_IPV6_GOOGLE_ACCESS_TO_GOOGLE = 2 + PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL = 3 + + +class UpgradeResourceType(proto.Enum): + r"""UpgradeResourceType is the resource type that is upgrading. + It is used in upgrade notifications. + + Values: + UPGRADE_RESOURCE_TYPE_UNSPECIFIED (0): + Default value. This shouldn't be used. + MASTER (1): + Master / control plane + NODE_POOL (2): + Node pool + """ + UPGRADE_RESOURCE_TYPE_UNSPECIFIED = 0 + MASTER = 1 + NODE_POOL = 2 + + +class DatapathProvider(proto.Enum): + r"""The datapath provider selects the implementation of the + Kubernetes networking model for service resolution and network + policy enforcement. + + Values: + DATAPATH_PROVIDER_UNSPECIFIED (0): + Default value. + LEGACY_DATAPATH (1): + Use the IPTables implementation based on + kube-proxy. + ADVANCED_DATAPATH (2): + Use the eBPF based GKE Dataplane V2 with additional + features. See the `GKE Dataplane V2 + documentation `__ + for more. + """ + DATAPATH_PROVIDER_UNSPECIFIED = 0 + LEGACY_DATAPATH = 1 + ADVANCED_DATAPATH = 2 + + +class NodePoolUpdateStrategy(proto.Enum): + r"""Strategy used for node pool update. + + Values: + NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED (0): + Default value if unset. GKE internally + defaults the update strategy to SURGE for + unspecified strategies. + BLUE_GREEN (2): + blue-green upgrade. + SURGE (3): + SURGE is the traditional way of upgrade a node pool. + max_surge and max_unavailable determines the level of + upgrade parallelism. + """ + NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED = 0 + BLUE_GREEN = 2 + SURGE = 3 + + +class StackType(proto.Enum): + r"""Possible values for IP stack type + + Values: + STACK_TYPE_UNSPECIFIED (0): + Default value, will be defaulted as IPV4 only + IPV4 (1): + Cluster is IPV4 only + IPV4_IPV6 (2): + Cluster can use both IPv4 and IPv6 + """ + STACK_TYPE_UNSPECIFIED = 0 + IPV4 = 1 + IPV4_IPV6 = 2 + + +class IPv6AccessType(proto.Enum): + r"""Possible values for IPv6 access type + + Values: + IPV6_ACCESS_TYPE_UNSPECIFIED (0): + Default value, will be defaulted as type + external. + INTERNAL (1): + Access type internal (all v6 addresses are + internal IPs) + EXTERNAL (2): + Access type external (all v6 addresses are + external IPs) + """ + IPV6_ACCESS_TYPE_UNSPECIFIED = 0 + INTERNAL = 1 + EXTERNAL = 2 + + +class InTransitEncryptionConfig(proto.Enum): + r"""Options for in-transit encryption. + + Values: + IN_TRANSIT_ENCRYPTION_CONFIG_UNSPECIFIED (0): + Unspecified, will be inferred as default - + IN_TRANSIT_ENCRYPTION_UNSPECIFIED. + IN_TRANSIT_ENCRYPTION_DISABLED (1): + In-transit encryption is disabled. + IN_TRANSIT_ENCRYPTION_INTER_NODE_TRANSPARENT (2): + Data in-transit is encrypted using inter-node + transparent encryption. + """ + IN_TRANSIT_ENCRYPTION_CONFIG_UNSPECIFIED = 0 + IN_TRANSIT_ENCRYPTION_DISABLED = 1 + IN_TRANSIT_ENCRYPTION_INTER_NODE_TRANSPARENT = 2 + + +class LinuxNodeConfig(proto.Message): + r"""Parameters that can be configured on Linux nodes. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + sysctls (MutableMapping[str, str]): + The Linux kernel parameters to be applied to the nodes and + all pods running on the nodes. + + The following parameters are supported. + + net.core.busy_poll net.core.busy_read + net.core.netdev_max_backlog net.core.rmem_max + net.core.wmem_default net.core.wmem_max net.core.optmem_max + net.core.somaxconn net.ipv4.tcp_rmem net.ipv4.tcp_wmem + net.ipv4.tcp_tw_reuse kernel.shmmni kernel.shmmax + kernel.shmall + cgroup_mode (google.cloud.container_v1.types.LinuxNodeConfig.CgroupMode): + cgroup_mode specifies the cgroup mode to be used on the + node. + hugepages (google.cloud.container_v1.types.LinuxNodeConfig.HugepagesConfig): + Optional. Amounts for 2M and 1G hugepages + + This field is a member of `oneof`_ ``_hugepages``. + """ + class CgroupMode(proto.Enum): + r"""Possible cgroup modes that can be used. + + Values: + CGROUP_MODE_UNSPECIFIED (0): + CGROUP_MODE_UNSPECIFIED is when unspecified cgroup + configuration is used. The default for the GKE node OS image + will be used. + CGROUP_MODE_V1 (1): + CGROUP_MODE_V1 specifies to use cgroupv1 for the cgroup + configuration on the node image. + CGROUP_MODE_V2 (2): + CGROUP_MODE_V2 specifies to use cgroupv2 for the cgroup + configuration on the node image. + """ + CGROUP_MODE_UNSPECIFIED = 0 + CGROUP_MODE_V1 = 1 + CGROUP_MODE_V2 = 2 + + class HugepagesConfig(proto.Message): + r"""Hugepages amount in both 2m and 1g size + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + hugepage_size2m (int): + Optional. Amount of 2M hugepages + + This field is a member of `oneof`_ ``_hugepage_size2m``. + hugepage_size1g (int): + Optional. Amount of 1G hugepages + + This field is a member of `oneof`_ ``_hugepage_size1g``. + """ + + hugepage_size2m: int = proto.Field( + proto.INT32, + number=1, + optional=True, + ) + hugepage_size1g: int = proto.Field( + proto.INT32, + number=2, + optional=True, + ) + + sysctls: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=1, + ) + cgroup_mode: CgroupMode = proto.Field( + proto.ENUM, + number=2, + enum=CgroupMode, + ) + hugepages: HugepagesConfig = proto.Field( + proto.MESSAGE, + number=3, + optional=True, + message=HugepagesConfig, + ) + + +class WindowsNodeConfig(proto.Message): + r"""Parameters that can be configured on Windows nodes. + Windows Node Config that define the parameters that will be used + to configure the Windows node pool settings + + Attributes: + os_version (google.cloud.container_v1.types.WindowsNodeConfig.OSVersion): + OSVersion specifies the Windows node config + to be used on the node + """ + class OSVersion(proto.Enum): + r"""Possible OS version that can be used. + + Values: + OS_VERSION_UNSPECIFIED (0): + When OSVersion is not specified + OS_VERSION_LTSC2019 (1): + LTSC2019 specifies to use LTSC2019 as the + Windows Servercore Base Image + OS_VERSION_LTSC2022 (2): + LTSC2022 specifies to use LTSC2022 as the + Windows Servercore Base Image + """ + OS_VERSION_UNSPECIFIED = 0 + OS_VERSION_LTSC2019 = 1 + OS_VERSION_LTSC2022 = 2 + + os_version: OSVersion = proto.Field( + proto.ENUM, + number=1, + enum=OSVersion, + ) + + +class NodeKubeletConfig(proto.Message): + r"""Node kubelet configs. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + cpu_manager_policy (str): + Control the CPU management policy on the node. See + https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/ + + The following values are allowed. + + - "none": the default, which represents the existing + scheduling behavior. + - "static": allows pods with certain resource + characteristics to be granted increased CPU affinity and + exclusivity on the node. The default value is 'none' if + unspecified. + cpu_cfs_quota (google.protobuf.wrappers_pb2.BoolValue): + Enable CPU CFS quota enforcement for + containers that specify CPU limits. + This option is enabled by default which makes + kubelet use CFS quota + (https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt) + to enforce container CPU limits. Otherwise, CPU + limits will not be enforced at all. + + Disable this option to mitigate CPU throttling + problems while still having your pods to be in + Guaranteed QoS class by specifying the CPU + limits. + + The default value is 'true' if unspecified. + cpu_cfs_quota_period (str): + Set the CPU CFS quota period value 'cpu.cfs_period_us'. + + The string must be a sequence of decimal numbers, each with + optional fraction and a unit suffix, such as "300ms". Valid + time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". + The value must be a positive duration. + pod_pids_limit (int): + Set the Pod PID limits. See + https://kubernetes.io/docs/concepts/policy/pid-limiting/#pod-pid-limits + + Controls the maximum number of processes allowed + to run in a pod. The value must be greater than + or equal to 1024 and less than 4194304. + insecure_kubelet_readonly_port_enabled (bool): + Enable or disable Kubelet read only port. + + This field is a member of `oneof`_ ``_insecure_kubelet_readonly_port_enabled``. + """ + + cpu_manager_policy: str = proto.Field( + proto.STRING, + number=1, + ) + cpu_cfs_quota: wrappers_pb2.BoolValue = proto.Field( + proto.MESSAGE, + number=2, + message=wrappers_pb2.BoolValue, + ) + cpu_cfs_quota_period: str = proto.Field( + proto.STRING, + number=3, + ) + pod_pids_limit: int = proto.Field( + proto.INT64, + number=4, + ) + insecure_kubelet_readonly_port_enabled: bool = proto.Field( + proto.BOOL, + number=7, + optional=True, + ) + + +class NodeConfig(proto.Message): + r"""Parameters that describe the nodes in a cluster. + + GKE Autopilot clusters do not recognize parameters in + ``NodeConfig``. Use + [AutoprovisioningNodePoolDefaults][google.container.v1.AutoprovisioningNodePoolDefaults] + instead. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + machine_type (str): + The name of a Google Compute Engine `machine + type `__ + + If unspecified, the default machine type is ``e2-medium``. + disk_size_gb (int): + Size of the disk attached to each node, + specified in GB. The smallest allowed disk size + is 10GB. + + If unspecified, the default disk size is 100GB. + oauth_scopes (MutableSequence[str]): + The set of Google API scopes to be made available on all of + the node VMs under the "default" service account. + + The following scopes are recommended, but not required, and + by default are not included: + + - ``https://www.googleapis.com/auth/compute`` is required + for mounting persistent storage on your nodes. + - ``https://www.googleapis.com/auth/devstorage.read_only`` + is required for communicating with **gcr.io** (the + `Google Container + Registry `__). + + If unspecified, no scopes are added, unless Cloud Logging or + Cloud Monitoring are enabled, in which case their required + scopes will be added. + service_account (str): + The Google Cloud Platform Service Account to + be used by the node VMs. Specify the email + address of the Service Account; otherwise, if no + Service Account is specified, the "default" + service account is used. + metadata (MutableMapping[str, str]): + The metadata key/value pairs assigned to instances in the + cluster. + + Keys must conform to the regexp ``[a-zA-Z0-9-_]+`` and be + less than 128 bytes in length. These are reflected as part + of a URL in the metadata server. Additionally, to avoid + ambiguity, keys must not conflict with any other metadata + keys for the project or be one of the reserved keys: + + - "cluster-location" + - "cluster-name" + - "cluster-uid" + - "configure-sh" + - "containerd-configure-sh" + - "enable-os-login" + - "gci-ensure-gke-docker" + - "gci-metrics-enabled" + - "gci-update-strategy" + - "instance-template" + - "kube-env" + - "startup-script" + - "user-data" + - "disable-address-manager" + - "windows-startup-script-ps1" + - "common-psm1" + - "k8s-node-setup-psm1" + - "install-ssh-psm1" + - "user-profile-psm1" + + Values are free-form strings, and only have meaning as + interpreted by the image running in the instance. The only + restriction placed on them is that each value's size must be + less than or equal to 32 KB. + + The total size of all keys and values must be less than 512 + KB. + image_type (str): + The image type to use for this node. Note + that for a given image type, the latest version + of it will be used. Please see + https://cloud.google.com/kubernetes-engine/docs/concepts/node-images + for available image types. + labels (MutableMapping[str, str]): + The map of Kubernetes labels (key/value + pairs) to be applied to each node. These will + added in addition to any default label(s) that + Kubernetes may apply to the node. + In case of conflict in label keys, the applied + set may differ depending on the Kubernetes + version -- it's best to assume the behavior is + undefined and conflicts should be avoided. + For more information, including usage and the + valid values, see: + + https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + local_ssd_count (int): + The number of local SSD disks to be attached + to the node. + The limit for this value is dependent upon the + maximum number of disks available on a machine + per zone. See: + + https://cloud.google.com/compute/docs/disks/local-ssd + for more information. + tags (MutableSequence[str]): + The list of instance tags applied to all + nodes. Tags are used to identify valid sources + or targets for network firewalls and are + specified by the client during cluster or node + pool creation. Each tag within the list must + comply with RFC1035. + preemptible (bool): + Whether the nodes are created as preemptible + VM instances. See: + https://cloud.google.com/compute/docs/instances/preemptible + for more information about preemptible VM + instances. + accelerators (MutableSequence[google.cloud.container_v1.types.AcceleratorConfig]): + A list of hardware accelerators to be + attached to each node. See + https://cloud.google.com/compute/docs/gpus for + more information about support for GPUs. + disk_type (str): + Type of the disk attached to each node (e.g. + 'pd-standard', 'pd-ssd' or 'pd-balanced') + + If unspecified, the default disk type is + 'pd-standard' + min_cpu_platform (str): + Minimum CPU platform to be used by this instance. The + instance may be scheduled on the specified or newer CPU + platform. Applicable values are the friendly names of CPU + platforms, such as ``minCpuPlatform: "Intel Haswell"`` or + ``minCpuPlatform: "Intel Sandy Bridge"``. For more + information, read `how to specify min CPU + platform `__ + workload_metadata_config (google.cloud.container_v1.types.WorkloadMetadataConfig): + The workload metadata configuration for this + node. + taints (MutableSequence[google.cloud.container_v1.types.NodeTaint]): + List of kubernetes taints to be applied to + each node. + For more information, including usage and the + valid values, see: + + https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + sandbox_config (google.cloud.container_v1.types.SandboxConfig): + Sandbox configuration for this node. + node_group (str): + Setting this field will assign instances of this pool to run + on the specified node group. This is useful for running + workloads on `sole tenant + nodes `__. + reservation_affinity (google.cloud.container_v1.types.ReservationAffinity): + The optional reservation affinity. Setting this field will + apply the specified `Zonal Compute + Reservation `__ + to this node pool. + shielded_instance_config (google.cloud.container_v1.types.ShieldedInstanceConfig): + Shielded Instance options. + linux_node_config (google.cloud.container_v1.types.LinuxNodeConfig): + Parameters that can be configured on Linux + nodes. + kubelet_config (google.cloud.container_v1.types.NodeKubeletConfig): + Node kubelet configs. + boot_disk_kms_key (str): + The Customer Managed Encryption Key used to encrypt the boot + disk attached to each node in the node pool. This should be + of the form + projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. + For more information about protecting resources with Cloud + KMS Keys please see: + https://cloud.google.com/compute/docs/disks/customer-managed-encryption + gcfs_config (google.cloud.container_v1.types.GcfsConfig): + Google Container File System (image + streaming) configs. + advanced_machine_features (google.cloud.container_v1.types.AdvancedMachineFeatures): + Advanced features for the Compute Engine VM. + gvnic (google.cloud.container_v1.types.VirtualNIC): + Enable or disable gvnic in the node pool. + spot (bool): + Spot flag for enabling Spot VM, which is a + rebrand of the existing preemptible flag. + confidential_nodes (google.cloud.container_v1.types.ConfidentialNodes): + Confidential nodes config. + All the nodes in the node pool will be + Confidential VM once enabled. + fast_socket (google.cloud.container_v1.types.FastSocket): + Enable or disable NCCL fast socket for the + node pool. + + This field is a member of `oneof`_ ``_fast_socket``. + resource_labels (MutableMapping[str, str]): + The resource labels for the node pool to use + to annotate any related Google Compute Engine + resources. + logging_config (google.cloud.container_v1.types.NodePoolLoggingConfig): + Logging configuration. + windows_node_config (google.cloud.container_v1.types.WindowsNodeConfig): + Parameters that can be configured on Windows + nodes. + local_nvme_ssd_block_config (google.cloud.container_v1.types.LocalNvmeSsdBlockConfig): + Parameters for using raw-block Local NVMe + SSDs. + ephemeral_storage_local_ssd_config (google.cloud.container_v1.types.EphemeralStorageLocalSsdConfig): + Parameters for the node ephemeral storage + using Local SSDs. If unspecified, ephemeral + storage is backed by the boot disk. + sole_tenant_config (google.cloud.container_v1.types.SoleTenantConfig): + Parameters for node pools to be backed by + shared sole tenant node groups. + containerd_config (google.cloud.container_v1.types.ContainerdConfig): + Parameters for containerd customization. + resource_manager_tags (google.cloud.container_v1.types.ResourceManagerTags): + A map of resource manager tag keys and values + to be attached to the nodes. + enable_confidential_storage (bool): + Optional. Reserved for future use. + secondary_boot_disks (MutableSequence[google.cloud.container_v1.types.SecondaryBootDisk]): + List of secondary boot disks attached to the + nodes. + storage_pools (MutableSequence[str]): + List of Storage Pools where boot disks are + provisioned. + secondary_boot_disk_update_strategy (google.cloud.container_v1.types.SecondaryBootDiskUpdateStrategy): + Secondary boot disk update strategy. + + This field is a member of `oneof`_ ``_secondary_boot_disk_update_strategy``. + local_ssd_encryption_mode (google.cloud.container_v1.types.NodeConfig.LocalSsdEncryptionMode): + Specifies which method should be used for + encrypting the Local SSDs attahced to the node. + + This field is a member of `oneof`_ ``_local_ssd_encryption_mode``. + effective_cgroup_mode (google.cloud.container_v1.types.NodeConfig.EffectiveCgroupMode): + Output only. effective_cgroup_mode is the cgroup mode + actually used by the node pool. It is determined by the + cgroup mode specified in the LinuxNodeConfig or the default + cgroup mode based on the cluster creation version. + """ + class LocalSsdEncryptionMode(proto.Enum): + r"""LocalSsdEncryptionMode specifies the method used for + encrypting the Local SSDs attached to the node. + + Values: + LOCAL_SSD_ENCRYPTION_MODE_UNSPECIFIED (0): + The given node will be encrypted using keys + managed by Google infrastructure and the keys + will be deleted when the node is deleted. + STANDARD_ENCRYPTION (1): + The given node will be encrypted using keys + managed by Google infrastructure and the keys + will be deleted when the node is deleted. + EPHEMERAL_KEY_ENCRYPTION (2): + The given node will opt-in for using + ephemeral key for encryption of Local SSDs. + The Local SSDs will not be able to recover data + in case of node crash. + """ + LOCAL_SSD_ENCRYPTION_MODE_UNSPECIFIED = 0 + STANDARD_ENCRYPTION = 1 + EPHEMERAL_KEY_ENCRYPTION = 2 + + class EffectiveCgroupMode(proto.Enum): + r"""Possible effective cgroup modes for the node. + + Values: + EFFECTIVE_CGROUP_MODE_UNSPECIFIED (0): + EFFECTIVE_CGROUP_MODE_UNSPECIFIED means the cgroup + configuration for the node pool is unspecified, i.e. the + node pool is a Windows node pool. + EFFECTIVE_CGROUP_MODE_V1 (1): + CGROUP_MODE_V1 means the node pool is configured to use + cgroupv1 for the cgroup configuration. + EFFECTIVE_CGROUP_MODE_V2 (2): + CGROUP_MODE_V2 means the node pool is configured to use + cgroupv2 for the cgroup configuration. + """ + EFFECTIVE_CGROUP_MODE_UNSPECIFIED = 0 + EFFECTIVE_CGROUP_MODE_V1 = 1 + EFFECTIVE_CGROUP_MODE_V2 = 2 + + machine_type: str = proto.Field( + proto.STRING, + number=1, + ) + disk_size_gb: int = proto.Field( + proto.INT32, + number=2, + ) + oauth_scopes: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + service_account: str = proto.Field( + proto.STRING, + number=9, + ) + metadata: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + image_type: str = proto.Field( + proto.STRING, + number=5, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=6, + ) + local_ssd_count: int = proto.Field( + proto.INT32, + number=7, + ) + tags: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=8, + ) + preemptible: bool = proto.Field( + proto.BOOL, + number=10, + ) + accelerators: MutableSequence['AcceleratorConfig'] = proto.RepeatedField( + proto.MESSAGE, + number=11, + message='AcceleratorConfig', + ) + disk_type: str = proto.Field( + proto.STRING, + number=12, + ) + min_cpu_platform: str = proto.Field( + proto.STRING, + number=13, + ) + workload_metadata_config: 'WorkloadMetadataConfig' = proto.Field( + proto.MESSAGE, + number=14, + message='WorkloadMetadataConfig', + ) + taints: MutableSequence['NodeTaint'] = proto.RepeatedField( + proto.MESSAGE, + number=15, + message='NodeTaint', + ) + sandbox_config: 'SandboxConfig' = proto.Field( + proto.MESSAGE, + number=17, + message='SandboxConfig', + ) + node_group: str = proto.Field( + proto.STRING, + number=18, + ) + reservation_affinity: 'ReservationAffinity' = proto.Field( + proto.MESSAGE, + number=19, + message='ReservationAffinity', + ) + shielded_instance_config: 'ShieldedInstanceConfig' = proto.Field( + proto.MESSAGE, + number=20, + message='ShieldedInstanceConfig', + ) + linux_node_config: 'LinuxNodeConfig' = proto.Field( + proto.MESSAGE, + number=21, + message='LinuxNodeConfig', + ) + kubelet_config: 'NodeKubeletConfig' = proto.Field( + proto.MESSAGE, + number=22, + message='NodeKubeletConfig', + ) + boot_disk_kms_key: str = proto.Field( + proto.STRING, + number=23, + ) + gcfs_config: 'GcfsConfig' = proto.Field( + proto.MESSAGE, + number=25, + message='GcfsConfig', + ) + advanced_machine_features: 'AdvancedMachineFeatures' = proto.Field( + proto.MESSAGE, + number=26, + message='AdvancedMachineFeatures', + ) + gvnic: 'VirtualNIC' = proto.Field( + proto.MESSAGE, + number=29, + message='VirtualNIC', + ) + spot: bool = proto.Field( + proto.BOOL, + number=32, + ) + confidential_nodes: 'ConfidentialNodes' = proto.Field( + proto.MESSAGE, + number=35, + message='ConfidentialNodes', + ) + fast_socket: 'FastSocket' = proto.Field( + proto.MESSAGE, + number=36, + optional=True, + message='FastSocket', + ) + resource_labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=37, + ) + logging_config: 'NodePoolLoggingConfig' = proto.Field( + proto.MESSAGE, + number=38, + message='NodePoolLoggingConfig', + ) + windows_node_config: 'WindowsNodeConfig' = proto.Field( + proto.MESSAGE, + number=39, + message='WindowsNodeConfig', + ) + local_nvme_ssd_block_config: 'LocalNvmeSsdBlockConfig' = proto.Field( + proto.MESSAGE, + number=40, + message='LocalNvmeSsdBlockConfig', + ) + ephemeral_storage_local_ssd_config: 'EphemeralStorageLocalSsdConfig' = proto.Field( + proto.MESSAGE, + number=41, + message='EphemeralStorageLocalSsdConfig', + ) + sole_tenant_config: 'SoleTenantConfig' = proto.Field( + proto.MESSAGE, + number=42, + message='SoleTenantConfig', + ) + containerd_config: 'ContainerdConfig' = proto.Field( + proto.MESSAGE, + number=43, + message='ContainerdConfig', + ) + resource_manager_tags: 'ResourceManagerTags' = proto.Field( + proto.MESSAGE, + number=45, + message='ResourceManagerTags', + ) + enable_confidential_storage: bool = proto.Field( + proto.BOOL, + number=46, + ) + secondary_boot_disks: MutableSequence['SecondaryBootDisk'] = proto.RepeatedField( + proto.MESSAGE, + number=48, + message='SecondaryBootDisk', + ) + storage_pools: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=49, + ) + secondary_boot_disk_update_strategy: 'SecondaryBootDiskUpdateStrategy' = proto.Field( + proto.MESSAGE, + number=50, + optional=True, + message='SecondaryBootDiskUpdateStrategy', + ) + local_ssd_encryption_mode: LocalSsdEncryptionMode = proto.Field( + proto.ENUM, + number=54, + optional=True, + enum=LocalSsdEncryptionMode, + ) + effective_cgroup_mode: EffectiveCgroupMode = proto.Field( + proto.ENUM, + number=55, + enum=EffectiveCgroupMode, + ) + + +class AdvancedMachineFeatures(proto.Message): + r"""Specifies options for controlling advanced machine features. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + threads_per_core (int): + The number of threads per physical core. To + disable simultaneous multithreading (SMT) set + this to 1. If unset, the maximum number of + threads supported per core by the underlying + processor is assumed. + + This field is a member of `oneof`_ ``_threads_per_core``. + enable_nested_virtualization (bool): + Whether or not to enable nested + virtualization (defaults to false). + + This field is a member of `oneof`_ ``_enable_nested_virtualization``. + """ + + threads_per_core: int = proto.Field( + proto.INT64, + number=1, + optional=True, + ) + enable_nested_virtualization: bool = proto.Field( + proto.BOOL, + number=2, + optional=True, + ) + + +class NodeNetworkConfig(proto.Message): + r"""Parameters for node pool-level network config. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + create_pod_range (bool): + Input only. Whether to create a new range for pod IPs in + this node pool. Defaults are provided for ``pod_range`` and + ``pod_ipv4_cidr_block`` if they are not specified. + + If neither ``create_pod_range`` or ``pod_range`` are + specified, the cluster-level default + (``ip_allocation_policy.cluster_ipv4_cidr_block``) is used. + + Only applicable if ``ip_allocation_policy.use_ip_aliases`` + is true. + + This field cannot be changed after the node pool has been + created. + pod_range (str): + The ID of the secondary range for pod IPs. If + ``create_pod_range`` is true, this ID is used for the new + range. If ``create_pod_range`` is false, uses an existing + secondary range with this ID. + + Only applicable if ``ip_allocation_policy.use_ip_aliases`` + is true. + + This field cannot be changed after the node pool has been + created. + pod_ipv4_cidr_block (str): + The IP address range for pod IPs in this node pool. + + Only applicable if ``create_pod_range`` is true. + + Set to blank to have a range chosen with the default size. + + Set to /netmask (e.g. ``/14``) to have a range chosen with a + specific netmask. + + Set to a + `CIDR `__ + notation (e.g. ``10.96.0.0/14``) to pick a specific range to + use. + + Only applicable if ``ip_allocation_policy.use_ip_aliases`` + is true. + + This field cannot be changed after the node pool has been + created. + enable_private_nodes (bool): + Whether nodes have internal IP addresses only. If + enable_private_nodes is not specified, then the value is + derived from + [Cluster.NetworkConfig.default_enable_private_nodes][] + + This field is a member of `oneof`_ ``_enable_private_nodes``. + network_performance_config (google.cloud.container_v1.types.NodeNetworkConfig.NetworkPerformanceConfig): + Network bandwidth tier configuration. + + This field is a member of `oneof`_ ``_network_performance_config``. + pod_cidr_overprovision_config (google.cloud.container_v1.types.PodCIDROverprovisionConfig): + [PRIVATE FIELD] Pod CIDR size overprovisioning config for + the nodepool. + + Pod CIDR size per node depends on max_pods_per_node. By + default, the value of max_pods_per_node is rounded off to + next power of 2 and we then double that to get the size of + pod CIDR block per node. Example: max_pods_per_node of 30 + would result in 64 IPs (/26). + + This config can disable the doubling of IPs (we still round + off to next power of 2) Example: max_pods_per_node of 30 + will result in 32 IPs (/27) when overprovisioning is + disabled. + additional_node_network_configs (MutableSequence[google.cloud.container_v1.types.AdditionalNodeNetworkConfig]): + We specify the additional node networks for + this node pool using this list. Each node + network corresponds to an additional interface + additional_pod_network_configs (MutableSequence[google.cloud.container_v1.types.AdditionalPodNetworkConfig]): + We specify the additional pod networks for + this node pool using this list. Each pod network + corresponds to an additional alias IP range for + the node + pod_ipv4_range_utilization (float): + Output only. The utilization of the IPv4 range for the pod. + The ratio is Usage/[Total number of IPs in the secondary + range], Usage=numNodes\ *numZones*\ podIPsPerNode. + """ + + class NetworkPerformanceConfig(proto.Message): + r"""Configuration of all network bandwidth tiers + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + total_egress_bandwidth_tier (google.cloud.container_v1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier): + Specifies the total network bandwidth tier + for the NodePool. + + This field is a member of `oneof`_ ``_total_egress_bandwidth_tier``. + """ + class Tier(proto.Enum): + r"""Node network tier + + Values: + TIER_UNSPECIFIED (0): + Default value + TIER_1 (1): + Higher bandwidth, actual values based on VM + size. + """ + TIER_UNSPECIFIED = 0 + TIER_1 = 1 + + total_egress_bandwidth_tier: 'NodeNetworkConfig.NetworkPerformanceConfig.Tier' = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum='NodeNetworkConfig.NetworkPerformanceConfig.Tier', + ) + + create_pod_range: bool = proto.Field( + proto.BOOL, + number=4, + ) + pod_range: str = proto.Field( + proto.STRING, + number=5, + ) + pod_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=6, + ) + enable_private_nodes: bool = proto.Field( + proto.BOOL, + number=9, + optional=True, + ) + network_performance_config: NetworkPerformanceConfig = proto.Field( + proto.MESSAGE, + number=11, + optional=True, + message=NetworkPerformanceConfig, + ) + pod_cidr_overprovision_config: 'PodCIDROverprovisionConfig' = proto.Field( + proto.MESSAGE, + number=13, + message='PodCIDROverprovisionConfig', + ) + additional_node_network_configs: MutableSequence['AdditionalNodeNetworkConfig'] = proto.RepeatedField( + proto.MESSAGE, + number=14, + message='AdditionalNodeNetworkConfig', + ) + additional_pod_network_configs: MutableSequence['AdditionalPodNetworkConfig'] = proto.RepeatedField( + proto.MESSAGE, + number=15, + message='AdditionalPodNetworkConfig', + ) + pod_ipv4_range_utilization: float = proto.Field( + proto.DOUBLE, + number=16, + ) + + +class AdditionalNodeNetworkConfig(proto.Message): + r"""AdditionalNodeNetworkConfig is the configuration for + additional node networks within the NodeNetworkConfig message + + Attributes: + network (str): + Name of the VPC where the additional + interface belongs + subnetwork (str): + Name of the subnetwork where the additional + interface belongs + """ + + network: str = proto.Field( + proto.STRING, + number=1, + ) + subnetwork: str = proto.Field( + proto.STRING, + number=2, + ) + + +class AdditionalPodNetworkConfig(proto.Message): + r"""AdditionalPodNetworkConfig is the configuration for + additional pod networks within the NodeNetworkConfig message + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + subnetwork (str): + Name of the subnetwork where the additional + pod network belongs. + secondary_pod_range (str): + The name of the secondary range on the subnet + which provides IP address for this pod range. + max_pods_per_node (google.cloud.container_v1.types.MaxPodsConstraint): + The maximum number of pods per node which use + this pod network. + + This field is a member of `oneof`_ ``_max_pods_per_node``. + """ + + subnetwork: str = proto.Field( + proto.STRING, + number=1, + ) + secondary_pod_range: str = proto.Field( + proto.STRING, + number=2, + ) + max_pods_per_node: 'MaxPodsConstraint' = proto.Field( + proto.MESSAGE, + number=3, + optional=True, + message='MaxPodsConstraint', + ) + + +class ShieldedInstanceConfig(proto.Message): + r"""A set of Shielded Instance options. + + Attributes: + enable_secure_boot (bool): + Defines whether the instance has Secure Boot + enabled. + Secure Boot helps ensure that the system only + runs authentic software by verifying the digital + signature of all boot components, and halting + the boot process if signature verification + fails. + enable_integrity_monitoring (bool): + Defines whether the instance has integrity + monitoring enabled. + Enables monitoring and attestation of the boot + integrity of the instance. The attestation is + performed against the integrity policy baseline. + This baseline is initially derived from the + implicitly trusted boot image when the instance + is created. + """ + + enable_secure_boot: bool = proto.Field( + proto.BOOL, + number=1, + ) + enable_integrity_monitoring: bool = proto.Field( + proto.BOOL, + number=2, + ) + + +class SandboxConfig(proto.Message): + r"""SandboxConfig contains configurations of the sandbox to use + for the node. + + Attributes: + type_ (google.cloud.container_v1.types.SandboxConfig.Type): + Type of the sandbox to use for the node. + """ + class Type(proto.Enum): + r"""Possible types of sandboxes. + + Values: + UNSPECIFIED (0): + Default value. This should not be used. + GVISOR (1): + Run sandbox using gvisor. + """ + UNSPECIFIED = 0 + GVISOR = 1 + + type_: Type = proto.Field( + proto.ENUM, + number=2, + enum=Type, + ) + + +class GcfsConfig(proto.Message): + r"""GcfsConfig contains configurations of Google Container File + System (image streaming). + + Attributes: + enabled (bool): + Whether to use GCFS. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class ReservationAffinity(proto.Message): + r"""`ReservationAffinity `__ + is the configuration of desired reservation which instances could + take capacity from. + + Attributes: + consume_reservation_type (google.cloud.container_v1.types.ReservationAffinity.Type): + Corresponds to the type of reservation + consumption. + key (str): + Corresponds to the label key of a reservation resource. To + target a SPECIFIC_RESERVATION by name, specify + "compute.googleapis.com/reservation-name" as the key and + specify the name of your reservation as its value. + values (MutableSequence[str]): + Corresponds to the label value(s) of + reservation resource(s). + """ + class Type(proto.Enum): + r"""Indicates whether to consume capacity from a reservation or + not. + + Values: + UNSPECIFIED (0): + Default value. This should not be used. + NO_RESERVATION (1): + Do not consume from any reserved capacity. + ANY_RESERVATION (2): + Consume any reservation available. + SPECIFIC_RESERVATION (3): + Must consume from a specific reservation. + Must specify key value fields for specifying the + reservations. + """ + UNSPECIFIED = 0 + NO_RESERVATION = 1 + ANY_RESERVATION = 2 + SPECIFIC_RESERVATION = 3 + + consume_reservation_type: Type = proto.Field( + proto.ENUM, + number=1, + enum=Type, + ) + key: str = proto.Field( + proto.STRING, + number=2, + ) + values: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class SoleTenantConfig(proto.Message): + r"""SoleTenantConfig contains the NodeAffinities to specify what + shared sole tenant node groups should back the node pool. + + Attributes: + node_affinities (MutableSequence[google.cloud.container_v1.types.SoleTenantConfig.NodeAffinity]): + NodeAffinities used to match to a shared sole + tenant node group. + """ + + class NodeAffinity(proto.Message): + r"""Specifies the NodeAffinity key, values, and affinity operator + according to `shared sole tenant node group + affinities `__. + + Attributes: + key (str): + Key for NodeAffinity. + operator (google.cloud.container_v1.types.SoleTenantConfig.NodeAffinity.Operator): + Operator for NodeAffinity. + values (MutableSequence[str]): + Values for NodeAffinity. + """ + class Operator(proto.Enum): + r"""Operator allows user to specify affinity or anti-affinity for + the given key values. + + Values: + OPERATOR_UNSPECIFIED (0): + Invalid or unspecified affinity operator. + IN (1): + Affinity operator. + NOT_IN (2): + Anti-affinity operator. + """ + OPERATOR_UNSPECIFIED = 0 + IN = 1 + NOT_IN = 2 + + key: str = proto.Field( + proto.STRING, + number=1, + ) + operator: 'SoleTenantConfig.NodeAffinity.Operator' = proto.Field( + proto.ENUM, + number=2, + enum='SoleTenantConfig.NodeAffinity.Operator', + ) + values: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + node_affinities: MutableSequence[NodeAffinity] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=NodeAffinity, + ) + + +class ContainerdConfig(proto.Message): + r"""ContainerdConfig contains configuration to customize + containerd. + + Attributes: + private_registry_access_config (google.cloud.container_v1.types.ContainerdConfig.PrivateRegistryAccessConfig): + PrivateRegistryAccessConfig is used to + configure access configuration for private + container registries. + """ + + class PrivateRegistryAccessConfig(proto.Message): + r"""PrivateRegistryAccessConfig contains access configuration for + private container registries. + + Attributes: + enabled (bool): + Private registry access is enabled. + certificate_authority_domain_config (MutableSequence[google.cloud.container_v1.types.ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig]): + Private registry access configuration. + """ + + class CertificateAuthorityDomainConfig(proto.Message): + r"""CertificateAuthorityDomainConfig configures one or more fully + qualified domain names (FQDN) to a specific certificate. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + fqdns (MutableSequence[str]): + List of fully qualified domain names (FQDN). + Specifying port is supported. + Wilcards are NOT supported. + Examples: + + - my.customdomain.com + - 10.0.1.2:5000 + gcp_secret_manager_certificate_config (google.cloud.container_v1.types.ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig.GCPSecretManagerCertificateConfig): + Google Secret Manager (GCP) certificate + configuration. + + This field is a member of `oneof`_ ``certificate_config``. + """ + + class GCPSecretManagerCertificateConfig(proto.Message): + r"""GCPSecretManagerCertificateConfig configures a secret from `Google + Secret Manager `__. + + Attributes: + secret_uri (str): + Secret URI, in the form + "projects/$PROJECT_ID/secrets/$SECRET_NAME/versions/$VERSION". + Version can be fixed (e.g. "2") or "latest". + """ + + secret_uri: str = proto.Field( + proto.STRING, + number=1, + ) + + fqdns: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + gcp_secret_manager_certificate_config: 'ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig.GCPSecretManagerCertificateConfig' = proto.Field( + proto.MESSAGE, + number=2, + oneof='certificate_config', + message='ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig.GCPSecretManagerCertificateConfig', + ) + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + certificate_authority_domain_config: MutableSequence['ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig', + ) + + private_registry_access_config: PrivateRegistryAccessConfig = proto.Field( + proto.MESSAGE, + number=1, + message=PrivateRegistryAccessConfig, + ) + + +class NodeTaint(proto.Message): + r"""Kubernetes taint is composed of three fields: key, value, and + effect. Effect can only be one of three types: NoSchedule, + PreferNoSchedule or NoExecute. + + See + `here `__ + for more information, including usage and the valid values. + + Attributes: + key (str): + Key for taint. + value (str): + Value for taint. + effect (google.cloud.container_v1.types.NodeTaint.Effect): + Effect for taint. + """ + class Effect(proto.Enum): + r"""Possible values for Effect in taint. + + Values: + EFFECT_UNSPECIFIED (0): + Not set + NO_SCHEDULE (1): + NoSchedule + PREFER_NO_SCHEDULE (2): + PreferNoSchedule + NO_EXECUTE (3): + NoExecute + """ + EFFECT_UNSPECIFIED = 0 + NO_SCHEDULE = 1 + PREFER_NO_SCHEDULE = 2 + NO_EXECUTE = 3 + + key: str = proto.Field( + proto.STRING, + number=1, + ) + value: str = proto.Field( + proto.STRING, + number=2, + ) + effect: Effect = proto.Field( + proto.ENUM, + number=3, + enum=Effect, + ) + + +class NodeTaints(proto.Message): + r"""Collection of Kubernetes `node + taints `__. + + Attributes: + taints (MutableSequence[google.cloud.container_v1.types.NodeTaint]): + List of node taints. + """ + + taints: MutableSequence['NodeTaint'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='NodeTaint', + ) + + +class NodeLabels(proto.Message): + r"""Collection of node-level `Kubernetes + labels `__. + + Attributes: + labels (MutableMapping[str, str]): + Map of node label keys and node label values. + """ + + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=1, + ) + + +class ResourceLabels(proto.Message): + r"""Collection of `GCP + labels `__. + + Attributes: + labels (MutableMapping[str, str]): + Map of node label keys and node label values. + """ + + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=1, + ) + + +class NetworkTags(proto.Message): + r"""Collection of Compute Engine network tags that can be applied + to a node's underlying VM instance. + + Attributes: + tags (MutableSequence[str]): + List of network tags. + """ + + tags: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + + +class MasterAuth(proto.Message): + r"""The authentication information for accessing the master + endpoint. Authentication can be done using HTTP basic auth or + using client certificates. + + Attributes: + username (str): + The username to use for HTTP basic + authentication to the master endpoint. For + clusters v1.6.0 and later, basic authentication + can be disabled by leaving username unspecified + (or setting it to the empty string). + + Warning: basic authentication is deprecated, and + will be removed in GKE control plane versions + 1.19 and newer. For a list of recommended + authentication methods, see: + + https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication + password (str): + The password to use for HTTP basic + authentication to the master endpoint. Because + the master endpoint is open to the Internet, you + should create a strong password. If a password + is provided for cluster creation, username must + be non-empty. + + Warning: basic authentication is deprecated, and + will be removed in GKE control plane versions + 1.19 and newer. For a list of recommended + authentication methods, see: + + https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication + client_certificate_config (google.cloud.container_v1.types.ClientCertificateConfig): + Configuration for client certificate + authentication on the cluster. For clusters + before v1.12, if no configuration is specified, + a client certificate is issued. + cluster_ca_certificate (str): + Output only. Base64-encoded public + certificate that is the root of trust for the + cluster. + client_certificate (str): + Output only. Base64-encoded public certificate used by + clients to authenticate to the cluster endpoint. Issued only + if client_certificate_config is set. + client_key (str): + Output only. Base64-encoded private key used + by clients to authenticate to the cluster + endpoint. + """ + + username: str = proto.Field( + proto.STRING, + number=1, + ) + password: str = proto.Field( + proto.STRING, + number=2, + ) + client_certificate_config: 'ClientCertificateConfig' = proto.Field( + proto.MESSAGE, + number=3, + message='ClientCertificateConfig', + ) + cluster_ca_certificate: str = proto.Field( + proto.STRING, + number=100, + ) + client_certificate: str = proto.Field( + proto.STRING, + number=101, + ) + client_key: str = proto.Field( + proto.STRING, + number=102, + ) + + +class ClientCertificateConfig(proto.Message): + r"""Configuration for client certificates on the cluster. + + Attributes: + issue_client_certificate (bool): + Issue a client certificate. + """ + + issue_client_certificate: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class AddonsConfig(proto.Message): + r"""Configuration for the addons that can be automatically spun + up in the cluster, enabling additional functionality. + + Attributes: + http_load_balancing (google.cloud.container_v1.types.HttpLoadBalancing): + Configuration for the HTTP (L7) load + balancing controller addon, which makes it easy + to set up HTTP load balancers for services in a + cluster. + horizontal_pod_autoscaling (google.cloud.container_v1.types.HorizontalPodAutoscaling): + Configuration for the horizontal pod + autoscaling feature, which increases or + decreases the number of replica pods a + replication controller has based on the resource + usage of the existing pods. + kubernetes_dashboard (google.cloud.container_v1.types.KubernetesDashboard): + Configuration for the Kubernetes Dashboard. + This addon is deprecated, and will be disabled + in 1.15. It is recommended to use the Cloud + Console to manage and monitor your Kubernetes + clusters, workloads and applications. For more + information, see: + + https://cloud.google.com/kubernetes-engine/docs/concepts/dashboards + network_policy_config (google.cloud.container_v1.types.NetworkPolicyConfig): + Configuration for NetworkPolicy. This only + tracks whether the addon is enabled or not on + the Master, it does not track whether network + policy is enabled for the nodes. + cloud_run_config (google.cloud.container_v1.types.CloudRunConfig): + Configuration for the Cloud Run addon, which + allows the user to use a managed Knative + service. + dns_cache_config (google.cloud.container_v1.types.DnsCacheConfig): + Configuration for NodeLocalDNS, a dns cache + running on cluster nodes + config_connector_config (google.cloud.container_v1.types.ConfigConnectorConfig): + Configuration for the ConfigConnector add-on, + a Kubernetes extension to manage hosted GCP + services through the Kubernetes API + gce_persistent_disk_csi_driver_config (google.cloud.container_v1.types.GcePersistentDiskCsiDriverConfig): + Configuration for the Compute Engine + Persistent Disk CSI driver. + gcp_filestore_csi_driver_config (google.cloud.container_v1.types.GcpFilestoreCsiDriverConfig): + Configuration for the GCP Filestore CSI + driver. + gke_backup_agent_config (google.cloud.container_v1.types.GkeBackupAgentConfig): + Configuration for the Backup for GKE agent + addon. + gcs_fuse_csi_driver_config (google.cloud.container_v1.types.GcsFuseCsiDriverConfig): + Configuration for the Cloud Storage Fuse CSI + driver. + stateful_ha_config (google.cloud.container_v1.types.StatefulHAConfig): + Optional. Configuration for the StatefulHA + add-on. + parallelstore_csi_driver_config (google.cloud.container_v1.types.ParallelstoreCsiDriverConfig): + Configuration for the Cloud Storage + Parallelstore CSI driver. + ray_operator_config (google.cloud.container_v1.types.RayOperatorConfig): + Optional. Configuration for Ray Operator + addon. + """ + + http_load_balancing: 'HttpLoadBalancing' = proto.Field( + proto.MESSAGE, + number=1, + message='HttpLoadBalancing', + ) + horizontal_pod_autoscaling: 'HorizontalPodAutoscaling' = proto.Field( + proto.MESSAGE, + number=2, + message='HorizontalPodAutoscaling', + ) + kubernetes_dashboard: 'KubernetesDashboard' = proto.Field( + proto.MESSAGE, + number=3, + message='KubernetesDashboard', + ) + network_policy_config: 'NetworkPolicyConfig' = proto.Field( + proto.MESSAGE, + number=4, + message='NetworkPolicyConfig', + ) + cloud_run_config: 'CloudRunConfig' = proto.Field( + proto.MESSAGE, + number=7, + message='CloudRunConfig', + ) + dns_cache_config: 'DnsCacheConfig' = proto.Field( + proto.MESSAGE, + number=8, + message='DnsCacheConfig', + ) + config_connector_config: 'ConfigConnectorConfig' = proto.Field( + proto.MESSAGE, + number=10, + message='ConfigConnectorConfig', + ) + gce_persistent_disk_csi_driver_config: 'GcePersistentDiskCsiDriverConfig' = proto.Field( + proto.MESSAGE, + number=11, + message='GcePersistentDiskCsiDriverConfig', + ) + gcp_filestore_csi_driver_config: 'GcpFilestoreCsiDriverConfig' = proto.Field( + proto.MESSAGE, + number=14, + message='GcpFilestoreCsiDriverConfig', + ) + gke_backup_agent_config: 'GkeBackupAgentConfig' = proto.Field( + proto.MESSAGE, + number=16, + message='GkeBackupAgentConfig', + ) + gcs_fuse_csi_driver_config: 'GcsFuseCsiDriverConfig' = proto.Field( + proto.MESSAGE, + number=17, + message='GcsFuseCsiDriverConfig', + ) + stateful_ha_config: 'StatefulHAConfig' = proto.Field( + proto.MESSAGE, + number=18, + message='StatefulHAConfig', + ) + parallelstore_csi_driver_config: 'ParallelstoreCsiDriverConfig' = proto.Field( + proto.MESSAGE, + number=19, + message='ParallelstoreCsiDriverConfig', + ) + ray_operator_config: 'RayOperatorConfig' = proto.Field( + proto.MESSAGE, + number=21, + message='RayOperatorConfig', + ) + + +class HttpLoadBalancing(proto.Message): + r"""Configuration options for the HTTP (L7) load balancing + controller addon, which makes it easy to set up HTTP load + balancers for services in a cluster. + + Attributes: + disabled (bool): + Whether the HTTP Load Balancing controller is + enabled in the cluster. When enabled, it runs a + small pod in the cluster that manages the load + balancers. + """ + + disabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class HorizontalPodAutoscaling(proto.Message): + r"""Configuration options for the horizontal pod autoscaling + feature, which increases or decreases the number of replica pods + a replication controller has based on the resource usage of the + existing pods. + + Attributes: + disabled (bool): + Whether the Horizontal Pod Autoscaling + feature is enabled in the cluster. When enabled, + it ensures that metrics are collected into + Stackdriver Monitoring. + """ + + disabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class KubernetesDashboard(proto.Message): + r"""Configuration for the Kubernetes Dashboard. + + Attributes: + disabled (bool): + Whether the Kubernetes Dashboard is enabled + for this cluster. + """ + + disabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class NetworkPolicyConfig(proto.Message): + r"""Configuration for NetworkPolicy. This only tracks whether the + addon is enabled or not on the Master, it does not track whether + network policy is enabled for the nodes. + + Attributes: + disabled (bool): + Whether NetworkPolicy is enabled for this + cluster. + """ + + disabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class DnsCacheConfig(proto.Message): + r"""Configuration for NodeLocal DNSCache + + Attributes: + enabled (bool): + Whether NodeLocal DNSCache is enabled for + this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class PrivateClusterMasterGlobalAccessConfig(proto.Message): + r"""Configuration for controlling master global access settings. + + Attributes: + enabled (bool): + Whenever master is accessible globally or + not. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class PrivateClusterConfig(proto.Message): + r"""Configuration options for private clusters. + + Attributes: + enable_private_nodes (bool): + Whether nodes have internal IP addresses only. If enabled, + all nodes are given only RFC 1918 private addresses and + communicate with the master via private networking. + + Deprecated: Use + [NetworkConfig.default_enable_private_nodes][google.container.v1.NetworkConfig.default_enable_private_nodes] + instead. + enable_private_endpoint (bool): + Whether the master's internal IP address is used as the + cluster endpoint. + + Deprecated: Use + [ControlPlaneEndpointsConfig.IPEndpointsConfig.enable_public_endpoint][google.container.v1.ControlPlaneEndpointsConfig.IPEndpointsConfig.enable_public_endpoint] + instead. Note that the value of enable_public_endpoint is + reversed: if enable_private_endpoint is false, then + enable_public_endpoint will be true. + master_ipv4_cidr_block (str): + The IP range in CIDR notation to use for the + hosted master network. This range will be used + for assigning internal IP addresses to the + master or set of masters, as well as the ILB + VIP. This range must not overlap with any other + ranges in use within the cluster's network. + private_endpoint (str): + Output only. The internal IP address of this cluster's + master endpoint. + + Deprecated: Use + [ControlPlaneEndpointsConfig.IPEndpointsConfig.private_endpoint][google.container.v1.ControlPlaneEndpointsConfig.IPEndpointsConfig.private_endpoint] + instead. + public_endpoint (str): + Output only. The external IP address of this cluster's + master endpoint. + + Deprecated:Use + [ControlPlaneEndpointsConfig.IPEndpointsConfig.public_endpoint][google.container.v1.ControlPlaneEndpointsConfig.IPEndpointsConfig.public_endpoint] + instead. + peering_name (str): + Output only. The peering name in the customer + VPC used by this cluster. + master_global_access_config (google.cloud.container_v1.types.PrivateClusterMasterGlobalAccessConfig): + Controls master global access settings. + + Deprecated: Use + [ControlPlaneEndpointsConfig.IPEndpointsConfig.enable_global_access][] + instead. + private_endpoint_subnetwork (str): + Subnet to provision the master's private endpoint during + cluster creation. Specified in + projects/\ */regions/*/subnetworks/\* format. + + Deprecated: Use + [ControlPlaneEndpointsConfig.IPEndpointsConfig.private_endpoint_subnetwork][google.container.v1.ControlPlaneEndpointsConfig.IPEndpointsConfig.private_endpoint_subnetwork] + instead. + """ + + enable_private_nodes: bool = proto.Field( + proto.BOOL, + number=1, + ) + enable_private_endpoint: bool = proto.Field( + proto.BOOL, + number=2, + ) + master_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=3, + ) + private_endpoint: str = proto.Field( + proto.STRING, + number=4, + ) + public_endpoint: str = proto.Field( + proto.STRING, + number=5, + ) + peering_name: str = proto.Field( + proto.STRING, + number=7, + ) + master_global_access_config: 'PrivateClusterMasterGlobalAccessConfig' = proto.Field( + proto.MESSAGE, + number=8, + message='PrivateClusterMasterGlobalAccessConfig', + ) + private_endpoint_subnetwork: str = proto.Field( + proto.STRING, + number=10, + ) + + +class AuthenticatorGroupsConfig(proto.Message): + r"""Configuration for returning group information from + authenticators. + + Attributes: + enabled (bool): + Whether this cluster should return group + membership lookups during authentication using a + group of security groups. + security_group (str): + The name of the security group-of-groups to + be used. Only relevant if enabled = true. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + security_group: str = proto.Field( + proto.STRING, + number=2, + ) + + +class CloudRunConfig(proto.Message): + r"""Configuration options for the Cloud Run feature. + + Attributes: + disabled (bool): + Whether Cloud Run addon is enabled for this + cluster. + load_balancer_type (google.cloud.container_v1.types.CloudRunConfig.LoadBalancerType): + Which load balancer type is installed for + Cloud Run. + """ + class LoadBalancerType(proto.Enum): + r"""Load balancer type of ingress service of Cloud Run. + + Values: + LOAD_BALANCER_TYPE_UNSPECIFIED (0): + Load balancer type for Cloud Run is + unspecified. + LOAD_BALANCER_TYPE_EXTERNAL (1): + Install external load balancer for Cloud Run. + LOAD_BALANCER_TYPE_INTERNAL (2): + Install internal load balancer for Cloud Run. + """ + LOAD_BALANCER_TYPE_UNSPECIFIED = 0 + LOAD_BALANCER_TYPE_EXTERNAL = 1 + LOAD_BALANCER_TYPE_INTERNAL = 2 + + disabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + load_balancer_type: LoadBalancerType = proto.Field( + proto.ENUM, + number=3, + enum=LoadBalancerType, + ) + + +class ConfigConnectorConfig(proto.Message): + r"""Configuration options for the Config Connector add-on. + + Attributes: + enabled (bool): + Whether Cloud Connector is enabled for this + cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class GcePersistentDiskCsiDriverConfig(proto.Message): + r"""Configuration for the Compute Engine PD CSI driver. + + Attributes: + enabled (bool): + Whether the Compute Engine PD CSI driver is + enabled for this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class GcpFilestoreCsiDriverConfig(proto.Message): + r"""Configuration for the GCP Filestore CSI driver. + + Attributes: + enabled (bool): + Whether the GCP Filestore CSI driver is + enabled for this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class GcsFuseCsiDriverConfig(proto.Message): + r"""Configuration for the Cloud Storage Fuse CSI driver. + + Attributes: + enabled (bool): + Whether the Cloud Storage Fuse CSI driver is + enabled for this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class ParallelstoreCsiDriverConfig(proto.Message): + r"""Configuration for the Cloud Storage Parallelstore CSI driver. + + Attributes: + enabled (bool): + Whether the Cloud Storage Parallelstore CSI + driver is enabled for this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class RayOperatorConfig(proto.Message): + r"""Configuration options for the Ray Operator add-on. + + Attributes: + enabled (bool): + Whether the Ray Operator addon is enabled for + this cluster. + ray_cluster_logging_config (google.cloud.container_v1.types.RayClusterLoggingConfig): + Optional. Logging configuration for Ray + clusters. + ray_cluster_monitoring_config (google.cloud.container_v1.types.RayClusterMonitoringConfig): + Optional. Monitoring configuration for Ray + clusters. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + ray_cluster_logging_config: 'RayClusterLoggingConfig' = proto.Field( + proto.MESSAGE, + number=2, + message='RayClusterLoggingConfig', + ) + ray_cluster_monitoring_config: 'RayClusterMonitoringConfig' = proto.Field( + proto.MESSAGE, + number=3, + message='RayClusterMonitoringConfig', + ) + + +class GkeBackupAgentConfig(proto.Message): + r"""Configuration for the Backup for GKE Agent. + + Attributes: + enabled (bool): + Whether the Backup for GKE agent is enabled + for this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class StatefulHAConfig(proto.Message): + r"""Configuration for the Stateful HA add-on. + + Attributes: + enabled (bool): + Whether the Stateful HA add-on is enabled for + this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class MasterAuthorizedNetworksConfig(proto.Message): + r"""Configuration options for the master authorized networks + feature. Enabled master authorized networks will disallow all + external traffic to access Kubernetes master through HTTPS + except traffic from the given CIDR blocks, Google Compute Engine + Public IPs and Google Prod IPs. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + enabled (bool): + Whether or not master authorized networks is + enabled. + cidr_blocks (MutableSequence[google.cloud.container_v1.types.MasterAuthorizedNetworksConfig.CidrBlock]): + cidr_blocks define up to 50 external networks that could + access Kubernetes master through HTTPS. + gcp_public_cidrs_access_enabled (bool): + Whether master is accessbile via Google + Compute Engine Public IP addresses. + + This field is a member of `oneof`_ ``_gcp_public_cidrs_access_enabled``. + private_endpoint_enforcement_enabled (bool): + Whether master authorized networks is + enforced on private endpoint or not. + + This field is a member of `oneof`_ ``_private_endpoint_enforcement_enabled``. + """ + + class CidrBlock(proto.Message): + r"""CidrBlock contains an optional name and one CIDR block. + + Attributes: + display_name (str): + display_name is an optional field for users to identify CIDR + blocks. + cidr_block (str): + cidr_block must be specified in CIDR notation. + """ + + display_name: str = proto.Field( + proto.STRING, + number=1, + ) + cidr_block: str = proto.Field( + proto.STRING, + number=2, + ) + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + cidr_blocks: MutableSequence[CidrBlock] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=CidrBlock, + ) + gcp_public_cidrs_access_enabled: bool = proto.Field( + proto.BOOL, + number=3, + optional=True, + ) + private_endpoint_enforcement_enabled: bool = proto.Field( + proto.BOOL, + number=5, + optional=True, + ) + + +class LegacyAbac(proto.Message): + r"""Configuration for the legacy Attribute Based Access Control + authorization mode. + + Attributes: + enabled (bool): + Whether the ABAC authorizer is enabled for + this cluster. When enabled, identities in the + system, including service accounts, nodes, and + controllers, will have statically granted + permissions beyond those provided by the RBAC + configuration or IAM. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class NetworkPolicy(proto.Message): + r"""Configuration options for the NetworkPolicy feature. + https://kubernetes.io/docs/concepts/services-networking/networkpolicies/ + + Attributes: + provider (google.cloud.container_v1.types.NetworkPolicy.Provider): + The selected network policy provider. + enabled (bool): + Whether network policy is enabled on the + cluster. + """ + class Provider(proto.Enum): + r"""Allowed Network Policy providers. + + Values: + PROVIDER_UNSPECIFIED (0): + Not set + CALICO (1): + Tigera (Calico Felix). + """ + PROVIDER_UNSPECIFIED = 0 + CALICO = 1 + + provider: Provider = proto.Field( + proto.ENUM, + number=1, + enum=Provider, + ) + enabled: bool = proto.Field( + proto.BOOL, + number=2, + ) + + +class BinaryAuthorization(proto.Message): + r"""Configuration for Binary Authorization. + + Attributes: + enabled (bool): + This field is deprecated. Leave this unset and instead + configure BinaryAuthorization using evaluation_mode. If + evaluation_mode is set to anything other than + EVALUATION_MODE_UNSPECIFIED, this field is ignored. + evaluation_mode (google.cloud.container_v1.types.BinaryAuthorization.EvaluationMode): + Mode of operation for binauthz policy + evaluation. If unspecified, defaults to + DISABLED. + """ + class EvaluationMode(proto.Enum): + r"""Binary Authorization mode of operation. + + Values: + EVALUATION_MODE_UNSPECIFIED (0): + Default value + DISABLED (1): + Disable BinaryAuthorization + PROJECT_SINGLETON_POLICY_ENFORCE (2): + Enforce Kubernetes admission requests with + BinaryAuthorization using the project's + singleton policy. This is equivalent to setting + the enabled boolean to true. + """ + EVALUATION_MODE_UNSPECIFIED = 0 + DISABLED = 1 + PROJECT_SINGLETON_POLICY_ENFORCE = 2 + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + evaluation_mode: EvaluationMode = proto.Field( + proto.ENUM, + number=2, + enum=EvaluationMode, + ) + + +class PodCIDROverprovisionConfig(proto.Message): + r"""[PRIVATE FIELD] Config for pod CIDR size overprovisioning. + + Attributes: + disable (bool): + Whether Pod CIDR overprovisioning is + disabled. Note: Pod CIDR overprovisioning is + enabled by default. + """ + + disable: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class IPAllocationPolicy(proto.Message): + r"""Configuration for controlling how IPs are allocated in the + cluster. + + Attributes: + use_ip_aliases (bool): + Whether alias IPs will be used for pod IPs in the cluster. + This is used in conjunction with use_routes. It cannot be + true if use_routes is true. If both use_ip_aliases and + use_routes are false, then the server picks the default IP + allocation mode + create_subnetwork (bool): + Whether a new subnetwork will be created automatically for + the cluster. + + This field is only applicable when ``use_ip_aliases`` is + true. + subnetwork_name (str): + A custom subnetwork name to be used if ``create_subnetwork`` + is true. If this field is empty, then an automatic name will + be chosen for the new subnetwork. + cluster_ipv4_cidr (str): + This field is deprecated, use cluster_ipv4_cidr_block. + node_ipv4_cidr (str): + This field is deprecated, use node_ipv4_cidr_block. + services_ipv4_cidr (str): + This field is deprecated, use services_ipv4_cidr_block. + cluster_secondary_range_name (str): + The name of the secondary range to be used for the cluster + CIDR block. The secondary range will be used for pod IP + addresses. This must be an existing secondary range + associated with the cluster subnetwork. + + This field is only applicable with use_ip_aliases is true + and create_subnetwork is false. + services_secondary_range_name (str): + The name of the secondary range to be used as for the + services CIDR block. The secondary range will be used for + service ClusterIPs. This must be an existing secondary range + associated with the cluster subnetwork. + + This field is only applicable with use_ip_aliases is true + and create_subnetwork is false. + cluster_ipv4_cidr_block (str): + The IP address range for the cluster pod IPs. If this field + is set, then ``cluster.cluster_ipv4_cidr`` must be left + blank. + + This field is only applicable when ``use_ip_aliases`` is + true. + + Set to blank to have a range chosen with the default size. + + Set to /netmask (e.g. ``/14``) to have a range chosen with a + specific netmask. + + Set to a + `CIDR `__ + notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private + networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, + ``192.168.0.0/16``) to pick a specific range to use. + node_ipv4_cidr_block (str): + The IP address range of the instance IPs in this cluster. + + This is applicable only if ``create_subnetwork`` is true. + + Set to blank to have a range chosen with the default size. + + Set to /netmask (e.g. ``/14``) to have a range chosen with a + specific netmask. + + Set to a + `CIDR `__ + notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private + networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, + ``192.168.0.0/16``) to pick a specific range to use. + services_ipv4_cidr_block (str): + The IP address range of the services IPs in this cluster. If + blank, a range will be automatically chosen with the default + size. + + This field is only applicable when ``use_ip_aliases`` is + true. + + Set to blank to have a range chosen with the default size. + + Set to /netmask (e.g. ``/14``) to have a range chosen with a + specific netmask. + + Set to a + `CIDR `__ + notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private + networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, + ``192.168.0.0/16``) to pick a specific range to use. + tpu_ipv4_cidr_block (str): + The IP address range of the Cloud TPUs in this cluster. If + unspecified, a range will be automatically chosen with the + default size. + + This field is only applicable when ``use_ip_aliases`` is + true. + + If unspecified, the range will use the default size. + + Set to /netmask (e.g. ``/14``) to have a range chosen with a + specific netmask. + + Set to a + `CIDR `__ + notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private + networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, + ``192.168.0.0/16``) to pick a specific range to use. + use_routes (bool): + Whether routes will be used for pod IPs in the cluster. This + is used in conjunction with use_ip_aliases. It cannot be + true if use_ip_aliases is true. If both use_ip_aliases and + use_routes are false, then the server picks the default IP + allocation mode + stack_type (google.cloud.container_v1.types.StackType): + The IP stack type of the cluster + ipv6_access_type (google.cloud.container_v1.types.IPv6AccessType): + The ipv6 access type (internal or external) when + create_subnetwork is true + pod_cidr_overprovision_config (google.cloud.container_v1.types.PodCIDROverprovisionConfig): + [PRIVATE FIELD] Pod CIDR size overprovisioning config for + the cluster. + + Pod CIDR size per node depends on max_pods_per_node. By + default, the value of max_pods_per_node is doubled and then + rounded off to next power of 2 to get the size of pod CIDR + block per node. Example: max_pods_per_node of 30 would + result in 64 IPs (/26). + + This config can disable the doubling of IPs (we still round + off to next power of 2) Example: max_pods_per_node of 30 + will result in 32 IPs (/27) when overprovisioning is + disabled. + subnet_ipv6_cidr_block (str): + Output only. The subnet's IPv6 CIDR block + used by nodes and pods. + services_ipv6_cidr_block (str): + Output only. The services IPv6 CIDR block for + the cluster. + additional_pod_ranges_config (google.cloud.container_v1.types.AdditionalPodRangesConfig): + Output only. The additional pod ranges that + are added to the cluster. These pod ranges can + be used by new node pools to allocate pod IPs + automatically. Once the range is removed it will + not show up in IPAllocationPolicy. + default_pod_ipv4_range_utilization (float): + Output only. The utilization of the cluster default IPv4 + range for the pod. The ratio is Usage/[Total number of IPs + in the secondary range], + Usage=numNodes\ *numZones*\ podIPsPerNode. + """ + + use_ip_aliases: bool = proto.Field( + proto.BOOL, + number=1, + ) + create_subnetwork: bool = proto.Field( + proto.BOOL, + number=2, + ) + subnetwork_name: str = proto.Field( + proto.STRING, + number=3, + ) + cluster_ipv4_cidr: str = proto.Field( + proto.STRING, + number=4, + ) + node_ipv4_cidr: str = proto.Field( + proto.STRING, + number=5, + ) + services_ipv4_cidr: str = proto.Field( + proto.STRING, + number=6, + ) + cluster_secondary_range_name: str = proto.Field( + proto.STRING, + number=7, + ) + services_secondary_range_name: str = proto.Field( + proto.STRING, + number=8, + ) + cluster_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=9, + ) + node_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=10, + ) + services_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=11, + ) + tpu_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=13, + ) + use_routes: bool = proto.Field( + proto.BOOL, + number=15, + ) + stack_type: 'StackType' = proto.Field( + proto.ENUM, + number=16, + enum='StackType', + ) + ipv6_access_type: 'IPv6AccessType' = proto.Field( + proto.ENUM, + number=17, + enum='IPv6AccessType', + ) + pod_cidr_overprovision_config: 'PodCIDROverprovisionConfig' = proto.Field( + proto.MESSAGE, + number=21, + message='PodCIDROverprovisionConfig', + ) + subnet_ipv6_cidr_block: str = proto.Field( + proto.STRING, + number=22, + ) + services_ipv6_cidr_block: str = proto.Field( + proto.STRING, + number=23, + ) + additional_pod_ranges_config: 'AdditionalPodRangesConfig' = proto.Field( + proto.MESSAGE, + number=24, + message='AdditionalPodRangesConfig', + ) + default_pod_ipv4_range_utilization: float = proto.Field( + proto.DOUBLE, + number=25, + ) + + +class Cluster(proto.Message): + r"""A Google Kubernetes Engine cluster. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + name (str): + The name of this cluster. The name must be unique within + this project and location (e.g. zone or region), and can be + up to 40 characters with the following restrictions: + + - Lowercase letters, numbers, and hyphens only. + - Must start with a letter. + - Must end with a number or a letter. + description (str): + An optional description of this cluster. + initial_node_count (int): + The number of nodes to create in this cluster. You must + ensure that your Compute Engine `resource + quota `__ is + sufficient for this number of instances. You must also have + available firewall and routes quota. For requests, this + field should only be used in lieu of a "node_pool" object, + since this configuration (along with the "node_config") will + be used to create a "NodePool" object with an auto-generated + name. Do not use this and a node_pool at the same time. + + This field is deprecated, use node_pool.initial_node_count + instead. + node_config (google.cloud.container_v1.types.NodeConfig): + Parameters used in creating the cluster's nodes. For + requests, this field should only be used in lieu of a + "node_pool" object, since this configuration (along with the + "initial_node_count") will be used to create a "NodePool" + object with an auto-generated name. Do not use this and a + node_pool at the same time. For responses, this field will + be populated with the node configuration of the first node + pool. (For configuration of each node pool, see + ``node_pool.config``) + + If unspecified, the defaults are used. This field is + deprecated, use node_pool.config instead. + master_auth (google.cloud.container_v1.types.MasterAuth): + The authentication information for accessing the master + endpoint. If unspecified, the defaults are used: For + clusters before v1.12, if master_auth is unspecified, + ``username`` will be set to "admin", a random password will + be generated, and a client certificate will be issued. + logging_service (str): + The logging service the cluster should use to write logs. + Currently available options: + + - ``logging.googleapis.com/kubernetes`` - The Cloud Logging + service with a Kubernetes-native resource model + - ``logging.googleapis.com`` - The legacy Cloud Logging + service (no longer available as of GKE 1.15). + - ``none`` - no logs will be exported from the cluster. + + If left as an empty + string,\ ``logging.googleapis.com/kubernetes`` will be used + for GKE 1.14+ or ``logging.googleapis.com`` for earlier + versions. + monitoring_service (str): + The monitoring service the cluster should use to write + metrics. Currently available options: + + - "monitoring.googleapis.com/kubernetes" - The Cloud + Monitoring service with a Kubernetes-native resource + model + - ``monitoring.googleapis.com`` - The legacy Cloud + Monitoring service (no longer available as of GKE 1.15). + - ``none`` - No metrics will be exported from the cluster. + + If left as an empty + string,\ ``monitoring.googleapis.com/kubernetes`` will be + used for GKE 1.14+ or ``monitoring.googleapis.com`` for + earlier versions. + network (str): + The name of the Google Compute Engine + `network `__ + to which the cluster is connected. If left unspecified, the + ``default`` network will be used. + cluster_ipv4_cidr (str): + The IP address range of the container pods in this cluster, + in + `CIDR `__ + notation (e.g. ``10.96.0.0/14``). Leave blank to have one + automatically chosen or specify a ``/14`` block in + ``10.0.0.0/8``. + addons_config (google.cloud.container_v1.types.AddonsConfig): + Configurations for the various addons + available to run in the cluster. + subnetwork (str): + The name of the Google Compute Engine + `subnetwork `__ + to which the cluster is connected. + node_pools (MutableSequence[google.cloud.container_v1.types.NodePool]): + The node pools associated with this cluster. This field + should not be set if "node_config" or "initial_node_count" + are specified. + locations (MutableSequence[str]): + The list of Google Compute Engine + `zones `__ + in which the cluster's nodes should be located. + + This field provides a default value if + `NodePool.Locations `__ + are not specified during node pool creation. + + Warning: changing cluster locations will update the + `NodePool.Locations `__ + of all node pools and will result in nodes being added + and/or removed. + enable_kubernetes_alpha (bool): + Kubernetes alpha features are enabled on this + cluster. This includes alpha API groups (e.g. + v1alpha1) and features that may not be + production ready in the kubernetes version of + the master and nodes. The cluster has no SLA for + uptime and master/node upgrades are disabled. + Alpha enabled clusters are automatically deleted + thirty days after creation. + resource_labels (MutableMapping[str, str]): + The resource labels for the cluster to use to + annotate any related Google Compute Engine + resources. + label_fingerprint (str): + The fingerprint of the set of labels for this + cluster. + legacy_abac (google.cloud.container_v1.types.LegacyAbac): + Configuration for the legacy ABAC + authorization mode. + network_policy (google.cloud.container_v1.types.NetworkPolicy): + Configuration options for the NetworkPolicy + feature. + ip_allocation_policy (google.cloud.container_v1.types.IPAllocationPolicy): + Configuration for cluster IP allocation. + master_authorized_networks_config (google.cloud.container_v1.types.MasterAuthorizedNetworksConfig): + The configuration options for master authorized networks + feature. + + Deprecated: Use + [ControlPlaneEndpointsConfig.IPEndpointsConfig.authorized_networks_config][google.container.v1.ControlPlaneEndpointsConfig.IPEndpointsConfig.authorized_networks_config] + instead. + maintenance_policy (google.cloud.container_v1.types.MaintenancePolicy): + Configure the maintenance policy for this + cluster. + binary_authorization (google.cloud.container_v1.types.BinaryAuthorization): + Configuration for Binary Authorization. + autoscaling (google.cloud.container_v1.types.ClusterAutoscaling): + Cluster-level autoscaling configuration. + network_config (google.cloud.container_v1.types.NetworkConfig): + Configuration for cluster networking. + default_max_pods_constraint (google.cloud.container_v1.types.MaxPodsConstraint): + The default constraint on the maximum number + of pods that can be run simultaneously on a node + in the node pool of this cluster. Only honored + if cluster created with IP Alias support. + resource_usage_export_config (google.cloud.container_v1.types.ResourceUsageExportConfig): + Configuration for exporting resource usages. + Resource usage export is disabled when this + config is unspecified. + authenticator_groups_config (google.cloud.container_v1.types.AuthenticatorGroupsConfig): + Configuration controlling RBAC group + membership information. + private_cluster_config (google.cloud.container_v1.types.PrivateClusterConfig): + Configuration for private cluster. + database_encryption (google.cloud.container_v1.types.DatabaseEncryption): + Configuration of etcd encryption. + vertical_pod_autoscaling (google.cloud.container_v1.types.VerticalPodAutoscaling): + Cluster-level Vertical Pod Autoscaling + configuration. + shielded_nodes (google.cloud.container_v1.types.ShieldedNodes): + Shielded Nodes configuration. + release_channel (google.cloud.container_v1.types.ReleaseChannel): + Release channel configuration. If left + unspecified on cluster creation and a version is + specified, the cluster is enrolled in the most + mature release channel where the version is + available (first checking STABLE, then REGULAR, + and finally RAPID). Otherwise, if no release + channel configuration and no version is + specified, the cluster is enrolled in the + REGULAR channel with its default version. + workload_identity_config (google.cloud.container_v1.types.WorkloadIdentityConfig): + Configuration for the use of Kubernetes + Service Accounts in GCP IAM policies. + mesh_certificates (google.cloud.container_v1.types.MeshCertificates): + Configuration for issuance of mTLS keys and + certificates to Kubernetes pods. + cost_management_config (google.cloud.container_v1.types.CostManagementConfig): + Configuration for the fine-grained cost + management feature. + notification_config (google.cloud.container_v1.types.NotificationConfig): + Notification configuration of the cluster. + confidential_nodes (google.cloud.container_v1.types.ConfidentialNodes): + Configuration of Confidential Nodes. + All the nodes in the cluster will be + Confidential VM once enabled. + identity_service_config (google.cloud.container_v1.types.IdentityServiceConfig): + Configuration for Identity Service component. + self_link (str): + Output only. Server-defined URL for the + resource. + zone (str): + Output only. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field is deprecated, use + location instead. + endpoint (str): + Output only. The IP address of this cluster's master + endpoint. The endpoint can be accessed from the internet at + ``https://username:password@endpoint/``. + + See the ``masterAuth`` property of this resource for + username and password information. + initial_cluster_version (str): + The initial Kubernetes version for this + cluster. Valid versions are those found in + validMasterVersions returned by getServerConfig. + The version can be upgraded over time; such + upgrades are reflected in currentMasterVersion + and currentNodeVersion. + + Users may specify either explicit versions + offered by Kubernetes Engine or version aliases, + which have the following behavior: + + - "latest": picks the highest valid Kubernetes + version + - "1.X": picks the highest valid patch+gke.N + patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N patch + in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit Kubernetes + version + - "","-": picks the default Kubernetes version + current_master_version (str): + Output only. The current software version of + the master endpoint. + current_node_version (str): + Output only. Deprecated, use + `NodePools.version `__ + instead. The current version of the node software + components. If they are currently at multiple versions + because they're in the process of being upgraded, this + reflects the minimum version of all nodes. + create_time (str): + Output only. The time the cluster was created, in + `RFC3339 `__ text + format. + status (google.cloud.container_v1.types.Cluster.Status): + Output only. The current status of this + cluster. + status_message (str): + Output only. Deprecated. Use conditions + instead. Additional information about the + current status of this cluster, if available. + node_ipv4_cidr_size (int): + Output only. The size of the address space on each node for + hosting containers. This is provisioned from within the + ``container_ipv4_cidr`` range. This field will only be set + when cluster is in route-based network mode. + services_ipv4_cidr (str): + Output only. The IP address range of the Kubernetes services + in this cluster, in + `CIDR `__ + notation (e.g. ``1.2.3.4/29``). Service addresses are + typically put in the last ``/16`` from the container CIDR. + instance_group_urls (MutableSequence[str]): + Output only. Deprecated. Use node_pools.instance_group_urls. + current_node_count (int): + Output only. The number of nodes currently in + the cluster. Deprecated. Call Kubernetes API + directly to retrieve node information. + expire_time (str): + Output only. The time the cluster will be automatically + deleted in + `RFC3339 `__ text + format. + location (str): + Output only. The name of the Google Compute Engine + `zone `__ + or + `region `__ + in which the cluster resides. + enable_tpu (bool): + Enable the ability to use Cloud TPUs in this + cluster. + tpu_ipv4_cidr_block (str): + Output only. The IP address range of the Cloud TPUs in this + cluster, in + `CIDR `__ + notation (e.g. ``1.2.3.4/29``). + conditions (MutableSequence[google.cloud.container_v1.types.StatusCondition]): + Which conditions caused the current cluster + state. + autopilot (google.cloud.container_v1.types.Autopilot): + Autopilot configuration for the cluster. + id (str): + Output only. Unique id for the cluster. + node_pool_defaults (google.cloud.container_v1.types.NodePoolDefaults): + Default NodePool settings for the entire + cluster. These settings are overridden if + specified on the specific NodePool object. + + This field is a member of `oneof`_ ``_node_pool_defaults``. + logging_config (google.cloud.container_v1.types.LoggingConfig): + Logging configuration for the cluster. + monitoring_config (google.cloud.container_v1.types.MonitoringConfig): + Monitoring configuration for the cluster. + node_pool_auto_config (google.cloud.container_v1.types.NodePoolAutoConfig): + Node pool configs that apply to all + auto-provisioned node pools in autopilot + clusters and node auto-provisioning enabled + clusters. + etag (str): + This checksum is computed by the server based + on the value of cluster fields, and may be sent + on update requests to ensure the client has an + up-to-date value before proceeding. + fleet (google.cloud.container_v1.types.Fleet): + Fleet information for the cluster. + security_posture_config (google.cloud.container_v1.types.SecurityPostureConfig): + Enable/Disable Security Posture API features + for the cluster. + control_plane_endpoints_config (google.cloud.container_v1.types.ControlPlaneEndpointsConfig): + Configuration for all cluster's control plane + endpoints. + enable_k8s_beta_apis (google.cloud.container_v1.types.K8sBetaAPIConfig): + Beta APIs Config + enterprise_config (google.cloud.container_v1.types.EnterpriseConfig): + GKE Enterprise Configuration. + secret_manager_config (google.cloud.container_v1.types.SecretManagerConfig): + Secret CSI driver configuration. + compliance_posture_config (google.cloud.container_v1.types.CompliancePostureConfig): + Enable/Disable Compliance Posture features + for the cluster. + satisfies_pzs (bool): + Output only. Reserved for future use. + + This field is a member of `oneof`_ ``_satisfies_pzs``. + satisfies_pzi (bool): + Output only. Reserved for future use. + + This field is a member of `oneof`_ ``_satisfies_pzi``. + user_managed_keys_config (google.cloud.container_v1.types.UserManagedKeysConfig): + The Custom keys configuration for the + cluster. + + This field is a member of `oneof`_ ``_user_managed_keys_config``. + rbac_binding_config (google.cloud.container_v1.types.RBACBindingConfig): + RBACBindingConfig allows user to restrict + ClusterRoleBindings an RoleBindings that can be + created. + + This field is a member of `oneof`_ ``_rbac_binding_config``. + """ + class Status(proto.Enum): + r"""The current status of the cluster. + + Values: + STATUS_UNSPECIFIED (0): + Not set. + PROVISIONING (1): + The PROVISIONING state indicates the cluster + is being created. + RUNNING (2): + The RUNNING state indicates the cluster has + been created and is fully usable. + RECONCILING (3): + The RECONCILING state indicates that some work is actively + being done on the cluster, such as upgrading the master or + node software. Details can be found in the ``statusMessage`` + field. + STOPPING (4): + The STOPPING state indicates the cluster is + being deleted. + ERROR (5): + The ERROR state indicates the cluster is unusable. It will + be automatically deleted. Details can be found in the + ``statusMessage`` field. + DEGRADED (6): + The DEGRADED state indicates the cluster requires user + action to restore full functionality. Details can be found + in the ``statusMessage`` field. + """ + STATUS_UNSPECIFIED = 0 + PROVISIONING = 1 + RUNNING = 2 + RECONCILING = 3 + STOPPING = 4 + ERROR = 5 + DEGRADED = 6 + + name: str = proto.Field( + proto.STRING, + number=1, + ) + description: str = proto.Field( + proto.STRING, + number=2, + ) + initial_node_count: int = proto.Field( + proto.INT32, + number=3, + ) + node_config: 'NodeConfig' = proto.Field( + proto.MESSAGE, + number=4, + message='NodeConfig', + ) + master_auth: 'MasterAuth' = proto.Field( + proto.MESSAGE, + number=5, + message='MasterAuth', + ) + logging_service: str = proto.Field( + proto.STRING, + number=6, + ) + monitoring_service: str = proto.Field( + proto.STRING, + number=7, + ) + network: str = proto.Field( + proto.STRING, + number=8, + ) + cluster_ipv4_cidr: str = proto.Field( + proto.STRING, + number=9, + ) + addons_config: 'AddonsConfig' = proto.Field( + proto.MESSAGE, + number=10, + message='AddonsConfig', + ) + subnetwork: str = proto.Field( + proto.STRING, + number=11, + ) + node_pools: MutableSequence['NodePool'] = proto.RepeatedField( + proto.MESSAGE, + number=12, + message='NodePool', + ) + locations: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=13, + ) + enable_kubernetes_alpha: bool = proto.Field( + proto.BOOL, + number=14, + ) + resource_labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=15, + ) + label_fingerprint: str = proto.Field( + proto.STRING, + number=16, + ) + legacy_abac: 'LegacyAbac' = proto.Field( + proto.MESSAGE, + number=18, + message='LegacyAbac', + ) + network_policy: 'NetworkPolicy' = proto.Field( + proto.MESSAGE, + number=19, + message='NetworkPolicy', + ) + ip_allocation_policy: 'IPAllocationPolicy' = proto.Field( + proto.MESSAGE, + number=20, + message='IPAllocationPolicy', + ) + master_authorized_networks_config: 'MasterAuthorizedNetworksConfig' = proto.Field( + proto.MESSAGE, + number=22, + message='MasterAuthorizedNetworksConfig', + ) + maintenance_policy: 'MaintenancePolicy' = proto.Field( + proto.MESSAGE, + number=23, + message='MaintenancePolicy', + ) + binary_authorization: 'BinaryAuthorization' = proto.Field( + proto.MESSAGE, + number=24, + message='BinaryAuthorization', + ) + autoscaling: 'ClusterAutoscaling' = proto.Field( + proto.MESSAGE, + number=26, + message='ClusterAutoscaling', + ) + network_config: 'NetworkConfig' = proto.Field( + proto.MESSAGE, + number=27, + message='NetworkConfig', + ) + default_max_pods_constraint: 'MaxPodsConstraint' = proto.Field( + proto.MESSAGE, + number=30, + message='MaxPodsConstraint', + ) + resource_usage_export_config: 'ResourceUsageExportConfig' = proto.Field( + proto.MESSAGE, + number=33, + message='ResourceUsageExportConfig', + ) + authenticator_groups_config: 'AuthenticatorGroupsConfig' = proto.Field( + proto.MESSAGE, + number=34, + message='AuthenticatorGroupsConfig', + ) + private_cluster_config: 'PrivateClusterConfig' = proto.Field( + proto.MESSAGE, + number=37, + message='PrivateClusterConfig', + ) + database_encryption: 'DatabaseEncryption' = proto.Field( + proto.MESSAGE, + number=38, + message='DatabaseEncryption', + ) + vertical_pod_autoscaling: 'VerticalPodAutoscaling' = proto.Field( + proto.MESSAGE, + number=39, + message='VerticalPodAutoscaling', + ) + shielded_nodes: 'ShieldedNodes' = proto.Field( + proto.MESSAGE, + number=40, + message='ShieldedNodes', + ) + release_channel: 'ReleaseChannel' = proto.Field( + proto.MESSAGE, + number=41, + message='ReleaseChannel', + ) + workload_identity_config: 'WorkloadIdentityConfig' = proto.Field( + proto.MESSAGE, + number=43, + message='WorkloadIdentityConfig', + ) + mesh_certificates: 'MeshCertificates' = proto.Field( + proto.MESSAGE, + number=67, + message='MeshCertificates', + ) + cost_management_config: 'CostManagementConfig' = proto.Field( + proto.MESSAGE, + number=45, + message='CostManagementConfig', + ) + notification_config: 'NotificationConfig' = proto.Field( + proto.MESSAGE, + number=49, + message='NotificationConfig', + ) + confidential_nodes: 'ConfidentialNodes' = proto.Field( + proto.MESSAGE, + number=50, + message='ConfidentialNodes', + ) + identity_service_config: 'IdentityServiceConfig' = proto.Field( + proto.MESSAGE, + number=54, + message='IdentityServiceConfig', + ) + self_link: str = proto.Field( + proto.STRING, + number=100, + ) + zone: str = proto.Field( + proto.STRING, + number=101, + ) + endpoint: str = proto.Field( + proto.STRING, + number=102, + ) + initial_cluster_version: str = proto.Field( + proto.STRING, + number=103, + ) + current_master_version: str = proto.Field( + proto.STRING, + number=104, + ) + current_node_version: str = proto.Field( + proto.STRING, + number=105, + ) + create_time: str = proto.Field( + proto.STRING, + number=106, + ) + status: Status = proto.Field( + proto.ENUM, + number=107, + enum=Status, + ) + status_message: str = proto.Field( + proto.STRING, + number=108, + ) + node_ipv4_cidr_size: int = proto.Field( + proto.INT32, + number=109, + ) + services_ipv4_cidr: str = proto.Field( + proto.STRING, + number=110, + ) + instance_group_urls: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=111, + ) + current_node_count: int = proto.Field( + proto.INT32, + number=112, + ) + expire_time: str = proto.Field( + proto.STRING, + number=113, + ) + location: str = proto.Field( + proto.STRING, + number=114, + ) + enable_tpu: bool = proto.Field( + proto.BOOL, + number=115, + ) + tpu_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=116, + ) + conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( + proto.MESSAGE, + number=118, + message='StatusCondition', + ) + autopilot: 'Autopilot' = proto.Field( + proto.MESSAGE, + number=128, + message='Autopilot', + ) + id: str = proto.Field( + proto.STRING, + number=129, + ) + node_pool_defaults: 'NodePoolDefaults' = proto.Field( + proto.MESSAGE, + number=131, + optional=True, + message='NodePoolDefaults', + ) + logging_config: 'LoggingConfig' = proto.Field( + proto.MESSAGE, + number=132, + message='LoggingConfig', + ) + monitoring_config: 'MonitoringConfig' = proto.Field( + proto.MESSAGE, + number=133, + message='MonitoringConfig', + ) + node_pool_auto_config: 'NodePoolAutoConfig' = proto.Field( + proto.MESSAGE, + number=136, + message='NodePoolAutoConfig', + ) + etag: str = proto.Field( + proto.STRING, + number=139, + ) + fleet: 'Fleet' = proto.Field( + proto.MESSAGE, + number=140, + message='Fleet', + ) + security_posture_config: 'SecurityPostureConfig' = proto.Field( + proto.MESSAGE, + number=145, + message='SecurityPostureConfig', + ) + control_plane_endpoints_config: 'ControlPlaneEndpointsConfig' = proto.Field( + proto.MESSAGE, + number=146, + message='ControlPlaneEndpointsConfig', + ) + enable_k8s_beta_apis: 'K8sBetaAPIConfig' = proto.Field( + proto.MESSAGE, + number=143, + message='K8sBetaAPIConfig', + ) + enterprise_config: 'EnterpriseConfig' = proto.Field( + proto.MESSAGE, + number=149, + message='EnterpriseConfig', + ) + secret_manager_config: 'SecretManagerConfig' = proto.Field( + proto.MESSAGE, + number=150, + message='SecretManagerConfig', + ) + compliance_posture_config: 'CompliancePostureConfig' = proto.Field( + proto.MESSAGE, + number=151, + message='CompliancePostureConfig', + ) + satisfies_pzs: bool = proto.Field( + proto.BOOL, + number=152, + optional=True, + ) + satisfies_pzi: bool = proto.Field( + proto.BOOL, + number=153, + optional=True, + ) + user_managed_keys_config: 'UserManagedKeysConfig' = proto.Field( + proto.MESSAGE, + number=154, + optional=True, + message='UserManagedKeysConfig', + ) + rbac_binding_config: 'RBACBindingConfig' = proto.Field( + proto.MESSAGE, + number=156, + optional=True, + message='RBACBindingConfig', + ) + + +class RBACBindingConfig(proto.Message): + r"""RBACBindingConfig allows user to restrict ClusterRoleBindings + an RoleBindings that can be created. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + enable_insecure_binding_system_unauthenticated (bool): + Setting this to true will allow any + ClusterRoleBinding and RoleBinding with subjets + system:anonymous or system:unauthenticated. + + This field is a member of `oneof`_ ``_enable_insecure_binding_system_unauthenticated``. + enable_insecure_binding_system_authenticated (bool): + Setting this to true will allow any + ClusterRoleBinding and RoleBinding with subjects + system:authenticated. + + This field is a member of `oneof`_ ``_enable_insecure_binding_system_authenticated``. + """ + + enable_insecure_binding_system_unauthenticated: bool = proto.Field( + proto.BOOL, + number=1, + optional=True, + ) + enable_insecure_binding_system_authenticated: bool = proto.Field( + proto.BOOL, + number=2, + optional=True, + ) + + +class UserManagedKeysConfig(proto.Message): + r"""UserManagedKeysConfig holds the resource address to Keys + which are used for signing certs and token that are used for + communication within cluster. + + Attributes: + cluster_ca (str): + The Certificate Authority Service caPool to + use for the cluster CA in this cluster. + etcd_api_ca (str): + Resource path of the Certificate Authority + Service caPool to use for the etcd API CA in + this cluster. + etcd_peer_ca (str): + Resource path of the Certificate Authority + Service caPool to use for the etcd peer CA in + this cluster. + service_account_signing_keys (MutableSequence[str]): + The Cloud KMS cryptoKeyVersions to use for signing service + account JWTs issued by this cluster. + + Format: + ``projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}`` + service_account_verification_keys (MutableSequence[str]): + The Cloud KMS cryptoKeyVersions to use for verifying service + account JWTs issued by this cluster. + + Format: + ``projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}`` + aggregation_ca (str): + The Certificate Authority Service caPool to + use for the aggregation CA in this cluster. + control_plane_disk_encryption_key (str): + The Cloud KMS cryptoKey to use for + Confidential Hyperdisk on the control plane + nodes. + gkeops_etcd_backup_encryption_key (str): + Resource path of the Cloud KMS cryptoKey to + use for encryption of internal etcd backups. + """ + + cluster_ca: str = proto.Field( + proto.STRING, + number=10, + ) + etcd_api_ca: str = proto.Field( + proto.STRING, + number=11, + ) + etcd_peer_ca: str = proto.Field( + proto.STRING, + number=12, + ) + service_account_signing_keys: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=13, + ) + service_account_verification_keys: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=14, + ) + aggregation_ca: str = proto.Field( + proto.STRING, + number=15, + ) + control_plane_disk_encryption_key: str = proto.Field( + proto.STRING, + number=16, + ) + gkeops_etcd_backup_encryption_key: str = proto.Field( + proto.STRING, + number=17, + ) + + +class CompliancePostureConfig(proto.Message): + r"""CompliancePostureConfig defines the settings needed to + enable/disable features for the Compliance Posture. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + mode (google.cloud.container_v1.types.CompliancePostureConfig.Mode): + Defines the enablement mode for Compliance + Posture. + + This field is a member of `oneof`_ ``_mode``. + compliance_standards (MutableSequence[google.cloud.container_v1.types.CompliancePostureConfig.ComplianceStandard]): + List of enabled compliance standards. + """ + class Mode(proto.Enum): + r"""Mode defines enablement mode for Compliance Posture. + + Values: + MODE_UNSPECIFIED (0): + Default value not specified. + DISABLED (1): + Disables Compliance Posture features on the + cluster. + ENABLED (2): + Enables Compliance Posture features on the + cluster. + """ + MODE_UNSPECIFIED = 0 + DISABLED = 1 + ENABLED = 2 + + class ComplianceStandard(proto.Message): + r"""Defines the details of a compliance standard. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + standard (str): + Name of the compliance standard. + + This field is a member of `oneof`_ ``_standard``. + """ + + standard: str = proto.Field( + proto.STRING, + number=1, + optional=True, + ) + + mode: Mode = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum=Mode, + ) + compliance_standards: MutableSequence[ComplianceStandard] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=ComplianceStandard, + ) + + +class K8sBetaAPIConfig(proto.Message): + r"""K8sBetaAPIConfig , configuration for beta APIs + + Attributes: + enabled_apis (MutableSequence[str]): + Enabled k8s beta APIs. + """ + + enabled_apis: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + + +class SecurityPostureConfig(proto.Message): + r"""SecurityPostureConfig defines the flags needed to + enable/disable features for the Security Posture API. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + mode (google.cloud.container_v1.types.SecurityPostureConfig.Mode): + Sets which mode to use for Security Posture + features. + + This field is a member of `oneof`_ ``_mode``. + vulnerability_mode (google.cloud.container_v1.types.SecurityPostureConfig.VulnerabilityMode): + Sets which mode to use for vulnerability + scanning. + + This field is a member of `oneof`_ ``_vulnerability_mode``. + """ + class Mode(proto.Enum): + r"""Mode defines enablement mode for GKE Security posture + features. + + Values: + MODE_UNSPECIFIED (0): + Default value not specified. + DISABLED (1): + Disables Security Posture features on the + cluster. + BASIC (2): + Applies Security Posture features on the + cluster. + ENTERPRISE (3): + Applies the Security Posture off cluster + Enterprise level features. + """ + MODE_UNSPECIFIED = 0 + DISABLED = 1 + BASIC = 2 + ENTERPRISE = 3 + + class VulnerabilityMode(proto.Enum): + r"""VulnerabilityMode defines enablement mode for vulnerability + scanning. + + Values: + VULNERABILITY_MODE_UNSPECIFIED (0): + Default value not specified. + VULNERABILITY_DISABLED (1): + Disables vulnerability scanning on the + cluster. + VULNERABILITY_BASIC (2): + Applies basic vulnerability scanning on the + cluster. + VULNERABILITY_ENTERPRISE (3): + Applies the Security Posture's vulnerability + on cluster Enterprise level features. + """ + VULNERABILITY_MODE_UNSPECIFIED = 0 + VULNERABILITY_DISABLED = 1 + VULNERABILITY_BASIC = 2 + VULNERABILITY_ENTERPRISE = 3 + + mode: Mode = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum=Mode, + ) + vulnerability_mode: VulnerabilityMode = proto.Field( + proto.ENUM, + number=2, + optional=True, + enum=VulnerabilityMode, + ) + + +class NodePoolAutoConfig(proto.Message): + r"""Node pool configs that apply to all auto-provisioned node + pools in autopilot clusters and node auto-provisioning enabled + clusters. + + Attributes: + network_tags (google.cloud.container_v1.types.NetworkTags): + The list of instance tags applied to all + nodes. Tags are used to identify valid sources + or targets for network firewalls and are + specified by the client during cluster creation. + Each tag within the list must comply with + RFC1035. + resource_manager_tags (google.cloud.container_v1.types.ResourceManagerTags): + Resource manager tag keys and values to be + attached to the nodes for managing Compute + Engine firewalls using Network Firewall + Policies. + node_kubelet_config (google.cloud.container_v1.types.NodeKubeletConfig): + NodeKubeletConfig controls the defaults for autoprovisioned + node-pools. + + Currently only ``insecure_kubelet_readonly_port_enabled`` + can be set here. + linux_node_config (google.cloud.container_v1.types.LinuxNodeConfig): + Output only. Configuration options for Linux + nodes. + """ + + network_tags: 'NetworkTags' = proto.Field( + proto.MESSAGE, + number=1, + message='NetworkTags', + ) + resource_manager_tags: 'ResourceManagerTags' = proto.Field( + proto.MESSAGE, + number=2, + message='ResourceManagerTags', + ) + node_kubelet_config: 'NodeKubeletConfig' = proto.Field( + proto.MESSAGE, + number=3, + message='NodeKubeletConfig', + ) + linux_node_config: 'LinuxNodeConfig' = proto.Field( + proto.MESSAGE, + number=4, + message='LinuxNodeConfig', + ) + + +class NodePoolDefaults(proto.Message): + r"""Subset of Nodepool message that has defaults. + + Attributes: + node_config_defaults (google.cloud.container_v1.types.NodeConfigDefaults): + Subset of NodeConfig message that has + defaults. + """ + + node_config_defaults: 'NodeConfigDefaults' = proto.Field( + proto.MESSAGE, + number=1, + message='NodeConfigDefaults', + ) + + +class NodeConfigDefaults(proto.Message): + r"""Subset of NodeConfig message that has defaults. + + Attributes: + gcfs_config (google.cloud.container_v1.types.GcfsConfig): + GCFS (Google Container File System, also + known as Riptide) options. + logging_config (google.cloud.container_v1.types.NodePoolLoggingConfig): + Logging configuration for node pools. + containerd_config (google.cloud.container_v1.types.ContainerdConfig): + Parameters for containerd customization. + node_kubelet_config (google.cloud.container_v1.types.NodeKubeletConfig): + NodeKubeletConfig controls the defaults for new node-pools. + + Currently only ``insecure_kubelet_readonly_port_enabled`` + can be set here. + """ + + gcfs_config: 'GcfsConfig' = proto.Field( + proto.MESSAGE, + number=1, + message='GcfsConfig', + ) + logging_config: 'NodePoolLoggingConfig' = proto.Field( + proto.MESSAGE, + number=3, + message='NodePoolLoggingConfig', + ) + containerd_config: 'ContainerdConfig' = proto.Field( + proto.MESSAGE, + number=4, + message='ContainerdConfig', + ) + node_kubelet_config: 'NodeKubeletConfig' = proto.Field( + proto.MESSAGE, + number=6, + message='NodeKubeletConfig', + ) + + +class ClusterUpdate(proto.Message): + r"""ClusterUpdate describes an update to the cluster. Exactly one + update can be applied to a cluster with each request, so at most + one field can be provided. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + desired_node_version (str): + The Kubernetes version to change the nodes to + (typically an upgrade). + + Users may specify either explicit versions + offered by Kubernetes Engine or version aliases, + which have the following behavior: + + - "latest": picks the highest valid Kubernetes + version + - "1.X": picks the highest valid patch+gke.N + patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N patch + in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit Kubernetes + version + - "-": picks the Kubernetes master version + desired_monitoring_service (str): + The monitoring service the cluster should use to write + metrics. Currently available options: + + - "monitoring.googleapis.com/kubernetes" - The Cloud + Monitoring service with a Kubernetes-native resource + model + - ``monitoring.googleapis.com`` - The legacy Cloud + Monitoring service (no longer available as of GKE 1.15). + - ``none`` - No metrics will be exported from the cluster. + + If left as an empty + string,\ ``monitoring.googleapis.com/kubernetes`` will be + used for GKE 1.14+ or ``monitoring.googleapis.com`` for + earlier versions. + desired_addons_config (google.cloud.container_v1.types.AddonsConfig): + Configurations for the various addons + available to run in the cluster. + desired_node_pool_id (str): + The node pool to be upgraded. This field is mandatory if + "desired_node_version", "desired_image_family" or + "desired_node_pool_autoscaling" is specified and there is + more than one node pool on the cluster. + desired_image_type (str): + The desired image type for the node pool. NOTE: Set the + "desired_node_pool" field as well. + desired_database_encryption (google.cloud.container_v1.types.DatabaseEncryption): + Configuration of etcd encryption. + desired_workload_identity_config (google.cloud.container_v1.types.WorkloadIdentityConfig): + Configuration for Workload Identity. + desired_mesh_certificates (google.cloud.container_v1.types.MeshCertificates): + Configuration for issuance of mTLS keys and + certificates to Kubernetes pods. + desired_shielded_nodes (google.cloud.container_v1.types.ShieldedNodes): + Configuration for Shielded Nodes. + desired_cost_management_config (google.cloud.container_v1.types.CostManagementConfig): + The desired configuration for the + fine-grained cost management feature. + desired_dns_config (google.cloud.container_v1.types.DNSConfig): + DNSConfig contains clusterDNS config for this + cluster. + desired_node_pool_autoscaling (google.cloud.container_v1.types.NodePoolAutoscaling): + Autoscaler configuration for the node pool specified in + desired_node_pool_id. If there is only one pool in the + cluster and desired_node_pool_id is not provided then the + change applies to that single node pool. + desired_locations (MutableSequence[str]): + The desired list of Google Compute Engine + `zones `__ + in which the cluster's nodes should be located. + + This list must always include the cluster's primary zone. + + Warning: changing cluster locations will update the + locations of all node pools and will result in nodes being + added and/or removed. + desired_master_authorized_networks_config (google.cloud.container_v1.types.MasterAuthorizedNetworksConfig): + The desired configuration options for master authorized + networks feature. + + Deprecated: Use + desired_control_plane_endpoints_config.ip_endpoints_config.authorized_networks_config + instead. + desired_cluster_autoscaling (google.cloud.container_v1.types.ClusterAutoscaling): + Cluster-level autoscaling configuration. + desired_binary_authorization (google.cloud.container_v1.types.BinaryAuthorization): + The desired configuration options for the + Binary Authorization feature. + desired_logging_service (str): + The logging service the cluster should use to write logs. + Currently available options: + + - ``logging.googleapis.com/kubernetes`` - The Cloud Logging + service with a Kubernetes-native resource model + - ``logging.googleapis.com`` - The legacy Cloud Logging + service (no longer available as of GKE 1.15). + - ``none`` - no logs will be exported from the cluster. + + If left as an empty + string,\ ``logging.googleapis.com/kubernetes`` will be used + for GKE 1.14+ or ``logging.googleapis.com`` for earlier + versions. + desired_resource_usage_export_config (google.cloud.container_v1.types.ResourceUsageExportConfig): + The desired configuration for exporting + resource usage. + desired_vertical_pod_autoscaling (google.cloud.container_v1.types.VerticalPodAutoscaling): + Cluster-level Vertical Pod Autoscaling + configuration. + desired_private_cluster_config (google.cloud.container_v1.types.PrivateClusterConfig): + The desired private cluster configuration. + master_global_access_config is the only field that can be + changed via this field. See also + [ClusterUpdate.desired_enable_private_endpoint][google.container.v1.ClusterUpdate.desired_enable_private_endpoint] + for modifying other fields within + [PrivateClusterConfig][google.container.v1.PrivateClusterConfig]. + + Deprecated: Use + desired_control_plane_endpoints_config.ip_endpoints_config.global_access + instead. + desired_intra_node_visibility_config (google.cloud.container_v1.types.IntraNodeVisibilityConfig): + The desired config of Intra-node visibility. + desired_default_snat_status (google.cloud.container_v1.types.DefaultSnatStatus): + The desired status of whether to disable + default sNAT for this cluster. + desired_release_channel (google.cloud.container_v1.types.ReleaseChannel): + The desired release channel configuration. + desired_l4ilb_subsetting_config (google.cloud.container_v1.types.ILBSubsettingConfig): + The desired L4 Internal Load Balancer + Subsetting configuration. + desired_datapath_provider (google.cloud.container_v1.types.DatapathProvider): + The desired datapath provider for the + cluster. + desired_private_ipv6_google_access (google.cloud.container_v1.types.PrivateIPv6GoogleAccess): + The desired state of IPv6 connectivity to + Google Services. + desired_notification_config (google.cloud.container_v1.types.NotificationConfig): + The desired notification configuration. + desired_authenticator_groups_config (google.cloud.container_v1.types.AuthenticatorGroupsConfig): + The desired authenticator groups config for + the cluster. + desired_logging_config (google.cloud.container_v1.types.LoggingConfig): + The desired logging configuration. + desired_monitoring_config (google.cloud.container_v1.types.MonitoringConfig): + The desired monitoring configuration. + desired_identity_service_config (google.cloud.container_v1.types.IdentityServiceConfig): + The desired Identity Service component + configuration. + desired_service_external_ips_config (google.cloud.container_v1.types.ServiceExternalIPsConfig): + ServiceExternalIPsConfig specifies the config + for the use of Services with ExternalIPs field. + desired_enable_private_endpoint (bool): + Enable/Disable private endpoint for the cluster's master. + + Deprecated: Use + desired_control_plane_endpoints_config.ip_endpoints_config.enable_public_endpoint + instead. Note that the value of enable_public_endpoint is + reversed: if enable_private_endpoint is false, then + enable_public_endpoint will be true. + + This field is a member of `oneof`_ ``_desired_enable_private_endpoint``. + desired_default_enable_private_nodes (bool): + Override the default setting of whether future created nodes + have private IP addresses only, namely + [NetworkConfig.default_enable_private_nodes][google.container.v1.NetworkConfig.default_enable_private_nodes] + + This field is a member of `oneof`_ ``_desired_default_enable_private_nodes``. + desired_control_plane_endpoints_config (google.cloud.container_v1.types.ControlPlaneEndpointsConfig): + [Control plane + endpoints][google.container.v1.Cluster.control_plane_endpoints_config] + configuration. + desired_master_version (str): + The Kubernetes version to change the master + to. + Users may specify either explicit versions + offered by Kubernetes Engine or version aliases, + which have the following behavior: + + - "latest": picks the highest valid Kubernetes + version + - "1.X": picks the highest valid patch+gke.N + patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N patch + in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit Kubernetes + version + - "-": picks the default Kubernetes version + desired_gcfs_config (google.cloud.container_v1.types.GcfsConfig): + The desired GCFS config for the cluster + desired_node_pool_auto_config_network_tags (google.cloud.container_v1.types.NetworkTags): + The desired network tags that apply to all + auto-provisioned node pools in autopilot + clusters and node auto-provisioning enabled + clusters. + desired_gateway_api_config (google.cloud.container_v1.types.GatewayAPIConfig): + The desired config of Gateway API on this + cluster. + etag (str): + The current etag of the cluster. + If an etag is provided and does not match the + current etag of the cluster, update will be + blocked and an ABORTED error will be returned. + desired_node_pool_logging_config (google.cloud.container_v1.types.NodePoolLoggingConfig): + The desired node pool logging configuration + defaults for the cluster. + desired_fleet (google.cloud.container_v1.types.Fleet): + The desired fleet configuration for the + cluster. + desired_stack_type (google.cloud.container_v1.types.StackType): + The desired stack type of the cluster. + If a stack type is provided and does not match + the current stack type of the cluster, update + will attempt to change the stack type to the new + type. + additional_pod_ranges_config (google.cloud.container_v1.types.AdditionalPodRangesConfig): + The additional pod ranges to be added to the + cluster. These pod ranges can be used by node + pools to allocate pod IPs. + removed_additional_pod_ranges_config (google.cloud.container_v1.types.AdditionalPodRangesConfig): + The additional pod ranges that are to be removed from the + cluster. The pod ranges specified here must have been + specified earlier in the 'additional_pod_ranges_config' + argument. + enable_k8s_beta_apis (google.cloud.container_v1.types.K8sBetaAPIConfig): + Kubernetes open source beta apis enabled on + the cluster. Only beta apis + desired_security_posture_config (google.cloud.container_v1.types.SecurityPostureConfig): + Enable/Disable Security Posture API features + for the cluster. + desired_network_performance_config (google.cloud.container_v1.types.NetworkConfig.ClusterNetworkPerformanceConfig): + The desired network performance config. + desired_enable_fqdn_network_policy (bool): + Enable/Disable FQDN Network Policy for the + cluster. + + This field is a member of `oneof`_ ``_desired_enable_fqdn_network_policy``. + desired_autopilot_workload_policy_config (google.cloud.container_v1.types.WorkloadPolicyConfig): + The desired workload policy configuration for + the autopilot cluster. + desired_k8s_beta_apis (google.cloud.container_v1.types.K8sBetaAPIConfig): + Desired Beta APIs to be enabled for cluster. + desired_containerd_config (google.cloud.container_v1.types.ContainerdConfig): + The desired containerd config for the + cluster. + desired_enable_multi_networking (bool): + Enable/Disable Multi-Networking for the + cluster + + This field is a member of `oneof`_ ``_desired_enable_multi_networking``. + desired_node_pool_auto_config_resource_manager_tags (google.cloud.container_v1.types.ResourceManagerTags): + The desired resource manager tags that apply + to all auto-provisioned node pools in autopilot + clusters and node auto-provisioning enabled + clusters. + desired_in_transit_encryption_config (google.cloud.container_v1.types.InTransitEncryptionConfig): + Specify the details of in-transit encryption. + + This field is a member of `oneof`_ ``_desired_in_transit_encryption_config``. + desired_enable_cilium_clusterwide_network_policy (bool): + Enable/Disable Cilium Clusterwide Network + Policy for the cluster. + + This field is a member of `oneof`_ ``_desired_enable_cilium_clusterwide_network_policy``. + desired_secret_manager_config (google.cloud.container_v1.types.SecretManagerConfig): + Enable/Disable Secret Manager Config. + + This field is a member of `oneof`_ ``_desired_secret_manager_config``. + desired_compliance_posture_config (google.cloud.container_v1.types.CompliancePostureConfig): + Enable/Disable Compliance Posture features + for the cluster. + + This field is a member of `oneof`_ ``_desired_compliance_posture_config``. + desired_node_kubelet_config (google.cloud.container_v1.types.NodeKubeletConfig): + The desired node kubelet config for the + cluster. + desired_node_pool_auto_config_kubelet_config (google.cloud.container_v1.types.NodeKubeletConfig): + The desired node kubelet config for all + auto-provisioned node pools in autopilot + clusters and node auto-provisioning enabled + clusters. + user_managed_keys_config (google.cloud.container_v1.types.UserManagedKeysConfig): + The Custom keys configuration for the + cluster. + desired_rbac_binding_config (google.cloud.container_v1.types.RBACBindingConfig): + RBACBindingConfig allows user to restrict + ClusterRoleBindings an RoleBindings that can be + created. + + This field is a member of `oneof`_ ``_desired_rbac_binding_config``. + desired_enterprise_config (google.cloud.container_v1.types.DesiredEnterpriseConfig): + The desired enterprise configuration for the + cluster. + desired_node_pool_auto_config_linux_node_config (google.cloud.container_v1.types.LinuxNodeConfig): + The desired Linux node config for all auto-provisioned node + pools in autopilot clusters and node auto-provisioning + enabled clusters. + + Currently only ``cgroup_mode`` can be set here. + """ + + desired_node_version: str = proto.Field( + proto.STRING, + number=4, + ) + desired_monitoring_service: str = proto.Field( + proto.STRING, + number=5, + ) + desired_addons_config: 'AddonsConfig' = proto.Field( + proto.MESSAGE, + number=6, + message='AddonsConfig', + ) + desired_node_pool_id: str = proto.Field( + proto.STRING, + number=7, + ) + desired_image_type: str = proto.Field( + proto.STRING, + number=8, + ) + desired_database_encryption: 'DatabaseEncryption' = proto.Field( + proto.MESSAGE, + number=46, + message='DatabaseEncryption', + ) + desired_workload_identity_config: 'WorkloadIdentityConfig' = proto.Field( + proto.MESSAGE, + number=47, + message='WorkloadIdentityConfig', + ) + desired_mesh_certificates: 'MeshCertificates' = proto.Field( + proto.MESSAGE, + number=67, + message='MeshCertificates', + ) + desired_shielded_nodes: 'ShieldedNodes' = proto.Field( + proto.MESSAGE, + number=48, + message='ShieldedNodes', + ) + desired_cost_management_config: 'CostManagementConfig' = proto.Field( + proto.MESSAGE, + number=49, + message='CostManagementConfig', + ) + desired_dns_config: 'DNSConfig' = proto.Field( + proto.MESSAGE, + number=53, + message='DNSConfig', + ) + desired_node_pool_autoscaling: 'NodePoolAutoscaling' = proto.Field( + proto.MESSAGE, + number=9, + message='NodePoolAutoscaling', + ) + desired_locations: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=10, + ) + desired_master_authorized_networks_config: 'MasterAuthorizedNetworksConfig' = proto.Field( + proto.MESSAGE, + number=12, + message='MasterAuthorizedNetworksConfig', + ) + desired_cluster_autoscaling: 'ClusterAutoscaling' = proto.Field( + proto.MESSAGE, + number=15, + message='ClusterAutoscaling', + ) + desired_binary_authorization: 'BinaryAuthorization' = proto.Field( + proto.MESSAGE, + number=16, + message='BinaryAuthorization', + ) + desired_logging_service: str = proto.Field( + proto.STRING, + number=19, + ) + desired_resource_usage_export_config: 'ResourceUsageExportConfig' = proto.Field( + proto.MESSAGE, + number=21, + message='ResourceUsageExportConfig', + ) + desired_vertical_pod_autoscaling: 'VerticalPodAutoscaling' = proto.Field( + proto.MESSAGE, + number=22, + message='VerticalPodAutoscaling', + ) + desired_private_cluster_config: 'PrivateClusterConfig' = proto.Field( + proto.MESSAGE, + number=25, + message='PrivateClusterConfig', + ) + desired_intra_node_visibility_config: 'IntraNodeVisibilityConfig' = proto.Field( + proto.MESSAGE, + number=26, + message='IntraNodeVisibilityConfig', + ) + desired_default_snat_status: 'DefaultSnatStatus' = proto.Field( + proto.MESSAGE, + number=28, + message='DefaultSnatStatus', + ) + desired_release_channel: 'ReleaseChannel' = proto.Field( + proto.MESSAGE, + number=31, + message='ReleaseChannel', + ) + desired_l4ilb_subsetting_config: 'ILBSubsettingConfig' = proto.Field( + proto.MESSAGE, + number=39, + message='ILBSubsettingConfig', + ) + desired_datapath_provider: 'DatapathProvider' = proto.Field( + proto.ENUM, + number=50, + enum='DatapathProvider', + ) + desired_private_ipv6_google_access: 'PrivateIPv6GoogleAccess' = proto.Field( + proto.ENUM, + number=51, + enum='PrivateIPv6GoogleAccess', + ) + desired_notification_config: 'NotificationConfig' = proto.Field( + proto.MESSAGE, + number=55, + message='NotificationConfig', + ) + desired_authenticator_groups_config: 'AuthenticatorGroupsConfig' = proto.Field( + proto.MESSAGE, + number=63, + message='AuthenticatorGroupsConfig', + ) + desired_logging_config: 'LoggingConfig' = proto.Field( + proto.MESSAGE, + number=64, + message='LoggingConfig', + ) + desired_monitoring_config: 'MonitoringConfig' = proto.Field( + proto.MESSAGE, + number=65, + message='MonitoringConfig', + ) + desired_identity_service_config: 'IdentityServiceConfig' = proto.Field( + proto.MESSAGE, + number=66, + message='IdentityServiceConfig', + ) + desired_service_external_ips_config: 'ServiceExternalIPsConfig' = proto.Field( + proto.MESSAGE, + number=60, + message='ServiceExternalIPsConfig', + ) + desired_enable_private_endpoint: bool = proto.Field( + proto.BOOL, + number=71, + optional=True, + ) + desired_default_enable_private_nodes: bool = proto.Field( + proto.BOOL, + number=72, + optional=True, + ) + desired_control_plane_endpoints_config: 'ControlPlaneEndpointsConfig' = proto.Field( + proto.MESSAGE, + number=73, + message='ControlPlaneEndpointsConfig', + ) + desired_master_version: str = proto.Field( + proto.STRING, + number=100, + ) + desired_gcfs_config: 'GcfsConfig' = proto.Field( + proto.MESSAGE, + number=109, + message='GcfsConfig', + ) + desired_node_pool_auto_config_network_tags: 'NetworkTags' = proto.Field( + proto.MESSAGE, + number=110, + message='NetworkTags', + ) + desired_gateway_api_config: 'GatewayAPIConfig' = proto.Field( + proto.MESSAGE, + number=114, + message='GatewayAPIConfig', + ) + etag: str = proto.Field( + proto.STRING, + number=115, + ) + desired_node_pool_logging_config: 'NodePoolLoggingConfig' = proto.Field( + proto.MESSAGE, + number=116, + message='NodePoolLoggingConfig', + ) + desired_fleet: 'Fleet' = proto.Field( + proto.MESSAGE, + number=117, + message='Fleet', + ) + desired_stack_type: 'StackType' = proto.Field( + proto.ENUM, + number=119, + enum='StackType', + ) + additional_pod_ranges_config: 'AdditionalPodRangesConfig' = proto.Field( + proto.MESSAGE, + number=120, + message='AdditionalPodRangesConfig', + ) + removed_additional_pod_ranges_config: 'AdditionalPodRangesConfig' = proto.Field( + proto.MESSAGE, + number=121, + message='AdditionalPodRangesConfig', + ) + enable_k8s_beta_apis: 'K8sBetaAPIConfig' = proto.Field( + proto.MESSAGE, + number=122, + message='K8sBetaAPIConfig', + ) + desired_security_posture_config: 'SecurityPostureConfig' = proto.Field( + proto.MESSAGE, + number=124, + message='SecurityPostureConfig', + ) + desired_network_performance_config: 'NetworkConfig.ClusterNetworkPerformanceConfig' = proto.Field( + proto.MESSAGE, + number=125, + message='NetworkConfig.ClusterNetworkPerformanceConfig', + ) + desired_enable_fqdn_network_policy: bool = proto.Field( + proto.BOOL, + number=126, + optional=True, + ) + desired_autopilot_workload_policy_config: 'WorkloadPolicyConfig' = proto.Field( + proto.MESSAGE, + number=128, + message='WorkloadPolicyConfig', + ) + desired_k8s_beta_apis: 'K8sBetaAPIConfig' = proto.Field( + proto.MESSAGE, + number=131, + message='K8sBetaAPIConfig', + ) + desired_containerd_config: 'ContainerdConfig' = proto.Field( + proto.MESSAGE, + number=134, + message='ContainerdConfig', + ) + desired_enable_multi_networking: bool = proto.Field( + proto.BOOL, + number=135, + optional=True, + ) + desired_node_pool_auto_config_resource_manager_tags: 'ResourceManagerTags' = proto.Field( + proto.MESSAGE, + number=136, + message='ResourceManagerTags', + ) + desired_in_transit_encryption_config: 'InTransitEncryptionConfig' = proto.Field( + proto.ENUM, + number=137, + optional=True, + enum='InTransitEncryptionConfig', + ) + desired_enable_cilium_clusterwide_network_policy: bool = proto.Field( + proto.BOOL, + number=138, + optional=True, + ) + desired_secret_manager_config: 'SecretManagerConfig' = proto.Field( + proto.MESSAGE, + number=139, + optional=True, + message='SecretManagerConfig', + ) + desired_compliance_posture_config: 'CompliancePostureConfig' = proto.Field( + proto.MESSAGE, + number=140, + optional=True, + message='CompliancePostureConfig', + ) + desired_node_kubelet_config: 'NodeKubeletConfig' = proto.Field( + proto.MESSAGE, + number=141, + message='NodeKubeletConfig', + ) + desired_node_pool_auto_config_kubelet_config: 'NodeKubeletConfig' = proto.Field( + proto.MESSAGE, + number=142, + message='NodeKubeletConfig', + ) + user_managed_keys_config: 'UserManagedKeysConfig' = proto.Field( + proto.MESSAGE, + number=143, + message='UserManagedKeysConfig', + ) + desired_rbac_binding_config: 'RBACBindingConfig' = proto.Field( + proto.MESSAGE, + number=144, + optional=True, + message='RBACBindingConfig', + ) + desired_enterprise_config: 'DesiredEnterpriseConfig' = proto.Field( + proto.MESSAGE, + number=147, + message='DesiredEnterpriseConfig', + ) + desired_node_pool_auto_config_linux_node_config: 'LinuxNodeConfig' = proto.Field( + proto.MESSAGE, + number=150, + message='LinuxNodeConfig', + ) + + +class AdditionalPodRangesConfig(proto.Message): + r"""AdditionalPodRangesConfig is the configuration for additional + pod secondary ranges supporting the ClusterUpdate message. + + Attributes: + pod_range_names (MutableSequence[str]): + Name for pod secondary ipv4 range which has + the actual range defined ahead. + pod_range_info (MutableSequence[google.cloud.container_v1.types.RangeInfo]): + Output only. Information for additional pod + range. + """ + + pod_range_names: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + pod_range_info: MutableSequence['RangeInfo'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='RangeInfo', + ) + + +class RangeInfo(proto.Message): + r"""RangeInfo contains the range name and the range utilization + by this cluster. + + Attributes: + range_name (str): + Output only. Name of a range. + utilization (float): + Output only. The utilization of the range. + """ + + range_name: str = proto.Field( + proto.STRING, + number=1, + ) + utilization: float = proto.Field( + proto.DOUBLE, + number=2, + ) + + +class DesiredEnterpriseConfig(proto.Message): + r"""DesiredEnterpriseConfig is a wrapper used for updating + enterprise_config. + + Attributes: + desired_tier (google.cloud.container_v1.types.EnterpriseConfig.ClusterTier): + desired_tier specifies the desired tier of the cluster. + """ + + desired_tier: 'EnterpriseConfig.ClusterTier' = proto.Field( + proto.ENUM, + number=1, + enum='EnterpriseConfig.ClusterTier', + ) + + +class Operation(proto.Message): + r"""This operation resource represents operations that may have + happened or are happening on the cluster. All fields are output + only. + + Attributes: + name (str): + Output only. The server-assigned ID for the + operation. + zone (str): + Output only. The name of the Google Compute Engine + `zone `__ + in which the operation is taking place. This field is + deprecated, use location instead. + operation_type (google.cloud.container_v1.types.Operation.Type): + Output only. The operation type. + status (google.cloud.container_v1.types.Operation.Status): + Output only. The current status of the + operation. + detail (str): + Output only. Detailed operation progress, if + available. + status_message (str): + Output only. If an error has occurred, a + textual description of the error. Deprecated. + Use the field error instead. + self_link (str): + Output only. Server-defined URI for the operation. Example: + ``https://container.googleapis.com/v1alpha1/projects/123/locations/us-central1/operations/operation-123``. + target_link (str): + Output only. Server-defined URI for the target of the + operation. The format of this is a URI to the resource being + modified (such as a cluster, node pool, or node). For node + pool repairs, there may be multiple nodes being repaired, + but only one will be the target. + + Examples: + + - + + ``https://container.googleapis.com/v1/projects/123/locations/us-central1/clusters/my-cluster`` + + ``https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np`` + + ``https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np/node/my-node`` + location (str): + Output only. The name of the Google Compute Engine + `zone `__ + or + `region `__ + in which the cluster resides. + start_time (str): + Output only. The time the operation started, in + `RFC3339 `__ text + format. + end_time (str): + Output only. The time the operation completed, in + `RFC3339 `__ text + format. + progress (google.cloud.container_v1.types.OperationProgress): + Output only. Progress information for an + operation. + cluster_conditions (MutableSequence[google.cloud.container_v1.types.StatusCondition]): + Which conditions caused the current cluster + state. Deprecated. Use field error instead. + nodepool_conditions (MutableSequence[google.cloud.container_v1.types.StatusCondition]): + Which conditions caused the current node pool + state. Deprecated. Use field error instead. + error (google.rpc.status_pb2.Status): + The error result of the operation in case of + failure. + """ + class Status(proto.Enum): + r"""Current status of the operation. + + Values: + STATUS_UNSPECIFIED (0): + Not set. + PENDING (1): + The operation has been created. + RUNNING (2): + The operation is currently running. + DONE (3): + The operation is done, either cancelled or + completed. + ABORTING (4): + The operation is aborting. + """ + STATUS_UNSPECIFIED = 0 + PENDING = 1 + RUNNING = 2 + DONE = 3 + ABORTING = 4 + + class Type(proto.Enum): + r"""Operation type categorizes the operation. + + Values: + TYPE_UNSPECIFIED (0): + Not set. + CREATE_CLUSTER (1): + The cluster is being created. The cluster should be assumed + to be unusable until the operation finishes. + + In the event of the operation failing, the cluster will + enter the [ERROR state][Cluster.Status.ERROR] and eventually + be deleted. + DELETE_CLUSTER (2): + The cluster is being deleted. The cluster should be assumed + to be unusable as soon as this operation starts. + + In the event of the operation failing, the cluster will + enter the [ERROR state][Cluster.Status.ERROR] and the + deletion will be automatically retried until completed. + UPGRADE_MASTER (3): + The [cluster + version][google.container.v1.ClusterUpdate.desired_master_version] + is being updated. Note that this includes "upgrades" to the + same version, which are simply a recreation. This also + includes + `auto-upgrades `__. + For more details, see `documentation on cluster + upgrades `__. + UPGRADE_NODES (4): + A node pool is being updated. Despite calling this an + "upgrade", this includes most forms of updates to node + pools. This also includes + `auto-upgrades `__. + + This operation sets the + [progress][google.container.v1.Operation.progress] field and + may be + [canceled][google.container.v1.ClusterManager.CancelOperation]. + + The upgrade strategy depends on `node pool + configuration `__. + The nodes are generally still usable during this operation. + REPAIR_CLUSTER (5): + A problem has been detected with the control plane and is + being repaired. This operation type is initiated by GKE. For + more details, see `documentation on + repairs `__. + UPDATE_CLUSTER (6): + The cluster is being updated. This is a broad category of + operations and includes operations that only change metadata + as well as those that must recreate the entire cluster. If + the control plane must be recreated, this will cause + temporary downtime for zonal clusters. + + Some features require recreating the nodes as well. Those + will be recreated as separate operations and the update may + not be completely functional until the node pools + recreations finish. Node recreations will generally follow + `maintenance + policies `__. + + Some GKE-initiated operations use this type. This includes + certain types of auto-upgrades and incident mitigations. + CREATE_NODE_POOL (7): + A node pool is being created. The node pool should be + assumed to be unusable until this operation finishes. In the + event of an error, the node pool may be partially created. + + If enabled, `node + autoprovisioning `__ + may have automatically initiated such operations. + DELETE_NODE_POOL (8): + The node pool is being deleted. The node pool + should be assumed to be unusable as soon as this + operation starts. + SET_NODE_POOL_MANAGEMENT (9): + The node pool's + [manamagent][google.container.v1.NodePool.management] field + is being updated. These operations only update metadata and + may be concurrent with most other operations. + AUTO_REPAIR_NODES (10): + A problem has been detected with nodes and `they are being + repaired `__. + This operation type is initiated by GKE, typically + automatically. This operation may be concurrent with other + operations and there may be multiple repairs occurring on + the same node pool. + AUTO_UPGRADE_NODES (11): + Unused. Automatic node upgrade uses + [UPGRADE_NODES][google.container.v1.Operation.Type.UPGRADE_NODES]. + SET_LABELS (12): + Unused. Updating labels uses + [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. + SET_MASTER_AUTH (13): + Unused. Updating master auth uses + [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. + SET_NODE_POOL_SIZE (14): + The node pool is being resized. With the + exception of resizing to or from size zero, the + node pool is generally usable during this + operation. + SET_NETWORK_POLICY (15): + Unused. Updating network policy uses + [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. + SET_MAINTENANCE_POLICY (16): + Unused. Updating maintenance policy uses + [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. + RESIZE_CLUSTER (18): + The control plane is being resized. This operation type is + initiated by GKE. These operations are often performed + preemptively to ensure that the control plane has sufficient + resources and is not typically an indication of issues. For + more details, see `documentation on + resizes `__. + FLEET_FEATURE_UPGRADE (19): + Fleet features of GKE Enterprise are being + upgraded. The cluster should be assumed to be + blocked for other upgrades until the operation + finishes. + """ + TYPE_UNSPECIFIED = 0 + CREATE_CLUSTER = 1 + DELETE_CLUSTER = 2 + UPGRADE_MASTER = 3 + UPGRADE_NODES = 4 + REPAIR_CLUSTER = 5 + UPDATE_CLUSTER = 6 + CREATE_NODE_POOL = 7 + DELETE_NODE_POOL = 8 + SET_NODE_POOL_MANAGEMENT = 9 + AUTO_REPAIR_NODES = 10 + AUTO_UPGRADE_NODES = 11 + SET_LABELS = 12 + SET_MASTER_AUTH = 13 + SET_NODE_POOL_SIZE = 14 + SET_NETWORK_POLICY = 15 + SET_MAINTENANCE_POLICY = 16 + RESIZE_CLUSTER = 18 + FLEET_FEATURE_UPGRADE = 19 + + name: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + operation_type: Type = proto.Field( + proto.ENUM, + number=3, + enum=Type, + ) + status: Status = proto.Field( + proto.ENUM, + number=4, + enum=Status, + ) + detail: str = proto.Field( + proto.STRING, + number=8, + ) + status_message: str = proto.Field( + proto.STRING, + number=5, + ) + self_link: str = proto.Field( + proto.STRING, + number=6, + ) + target_link: str = proto.Field( + proto.STRING, + number=7, + ) + location: str = proto.Field( + proto.STRING, + number=9, + ) + start_time: str = proto.Field( + proto.STRING, + number=10, + ) + end_time: str = proto.Field( + proto.STRING, + number=11, + ) + progress: 'OperationProgress' = proto.Field( + proto.MESSAGE, + number=12, + message='OperationProgress', + ) + cluster_conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( + proto.MESSAGE, + number=13, + message='StatusCondition', + ) + nodepool_conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( + proto.MESSAGE, + number=14, + message='StatusCondition', + ) + error: status_pb2.Status = proto.Field( + proto.MESSAGE, + number=15, + message=status_pb2.Status, + ) + + +class OperationProgress(proto.Message): + r"""Information about operation (or operation stage) progress. + + Attributes: + name (str): + A non-parameterized string describing an + operation stage. Unset for single-stage + operations. + status (google.cloud.container_v1.types.Operation.Status): + Status of an operation stage. + Unset for single-stage operations. + metrics (MutableSequence[google.cloud.container_v1.types.OperationProgress.Metric]): + Progress metric bundle, for example: metrics: [{name: "nodes + done", int_value: 15}, {name: "nodes total", int_value: 32}] + or metrics: [{name: "progress", double_value: 0.56}, {name: + "progress scale", double_value: 1.0}] + stages (MutableSequence[google.cloud.container_v1.types.OperationProgress]): + Substages of an operation or a stage. + """ + + class Metric(proto.Message): + r"""Progress metric is (string, int|float|string) pair. + + 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): + Required. Metric name, e.g., "nodes total", + "percent done". + int_value (int): + For metrics with integer value. + + This field is a member of `oneof`_ ``value``. + double_value (float): + For metrics with floating point value. + + This field is a member of `oneof`_ ``value``. + string_value (str): + For metrics with custom values (ratios, + visual progress, etc.). + + This field is a member of `oneof`_ ``value``. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + int_value: int = proto.Field( + proto.INT64, + number=2, + oneof='value', + ) + double_value: float = proto.Field( + proto.DOUBLE, + number=3, + oneof='value', + ) + string_value: str = proto.Field( + proto.STRING, + number=4, + oneof='value', + ) + + name: str = proto.Field( + proto.STRING, + number=1, + ) + status: 'Operation.Status' = proto.Field( + proto.ENUM, + number=2, + enum='Operation.Status', + ) + metrics: MutableSequence[Metric] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=Metric, + ) + stages: MutableSequence['OperationProgress'] = proto.RepeatedField( + proto.MESSAGE, + number=4, + message='OperationProgress', + ) + + +class CreateClusterRequest(proto.Message): + r"""CreateClusterRequest creates a cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the parent + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the parent field. + cluster (google.cloud.container_v1.types.Cluster): + Required. A `cluster + resource `__ + parent (str): + The parent (project and location) where the cluster will be + created. Specified in the format ``projects/*/locations/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster: 'Cluster' = proto.Field( + proto.MESSAGE, + number=3, + message='Cluster', + ) + parent: str = proto.Field( + proto.STRING, + number=5, + ) + + +class GetClusterRequest(proto.Message): + r"""GetClusterRequest gets the settings of a cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + retrieve. This field has been deprecated and + replaced by the name field. + name (str): + The name (project, location, cluster) of the cluster to + retrieve. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + name: str = proto.Field( + proto.STRING, + number=5, + ) + + +class UpdateClusterRequest(proto.Message): + r"""UpdateClusterRequest updates the settings of a cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + upgrade. This field has been deprecated and + replaced by the name field. + update (google.cloud.container_v1.types.ClusterUpdate): + Required. A description of the update. + name (str): + The name (project, location, cluster) of the cluster to + update. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + update: 'ClusterUpdate' = proto.Field( + proto.MESSAGE, + number=4, + message='ClusterUpdate', + ) + name: str = proto.Field( + proto.STRING, + number=5, + ) + + +class UpdateNodePoolRequest(proto.Message): + r"""UpdateNodePoolRequests update a node pool's image and/or + version. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + upgrade. This field has been deprecated and + replaced by the name field. + node_pool_id (str): + Deprecated. The name of the node pool to + upgrade. This field has been deprecated and + replaced by the name field. + node_version (str): + Required. The Kubernetes version to change + the nodes to (typically an upgrade). + + Users may specify either explicit versions + offered by Kubernetes Engine or version aliases, + which have the following behavior: + + - "latest": picks the highest valid Kubernetes + version + - "1.X": picks the highest valid patch+gke.N + patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N patch + in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit Kubernetes + version + - "-": picks the Kubernetes master version + image_type (str): + Required. The desired image type for the node + pool. Please see + https://cloud.google.com/kubernetes-engine/docs/concepts/node-images + for available image types. + name (str): + The name (project, location, cluster, node pool) of the node + pool to update. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + locations (MutableSequence[str]): + The desired list of Google Compute Engine + `zones `__ + in which the node pool's nodes should be located. Changing + the locations for a node pool will result in nodes being + either created or removed from the node pool, depending on + whether locations are being added or removed. + workload_metadata_config (google.cloud.container_v1.types.WorkloadMetadataConfig): + The desired workload metadata config for the + node pool. + upgrade_settings (google.cloud.container_v1.types.NodePool.UpgradeSettings): + Upgrade settings control disruption and speed + of the upgrade. + tags (google.cloud.container_v1.types.NetworkTags): + The desired network tags to be applied to all nodes in the + node pool. If this field is not present, the tags will not + be changed. Otherwise, the existing network tags will be + *replaced* with the provided tags. + taints (google.cloud.container_v1.types.NodeTaints): + The desired node taints to be applied to all nodes in the + node pool. If this field is not present, the taints will not + be changed. Otherwise, the existing node taints will be + *replaced* with the provided taints. + labels (google.cloud.container_v1.types.NodeLabels): + The desired node labels to be applied to all nodes in the + node pool. If this field is not present, the labels will not + be changed. Otherwise, the existing node labels will be + *replaced* with the provided labels. + linux_node_config (google.cloud.container_v1.types.LinuxNodeConfig): + Parameters that can be configured on Linux + nodes. + kubelet_config (google.cloud.container_v1.types.NodeKubeletConfig): + Node kubelet configs. + node_network_config (google.cloud.container_v1.types.NodeNetworkConfig): + Node network config. + gcfs_config (google.cloud.container_v1.types.GcfsConfig): + GCFS config. + confidential_nodes (google.cloud.container_v1.types.ConfidentialNodes): + Confidential nodes config. + All the nodes in the node pool will be + Confidential VM once enabled. + gvnic (google.cloud.container_v1.types.VirtualNIC): + Enable or disable gvnic on the node pool. + etag (str): + The current etag of the node pool. + If an etag is provided and does not match the + current etag of the node pool, update will be + blocked and an ABORTED error will be returned. + fast_socket (google.cloud.container_v1.types.FastSocket): + Enable or disable NCCL fast socket for the + node pool. + logging_config (google.cloud.container_v1.types.NodePoolLoggingConfig): + Logging configuration. + resource_labels (google.cloud.container_v1.types.ResourceLabels): + The resource labels for the node pool to use + to annotate any related Google Compute Engine + resources. + windows_node_config (google.cloud.container_v1.types.WindowsNodeConfig): + Parameters that can be configured on Windows + nodes. + accelerators (MutableSequence[google.cloud.container_v1.types.AcceleratorConfig]): + A list of hardware accelerators to be + attached to each node. See + https://cloud.google.com/compute/docs/gpus for + more information about support for GPUs. + machine_type (str): + Optional. The desired `Google Compute Engine machine + type `__ + for nodes in the node pool. Initiates an upgrade operation + that migrates the nodes in the node pool to the specified + machine type. + disk_type (str): + Optional. The desired disk type (e.g. + 'pd-standard', 'pd-ssd' or 'pd-balanced') for + nodes in the node pool. Initiates an upgrade + operation that migrates the nodes in the node + pool to the specified disk type. + disk_size_gb (int): + Optional. The desired disk size for nodes in + the node pool specified in GB. The smallest + allowed disk size is 10GB. Initiates an upgrade + operation that migrates the nodes in the node + pool to the specified disk size. + resource_manager_tags (google.cloud.container_v1.types.ResourceManagerTags): + Desired resource manager tag keys and values + to be attached to the nodes for managing Compute + Engine firewalls using Network Firewall + Policies. Existing tags will be replaced with + new values. + containerd_config (google.cloud.container_v1.types.ContainerdConfig): + The desired containerd config for nodes in + the node pool. Initiates an upgrade operation + that recreates the nodes with the new config. + queued_provisioning (google.cloud.container_v1.types.NodePool.QueuedProvisioning): + Specifies the configuration of queued + provisioning. + storage_pools (MutableSequence[str]): + List of Storage Pools where boot disks are + provisioned. Existing Storage Pools will be + replaced with storage-pools. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + node_version: str = proto.Field( + proto.STRING, + number=5, + ) + image_type: str = proto.Field( + proto.STRING, + number=6, + ) + name: str = proto.Field( + proto.STRING, + number=8, + ) + locations: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=13, + ) + workload_metadata_config: 'WorkloadMetadataConfig' = proto.Field( + proto.MESSAGE, + number=14, + message='WorkloadMetadataConfig', + ) + upgrade_settings: 'NodePool.UpgradeSettings' = proto.Field( + proto.MESSAGE, + number=15, + message='NodePool.UpgradeSettings', + ) + tags: 'NetworkTags' = proto.Field( + proto.MESSAGE, + number=16, + message='NetworkTags', + ) + taints: 'NodeTaints' = proto.Field( + proto.MESSAGE, + number=17, + message='NodeTaints', + ) + labels: 'NodeLabels' = proto.Field( + proto.MESSAGE, + number=18, + message='NodeLabels', + ) + linux_node_config: 'LinuxNodeConfig' = proto.Field( + proto.MESSAGE, + number=19, + message='LinuxNodeConfig', + ) + kubelet_config: 'NodeKubeletConfig' = proto.Field( + proto.MESSAGE, + number=20, + message='NodeKubeletConfig', + ) + node_network_config: 'NodeNetworkConfig' = proto.Field( + proto.MESSAGE, + number=21, + message='NodeNetworkConfig', + ) + gcfs_config: 'GcfsConfig' = proto.Field( + proto.MESSAGE, + number=22, + message='GcfsConfig', + ) + confidential_nodes: 'ConfidentialNodes' = proto.Field( + proto.MESSAGE, + number=23, + message='ConfidentialNodes', + ) + gvnic: 'VirtualNIC' = proto.Field( + proto.MESSAGE, + number=29, + message='VirtualNIC', + ) + etag: str = proto.Field( + proto.STRING, + number=30, + ) + fast_socket: 'FastSocket' = proto.Field( + proto.MESSAGE, + number=31, + message='FastSocket', + ) + logging_config: 'NodePoolLoggingConfig' = proto.Field( + proto.MESSAGE, + number=32, + message='NodePoolLoggingConfig', + ) + resource_labels: 'ResourceLabels' = proto.Field( + proto.MESSAGE, + number=33, + message='ResourceLabels', + ) + windows_node_config: 'WindowsNodeConfig' = proto.Field( + proto.MESSAGE, + number=34, + message='WindowsNodeConfig', + ) + accelerators: MutableSequence['AcceleratorConfig'] = proto.RepeatedField( + proto.MESSAGE, + number=35, + message='AcceleratorConfig', + ) + machine_type: str = proto.Field( + proto.STRING, + number=36, + ) + disk_type: str = proto.Field( + proto.STRING, + number=37, + ) + disk_size_gb: int = proto.Field( + proto.INT64, + number=38, + ) + resource_manager_tags: 'ResourceManagerTags' = proto.Field( + proto.MESSAGE, + number=39, + message='ResourceManagerTags', + ) + containerd_config: 'ContainerdConfig' = proto.Field( + proto.MESSAGE, + number=40, + message='ContainerdConfig', + ) + queued_provisioning: 'NodePool.QueuedProvisioning' = proto.Field( + proto.MESSAGE, + number=42, + message='NodePool.QueuedProvisioning', + ) + storage_pools: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=43, + ) + + +class SetNodePoolAutoscalingRequest(proto.Message): + r"""SetNodePoolAutoscalingRequest sets the autoscaler settings of + a node pool. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + upgrade. This field has been deprecated and + replaced by the name field. + node_pool_id (str): + Deprecated. The name of the node pool to + upgrade. This field has been deprecated and + replaced by the name field. + autoscaling (google.cloud.container_v1.types.NodePoolAutoscaling): + Required. Autoscaling configuration for the + node pool. + name (str): + The name (project, location, cluster, node pool) of the node + pool to set autoscaler settings. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + autoscaling: 'NodePoolAutoscaling' = proto.Field( + proto.MESSAGE, + number=5, + message='NodePoolAutoscaling', + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class SetLoggingServiceRequest(proto.Message): + r"""SetLoggingServiceRequest sets the logging service of a + cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + upgrade. This field has been deprecated and + replaced by the name field. + logging_service (str): + Required. The logging service the cluster should use to + write logs. Currently available options: + + - ``logging.googleapis.com/kubernetes`` - The Cloud Logging + service with a Kubernetes-native resource model + - ``logging.googleapis.com`` - The legacy Cloud Logging + service (no longer available as of GKE 1.15). + - ``none`` - no logs will be exported from the cluster. + + If left as an empty + string,\ ``logging.googleapis.com/kubernetes`` will be used + for GKE 1.14+ or ``logging.googleapis.com`` for earlier + versions. + name (str): + The name (project, location, cluster) of the cluster to set + logging. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + logging_service: str = proto.Field( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=5, + ) + + +class SetMonitoringServiceRequest(proto.Message): + r"""SetMonitoringServiceRequest sets the monitoring service of a + cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + upgrade. This field has been deprecated and + replaced by the name field. + monitoring_service (str): + Required. The monitoring service the cluster should use to + write metrics. Currently available options: + + - "monitoring.googleapis.com/kubernetes" - The Cloud + Monitoring service with a Kubernetes-native resource + model + - ``monitoring.googleapis.com`` - The legacy Cloud + Monitoring service (no longer available as of GKE 1.15). + - ``none`` - No metrics will be exported from the cluster. + + If left as an empty + string,\ ``monitoring.googleapis.com/kubernetes`` will be + used for GKE 1.14+ or ``monitoring.googleapis.com`` for + earlier versions. + name (str): + The name (project, location, cluster) of the cluster to set + monitoring. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + monitoring_service: str = proto.Field( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class SetAddonsConfigRequest(proto.Message): + r"""SetAddonsConfigRequest sets the addons associated with the + cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + upgrade. This field has been deprecated and + replaced by the name field. + addons_config (google.cloud.container_v1.types.AddonsConfig): + Required. The desired configurations for the + various addons available to run in the cluster. + name (str): + The name (project, location, cluster) of the cluster to set + addons. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + addons_config: 'AddonsConfig' = proto.Field( + proto.MESSAGE, + number=4, + message='AddonsConfig', + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class SetLocationsRequest(proto.Message): + r"""SetLocationsRequest sets the locations of the cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + upgrade. This field has been deprecated and + replaced by the name field. + locations (MutableSequence[str]): + Required. The desired list of Google Compute Engine + `zones `__ + in which the cluster's nodes should be located. Changing the + locations a cluster is in will result in nodes being either + created or removed from the cluster, depending on whether + locations are being added or removed. + + This list must always include the cluster's primary zone. + name (str): + The name (project, location, cluster) of the cluster to set + locations. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + locations: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class UpdateMasterRequest(proto.Message): + r"""UpdateMasterRequest updates the master of the cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + upgrade. This field has been deprecated and + replaced by the name field. + master_version (str): + Required. The Kubernetes version to change + the master to. + Users may specify either explicit versions + offered by Kubernetes Engine or version aliases, + which have the following behavior: + + - "latest": picks the highest valid Kubernetes + version + - "1.X": picks the highest valid patch+gke.N + patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N patch + in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit Kubernetes + version + - "-": picks the default Kubernetes version + name (str): + The name (project, location, cluster) of the cluster to + update. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + master_version: str = proto.Field( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=7, + ) + + +class SetMasterAuthRequest(proto.Message): + r"""SetMasterAuthRequest updates the admin password of a cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + upgrade. This field has been deprecated and + replaced by the name field. + action (google.cloud.container_v1.types.SetMasterAuthRequest.Action): + Required. The exact form of action to be + taken on the master auth. + update (google.cloud.container_v1.types.MasterAuth): + Required. A description of the update. + name (str): + The name (project, location, cluster) of the cluster to set + auth. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + class Action(proto.Enum): + r"""Operation type: what type update to perform. + + Values: + UNKNOWN (0): + Operation is unknown and will error out. + SET_PASSWORD (1): + Set the password to a user generated value. + GENERATE_PASSWORD (2): + Generate a new password and set it to that. + SET_USERNAME (3): + Set the username. If an empty username is + provided, basic authentication is disabled for + the cluster. If a non-empty username is + provided, basic authentication is enabled, with + either a provided password or a generated one. + """ + UNKNOWN = 0 + SET_PASSWORD = 1 + GENERATE_PASSWORD = 2 + SET_USERNAME = 3 + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + action: Action = proto.Field( + proto.ENUM, + number=4, + enum=Action, + ) + update: 'MasterAuth' = proto.Field( + proto.MESSAGE, + number=5, + message='MasterAuth', + ) + name: str = proto.Field( + proto.STRING, + number=7, + ) + + +class DeleteClusterRequest(proto.Message): + r"""DeleteClusterRequest deletes a cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + delete. This field has been deprecated and + replaced by the name field. + name (str): + The name (project, location, cluster) of the cluster to + delete. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + name: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListClustersRequest(proto.Message): + r"""ListClustersRequest lists clusters. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the parent + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides, or "-" for all zones. This + field has been deprecated and replaced by the parent field. + parent (str): + The parent (project and location) where the clusters will be + listed. Specified in the format ``projects/*/locations/*``. + Location "-" matches all zones and all regions. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + parent: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListClustersResponse(proto.Message): + r"""ListClustersResponse is the result of ListClustersRequest. + + Attributes: + clusters (MutableSequence[google.cloud.container_v1.types.Cluster]): + A list of clusters in the project in the + specified zone, or across all ones. + missing_zones (MutableSequence[str]): + If any zones are listed here, the list of + clusters returned may be missing those zones. + """ + + clusters: MutableSequence['Cluster'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Cluster', + ) + missing_zones: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=2, + ) + + +class GetOperationRequest(proto.Message): + r"""GetOperationRequest gets a single operation. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + operation_id (str): + Deprecated. The server-assigned ``name`` of the operation. + This field has been deprecated and replaced by the name + field. + name (str): + The name (project, location, operation id) of the operation + to get. Specified in the format + ``projects/*/locations/*/operations/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + operation_id: str = proto.Field( + proto.STRING, + number=3, + ) + name: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListOperationsRequest(proto.Message): + r"""ListOperationsRequest lists operations. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the parent + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + to return operations for, or ``-`` for all zones. This field + has been deprecated and replaced by the parent field. + parent (str): + The parent (project and location) where the operations will + be listed. Specified in the format + ``projects/*/locations/*``. Location "-" matches all zones + and all regions. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + parent: str = proto.Field( + proto.STRING, + number=4, + ) + + +class CancelOperationRequest(proto.Message): + r"""CancelOperationRequest cancels a single operation. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the operation resides. This field has been + deprecated and replaced by the name field. + operation_id (str): + Deprecated. The server-assigned ``name`` of the operation. + This field has been deprecated and replaced by the name + field. + name (str): + The name (project, location, operation id) of the operation + to cancel. Specified in the format + ``projects/*/locations/*/operations/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + operation_id: str = proto.Field( + proto.STRING, + number=3, + ) + name: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListOperationsResponse(proto.Message): + r"""ListOperationsResponse is the result of + ListOperationsRequest. + + Attributes: + operations (MutableSequence[google.cloud.container_v1.types.Operation]): + A list of operations in the project in the + specified zone. + missing_zones (MutableSequence[str]): + If any zones are listed here, the list of + operations returned may be missing the + operations from those zones. + """ + + operations: MutableSequence['Operation'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Operation', + ) + missing_zones: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=2, + ) + + +class GetServerConfigRequest(proto.Message): + r"""Gets the current Kubernetes Engine service configuration. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + to return operations for. This field has been deprecated and + replaced by the name field. + name (str): + The name (project and location) of the server config to get, + specified in the format ``projects/*/locations/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + name: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ServerConfig(proto.Message): + r"""Kubernetes Engine service configuration. + + Attributes: + default_cluster_version (str): + Version of Kubernetes the service deploys by + default. + valid_node_versions (MutableSequence[str]): + List of valid node upgrade target versions, + in descending order. + default_image_type (str): + Default image type. + valid_image_types (MutableSequence[str]): + List of valid image types. + valid_master_versions (MutableSequence[str]): + List of valid master versions, in descending + order. + channels (MutableSequence[google.cloud.container_v1.types.ServerConfig.ReleaseChannelConfig]): + List of release channel configurations. + """ + + class ReleaseChannelConfig(proto.Message): + r"""ReleaseChannelConfig exposes configuration for a release + channel. + + Attributes: + channel (google.cloud.container_v1.types.ReleaseChannel.Channel): + The release channel this configuration + applies to. + default_version (str): + The default version for newly created + clusters on the channel. + valid_versions (MutableSequence[str]): + List of valid versions for the channel. + upgrade_target_version (str): + The auto upgrade target version for clusters + on the channel. + """ + + channel: 'ReleaseChannel.Channel' = proto.Field( + proto.ENUM, + number=1, + enum='ReleaseChannel.Channel', + ) + default_version: str = proto.Field( + proto.STRING, + number=2, + ) + valid_versions: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + upgrade_target_version: str = proto.Field( + proto.STRING, + number=5, + ) + + default_cluster_version: str = proto.Field( + proto.STRING, + number=1, + ) + valid_node_versions: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + default_image_type: str = proto.Field( + proto.STRING, + number=4, + ) + valid_image_types: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=5, + ) + valid_master_versions: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=6, + ) + channels: MutableSequence[ReleaseChannelConfig] = proto.RepeatedField( + proto.MESSAGE, + number=9, + message=ReleaseChannelConfig, + ) + + +class CreateNodePoolRequest(proto.Message): + r"""CreateNodePoolRequest creates a node pool for a cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the parent + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the parent field. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and replaced by + the parent field. + node_pool (google.cloud.container_v1.types.NodePool): + Required. The node pool to create. + parent (str): + The parent (project, location, cluster name) where the node + pool will be created. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool: 'NodePool' = proto.Field( + proto.MESSAGE, + number=4, + message='NodePool', + ) + parent: str = proto.Field( + proto.STRING, + number=6, + ) + + +class DeleteNodePoolRequest(proto.Message): + r"""DeleteNodePoolRequest deletes a node pool for a cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and replaced by + the name field. + node_pool_id (str): + Deprecated. The name of the node pool to + delete. This field has been deprecated and + replaced by the name field. + name (str): + The name (project, location, cluster, node pool id) of the + node pool to delete. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class ListNodePoolsRequest(proto.Message): + r"""ListNodePoolsRequest lists the node pool(s) for a cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the parent + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the parent field. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and replaced by + the parent field. + parent (str): + The parent (project, location, cluster name) where the node + pools will be listed. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + parent: str = proto.Field( + proto.STRING, + number=5, + ) + + +class GetNodePoolRequest(proto.Message): + r"""GetNodePoolRequest retrieves a node pool for a cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and replaced by + the name field. + node_pool_id (str): + Deprecated. The name of the node pool. + This field has been deprecated and replaced by + the name field. + name (str): + The name (project, location, cluster, node pool id) of the + node pool to get. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class BlueGreenSettings(proto.Message): + r"""Settings for blue-green upgrade. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + standard_rollout_policy (google.cloud.container_v1.types.BlueGreenSettings.StandardRolloutPolicy): + Standard policy for the blue-green upgrade. + + This field is a member of `oneof`_ ``rollout_policy``. + node_pool_soak_duration (google.protobuf.duration_pb2.Duration): + Time needed after draining entire blue pool. + After this period, blue pool will be cleaned up. + + This field is a member of `oneof`_ ``_node_pool_soak_duration``. + """ + + class StandardRolloutPolicy(proto.Message): + r"""Standard rollout policy is the default policy for blue-green. + + 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: + batch_percentage (float): + Percentage of the blue pool nodes to drain in a batch. The + range of this field should be (0.0, 1.0]. + + This field is a member of `oneof`_ ``update_batch_size``. + batch_node_count (int): + Number of blue nodes to drain in a batch. + + This field is a member of `oneof`_ ``update_batch_size``. + batch_soak_duration (google.protobuf.duration_pb2.Duration): + Soak time after each batch gets drained. + Default to zero. + + This field is a member of `oneof`_ ``_batch_soak_duration``. + """ + + batch_percentage: float = proto.Field( + proto.FLOAT, + number=1, + oneof='update_batch_size', + ) + batch_node_count: int = proto.Field( + proto.INT32, + number=2, + oneof='update_batch_size', + ) + batch_soak_duration: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=3, + optional=True, + message=duration_pb2.Duration, + ) + + standard_rollout_policy: StandardRolloutPolicy = proto.Field( + proto.MESSAGE, + number=1, + oneof='rollout_policy', + message=StandardRolloutPolicy, + ) + node_pool_soak_duration: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=2, + optional=True, + message=duration_pb2.Duration, + ) + + +class NodePool(proto.Message): + r"""NodePool contains the name and configuration for a cluster's + node pool. Node pools are a set of nodes (i.e. VM's), with a + common configuration and specification, under the control of the + cluster master. They may have a set of Kubernetes labels applied + to them, which may be used to reference them during pod + scheduling. They may also be resized up or down, to accommodate + the workload. + + Attributes: + name (str): + The name of the node pool. + config (google.cloud.container_v1.types.NodeConfig): + The node configuration of the pool. + initial_node_count (int): + The initial node count for the pool. You must ensure that + your Compute Engine `resource + quota `__ is + sufficient for this number of instances. You must also have + available firewall and routes quota. + locations (MutableSequence[str]): + The list of Google Compute Engine + `zones `__ + in which the NodePool's nodes should be located. + + If this value is unspecified during node pool creation, the + `Cluster.Locations `__ + value will be used, instead. + + Warning: changing node pool locations will result in nodes + being added and/or removed. + network_config (google.cloud.container_v1.types.NodeNetworkConfig): + Networking configuration for this NodePool. + If specified, it overrides the cluster-level + defaults. + self_link (str): + Output only. Server-defined URL for the + resource. + version (str): + The version of Kubernetes running on this NodePool's nodes. + If unspecified, it defaults as described + `here `__. + instance_group_urls (MutableSequence[str]): + Output only. The resource URLs of the `managed instance + groups `__ + associated with this node pool. During the node pool + blue-green upgrade operation, the URLs contain both blue and + green resources. + status (google.cloud.container_v1.types.NodePool.Status): + Output only. The status of the nodes in this + pool instance. + status_message (str): + Output only. Deprecated. Use conditions + instead. Additional information about the + current status of this node pool instance, if + available. + autoscaling (google.cloud.container_v1.types.NodePoolAutoscaling): + Autoscaler configuration for this NodePool. + Autoscaler is enabled only if a valid + configuration is present. + management (google.cloud.container_v1.types.NodeManagement): + NodeManagement configuration for this + NodePool. + max_pods_constraint (google.cloud.container_v1.types.MaxPodsConstraint): + The constraint on the maximum number of pods + that can be run simultaneously on a node in the + node pool. + conditions (MutableSequence[google.cloud.container_v1.types.StatusCondition]): + Which conditions caused the current node pool + state. + pod_ipv4_cidr_size (int): + Output only. The pod CIDR block size per node + in this node pool. + upgrade_settings (google.cloud.container_v1.types.NodePool.UpgradeSettings): + Upgrade settings control disruption and speed + of the upgrade. + placement_policy (google.cloud.container_v1.types.NodePool.PlacementPolicy): + Specifies the node placement policy. + update_info (google.cloud.container_v1.types.NodePool.UpdateInfo): + Output only. Update info contains relevant + information during a node pool update. + etag (str): + This checksum is computed by the server based + on the value of node pool fields, and may be + sent on update requests to ensure the client has + an up-to-date value before proceeding. + queued_provisioning (google.cloud.container_v1.types.NodePool.QueuedProvisioning): + Specifies the configuration of queued + provisioning. + best_effort_provisioning (google.cloud.container_v1.types.BestEffortProvisioning): + Enable best effort provisioning for nodes + """ + class Status(proto.Enum): + r"""The current status of the node pool instance. + + Values: + STATUS_UNSPECIFIED (0): + Not set. + PROVISIONING (1): + The PROVISIONING state indicates the node + pool is being created. + RUNNING (2): + The RUNNING state indicates the node pool has + been created and is fully usable. + RUNNING_WITH_ERROR (3): + The RUNNING_WITH_ERROR state indicates the node pool has + been created and is partially usable. Some error state has + occurred and some functionality may be impaired. Customer + may need to reissue a request or trigger a new update. + RECONCILING (4): + The RECONCILING state indicates that some work is actively + being done on the node pool, such as upgrading node + software. Details can be found in the ``statusMessage`` + field. + STOPPING (5): + The STOPPING state indicates the node pool is + being deleted. + ERROR (6): + The ERROR state indicates the node pool may be unusable. + Details can be found in the ``statusMessage`` field. + """ + STATUS_UNSPECIFIED = 0 + PROVISIONING = 1 + RUNNING = 2 + RUNNING_WITH_ERROR = 3 + RECONCILING = 4 + STOPPING = 5 + ERROR = 6 + + class UpgradeSettings(proto.Message): + r"""These upgrade settings control the level of parallelism and the + level of disruption caused by an upgrade. + + maxUnavailable controls the number of nodes that can be + simultaneously unavailable. + + maxSurge controls the number of additional nodes that can be added + to the node pool temporarily for the time of the upgrade to increase + the number of available nodes. + + (maxUnavailable + maxSurge) determines the level of parallelism (how + many nodes are being upgraded at the same time). + + Note: upgrades inevitably introduce some disruption since workloads + need to be moved from old nodes to new, upgraded ones. Even if + maxUnavailable=0, this holds true. (Disruption stays within the + limits of PodDisruptionBudget, if it is configured.) + + Consider a hypothetical node pool with 5 nodes having maxSurge=2, + maxUnavailable=1. This means the upgrade process upgrades 3 nodes + simultaneously. It creates 2 additional (upgraded) nodes, then it + brings down 3 old (not yet upgraded) nodes at the same time. This + ensures that there are always at least 4 nodes available. + + These upgrade settings configure the upgrade strategy for the node + pool. Use strategy to switch between the strategies applied to the + node pool. + + If the strategy is ROLLING, use max_surge and max_unavailable to + control the level of parallelism and the level of disruption caused + by upgrade. + + 1. maxSurge controls the number of additional nodes that can be + added to the node pool temporarily for the time of the upgrade to + increase the number of available nodes. + 2. maxUnavailable controls the number of nodes that can be + simultaneously unavailable. + 3. (maxUnavailable + maxSurge) determines the level of parallelism + (how many nodes are being upgraded at the same time). + + If the strategy is BLUE_GREEN, use blue_green_settings to configure + the blue-green upgrade related settings. + + 1. standard_rollout_policy is the default policy. The policy is used + to control the way blue pool gets drained. The draining is + executed in the batch mode. The batch size could be specified as + either percentage of the node pool size or the number of nodes. + batch_soak_duration is the soak time after each batch gets + drained. + 2. node_pool_soak_duration is the soak time after all blue nodes are + drained. After this period, the blue pool nodes will be deleted. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + max_surge (int): + The maximum number of nodes that can be + created beyond the current size of the node pool + during the upgrade process. + max_unavailable (int): + The maximum number of nodes that can be + simultaneously unavailable during the upgrade + process. A node is considered available if its + status is Ready. + strategy (google.cloud.container_v1.types.NodePoolUpdateStrategy): + Update strategy of the node pool. + + This field is a member of `oneof`_ ``_strategy``. + blue_green_settings (google.cloud.container_v1.types.BlueGreenSettings): + Settings for blue-green upgrade strategy. + + This field is a member of `oneof`_ ``_blue_green_settings``. + """ + + max_surge: int = proto.Field( + proto.INT32, + number=1, + ) + max_unavailable: int = proto.Field( + proto.INT32, + number=2, + ) + strategy: 'NodePoolUpdateStrategy' = proto.Field( + proto.ENUM, + number=3, + optional=True, + enum='NodePoolUpdateStrategy', + ) + blue_green_settings: 'BlueGreenSettings' = proto.Field( + proto.MESSAGE, + number=4, + optional=True, + message='BlueGreenSettings', + ) + + class UpdateInfo(proto.Message): + r"""UpdateInfo contains resource (instance groups, etc), status + and other intermediate information relevant to a node pool + upgrade. + + Attributes: + blue_green_info (google.cloud.container_v1.types.NodePool.UpdateInfo.BlueGreenInfo): + Information of a blue-green upgrade. + """ + + class BlueGreenInfo(proto.Message): + r"""Information relevant to blue-green upgrade. + + Attributes: + phase (google.cloud.container_v1.types.NodePool.UpdateInfo.BlueGreenInfo.Phase): + Current blue-green upgrade phase. + blue_instance_group_urls (MutableSequence[str]): + The resource URLs of the [managed instance groups] + (/compute/docs/instance-groups/creating-groups-of-managed-instances) + associated with blue pool. + green_instance_group_urls (MutableSequence[str]): + The resource URLs of the [managed instance groups] + (/compute/docs/instance-groups/creating-groups-of-managed-instances) + associated with green pool. + blue_pool_deletion_start_time (str): + Time to start deleting blue pool to complete blue-green + upgrade, in + `RFC3339 `__ text + format. + green_pool_version (str): + Version of green pool. + """ + class Phase(proto.Enum): + r"""Phase represents the different stages blue-green upgrade is + running in. + + Values: + PHASE_UNSPECIFIED (0): + Unspecified phase. + UPDATE_STARTED (1): + blue-green upgrade has been initiated. + CREATING_GREEN_POOL (2): + Start creating green pool nodes. + CORDONING_BLUE_POOL (3): + Start cordoning blue pool nodes. + DRAINING_BLUE_POOL (4): + Start draining blue pool nodes. + NODE_POOL_SOAKING (5): + Start soaking time after draining entire blue + pool. + DELETING_BLUE_POOL (6): + Start deleting blue nodes. + ROLLBACK_STARTED (7): + Rollback has been initiated. + """ + PHASE_UNSPECIFIED = 0 + UPDATE_STARTED = 1 + CREATING_GREEN_POOL = 2 + CORDONING_BLUE_POOL = 3 + DRAINING_BLUE_POOL = 4 + NODE_POOL_SOAKING = 5 + DELETING_BLUE_POOL = 6 + ROLLBACK_STARTED = 7 + + phase: 'NodePool.UpdateInfo.BlueGreenInfo.Phase' = proto.Field( + proto.ENUM, + number=1, + enum='NodePool.UpdateInfo.BlueGreenInfo.Phase', + ) + blue_instance_group_urls: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=2, + ) + green_instance_group_urls: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + blue_pool_deletion_start_time: str = proto.Field( + proto.STRING, + number=4, + ) + green_pool_version: str = proto.Field( + proto.STRING, + number=5, + ) + + blue_green_info: 'NodePool.UpdateInfo.BlueGreenInfo' = proto.Field( + proto.MESSAGE, + number=1, + message='NodePool.UpdateInfo.BlueGreenInfo', + ) + + class PlacementPolicy(proto.Message): + r"""PlacementPolicy defines the placement policy used by the node + pool. + + Attributes: + type_ (google.cloud.container_v1.types.NodePool.PlacementPolicy.Type): + The type of placement. + tpu_topology (str): + Optional. TPU placement topology for pod slice node pool. + https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies + policy_name (str): + If set, refers to the name of a custom + resource policy supplied by the user. The + resource policy must be in the same project and + region as the node pool. If not found, + InvalidArgument error is returned. + """ + class Type(proto.Enum): + r"""Type defines the type of placement policy. + + Values: + TYPE_UNSPECIFIED (0): + TYPE_UNSPECIFIED specifies no requirements on nodes + placement. + COMPACT (1): + COMPACT specifies node placement in the same + availability domain to ensure low communication + latency. + """ + TYPE_UNSPECIFIED = 0 + COMPACT = 1 + + type_: 'NodePool.PlacementPolicy.Type' = proto.Field( + proto.ENUM, + number=1, + enum='NodePool.PlacementPolicy.Type', + ) + tpu_topology: str = proto.Field( + proto.STRING, + number=2, + ) + policy_name: str = proto.Field( + proto.STRING, + number=3, + ) + + class QueuedProvisioning(proto.Message): + r"""QueuedProvisioning defines the queued provisioning used by + the node pool. + + Attributes: + enabled (bool): + Denotes that this nodepool is QRM specific, + meaning nodes can be only obtained through + queuing via the Cluster Autoscaler + ProvisioningRequest API. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + name: str = proto.Field( + proto.STRING, + number=1, + ) + config: 'NodeConfig' = proto.Field( + proto.MESSAGE, + number=2, + message='NodeConfig', + ) + initial_node_count: int = proto.Field( + proto.INT32, + number=3, + ) + locations: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=13, + ) + network_config: 'NodeNetworkConfig' = proto.Field( + proto.MESSAGE, + number=14, + message='NodeNetworkConfig', + ) + self_link: str = proto.Field( + proto.STRING, + number=100, + ) + version: str = proto.Field( + proto.STRING, + number=101, + ) + instance_group_urls: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=102, + ) + status: Status = proto.Field( + proto.ENUM, + number=103, + enum=Status, + ) + status_message: str = proto.Field( + proto.STRING, + number=104, + ) + autoscaling: 'NodePoolAutoscaling' = proto.Field( + proto.MESSAGE, + number=4, + message='NodePoolAutoscaling', + ) + management: 'NodeManagement' = proto.Field( + proto.MESSAGE, + number=5, + message='NodeManagement', + ) + max_pods_constraint: 'MaxPodsConstraint' = proto.Field( + proto.MESSAGE, + number=6, + message='MaxPodsConstraint', + ) + conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( + proto.MESSAGE, + number=105, + message='StatusCondition', + ) + pod_ipv4_cidr_size: int = proto.Field( + proto.INT32, + number=7, + ) + upgrade_settings: UpgradeSettings = proto.Field( + proto.MESSAGE, + number=107, + message=UpgradeSettings, + ) + placement_policy: PlacementPolicy = proto.Field( + proto.MESSAGE, + number=108, + message=PlacementPolicy, + ) + update_info: UpdateInfo = proto.Field( + proto.MESSAGE, + number=109, + message=UpdateInfo, + ) + etag: str = proto.Field( + proto.STRING, + number=110, + ) + queued_provisioning: QueuedProvisioning = proto.Field( + proto.MESSAGE, + number=112, + message=QueuedProvisioning, + ) + best_effort_provisioning: 'BestEffortProvisioning' = proto.Field( + proto.MESSAGE, + number=113, + message='BestEffortProvisioning', + ) + + +class NodeManagement(proto.Message): + r"""NodeManagement defines the set of node management services + turned on for the node pool. + + Attributes: + auto_upgrade (bool): + A flag that specifies whether node + auto-upgrade is enabled for the node pool. If + enabled, node auto-upgrade helps keep the nodes + in your node pool up to date with the latest + release version of Kubernetes. + auto_repair (bool): + A flag that specifies whether the node + auto-repair is enabled for the node pool. If + enabled, the nodes in this node pool will be + monitored and, if they fail health checks too + many times, an automatic repair action will be + triggered. + upgrade_options (google.cloud.container_v1.types.AutoUpgradeOptions): + Specifies the Auto Upgrade knobs for the node + pool. + """ + + auto_upgrade: bool = proto.Field( + proto.BOOL, + number=1, + ) + auto_repair: bool = proto.Field( + proto.BOOL, + number=2, + ) + upgrade_options: 'AutoUpgradeOptions' = proto.Field( + proto.MESSAGE, + number=10, + message='AutoUpgradeOptions', + ) + + +class BestEffortProvisioning(proto.Message): + r"""Best effort provisioning. + + Attributes: + enabled (bool): + When this is enabled, cluster/node pool + creations will ignore non-fatal errors like + stockout to best provision as many nodes as + possible right now and eventually bring up all + target number of nodes + min_provision_nodes (int): + Minimum number of nodes to be provisioned to + be considered as succeeded, and the rest of + nodes will be provisioned gradually and + eventually when stockout issue has been + resolved. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + min_provision_nodes: int = proto.Field( + proto.INT32, + number=2, + ) + + +class AutoUpgradeOptions(proto.Message): + r"""AutoUpgradeOptions defines the set of options for the user to + control how the Auto Upgrades will proceed. + + Attributes: + auto_upgrade_start_time (str): + Output only. This field is set when upgrades are about to + commence with the approximate start time for the upgrades, + in `RFC3339 `__ text + format. + description (str): + Output only. This field is set when upgrades + are about to commence with the description of + the upgrade. + """ + + auto_upgrade_start_time: str = proto.Field( + proto.STRING, + number=1, + ) + description: str = proto.Field( + proto.STRING, + number=2, + ) + + +class MaintenancePolicy(proto.Message): + r"""MaintenancePolicy defines the maintenance policy to be used + for the cluster. + + Attributes: + window (google.cloud.container_v1.types.MaintenanceWindow): + Specifies the maintenance window in which + maintenance may be performed. + resource_version (str): + A hash identifying the version of this policy, so that + updates to fields of the policy won't accidentally undo + intermediate changes (and so that users of the API unaware + of some fields won't accidentally remove other fields). Make + a ``get()`` request to the cluster to get the current + resource version and include it with requests to set the + policy. + """ + + window: 'MaintenanceWindow' = proto.Field( + proto.MESSAGE, + number=1, + message='MaintenanceWindow', + ) + resource_version: str = proto.Field( + proto.STRING, + number=3, + ) + + +class MaintenanceWindow(proto.Message): + r"""MaintenanceWindow defines the maintenance window to be used + for the cluster. + + 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: + daily_maintenance_window (google.cloud.container_v1.types.DailyMaintenanceWindow): + DailyMaintenanceWindow specifies a daily + maintenance operation window. + + This field is a member of `oneof`_ ``policy``. + recurring_window (google.cloud.container_v1.types.RecurringTimeWindow): + RecurringWindow specifies some number of + recurring time periods for maintenance to occur. + The time windows may be overlapping. If no + maintenance windows are set, maintenance can + occur at any time. + + This field is a member of `oneof`_ ``policy``. + maintenance_exclusions (MutableMapping[str, google.cloud.container_v1.types.TimeWindow]): + Exceptions to maintenance window. + Non-emergency maintenance should not occur in + these windows. + """ + + daily_maintenance_window: 'DailyMaintenanceWindow' = proto.Field( + proto.MESSAGE, + number=2, + oneof='policy', + message='DailyMaintenanceWindow', + ) + recurring_window: 'RecurringTimeWindow' = proto.Field( + proto.MESSAGE, + number=3, + oneof='policy', + message='RecurringTimeWindow', + ) + maintenance_exclusions: MutableMapping[str, 'TimeWindow'] = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=4, + message='TimeWindow', + ) + + +class TimeWindow(proto.Message): + r"""Represents an arbitrary window of time. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + maintenance_exclusion_options (google.cloud.container_v1.types.MaintenanceExclusionOptions): + MaintenanceExclusionOptions provides + maintenance exclusion related options. + + This field is a member of `oneof`_ ``options``. + start_time (google.protobuf.timestamp_pb2.Timestamp): + The time that the window first starts. + end_time (google.protobuf.timestamp_pb2.Timestamp): + The time that the window ends. The end time + should take place after the start time. + """ + + maintenance_exclusion_options: 'MaintenanceExclusionOptions' = proto.Field( + proto.MESSAGE, + number=3, + oneof='options', + message='MaintenanceExclusionOptions', + ) + start_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, + ) + + +class MaintenanceExclusionOptions(proto.Message): + r"""Represents the Maintenance exclusion option. + + Attributes: + scope (google.cloud.container_v1.types.MaintenanceExclusionOptions.Scope): + Scope specifies the upgrade scope which + upgrades are blocked by the exclusion. + """ + class Scope(proto.Enum): + r"""Scope of exclusion. + + Values: + NO_UPGRADES (0): + NO_UPGRADES excludes all upgrades, including patch upgrades + and minor upgrades across control planes and nodes. This is + the default exclusion behavior. + NO_MINOR_UPGRADES (1): + NO_MINOR_UPGRADES excludes all minor upgrades for the + cluster, only patches are allowed. + NO_MINOR_OR_NODE_UPGRADES (2): + NO_MINOR_OR_NODE_UPGRADES excludes all minor upgrades for + the cluster, and also exclude all node pool upgrades. Only + control plane patches are allowed. + """ + NO_UPGRADES = 0 + NO_MINOR_UPGRADES = 1 + NO_MINOR_OR_NODE_UPGRADES = 2 + + scope: Scope = proto.Field( + proto.ENUM, + number=1, + enum=Scope, + ) + + +class RecurringTimeWindow(proto.Message): + r"""Represents an arbitrary window of time that recurs. + + Attributes: + window (google.cloud.container_v1.types.TimeWindow): + The window of the first recurrence. + recurrence (str): + An RRULE + (https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for + how this window reccurs. They go on for the span of time + between the start and end time. + + For example, to have something repeat every weekday, you'd + use: ``FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR`` + + To repeat some window daily (equivalent to the + DailyMaintenanceWindow): ``FREQ=DAILY`` + + For the first weekend of every month: + ``FREQ=MONTHLY;BYSETPOS=1;BYDAY=SA,SU`` + + This specifies how frequently the window starts. Eg, if you + wanted to have a 9-5 UTC-4 window every weekday, you'd use + something like: + + :: + + start time = 2019-01-01T09:00:00-0400 + end time = 2019-01-01T17:00:00-0400 + recurrence = FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR + + Windows can span multiple days. Eg, to make the window + encompass every weekend from midnight Saturday till the last + minute of Sunday UTC: + + :: + + start time = 2019-01-05T00:00:00Z + end time = 2019-01-07T23:59:00Z + recurrence = FREQ=WEEKLY;BYDAY=SA + + Note the start and end time's specific dates are largely + arbitrary except to specify duration of the window and when + it first starts. The FREQ values of HOURLY, MINUTELY, and + SECONDLY are not supported. + """ + + window: 'TimeWindow' = proto.Field( + proto.MESSAGE, + number=1, + message='TimeWindow', + ) + recurrence: str = proto.Field( + proto.STRING, + number=2, + ) + + +class DailyMaintenanceWindow(proto.Message): + r"""Time window specified for daily maintenance operations. + + Attributes: + start_time (str): + Time within the maintenance window to start the maintenance + operations. Time format should be in + `RFC3339 `__ format + "HH:MM", where HH : [00-23] and MM : [00-59] GMT. + duration (str): + Output only. Duration of the time window, automatically + chosen to be smallest possible in the given scenario. + Duration will be in + `RFC3339 `__ format + "PTnHnMnS". + """ + + start_time: str = proto.Field( + proto.STRING, + number=2, + ) + duration: str = proto.Field( + proto.STRING, + number=3, + ) + + +class SetNodePoolManagementRequest(proto.Message): + r"""SetNodePoolManagementRequest sets the node management + properties of a node pool. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + update. This field has been deprecated and + replaced by the name field. + node_pool_id (str): + Deprecated. The name of the node pool to + update. This field has been deprecated and + replaced by the name field. + management (google.cloud.container_v1.types.NodeManagement): + Required. NodeManagement configuration for + the node pool. + name (str): + The name (project, location, cluster, node pool id) of the + node pool to set management properties. Specified in the + format ``projects/*/locations/*/clusters/*/nodePools/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + management: 'NodeManagement' = proto.Field( + proto.MESSAGE, + number=5, + message='NodeManagement', + ) + name: str = proto.Field( + proto.STRING, + number=7, + ) + + +class SetNodePoolSizeRequest(proto.Message): + r"""SetNodePoolSizeRequest sets the size of a node pool. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + update. This field has been deprecated and + replaced by the name field. + node_pool_id (str): + Deprecated. The name of the node pool to + update. This field has been deprecated and + replaced by the name field. + node_count (int): + Required. The desired node count for the + pool. + name (str): + The name (project, location, cluster, node pool id) of the + node pool to set size. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + node_count: int = proto.Field( + proto.INT32, + number=5, + ) + name: str = proto.Field( + proto.STRING, + number=7, + ) + + +class CompleteNodePoolUpgradeRequest(proto.Message): + r"""CompleteNodePoolUpgradeRequest sets the name of target node + pool to complete upgrade. + + Attributes: + name (str): + The name (project, location, cluster, node pool id) of the + node pool to complete upgrade. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class RollbackNodePoolUpgradeRequest(proto.Message): + r"""RollbackNodePoolUpgradeRequest rollbacks the previously + Aborted or Failed NodePool upgrade. This will be an no-op if the + last upgrade successfully completed. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + rollback. This field has been deprecated and + replaced by the name field. + node_pool_id (str): + Deprecated. The name of the node pool to + rollback. This field has been deprecated and + replaced by the name field. + name (str): + The name (project, location, cluster, node pool id) of the + node poll to rollback upgrade. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + respect_pdb (bool): + Option for rollback to ignore the + PodDisruptionBudget. Default value is false. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + respect_pdb: bool = proto.Field( + proto.BOOL, + number=7, + ) + + +class ListNodePoolsResponse(proto.Message): + r"""ListNodePoolsResponse is the result of ListNodePoolsRequest. + + Attributes: + node_pools (MutableSequence[google.cloud.container_v1.types.NodePool]): + A list of node pools for a cluster. + """ + + node_pools: MutableSequence['NodePool'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='NodePool', + ) + + +class ClusterAutoscaling(proto.Message): + r"""ClusterAutoscaling contains global, per-cluster information + required by Cluster Autoscaler to automatically adjust the size + of the cluster and create/delete + node pools based on the current needs. + + Attributes: + enable_node_autoprovisioning (bool): + Enables automatic node pool creation and + deletion. + resource_limits (MutableSequence[google.cloud.container_v1.types.ResourceLimit]): + Contains global constraints regarding minimum + and maximum amount of resources in the cluster. + autoscaling_profile (google.cloud.container_v1.types.ClusterAutoscaling.AutoscalingProfile): + Defines autoscaling behaviour. + autoprovisioning_node_pool_defaults (google.cloud.container_v1.types.AutoprovisioningNodePoolDefaults): + AutoprovisioningNodePoolDefaults contains + defaults for a node pool created by NAP. + autoprovisioning_locations (MutableSequence[str]): + The list of Google Compute Engine + `zones `__ + in which the NodePool's nodes can be created by NAP. + """ + class AutoscalingProfile(proto.Enum): + r"""Defines possible options for autoscaling_profile field. + + Values: + PROFILE_UNSPECIFIED (0): + No change to autoscaling configuration. + OPTIMIZE_UTILIZATION (1): + Prioritize optimizing utilization of + resources. + BALANCED (2): + Use default (balanced) autoscaling + configuration. + """ + PROFILE_UNSPECIFIED = 0 + OPTIMIZE_UTILIZATION = 1 + BALANCED = 2 + + enable_node_autoprovisioning: bool = proto.Field( + proto.BOOL, + number=1, + ) + resource_limits: MutableSequence['ResourceLimit'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='ResourceLimit', + ) + autoscaling_profile: AutoscalingProfile = proto.Field( + proto.ENUM, + number=3, + enum=AutoscalingProfile, + ) + autoprovisioning_node_pool_defaults: 'AutoprovisioningNodePoolDefaults' = proto.Field( + proto.MESSAGE, + number=4, + message='AutoprovisioningNodePoolDefaults', + ) + autoprovisioning_locations: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=5, + ) + + +class AutoprovisioningNodePoolDefaults(proto.Message): + r"""AutoprovisioningNodePoolDefaults contains defaults for a node + pool created by NAP. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + oauth_scopes (MutableSequence[str]): + Scopes that are used by NAP when creating + node pools. + service_account (str): + The Google Cloud Platform Service Account to + be used by the node VMs. + upgrade_settings (google.cloud.container_v1.types.NodePool.UpgradeSettings): + Specifies the upgrade settings for NAP + created node pools + management (google.cloud.container_v1.types.NodeManagement): + Specifies the node management options for NAP + created node-pools. + min_cpu_platform (str): + Deprecated. Minimum CPU platform to be used for NAP created + node pools. The instance may be scheduled on the specified + or newer CPU platform. Applicable values are the friendly + names of CPU platforms, such as minCpuPlatform: Intel + Haswell or minCpuPlatform: Intel Sandy Bridge. For more + information, read `how to specify min CPU + platform `__. + This field is deprecated, min_cpu_platform should be + specified using + ``cloud.google.com/requested-min-cpu-platform`` label + selector on the pod. To unset the min cpu platform field + pass "automatic" as field value. + disk_size_gb (int): + Size of the disk attached to each node, + specified in GB. The smallest allowed disk size + is 10GB. + + If unspecified, the default disk size is 100GB. + disk_type (str): + Type of the disk attached to each node (e.g. + 'pd-standard', 'pd-ssd' or 'pd-balanced') + + If unspecified, the default disk type is + 'pd-standard' + shielded_instance_config (google.cloud.container_v1.types.ShieldedInstanceConfig): + Shielded Instance options. + boot_disk_kms_key (str): + The Customer Managed Encryption Key used to encrypt the boot + disk attached to each node in the node pool. This should be + of the form + projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. + For more information about protecting resources with Cloud + KMS Keys please see: + https://cloud.google.com/compute/docs/disks/customer-managed-encryption + image_type (str): + The image type to use for NAP created node. + Please see + https://cloud.google.com/kubernetes-engine/docs/concepts/node-images + for available image types. + insecure_kubelet_readonly_port_enabled (bool): + Enable or disable Kubelet read only port. + + This field is a member of `oneof`_ ``_insecure_kubelet_readonly_port_enabled``. + """ + + oauth_scopes: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + service_account: str = proto.Field( + proto.STRING, + number=2, + ) + upgrade_settings: 'NodePool.UpgradeSettings' = proto.Field( + proto.MESSAGE, + number=3, + message='NodePool.UpgradeSettings', + ) + management: 'NodeManagement' = proto.Field( + proto.MESSAGE, + number=4, + message='NodeManagement', + ) + min_cpu_platform: str = proto.Field( + proto.STRING, + number=5, + ) + disk_size_gb: int = proto.Field( + proto.INT32, + number=6, + ) + disk_type: str = proto.Field( + proto.STRING, + number=7, + ) + shielded_instance_config: 'ShieldedInstanceConfig' = proto.Field( + proto.MESSAGE, + number=8, + message='ShieldedInstanceConfig', + ) + boot_disk_kms_key: str = proto.Field( + proto.STRING, + number=9, + ) + image_type: str = proto.Field( + proto.STRING, + number=10, + ) + insecure_kubelet_readonly_port_enabled: bool = proto.Field( + proto.BOOL, + number=13, + optional=True, + ) + + +class ResourceLimit(proto.Message): + r"""Contains information about amount of some resource in the + cluster. For memory, value should be in GB. + + Attributes: + resource_type (str): + Resource name "cpu", "memory" or gpu-specific + string. + minimum (int): + Minimum amount of the resource in the + cluster. + maximum (int): + Maximum amount of the resource in the + cluster. + """ + + resource_type: str = proto.Field( + proto.STRING, + number=1, + ) + minimum: int = proto.Field( + proto.INT64, + number=2, + ) + maximum: int = proto.Field( + proto.INT64, + number=3, + ) + + +class NodePoolAutoscaling(proto.Message): + r"""NodePoolAutoscaling contains information required by cluster + autoscaler to adjust the size of the node pool to the current + cluster usage. + + Attributes: + enabled (bool): + Is autoscaling enabled for this node pool. + min_node_count (int): + Minimum number of nodes for one location in the node pool. + Must be greater than or equal to 0 and less than or equal to + max_node_count. + max_node_count (int): + Maximum number of nodes for one location in the node pool. + Must be >= min_node_count. There has to be enough quota to + scale up the cluster. + autoprovisioned (bool): + Can this node pool be deleted automatically. + location_policy (google.cloud.container_v1.types.NodePoolAutoscaling.LocationPolicy): + Location policy used when scaling up a + nodepool. + total_min_node_count (int): + Minimum number of nodes in the node pool. Must be greater + than or equal to 0 and less than or equal to + total_max_node_count. The total_*_node_count fields are + mutually exclusive with the \*_node_count fields. + total_max_node_count (int): + Maximum number of nodes in the node pool. Must be greater + than or equal to total_min_node_count. There has to be + enough quota to scale up the cluster. The total_*_node_count + fields are mutually exclusive with the \*_node_count fields. + """ + class LocationPolicy(proto.Enum): + r"""Location policy specifies how zones are picked when scaling + up the nodepool. + + Values: + LOCATION_POLICY_UNSPECIFIED (0): + Not set. + BALANCED (1): + BALANCED is a best effort policy that aims to + balance the sizes of different zones. + ANY (2): + ANY policy picks zones that have the highest + capacity available. + """ + LOCATION_POLICY_UNSPECIFIED = 0 + BALANCED = 1 + ANY = 2 + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + min_node_count: int = proto.Field( + proto.INT32, + number=2, + ) + max_node_count: int = proto.Field( + proto.INT32, + number=3, + ) + autoprovisioned: bool = proto.Field( + proto.BOOL, + number=4, + ) + location_policy: LocationPolicy = proto.Field( + proto.ENUM, + number=5, + enum=LocationPolicy, + ) + total_min_node_count: int = proto.Field( + proto.INT32, + number=6, + ) + total_max_node_count: int = proto.Field( + proto.INT32, + number=7, + ) + + +class SetLabelsRequest(proto.Message): + r"""SetLabelsRequest sets the Google Cloud Platform labels on a + Google Container Engine cluster, which will in turn set them for + Google Compute Engine resources used by that cluster + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and replaced by + the name field. + resource_labels (MutableMapping[str, str]): + Required. The labels to set for that cluster. + label_fingerprint (str): + Required. The fingerprint of the previous set of labels for + this resource, used to detect conflicts. The fingerprint is + initially generated by Kubernetes Engine and changes after + every request to modify or update labels. You must always + provide an up-to-date fingerprint hash when updating or + changing labels. Make a ``get()`` request to the resource to + get the latest fingerprint. + name (str): + The name (project, location, cluster name) of the cluster to + set labels. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + resource_labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + label_fingerprint: str = proto.Field( + proto.STRING, + number=5, + ) + name: str = proto.Field( + proto.STRING, + number=7, + ) + + +class SetLegacyAbacRequest(proto.Message): + r"""SetLegacyAbacRequest enables or disables the ABAC + authorization mechanism for a cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster to + update. This field has been deprecated and + replaced by the name field. + enabled (bool): + Required. Whether ABAC authorization will be + enabled in the cluster. + name (str): + The name (project, location, cluster name) of the cluster to + set legacy abac. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + enabled: bool = proto.Field( + proto.BOOL, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class StartIPRotationRequest(proto.Message): + r"""StartIPRotationRequest creates a new IP for the cluster and + then performs a node upgrade on each node pool to point to the + new IP. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and replaced by + the name field. + name (str): + The name (project, location, cluster name) of the cluster to + start IP rotation. Specified in the format + ``projects/*/locations/*/clusters/*``. + rotate_credentials (bool): + Whether to rotate credentials during IP + rotation. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + rotate_credentials: bool = proto.Field( + proto.BOOL, + number=7, + ) + + +class CompleteIPRotationRequest(proto.Message): + r"""CompleteIPRotationRequest moves the cluster master back into + single-IP mode. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and replaced by + the name field. + name (str): + The name (project, location, cluster name) of the cluster to + complete IP rotation. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + name: str = proto.Field( + proto.STRING, + number=7, + ) + + +class AcceleratorConfig(proto.Message): + r"""AcceleratorConfig represents a Hardware Accelerator request. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + accelerator_count (int): + The number of the accelerator cards exposed + to an instance. + accelerator_type (str): + The accelerator type resource name. List of supported + accelerators + `here `__ + gpu_partition_size (str): + Size of partitions to create on the GPU. Valid values are + described in the NVIDIA `mig user + guide `__. + gpu_sharing_config (google.cloud.container_v1.types.GPUSharingConfig): + The configuration for GPU sharing options. + + This field is a member of `oneof`_ ``_gpu_sharing_config``. + gpu_driver_installation_config (google.cloud.container_v1.types.GPUDriverInstallationConfig): + The configuration for auto installation of + GPU driver. + + This field is a member of `oneof`_ ``_gpu_driver_installation_config``. + """ + + accelerator_count: int = proto.Field( + proto.INT64, + number=1, + ) + accelerator_type: str = proto.Field( + proto.STRING, + number=2, + ) + gpu_partition_size: str = proto.Field( + proto.STRING, + number=3, + ) + gpu_sharing_config: 'GPUSharingConfig' = proto.Field( + proto.MESSAGE, + number=5, + optional=True, + message='GPUSharingConfig', + ) + gpu_driver_installation_config: 'GPUDriverInstallationConfig' = proto.Field( + proto.MESSAGE, + number=6, + optional=True, + message='GPUDriverInstallationConfig', + ) + + +class GPUSharingConfig(proto.Message): + r"""GPUSharingConfig represents the GPU sharing configuration for + Hardware Accelerators. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + max_shared_clients_per_gpu (int): + The max number of containers that can share a + physical GPU. + gpu_sharing_strategy (google.cloud.container_v1.types.GPUSharingConfig.GPUSharingStrategy): + The type of GPU sharing strategy to enable on + the GPU node. + + This field is a member of `oneof`_ ``_gpu_sharing_strategy``. + """ + class GPUSharingStrategy(proto.Enum): + r"""The type of GPU sharing strategy currently provided. + + Values: + GPU_SHARING_STRATEGY_UNSPECIFIED (0): + Default value. + TIME_SHARING (1): + GPUs are time-shared between containers. + MPS (2): + GPUs are shared between containers with + NVIDIA MPS. + """ + GPU_SHARING_STRATEGY_UNSPECIFIED = 0 + TIME_SHARING = 1 + MPS = 2 + + max_shared_clients_per_gpu: int = proto.Field( + proto.INT64, + number=1, + ) + gpu_sharing_strategy: GPUSharingStrategy = proto.Field( + proto.ENUM, + number=2, + optional=True, + enum=GPUSharingStrategy, + ) + + +class GPUDriverInstallationConfig(proto.Message): + r"""GPUDriverInstallationConfig specifies the version of GPU + driver to be auto installed. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + gpu_driver_version (google.cloud.container_v1.types.GPUDriverInstallationConfig.GPUDriverVersion): + Mode for how the GPU driver is installed. + + This field is a member of `oneof`_ ``_gpu_driver_version``. + """ + class GPUDriverVersion(proto.Enum): + r"""The GPU driver version to install. + + Values: + GPU_DRIVER_VERSION_UNSPECIFIED (0): + Default value is to not install any GPU + driver. + INSTALLATION_DISABLED (1): + Disable GPU driver auto installation and + needs manual installation + DEFAULT (2): + "Default" GPU driver in COS and Ubuntu. + LATEST (3): + "Latest" GPU driver in COS. + """ + GPU_DRIVER_VERSION_UNSPECIFIED = 0 + INSTALLATION_DISABLED = 1 + DEFAULT = 2 + LATEST = 3 + + gpu_driver_version: GPUDriverVersion = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum=GPUDriverVersion, + ) + + +class WorkloadMetadataConfig(proto.Message): + r"""WorkloadMetadataConfig defines the metadata configuration to + expose to workloads on the node pool. + + Attributes: + mode (google.cloud.container_v1.types.WorkloadMetadataConfig.Mode): + Mode is the configuration for how to expose + metadata to workloads running on the node pool. + """ + class Mode(proto.Enum): + r"""Mode is the configuration for how to expose metadata to + workloads running on the node. + + Values: + MODE_UNSPECIFIED (0): + Not set. + GCE_METADATA (1): + Expose all Compute Engine metadata to pods. + GKE_METADATA (2): + Run the GKE Metadata Server on this node. The + GKE Metadata Server exposes a metadata API to + workloads that is compatible with the V1 Compute + Metadata APIs exposed by the Compute Engine and + App Engine Metadata Servers. This feature can + only be enabled if Workload Identity is enabled + at the cluster level. + """ + MODE_UNSPECIFIED = 0 + GCE_METADATA = 1 + GKE_METADATA = 2 + + mode: Mode = proto.Field( + proto.ENUM, + number=2, + enum=Mode, + ) + + +class SetNetworkPolicyRequest(proto.Message): + r"""SetNetworkPolicyRequest enables/disables network policy for a + cluster. + + Attributes: + project_id (str): + Deprecated. The Google Developers Console `project ID or + project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Deprecated. The name of the cluster. + This field has been deprecated and replaced by + the name field. + network_policy (google.cloud.container_v1.types.NetworkPolicy): + Required. Configuration options for the + NetworkPolicy feature. + name (str): + The name (project, location, cluster name) of the cluster to + set networking policy. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + network_policy: 'NetworkPolicy' = proto.Field( + proto.MESSAGE, + number=4, + message='NetworkPolicy', + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class SetMaintenancePolicyRequest(proto.Message): + r"""SetMaintenancePolicyRequest sets the maintenance policy for a + cluster. + + Attributes: + project_id (str): + Required. The Google Developers Console `project ID or + project + number `__. + zone (str): + Required. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. + cluster_id (str): + Required. The name of the cluster to update. + maintenance_policy (google.cloud.container_v1.types.MaintenancePolicy): + Required. The maintenance policy to be set + for the cluster. An empty field clears the + existing maintenance policy. + name (str): + The name (project, location, cluster name) of the cluster to + set maintenance policy. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + maintenance_policy: 'MaintenancePolicy' = proto.Field( + proto.MESSAGE, + number=4, + message='MaintenancePolicy', + ) + name: str = proto.Field( + proto.STRING, + number=5, + ) + + +class StatusCondition(proto.Message): + r"""StatusCondition describes why a cluster or a node pool has a + certain status (e.g., ERROR or DEGRADED). + + Attributes: + code (google.cloud.container_v1.types.StatusCondition.Code): + Machine-friendly representation of the condition Deprecated. + Use canonical_code instead. + message (str): + Human-friendly representation of the + condition + canonical_code (google.rpc.code_pb2.Code): + Canonical code of the condition. + """ + class Code(proto.Enum): + r"""Code for each condition + + Values: + UNKNOWN (0): + UNKNOWN indicates a generic condition. + GCE_STOCKOUT (1): + GCE_STOCKOUT indicates that Google Compute Engine resources + are temporarily unavailable. + GKE_SERVICE_ACCOUNT_DELETED (2): + GKE_SERVICE_ACCOUNT_DELETED indicates that the user deleted + their robot service account. + GCE_QUOTA_EXCEEDED (3): + Google Compute Engine quota was exceeded. + SET_BY_OPERATOR (4): + Cluster state was manually changed by an SRE + due to a system logic error. + CLOUD_KMS_KEY_ERROR (7): + Unable to perform an encrypt operation + against the CloudKMS key used for etcd level + encryption. + CA_EXPIRING (9): + Cluster CA is expiring soon. + """ + UNKNOWN = 0 + GCE_STOCKOUT = 1 + GKE_SERVICE_ACCOUNT_DELETED = 2 + GCE_QUOTA_EXCEEDED = 3 + SET_BY_OPERATOR = 4 + CLOUD_KMS_KEY_ERROR = 7 + CA_EXPIRING = 9 + + code: Code = proto.Field( + proto.ENUM, + number=1, + enum=Code, + ) + message: str = proto.Field( + proto.STRING, + number=2, + ) + canonical_code: code_pb2.Code = proto.Field( + proto.ENUM, + number=3, + enum=code_pb2.Code, + ) + + +class NetworkConfig(proto.Message): + r"""NetworkConfig reports the relative names of network & + subnetwork. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + network (str): + Output only. The relative name of the Google Compute Engine + `network `__ + to which the cluster is connected. Example: + projects/my-project/global/networks/my-network + subnetwork (str): + Output only. The relative name of the Google Compute Engine + `subnetwork `__ + to which the cluster is connected. Example: + projects/my-project/regions/us-central1/subnetworks/my-subnet + enable_intra_node_visibility (bool): + Whether Intra-node visibility is enabled for + this cluster. This makes same node pod to pod + traffic visible for VPC network. + default_snat_status (google.cloud.container_v1.types.DefaultSnatStatus): + Whether the cluster disables default in-node sNAT rules. + In-node sNAT rules will be disabled when default_snat_status + is disabled. When disabled is set to false, default IP + masquerade rules will be applied to the nodes to prevent + sNAT on cluster internal traffic. + enable_l4ilb_subsetting (bool): + Whether L4ILB Subsetting is enabled for this + cluster. + datapath_provider (google.cloud.container_v1.types.DatapathProvider): + The desired datapath provider for this + cluster. By default, uses the IPTables-based + kube-proxy implementation. + private_ipv6_google_access (google.cloud.container_v1.types.PrivateIPv6GoogleAccess): + The desired state of IPv6 connectivity to + Google Services. By default, no private IPv6 + access to or from Google Services (all access + will be via IPv4) + dns_config (google.cloud.container_v1.types.DNSConfig): + DNSConfig contains clusterDNS config for this + cluster. + service_external_ips_config (google.cloud.container_v1.types.ServiceExternalIPsConfig): + ServiceExternalIPsConfig specifies if + services with externalIPs field are blocked or + not. + gateway_api_config (google.cloud.container_v1.types.GatewayAPIConfig): + GatewayAPIConfig contains the desired config + of Gateway API on this cluster. + enable_multi_networking (bool): + Whether multi-networking is enabled for this + cluster. + network_performance_config (google.cloud.container_v1.types.NetworkConfig.ClusterNetworkPerformanceConfig): + Network bandwidth tier configuration. + enable_fqdn_network_policy (bool): + Whether FQDN Network Policy is enabled on + this cluster. + + This field is a member of `oneof`_ ``_enable_fqdn_network_policy``. + in_transit_encryption_config (google.cloud.container_v1.types.InTransitEncryptionConfig): + Specify the details of in-transit encryption. + Now named inter-node transparent encryption. + + This field is a member of `oneof`_ ``_in_transit_encryption_config``. + enable_cilium_clusterwide_network_policy (bool): + Whether CiliumClusterwideNetworkPolicy is + enabled on this cluster. + + This field is a member of `oneof`_ ``_enable_cilium_clusterwide_network_policy``. + default_enable_private_nodes (bool): + Controls whether by default nodes have private IP addresses + only. It is invalid to specify both + [PrivateClusterConfig.enablePrivateNodes][] and this field + at the same time. To update the default setting, use + [ClusterUpdate.desired_default_enable_private_nodes][google.container.v1.ClusterUpdate.desired_default_enable_private_nodes] + + This field is a member of `oneof`_ ``_default_enable_private_nodes``. + """ + + class ClusterNetworkPerformanceConfig(proto.Message): + r"""Configuration of network bandwidth tiers + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + total_egress_bandwidth_tier (google.cloud.container_v1.types.NetworkConfig.ClusterNetworkPerformanceConfig.Tier): + Specifies the total network bandwidth tier + for NodePools in the cluster. + + This field is a member of `oneof`_ ``_total_egress_bandwidth_tier``. + """ + class Tier(proto.Enum): + r"""Node network tier + + Values: + TIER_UNSPECIFIED (0): + Default value + TIER_1 (1): + Higher bandwidth, actual values based on VM + size. + """ + TIER_UNSPECIFIED = 0 + TIER_1 = 1 + + total_egress_bandwidth_tier: 'NetworkConfig.ClusterNetworkPerformanceConfig.Tier' = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum='NetworkConfig.ClusterNetworkPerformanceConfig.Tier', + ) + + network: str = proto.Field( + proto.STRING, + number=1, + ) + subnetwork: str = proto.Field( + proto.STRING, + number=2, + ) + enable_intra_node_visibility: bool = proto.Field( + proto.BOOL, + number=5, + ) + default_snat_status: 'DefaultSnatStatus' = proto.Field( + proto.MESSAGE, + number=7, + message='DefaultSnatStatus', + ) + enable_l4ilb_subsetting: bool = proto.Field( + proto.BOOL, + number=10, + ) + datapath_provider: 'DatapathProvider' = proto.Field( + proto.ENUM, + number=11, + enum='DatapathProvider', + ) + private_ipv6_google_access: 'PrivateIPv6GoogleAccess' = proto.Field( + proto.ENUM, + number=12, + enum='PrivateIPv6GoogleAccess', + ) + dns_config: 'DNSConfig' = proto.Field( + proto.MESSAGE, + number=13, + message='DNSConfig', + ) + service_external_ips_config: 'ServiceExternalIPsConfig' = proto.Field( + proto.MESSAGE, + number=15, + message='ServiceExternalIPsConfig', + ) + gateway_api_config: 'GatewayAPIConfig' = proto.Field( + proto.MESSAGE, + number=16, + message='GatewayAPIConfig', + ) + enable_multi_networking: bool = proto.Field( + proto.BOOL, + number=17, + ) + network_performance_config: ClusterNetworkPerformanceConfig = proto.Field( + proto.MESSAGE, + number=18, + message=ClusterNetworkPerformanceConfig, + ) + enable_fqdn_network_policy: bool = proto.Field( + proto.BOOL, + number=19, + optional=True, + ) + in_transit_encryption_config: 'InTransitEncryptionConfig' = proto.Field( + proto.ENUM, + number=20, + optional=True, + enum='InTransitEncryptionConfig', + ) + enable_cilium_clusterwide_network_policy: bool = proto.Field( + proto.BOOL, + number=21, + optional=True, + ) + default_enable_private_nodes: bool = proto.Field( + proto.BOOL, + number=22, + optional=True, + ) + + +class GatewayAPIConfig(proto.Message): + r"""GatewayAPIConfig contains the desired config of Gateway API + on this cluster. + + Attributes: + channel (google.cloud.container_v1.types.GatewayAPIConfig.Channel): + The Gateway API release channel to use for + Gateway API. + """ + class Channel(proto.Enum): + r"""Channel describes if/how Gateway API should be installed and + implemented in a cluster. + + Values: + CHANNEL_UNSPECIFIED (0): + Default value. + CHANNEL_DISABLED (1): + Gateway API support is disabled + CHANNEL_EXPERIMENTAL (3): + Deprecated: use CHANNEL_STANDARD instead. Gateway API + support is enabled, experimental CRDs are installed + CHANNEL_STANDARD (4): + Gateway API support is enabled, standard CRDs + are installed + """ + CHANNEL_UNSPECIFIED = 0 + CHANNEL_DISABLED = 1 + CHANNEL_EXPERIMENTAL = 3 + CHANNEL_STANDARD = 4 + + channel: Channel = proto.Field( + proto.ENUM, + number=1, + enum=Channel, + ) + + +class ServiceExternalIPsConfig(proto.Message): + r"""Config to block services with externalIPs field. + + Attributes: + enabled (bool): + Whether Services with ExternalIPs field are + allowed or not. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class GetOpenIDConfigRequest(proto.Message): + r"""GetOpenIDConfigRequest gets the OIDC discovery document for + the cluster. See the OpenID Connect Discovery 1.0 specification + for details. + + Attributes: + parent (str): + The cluster (project, location, cluster name) to get the + discovery document for. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + + +class GetOpenIDConfigResponse(proto.Message): + r"""GetOpenIDConfigResponse is an OIDC discovery document for the + cluster. See the OpenID Connect Discovery 1.0 specification for + details. + + Attributes: + issuer (str): + OIDC Issuer. + jwks_uri (str): + JSON Web Key uri. + response_types_supported (MutableSequence[str]): + Supported response types. + subject_types_supported (MutableSequence[str]): + Supported subject types. + id_token_signing_alg_values_supported (MutableSequence[str]): + supported ID Token signing Algorithms. + claims_supported (MutableSequence[str]): + Supported claims. + grant_types (MutableSequence[str]): + Supported grant types. + """ + + issuer: str = proto.Field( + proto.STRING, + number=1, + ) + jwks_uri: str = proto.Field( + proto.STRING, + number=2, + ) + response_types_supported: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + subject_types_supported: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + id_token_signing_alg_values_supported: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=5, + ) + claims_supported: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=6, + ) + grant_types: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=7, + ) + + +class GetJSONWebKeysRequest(proto.Message): + r"""GetJSONWebKeysRequest gets the public component of the keys used by + the cluster to sign token requests. This will be the jwks_uri for + the discover document returned by getOpenIDConfig. See the OpenID + Connect Discovery 1.0 specification for details. + + Attributes: + parent (str): + The cluster (project, location, cluster name) to get keys + for. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + + +class Jwk(proto.Message): + r"""Jwk is a JSON Web Key as specified in RFC 7517 + + Attributes: + kty (str): + Key Type. + alg (str): + Algorithm. + use (str): + Permitted uses for the public keys. + kid (str): + Key ID. + n (str): + Used for RSA keys. + e (str): + Used for RSA keys. + x (str): + Used for ECDSA keys. + y (str): + Used for ECDSA keys. + crv (str): + Used for ECDSA keys. + """ + + kty: str = proto.Field( + proto.STRING, + number=1, + ) + alg: str = proto.Field( + proto.STRING, + number=2, + ) + use: str = proto.Field( + proto.STRING, + number=3, + ) + kid: str = proto.Field( + proto.STRING, + number=4, + ) + n: str = proto.Field( + proto.STRING, + number=5, + ) + e: str = proto.Field( + proto.STRING, + number=6, + ) + x: str = proto.Field( + proto.STRING, + number=7, + ) + y: str = proto.Field( + proto.STRING, + number=8, + ) + crv: str = proto.Field( + proto.STRING, + number=9, + ) + + +class GetJSONWebKeysResponse(proto.Message): + r"""GetJSONWebKeysResponse is a valid JSON Web Key Set as + specififed in rfc 7517 + + Attributes: + keys (MutableSequence[google.cloud.container_v1.types.Jwk]): + The public component of the keys used by the + cluster to sign token requests. + """ + + keys: MutableSequence['Jwk'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Jwk', + ) + + +class CheckAutopilotCompatibilityRequest(proto.Message): + r"""CheckAutopilotCompatibilityRequest requests getting the + blockers for the given operation in the cluster. + + Attributes: + name (str): + The name (project, location, cluster) of the cluster to + retrieve. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class AutopilotCompatibilityIssue(proto.Message): + r"""AutopilotCompatibilityIssue contains information about a + specific compatibility issue with Autopilot mode. + + Attributes: + last_observation (google.protobuf.timestamp_pb2.Timestamp): + The last time when this issue was observed. + constraint_type (str): + The constraint type of the issue. + incompatibility_type (google.cloud.container_v1.types.AutopilotCompatibilityIssue.IssueType): + The incompatibility type of this issue. + subjects (MutableSequence[str]): + The name of the resources which are subject + to this issue. + documentation_url (str): + A URL to a public documnetation, which + addresses resolving this issue. + description (str): + The description of the issue. + """ + class IssueType(proto.Enum): + r"""The type of the reported issue. + + Values: + UNSPECIFIED (0): + Default value, should not be used. + INCOMPATIBILITY (1): + Indicates that the issue is a known + incompatibility between the cluster and + Autopilot mode. + ADDITIONAL_CONFIG_REQUIRED (2): + Indicates the issue is an incompatibility if + customers take no further action to resolve. + PASSED_WITH_OPTIONAL_CONFIG (3): + Indicates the issue is not an + incompatibility, but depending on the workloads + business logic, there is a potential that they + won't work on Autopilot. + """ + UNSPECIFIED = 0 + INCOMPATIBILITY = 1 + ADDITIONAL_CONFIG_REQUIRED = 2 + PASSED_WITH_OPTIONAL_CONFIG = 3 + + last_observation: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + constraint_type: str = proto.Field( + proto.STRING, + number=2, + ) + incompatibility_type: IssueType = proto.Field( + proto.ENUM, + number=3, + enum=IssueType, + ) + subjects: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + documentation_url: str = proto.Field( + proto.STRING, + number=5, + ) + description: str = proto.Field( + proto.STRING, + number=6, + ) + + +class CheckAutopilotCompatibilityResponse(proto.Message): + r"""CheckAutopilotCompatibilityResponse has a list of + compatibility issues. + + Attributes: + issues (MutableSequence[google.cloud.container_v1.types.AutopilotCompatibilityIssue]): + The list of issues for the given operation. + summary (str): + The summary of the autopilot compatibility + response. + """ + + issues: MutableSequence['AutopilotCompatibilityIssue'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='AutopilotCompatibilityIssue', + ) + summary: str = proto.Field( + proto.STRING, + number=2, + ) + + +class ReleaseChannel(proto.Message): + r"""ReleaseChannel indicates which release channel a cluster is + subscribed to. Release channels are arranged in order of risk. + + When a cluster is subscribed to a release channel, Google + maintains both the master version and the node version. Node + auto-upgrade defaults to true and cannot be disabled. + + Attributes: + channel (google.cloud.container_v1.types.ReleaseChannel.Channel): + channel specifies which release channel the + cluster is subscribed to. + """ + class Channel(proto.Enum): + r"""Possible values for 'channel'. + + Values: + UNSPECIFIED (0): + No channel specified. + RAPID (1): + RAPID channel is offered on an early access + basis for customers who want to test new + releases. + + WARNING: Versions available in the RAPID Channel + may be subject to unresolved issues with no + known workaround and are not subject to any + SLAs. + REGULAR (2): + Clusters subscribed to REGULAR receive + versions that are considered GA quality. REGULAR + is intended for production users who want to + take advantage of new features. + STABLE (3): + Clusters subscribed to STABLE receive + versions that are known to be stable and + reliable in production. + EXTENDED (4): + Clusters subscribed to EXTENDED receive + extended support and availability for versions + which are known to be stable and reliable in + production. + """ + UNSPECIFIED = 0 + RAPID = 1 + REGULAR = 2 + STABLE = 3 + EXTENDED = 4 + + channel: Channel = proto.Field( + proto.ENUM, + number=1, + enum=Channel, + ) + + +class CostManagementConfig(proto.Message): + r"""Configuration for fine-grained cost management feature. + + Attributes: + enabled (bool): + Whether the feature is enabled or not. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class IntraNodeVisibilityConfig(proto.Message): + r"""IntraNodeVisibilityConfig contains the desired config of the + intra-node visibility on this cluster. + + Attributes: + enabled (bool): + Enables intra node visibility for this + cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class ILBSubsettingConfig(proto.Message): + r"""ILBSubsettingConfig contains the desired config of L4 + Internal LoadBalancer subsetting on this cluster. + + Attributes: + enabled (bool): + Enables l4 ILB subsetting for this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class DNSConfig(proto.Message): + r"""DNSConfig contains the desired set of options for configuring + clusterDNS. + + Attributes: + cluster_dns (google.cloud.container_v1.types.DNSConfig.Provider): + cluster_dns indicates which in-cluster DNS provider should + be used. + cluster_dns_scope (google.cloud.container_v1.types.DNSConfig.DNSScope): + cluster_dns_scope indicates the scope of access to cluster + DNS records. + cluster_dns_domain (str): + cluster_dns_domain is the suffix used for all cluster + service records. + additive_vpc_scope_dns_domain (str): + Optional. The domain used in Additive VPC + scope. + """ + class Provider(proto.Enum): + r"""Provider lists the various in-cluster DNS providers. + + Values: + PROVIDER_UNSPECIFIED (0): + Default value + PLATFORM_DEFAULT (1): + Use GKE default DNS provider(kube-dns) for + DNS resolution. + CLOUD_DNS (2): + Use CloudDNS for DNS resolution. + KUBE_DNS (3): + Use KubeDNS for DNS resolution. + """ + PROVIDER_UNSPECIFIED = 0 + PLATFORM_DEFAULT = 1 + CLOUD_DNS = 2 + KUBE_DNS = 3 + + class DNSScope(proto.Enum): + r"""DNSScope lists the various scopes of access to cluster DNS + records. + + Values: + DNS_SCOPE_UNSPECIFIED (0): + Default value, will be inferred as cluster + scope. + CLUSTER_SCOPE (1): + DNS records are accessible from within the + cluster. + VPC_SCOPE (2): + DNS records are accessible from within the + VPC. + """ + DNS_SCOPE_UNSPECIFIED = 0 + CLUSTER_SCOPE = 1 + VPC_SCOPE = 2 + + cluster_dns: Provider = proto.Field( + proto.ENUM, + number=1, + enum=Provider, + ) + cluster_dns_scope: DNSScope = proto.Field( + proto.ENUM, + number=2, + enum=DNSScope, + ) + cluster_dns_domain: str = proto.Field( + proto.STRING, + number=3, + ) + additive_vpc_scope_dns_domain: str = proto.Field( + proto.STRING, + number=5, + ) + + +class MaxPodsConstraint(proto.Message): + r"""Constraints applied to pods. + + Attributes: + max_pods_per_node (int): + Constraint enforced on the max num of pods + per node. + """ + + max_pods_per_node: int = proto.Field( + proto.INT64, + number=1, + ) + + +class WorkloadIdentityConfig(proto.Message): + r"""Configuration for the use of Kubernetes Service Accounts in + GCP IAM policies. + + Attributes: + workload_pool (str): + The workload pool to attach all Kubernetes + service accounts to. + """ + + workload_pool: str = proto.Field( + proto.STRING, + number=2, + ) + + +class IdentityServiceConfig(proto.Message): + r"""IdentityServiceConfig is configuration for Identity Service + which allows customers to use external identity providers with + the K8S API + + Attributes: + enabled (bool): + Whether to enable the Identity Service + component + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class MeshCertificates(proto.Message): + r"""Configuration for issuance of mTLS keys and certificates to + Kubernetes pods. + + Attributes: + enable_certificates (google.protobuf.wrappers_pb2.BoolValue): + enable_certificates controls issuance of workload mTLS + certificates. + + If set, the GKE Workload Identity Certificates controller + and node agent will be deployed in the cluster, which can + then be configured by creating a WorkloadCertificateConfig + Custom Resource. + + Requires Workload Identity + ([workload_pool][google.container.v1.WorkloadIdentityConfig.workload_pool] + must be non-empty). + """ + + enable_certificates: wrappers_pb2.BoolValue = proto.Field( + proto.MESSAGE, + number=1, + message=wrappers_pb2.BoolValue, + ) + + +class DatabaseEncryption(proto.Message): + r"""Configuration of etcd encryption. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + key_name (str): + Name of CloudKMS key to use for the + encryption of secrets in etcd. Ex. + projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key + state (google.cloud.container_v1.types.DatabaseEncryption.State): + The desired state of etcd encryption. + current_state (google.cloud.container_v1.types.DatabaseEncryption.CurrentState): + Output only. The current state of etcd + encryption. + + This field is a member of `oneof`_ ``_current_state``. + decryption_keys (MutableSequence[str]): + Output only. Keys in use by the cluster for decrypting + existing objects, in addition to the key in ``key_name``. + + Each item is a CloudKMS key resource. + last_operation_errors (MutableSequence[google.cloud.container_v1.types.DatabaseEncryption.OperationError]): + Output only. Records errors seen during + DatabaseEncryption update operations. + """ + class State(proto.Enum): + r"""State of etcd encryption. + + Values: + UNKNOWN (0): + Should never be set + ENCRYPTED (1): + Secrets in etcd are encrypted. + DECRYPTED (2): + Secrets in etcd are stored in plain text (at + etcd level) - this is unrelated to Compute + Engine level full disk encryption. + """ + UNKNOWN = 0 + ENCRYPTED = 1 + DECRYPTED = 2 + + class CurrentState(proto.Enum): + r"""Current State of etcd encryption. + + Values: + CURRENT_STATE_UNSPECIFIED (0): + Should never be set + CURRENT_STATE_ENCRYPTED (7): + Secrets in etcd are encrypted. + CURRENT_STATE_DECRYPTED (2): + Secrets in etcd are stored in plain text (at + etcd level) - this is unrelated to Compute + Engine level full disk encryption. + CURRENT_STATE_ENCRYPTION_PENDING (3): + Encryption (or re-encryption with a different + CloudKMS key) of Secrets is in progress. + CURRENT_STATE_ENCRYPTION_ERROR (4): + Encryption (or re-encryption with a different + CloudKMS key) of Secrets in etcd encountered an + error. + CURRENT_STATE_DECRYPTION_PENDING (5): + De-crypting Secrets to plain text in etcd is + in progress. + CURRENT_STATE_DECRYPTION_ERROR (6): + De-crypting Secrets to plain text in etcd + encountered an error. + """ + CURRENT_STATE_UNSPECIFIED = 0 + CURRENT_STATE_ENCRYPTED = 7 + CURRENT_STATE_DECRYPTED = 2 + CURRENT_STATE_ENCRYPTION_PENDING = 3 + CURRENT_STATE_ENCRYPTION_ERROR = 4 + CURRENT_STATE_DECRYPTION_PENDING = 5 + CURRENT_STATE_DECRYPTION_ERROR = 6 + + class OperationError(proto.Message): + r"""OperationError records errors seen from CloudKMS keys + encountered during updates to DatabaseEncryption configuration. + + Attributes: + key_name (str): + CloudKMS key resource that had the error. + error_message (str): + Description of the error seen during the + operation. + timestamp (google.protobuf.timestamp_pb2.Timestamp): + Time when the CloudKMS error was seen. + """ + + key_name: str = proto.Field( + proto.STRING, + number=1, + ) + error_message: str = proto.Field( + proto.STRING, + number=2, + ) + timestamp: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + + key_name: str = proto.Field( + proto.STRING, + number=1, + ) + state: State = proto.Field( + proto.ENUM, + number=2, + enum=State, + ) + current_state: CurrentState = proto.Field( + proto.ENUM, + number=3, + optional=True, + enum=CurrentState, + ) + decryption_keys: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + last_operation_errors: MutableSequence[OperationError] = proto.RepeatedField( + proto.MESSAGE, + number=5, + message=OperationError, + ) + + +class ListUsableSubnetworksRequest(proto.Message): + r"""ListUsableSubnetworksRequest requests the list of usable + subnetworks available to a user for creating clusters. + + Attributes: + parent (str): + The parent project where subnetworks are usable. Specified + in the format ``projects/*``. + filter (str): + Filtering currently only supports equality on the + networkProjectId and must be in the form: + "networkProjectId=[PROJECTID]", where ``networkProjectId`` + is the project which owns the listed subnetworks. This + defaults to the parent project ID. + page_size (int): + The max number of results per page that should be returned. + If the number of available results is larger than + ``page_size``, a ``next_page_token`` is returned which can + be used to get the next page of results in subsequent + requests. Acceptable values are 0 to 500, inclusive. + (Default: 500) + page_token (str): + Specifies a page token to use. Set this to + the nextPageToken returned by previous list + requests to get the next page of results. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + filter: str = proto.Field( + proto.STRING, + number=2, + ) + page_size: int = proto.Field( + proto.INT32, + number=3, + ) + page_token: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListUsableSubnetworksResponse(proto.Message): + r"""ListUsableSubnetworksResponse is the response of + ListUsableSubnetworksRequest. + + Attributes: + subnetworks (MutableSequence[google.cloud.container_v1.types.UsableSubnetwork]): + A list of usable subnetworks in the specified + network project. + next_page_token (str): + This token allows you to get the next page of results for + list requests. If the number of results is larger than + ``page_size``, use the ``next_page_token`` as a value for + the query parameter ``page_token`` in the next request. The + value will become empty when there are no more pages. + """ + + @property + def raw_page(self): + return self + + subnetworks: MutableSequence['UsableSubnetwork'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='UsableSubnetwork', + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + + +class UsableSubnetworkSecondaryRange(proto.Message): + r"""Secondary IP range of a usable subnetwork. + + Attributes: + range_name (str): + The name associated with this subnetwork + secondary range, used when adding an alias IP + range to a VM instance. + ip_cidr_range (str): + The range of IP addresses belonging to this + subnetwork secondary range. + status (google.cloud.container_v1.types.UsableSubnetworkSecondaryRange.Status): + This field is to determine the status of the + secondary range programmably. + """ + class Status(proto.Enum): + r"""Status shows the current usage of a secondary IP range. + + Values: + UNKNOWN (0): + UNKNOWN is the zero value of the Status enum. + It's not a valid status. + UNUSED (1): + UNUSED denotes that this range is unclaimed + by any cluster. + IN_USE_SERVICE (2): + IN_USE_SERVICE denotes that this range is claimed by + cluster(s) for services. User-managed services range can be + shared between clusters within the same subnetwork. + IN_USE_SHAREABLE_POD (3): + IN_USE_SHAREABLE_POD denotes this range was created by the + network admin and is currently claimed by a cluster for + pods. It can only be used by other clusters as a pod range. + IN_USE_MANAGED_POD (4): + IN_USE_MANAGED_POD denotes this range was created by GKE and + is claimed for pods. It cannot be used for other clusters. + """ + UNKNOWN = 0 + UNUSED = 1 + IN_USE_SERVICE = 2 + IN_USE_SHAREABLE_POD = 3 + IN_USE_MANAGED_POD = 4 + + range_name: str = proto.Field( + proto.STRING, + number=1, + ) + ip_cidr_range: str = proto.Field( + proto.STRING, + number=2, + ) + status: Status = proto.Field( + proto.ENUM, + number=3, + enum=Status, + ) + + +class UsableSubnetwork(proto.Message): + r"""UsableSubnetwork resource returns the subnetwork name, its + associated network and the primary CIDR range. + + Attributes: + subnetwork (str): + Subnetwork Name. + Example: + projects/my-project/regions/us-central1/subnetworks/my-subnet + network (str): + Network Name. + Example: + projects/my-project/global/networks/my-network + ip_cidr_range (str): + The range of internal addresses that are + owned by this subnetwork. + secondary_ip_ranges (MutableSequence[google.cloud.container_v1.types.UsableSubnetworkSecondaryRange]): + Secondary IP ranges. + status_message (str): + A human readable status message representing the reasons for + cases where the caller cannot use the secondary ranges under + the subnet. For example if the secondary_ip_ranges is empty + due to a permission issue, an insufficient permission + message will be given by status_message. + """ + + subnetwork: str = proto.Field( + proto.STRING, + number=1, + ) + network: str = proto.Field( + proto.STRING, + number=2, + ) + ip_cidr_range: str = proto.Field( + proto.STRING, + number=3, + ) + secondary_ip_ranges: MutableSequence['UsableSubnetworkSecondaryRange'] = proto.RepeatedField( + proto.MESSAGE, + number=4, + message='UsableSubnetworkSecondaryRange', + ) + status_message: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ResourceUsageExportConfig(proto.Message): + r"""Configuration for exporting cluster resource usages. + + Attributes: + bigquery_destination (google.cloud.container_v1.types.ResourceUsageExportConfig.BigQueryDestination): + Configuration to use BigQuery as usage export + destination. + enable_network_egress_metering (bool): + Whether to enable network egress metering for + this cluster. If enabled, a daemonset will be + created in the cluster to meter network egress + traffic. + consumption_metering_config (google.cloud.container_v1.types.ResourceUsageExportConfig.ConsumptionMeteringConfig): + Configuration to enable resource consumption + metering. + """ + + class BigQueryDestination(proto.Message): + r"""Parameters for using BigQuery as the destination of resource + usage export. + + Attributes: + dataset_id (str): + The ID of a BigQuery Dataset. + """ + + dataset_id: str = proto.Field( + proto.STRING, + number=1, + ) + + class ConsumptionMeteringConfig(proto.Message): + r"""Parameters for controlling consumption metering. + + Attributes: + enabled (bool): + Whether to enable consumption metering for + this cluster. If enabled, a second BigQuery + table will be created to hold resource + consumption records. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + bigquery_destination: BigQueryDestination = proto.Field( + proto.MESSAGE, + number=1, + message=BigQueryDestination, + ) + enable_network_egress_metering: bool = proto.Field( + proto.BOOL, + number=2, + ) + consumption_metering_config: ConsumptionMeteringConfig = proto.Field( + proto.MESSAGE, + number=3, + message=ConsumptionMeteringConfig, + ) + + +class VerticalPodAutoscaling(proto.Message): + r"""VerticalPodAutoscaling contains global, per-cluster + information required by Vertical Pod Autoscaler to automatically + adjust the resources of pods controlled by it. + + Attributes: + enabled (bool): + Enables vertical pod autoscaling. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class DefaultSnatStatus(proto.Message): + r"""DefaultSnatStatus contains the desired state of whether + default sNAT should be disabled on the cluster. + + Attributes: + disabled (bool): + Disables cluster default sNAT rules. + """ + + disabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class ShieldedNodes(proto.Message): + r"""Configuration of Shielded Nodes feature. + + Attributes: + enabled (bool): + Whether Shielded Nodes features are enabled + on all nodes in this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class VirtualNIC(proto.Message): + r"""Configuration of gVNIC feature. + + Attributes: + enabled (bool): + Whether gVNIC features are enabled in the + node pool. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class FastSocket(proto.Message): + r"""Configuration of Fast Socket feature. + + Attributes: + enabled (bool): + Whether Fast Socket features are enabled in + the node pool. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class NotificationConfig(proto.Message): + r"""NotificationConfig is the configuration of notifications. + + Attributes: + pubsub (google.cloud.container_v1.types.NotificationConfig.PubSub): + Notification config for Pub/Sub. + """ + class EventType(proto.Enum): + r"""Types of notifications currently supported. Can be used to + filter what notifications are sent. + + Values: + EVENT_TYPE_UNSPECIFIED (0): + Not set, will be ignored. + UPGRADE_AVAILABLE_EVENT (1): + Corresponds with UpgradeAvailableEvent. + UPGRADE_EVENT (2): + Corresponds with UpgradeEvent. + SECURITY_BULLETIN_EVENT (3): + Corresponds with SecurityBulletinEvent. + """ + EVENT_TYPE_UNSPECIFIED = 0 + UPGRADE_AVAILABLE_EVENT = 1 + UPGRADE_EVENT = 2 + SECURITY_BULLETIN_EVENT = 3 + + class PubSub(proto.Message): + r"""Pub/Sub specific notification config. + + Attributes: + enabled (bool): + Enable notifications for Pub/Sub. + topic (str): + The desired Pub/Sub topic to which notifications will be + sent by GKE. Format is + ``projects/{project}/topics/{topic}``. + filter (google.cloud.container_v1.types.NotificationConfig.Filter): + Allows filtering to one or more specific + event types. If no filter is specified, or if a + filter is specified with no event types, all + event types will be sent + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + topic: str = proto.Field( + proto.STRING, + number=2, + ) + filter: 'NotificationConfig.Filter' = proto.Field( + proto.MESSAGE, + number=3, + message='NotificationConfig.Filter', + ) + + class Filter(proto.Message): + r"""Allows filtering to one or more specific event types. If + event types are present, those and only those event types will + be transmitted to the cluster. Other types will be skipped. If + no filter is specified, or no event types are present, all event + types will be sent + + Attributes: + event_type (MutableSequence[google.cloud.container_v1.types.NotificationConfig.EventType]): + Event types to allowlist. + """ + + event_type: MutableSequence['NotificationConfig.EventType'] = proto.RepeatedField( + proto.ENUM, + number=1, + enum='NotificationConfig.EventType', + ) + + pubsub: PubSub = proto.Field( + proto.MESSAGE, + number=1, + message=PubSub, + ) + + +class ConfidentialNodes(proto.Message): + r"""ConfidentialNodes is configuration for the confidential nodes + feature, which makes nodes run on confidential VMs. + + Attributes: + enabled (bool): + Whether Confidential Nodes feature is + enabled. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class UpgradeEvent(proto.Message): + r"""UpgradeEvent is a notification sent to customers by the + cluster server when a resource is upgrading. + + Attributes: + resource_type (google.cloud.container_v1.types.UpgradeResourceType): + The resource type that is upgrading. + operation (str): + The operation associated with this upgrade. + operation_start_time (google.protobuf.timestamp_pb2.Timestamp): + The time when the operation was started. + current_version (str): + The current version before the upgrade. + target_version (str): + The target version for the upgrade. + resource (str): + Optional relative path to the resource. For + example in node pool upgrades, the relative path + of the node pool. + """ + + resource_type: 'UpgradeResourceType' = proto.Field( + proto.ENUM, + number=1, + enum='UpgradeResourceType', + ) + operation: str = proto.Field( + proto.STRING, + number=2, + ) + operation_start_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + current_version: str = proto.Field( + proto.STRING, + number=4, + ) + target_version: str = proto.Field( + proto.STRING, + number=5, + ) + resource: str = proto.Field( + proto.STRING, + number=6, + ) + + +class UpgradeInfoEvent(proto.Message): + r"""UpgradeInfoEvent is a notification sent to customers about + the upgrade information of a resource. + + Attributes: + resource_type (google.cloud.container_v1.types.UpgradeResourceType): + The resource type associated with the + upgrade. + operation (str): + The operation associated with this upgrade. + start_time (google.protobuf.timestamp_pb2.Timestamp): + The time when the operation was started. + end_time (google.protobuf.timestamp_pb2.Timestamp): + The time when the operation ended. + current_version (str): + The current version before the upgrade. + target_version (str): + The target version for the upgrade. + resource (str): + Optional relative path to the resource. For + example in node pool upgrades, the relative path + of the node pool. + state (google.cloud.container_v1.types.UpgradeInfoEvent.State): + Output only. The state of the upgrade. + description (str): + A brief description of the event. + """ + class State(proto.Enum): + r"""The state of the upgrade. + + Values: + STATE_UNSPECIFIED (0): + STATE_UNSPECIFIED indicates the state is unspecified. + STARTED (3): + STARTED indicates the upgrade has started. + SUCCEEDED (4): + SUCCEEDED indicates the upgrade has completed + successfully. + FAILED (5): + FAILED indicates the upgrade has failed. + CANCELED (6): + CANCELED indicates the upgrade has canceled. + """ + STATE_UNSPECIFIED = 0 + STARTED = 3 + SUCCEEDED = 4 + FAILED = 5 + CANCELED = 6 + + resource_type: 'UpgradeResourceType' = proto.Field( + proto.ENUM, + number=1, + enum='UpgradeResourceType', + ) + operation: str = proto.Field( + proto.STRING, + number=2, + ) + start_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + end_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + current_version: str = proto.Field( + proto.STRING, + number=5, + ) + target_version: str = proto.Field( + proto.STRING, + number=6, + ) + resource: str = proto.Field( + proto.STRING, + number=7, + ) + state: State = proto.Field( + proto.ENUM, + number=8, + enum=State, + ) + description: str = proto.Field( + proto.STRING, + number=11, + ) + + +class UpgradeAvailableEvent(proto.Message): + r"""UpgradeAvailableEvent is a notification sent to customers + when a new available version is released. + + Attributes: + version (str): + The release version available for upgrade. + resource_type (google.cloud.container_v1.types.UpgradeResourceType): + The resource type of the release version. + release_channel (google.cloud.container_v1.types.ReleaseChannel): + The release channel of the version. If empty, + it means a non-channel release. + resource (str): + Optional relative path to the resource. For + example, the relative path of the node pool. + """ + + version: str = proto.Field( + proto.STRING, + number=1, + ) + resource_type: 'UpgradeResourceType' = proto.Field( + proto.ENUM, + number=2, + enum='UpgradeResourceType', + ) + release_channel: 'ReleaseChannel' = proto.Field( + proto.MESSAGE, + number=3, + message='ReleaseChannel', + ) + resource: str = proto.Field( + proto.STRING, + number=4, + ) + + +class SecurityBulletinEvent(proto.Message): + r"""SecurityBulletinEvent is a notification sent to customers + when a security bulletin has been posted that they are + vulnerable to. + + Attributes: + resource_type_affected (str): + The resource type (node/control plane) that + has the vulnerability. Multiple notifications (1 + notification per resource type) will be sent for + a vulnerability that affects > 1 resource type. + bulletin_id (str): + The ID of the bulletin corresponding to the + vulnerability. + cve_ids (MutableSequence[str]): + The CVEs associated with this bulletin. + severity (str): + The severity of this bulletin as it relates + to GKE. + bulletin_uri (str): + The URI link to the bulletin on the website + for more information. + brief_description (str): + A brief description of the bulletin. See the bulletin + pointed to by the bulletin_uri field for an expanded + description. + affected_supported_minors (MutableSequence[str]): + The GKE minor versions affected by this + vulnerability. + patched_versions (MutableSequence[str]): + The GKE versions where this vulnerability is + patched. + suggested_upgrade_target (str): + This represents a version selected from the patched_versions + field that the cluster receiving this notification should + most likely want to upgrade to based on its current version. + Note that if this notification is being received by a given + cluster, it means that this version is currently available + as an upgrade target in that cluster's location. + manual_steps_required (bool): + If this field is specified, it means there + are manual steps that the user must take to make + their clusters safe. + """ + + resource_type_affected: str = proto.Field( + proto.STRING, + number=1, + ) + bulletin_id: str = proto.Field( + proto.STRING, + number=2, + ) + cve_ids: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + severity: str = proto.Field( + proto.STRING, + number=4, + ) + bulletin_uri: str = proto.Field( + proto.STRING, + number=5, + ) + brief_description: str = proto.Field( + proto.STRING, + number=6, + ) + affected_supported_minors: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=7, + ) + patched_versions: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=8, + ) + suggested_upgrade_target: str = proto.Field( + proto.STRING, + number=9, + ) + manual_steps_required: bool = proto.Field( + proto.BOOL, + number=10, + ) + + +class Autopilot(proto.Message): + r"""Autopilot is the configuration for Autopilot settings on the + cluster. + + Attributes: + enabled (bool): + Enable Autopilot + workload_policy_config (google.cloud.container_v1.types.WorkloadPolicyConfig): + Workload policy configuration for Autopilot. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + workload_policy_config: 'WorkloadPolicyConfig' = proto.Field( + proto.MESSAGE, + number=2, + message='WorkloadPolicyConfig', + ) + + +class WorkloadPolicyConfig(proto.Message): + r"""WorkloadPolicyConfig is the configuration of workload policy + for autopilot clusters. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + allow_net_admin (bool): + If true, workloads can use NET_ADMIN capability. + + This field is a member of `oneof`_ ``_allow_net_admin``. + """ + + allow_net_admin: bool = proto.Field( + proto.BOOL, + number=1, + optional=True, + ) + + +class LoggingConfig(proto.Message): + r"""LoggingConfig is cluster logging configuration. + + Attributes: + component_config (google.cloud.container_v1.types.LoggingComponentConfig): + Logging components configuration + """ + + component_config: 'LoggingComponentConfig' = proto.Field( + proto.MESSAGE, + number=1, + message='LoggingComponentConfig', + ) + + +class LoggingComponentConfig(proto.Message): + r"""LoggingComponentConfig is cluster logging component + configuration. + + Attributes: + enable_components (MutableSequence[google.cloud.container_v1.types.LoggingComponentConfig.Component]): + Select components to collect logs. An empty + set would disable all logging. + """ + class Component(proto.Enum): + r"""GKE components exposing logs + + Values: + COMPONENT_UNSPECIFIED (0): + Default value. This shouldn't be used. + SYSTEM_COMPONENTS (1): + system components + WORKLOADS (2): + workloads + APISERVER (3): + kube-apiserver + SCHEDULER (4): + kube-scheduler + CONTROLLER_MANAGER (5): + kube-controller-manager + KCP_SSHD (7): + kcp-sshd + KCP_CONNECTION (8): + kcp connection logs + """ + COMPONENT_UNSPECIFIED = 0 + SYSTEM_COMPONENTS = 1 + WORKLOADS = 2 + APISERVER = 3 + SCHEDULER = 4 + CONTROLLER_MANAGER = 5 + KCP_SSHD = 7 + KCP_CONNECTION = 8 + + enable_components: MutableSequence[Component] = proto.RepeatedField( + proto.ENUM, + number=1, + enum=Component, + ) + + +class RayClusterLoggingConfig(proto.Message): + r"""RayClusterLoggingConfig specifies configuration of Ray + logging. + + Attributes: + enabled (bool): + Enable log collection for Ray clusters. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class MonitoringConfig(proto.Message): + r"""MonitoringConfig is cluster monitoring configuration. + + Attributes: + component_config (google.cloud.container_v1.types.MonitoringComponentConfig): + Monitoring components configuration + managed_prometheus_config (google.cloud.container_v1.types.ManagedPrometheusConfig): + Enable Google Cloud Managed Service for + Prometheus in the cluster. + advanced_datapath_observability_config (google.cloud.container_v1.types.AdvancedDatapathObservabilityConfig): + Configuration of Advanced Datapath + Observability features. + """ + + component_config: 'MonitoringComponentConfig' = proto.Field( + proto.MESSAGE, + number=1, + message='MonitoringComponentConfig', + ) + managed_prometheus_config: 'ManagedPrometheusConfig' = proto.Field( + proto.MESSAGE, + number=2, + message='ManagedPrometheusConfig', + ) + advanced_datapath_observability_config: 'AdvancedDatapathObservabilityConfig' = proto.Field( + proto.MESSAGE, + number=3, + message='AdvancedDatapathObservabilityConfig', + ) + + +class AdvancedDatapathObservabilityConfig(proto.Message): + r"""AdvancedDatapathObservabilityConfig specifies configuration + of observability features of advanced datapath. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + enable_metrics (bool): + Expose flow metrics on nodes + relay_mode (google.cloud.container_v1.types.AdvancedDatapathObservabilityConfig.RelayMode): + Method used to make Relay available + enable_relay (bool): + Enable Relay component + + This field is a member of `oneof`_ ``_enable_relay``. + """ + class RelayMode(proto.Enum): + r"""Supported Relay modes + + Values: + RELAY_MODE_UNSPECIFIED (0): + Default value. This shouldn't be used. + DISABLED (1): + disabled + INTERNAL_VPC_LB (3): + exposed via internal load balancer + EXTERNAL_LB (4): + exposed via external load balancer + """ + RELAY_MODE_UNSPECIFIED = 0 + DISABLED = 1 + INTERNAL_VPC_LB = 3 + EXTERNAL_LB = 4 + + enable_metrics: bool = proto.Field( + proto.BOOL, + number=1, + ) + relay_mode: RelayMode = proto.Field( + proto.ENUM, + number=2, + enum=RelayMode, + ) + enable_relay: bool = proto.Field( + proto.BOOL, + number=3, + optional=True, + ) + + +class RayClusterMonitoringConfig(proto.Message): + r"""RayClusterMonitoringConfig specifies monitoring configuration + for Ray clusters. + + Attributes: + enabled (bool): + Enable metrics collection for Ray clusters. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class NodePoolLoggingConfig(proto.Message): + r"""NodePoolLoggingConfig specifies logging configuration for + nodepools. + + Attributes: + variant_config (google.cloud.container_v1.types.LoggingVariantConfig): + Logging variant configuration. + """ + + variant_config: 'LoggingVariantConfig' = proto.Field( + proto.MESSAGE, + number=1, + message='LoggingVariantConfig', + ) + + +class LoggingVariantConfig(proto.Message): + r"""LoggingVariantConfig specifies the behaviour of the logging + component. + + Attributes: + variant (google.cloud.container_v1.types.LoggingVariantConfig.Variant): + Logging variant deployed on nodes. + """ + class Variant(proto.Enum): + r"""Logging component variants. + + Values: + VARIANT_UNSPECIFIED (0): + Default value. This shouldn't be used. + DEFAULT (1): + default logging variant. + MAX_THROUGHPUT (2): + maximum logging throughput variant. + """ + VARIANT_UNSPECIFIED = 0 + DEFAULT = 1 + MAX_THROUGHPUT = 2 + + variant: Variant = proto.Field( + proto.ENUM, + number=1, + enum=Variant, + ) + + +class MonitoringComponentConfig(proto.Message): + r"""MonitoringComponentConfig is cluster monitoring component + configuration. + + Attributes: + enable_components (MutableSequence[google.cloud.container_v1.types.MonitoringComponentConfig.Component]): + Select components to collect metrics. An + empty set would disable all monitoring. + """ + class Component(proto.Enum): + r"""GKE components exposing metrics + + Values: + COMPONENT_UNSPECIFIED (0): + Default value. This shouldn't be used. + SYSTEM_COMPONENTS (1): + system components + APISERVER (3): + kube-apiserver + SCHEDULER (4): + kube-scheduler + CONTROLLER_MANAGER (5): + kube-controller-manager + STORAGE (7): + Storage + HPA (8): + Horizontal Pod Autoscaling + POD (9): + Pod + DAEMONSET (10): + DaemonSet + DEPLOYMENT (11): + Deployment + STATEFULSET (12): + Statefulset + CADVISOR (13): + CADVISOR + KUBELET (14): + KUBELET + DCGM (15): + NVIDIA Data Center GPU Manager (DCGM) + """ + COMPONENT_UNSPECIFIED = 0 + SYSTEM_COMPONENTS = 1 + APISERVER = 3 + SCHEDULER = 4 + CONTROLLER_MANAGER = 5 + STORAGE = 7 + HPA = 8 + POD = 9 + DAEMONSET = 10 + DEPLOYMENT = 11 + STATEFULSET = 12 + CADVISOR = 13 + KUBELET = 14 + DCGM = 15 + + enable_components: MutableSequence[Component] = proto.RepeatedField( + proto.ENUM, + number=1, + enum=Component, + ) + + +class ManagedPrometheusConfig(proto.Message): + r"""ManagedPrometheusConfig defines the configuration for + Google Cloud Managed Service for Prometheus. + + Attributes: + enabled (bool): + Enable Managed Collection. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class Fleet(proto.Message): + r"""Fleet is the fleet configuration for the cluster. + + Attributes: + project (str): + The Fleet host project(project ID or project + number) where this cluster will be registered + to. This field cannot be changed after the + cluster has been registered. + membership (str): + Output only. The full resource name of the registered fleet + membership of the cluster, in the format + ``//gkehub.googleapis.com/projects/*/locations/*/memberships/*``. + pre_registered (bool): + Output only. Whether the cluster has been + registered through the fleet API. + """ + + project: str = proto.Field( + proto.STRING, + number=1, + ) + membership: str = proto.Field( + proto.STRING, + number=2, + ) + pre_registered: bool = proto.Field( + proto.BOOL, + number=3, + ) + + +class ControlPlaneEndpointsConfig(proto.Message): + r"""Configuration for all of the cluster's control plane + endpoints. + + Attributes: + dns_endpoint_config (google.cloud.container_v1.types.ControlPlaneEndpointsConfig.DNSEndpointConfig): + DNS endpoint configuration. + ip_endpoints_config (google.cloud.container_v1.types.ControlPlaneEndpointsConfig.IPEndpointsConfig): + IP endpoints configuration. + """ + + class DNSEndpointConfig(proto.Message): + r"""Describes the configuration of a DNS endpoint. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + endpoint (str): + Output only. The cluster's DNS endpoint configuration. A DNS + format address. This is accessible from the public internet. + Ex: uid.us-central1.gke.goog. Always present, but the + behavior may change according to the value of + [DNSEndpointConfig.allow_external_traffic][google.container.v1.ControlPlaneEndpointsConfig.DNSEndpointConfig.allow_external_traffic]. + allow_external_traffic (bool): + Controls whether user traffic is allowed over + this endpoint. Note that GCP-managed services + may still use the endpoint even if this is + false. + + This field is a member of `oneof`_ ``_allow_external_traffic``. + """ + + endpoint: str = proto.Field( + proto.STRING, + number=2, + ) + allow_external_traffic: bool = proto.Field( + proto.BOOL, + number=3, + optional=True, + ) + + class IPEndpointsConfig(proto.Message): + r"""IP endpoints configuration. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + enabled (bool): + Controls whether to allow direct IP access. + + This field is a member of `oneof`_ ``_enabled``. + enable_public_endpoint (bool): + Controls whether the control plane allows access through a + public IP. It is invalid to specify both + [PrivateClusterConfig.enablePrivateEndpoint][] and this + field at the same time. + + This field is a member of `oneof`_ ``_enable_public_endpoint``. + global_access (bool): + Controls whether the control plane's private endpoint is + accessible from sources in other regions. It is invalid to + specify both + [PrivateClusterMasterGlobalAccessConfig.enabled][google.container.v1.PrivateClusterMasterGlobalAccessConfig.enabled] + and this field at the same time. + + This field is a member of `oneof`_ ``_global_access``. + authorized_networks_config (google.cloud.container_v1.types.MasterAuthorizedNetworksConfig): + Configuration of authorized networks. If enabled, restricts + access to the control plane based on source IP. It is + invalid to specify both + [Cluster.masterAuthorizedNetworksConfig][] and this field at + the same time. + public_endpoint (str): + Output only. The external IP address of this + cluster's control plane. Only populated if + enabled. + private_endpoint (str): + Output only. The internal IP address of this + cluster's control plane. Only populated if + enabled. + private_endpoint_subnetwork (str): + Subnet to provision the master's private endpoint during + cluster creation. Specified in + projects/\ */regions/*/subnetworks/\* format. It is invalid + to specify both + [PrivateClusterConfig.privateEndpointSubnetwork][] and this + field at the same time. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + optional=True, + ) + enable_public_endpoint: bool = proto.Field( + proto.BOOL, + number=2, + optional=True, + ) + global_access: bool = proto.Field( + proto.BOOL, + number=3, + optional=True, + ) + authorized_networks_config: 'MasterAuthorizedNetworksConfig' = proto.Field( + proto.MESSAGE, + number=4, + message='MasterAuthorizedNetworksConfig', + ) + public_endpoint: str = proto.Field( + proto.STRING, + number=5, + ) + private_endpoint: str = proto.Field( + proto.STRING, + number=6, + ) + private_endpoint_subnetwork: str = proto.Field( + proto.STRING, + number=7, + ) + + dns_endpoint_config: DNSEndpointConfig = proto.Field( + proto.MESSAGE, + number=1, + message=DNSEndpointConfig, + ) + ip_endpoints_config: IPEndpointsConfig = proto.Field( + proto.MESSAGE, + number=3, + message=IPEndpointsConfig, + ) + + +class LocalNvmeSsdBlockConfig(proto.Message): + r"""LocalNvmeSsdBlockConfig contains configuration for using + raw-block local NVMe SSDs + + Attributes: + local_ssd_count (int): + Number of local NVMe SSDs to use. The limit for this value + is dependent upon the maximum number of disk available on a + machine per zone. See: + https://cloud.google.com/compute/docs/disks/local-ssd for + more information. + + A zero (or unset) value has different meanings depending on + machine type being used: + + 1. For pre-Gen3 machines, which support flexible numbers of + local ssds, zero (or unset) means to disable using local + SSDs as ephemeral storage. + 2. For Gen3 machines which dictate a specific number of + local ssds, zero (or unset) means to use the default + number of local ssds that goes with that machine type. + For example, for a c3-standard-8-lssd machine, 2 local + ssds would be provisioned. For c3-standard-8 (which + doesn't support local ssds), 0 will be provisioned. See + https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds + for more info. + """ + + local_ssd_count: int = proto.Field( + proto.INT32, + number=1, + ) + + +class EphemeralStorageLocalSsdConfig(proto.Message): + r"""EphemeralStorageLocalSsdConfig contains configuration for the + node ephemeral storage using Local SSDs. + + Attributes: + local_ssd_count (int): + Number of local SSDs to use to back ephemeral storage. Uses + NVMe interfaces. + + A zero (or unset) value has different meanings depending on + machine type being used: + + 1. For pre-Gen3 machines, which support flexible numbers of + local ssds, zero (or unset) means to disable using local + SSDs as ephemeral storage. The limit for this value is + dependent upon the maximum number of disk available on a + machine per zone. See: + https://cloud.google.com/compute/docs/disks/local-ssd for + more information. + 2. For Gen3 machines which dictate a specific number of + local ssds, zero (or unset) means to use the default + number of local ssds that goes with that machine type. + For example, for a c3-standard-8-lssd machine, 2 local + ssds would be provisioned. For c3-standard-8 (which + doesn't support local ssds), 0 will be provisioned. See + https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds + for more info. + """ + + local_ssd_count: int = proto.Field( + proto.INT32, + number=1, + ) + + +class ResourceManagerTags(proto.Message): + r"""A map of resource manager tag keys and values to be attached + to the nodes for managing Compute Engine firewalls using Network + Firewall Policies. Tags must be according to specifications in + https://cloud.google.com/vpc/docs/tags-firewalls-overview#specifications. + A maximum of 5 tag key-value pairs can be specified. Existing + tags will be replaced with new values. + + Attributes: + tags (MutableMapping[str, str]): + TagKeyValue must be in one of the following formats + ([KEY]=[VALUE]) + + 1. ``tagKeys/{tag_key_id}=tagValues/{tag_value_id}`` + 2. ``{org_id}/{tag_key_name}={tag_value_name}`` + 3. ``{project_id}/{tag_key_name}={tag_value_name}`` + """ + + tags: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=1, + ) + + +class EnterpriseConfig(proto.Message): + r"""EnterpriseConfig is the cluster enterprise configuration. + + Attributes: + cluster_tier (google.cloud.container_v1.types.EnterpriseConfig.ClusterTier): + Output only. cluster_tier indicates the effective tier of + the cluster. + desired_tier (google.cloud.container_v1.types.EnterpriseConfig.ClusterTier): + desired_tier specifies the desired tier of the cluster. + """ + class ClusterTier(proto.Enum): + r"""Premium tiers for GKE Cluster. + + Values: + CLUSTER_TIER_UNSPECIFIED (0): + CLUSTER_TIER_UNSPECIFIED is when cluster_tier is not set. + STANDARD (1): + STANDARD indicates a standard GKE cluster. + ENTERPRISE (2): + ENTERPRISE indicates a GKE Enterprise + cluster. + """ + CLUSTER_TIER_UNSPECIFIED = 0 + STANDARD = 1 + ENTERPRISE = 2 + + cluster_tier: ClusterTier = proto.Field( + proto.ENUM, + number=1, + enum=ClusterTier, + ) + desired_tier: ClusterTier = proto.Field( + proto.ENUM, + number=2, + enum=ClusterTier, + ) + + +class SecretManagerConfig(proto.Message): + r"""SecretManagerConfig is config for secret manager enablement. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + enabled (bool): + Enable/Disable Secret Manager Config. + + This field is a member of `oneof`_ ``_enabled``. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + optional=True, + ) + + +class SecondaryBootDisk(proto.Message): + r"""SecondaryBootDisk represents a persistent disk attached to a + node with special configurations based on its mode. + + Attributes: + mode (google.cloud.container_v1.types.SecondaryBootDisk.Mode): + Disk mode (container image cache, etc.) + disk_image (str): + Fully-qualified resource ID for an existing + disk image. + """ + class Mode(proto.Enum): + r"""Mode specifies how the secondary boot disk will be used. + This triggers mode-specified logic in the control plane. + + Values: + MODE_UNSPECIFIED (0): + MODE_UNSPECIFIED is when mode is not set. + CONTAINER_IMAGE_CACHE (1): + CONTAINER_IMAGE_CACHE is for using the secondary boot disk + as a container image cache. + """ + MODE_UNSPECIFIED = 0 + CONTAINER_IMAGE_CACHE = 1 + + mode: Mode = proto.Field( + proto.ENUM, + number=1, + enum=Mode, + ) + disk_image: str = proto.Field( + proto.STRING, + number=2, + ) + + +class SecondaryBootDiskUpdateStrategy(proto.Message): + r"""SecondaryBootDiskUpdateStrategy is a placeholder which will + be extended in the future to define different options for + updating secondary boot disks. + + """ + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/google-cloud-container/v1/mypy.ini b/owl-bot-staging/google-cloud-container/v1/mypy.ini new file mode 100644 index 000000000000..574c5aed394b --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/mypy.ini @@ -0,0 +1,3 @@ +[mypy] +python_version = 3.7 +namespace_packages = True diff --git a/owl-bot-staging/google-cloud-container/v1/noxfile.py b/owl-bot-staging/google-cloud-container/v1/noxfile.py new file mode 100644 index 000000000000..11a2bb18b3af --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/noxfile.py @@ -0,0 +1,280 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 re +import shutil +import subprocess +import sys + + +import nox # type: ignore + +ALL_PYTHON = [ + "3.7", + "3.8", + "3.9", + "3.10", + "3.11", + "3.12", + "3.13", +] + +CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() + +LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +PACKAGE_NAME = 'google-cloud-container' + +BLACK_VERSION = "black==22.3.0" +BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] +DEFAULT_PYTHON_VERSION = "3.13" + +nox.sessions = [ + "unit", + "cover", + "mypy", + "check_lower_bounds" + # exclude update_lower_bounds from default + "docs", + "blacken", + "lint", + "prerelease_deps", +] + +@nox.session(python=ALL_PYTHON) +@nox.parametrize( + "protobuf_implementation", + [ "python", "upb", "cpp" ], +) +def unit(session, protobuf_implementation): + """Run the unit test suite.""" + + if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): + session.skip("cpp implementation is not supported in python 3.11+") + + session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') + session.install('-e', '.', "-c", f"testing/constraints-{session.python}.txt") + + # Remove the 'cpp' implementation once support for Protobuf 3.x is dropped. + # The 'cpp' implementation requires Protobuf<4. + if protobuf_implementation == "cpp": + session.install("protobuf<4") + + session.run( + 'py.test', + '--quiet', + '--cov=google/cloud/container_v1/', + '--cov=tests/', + '--cov-config=.coveragerc', + '--cov-report=term', + '--cov-report=html', + os.path.join('tests', 'unit', ''.join(session.posargs)), + env={ + "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, + }, + ) + +@nox.session(python=ALL_PYTHON[-1]) +@nox.parametrize( + "protobuf_implementation", + [ "python", "upb", "cpp" ], +) +def prerelease_deps(session, protobuf_implementation): + """Run the unit test suite against pre-release versions of dependencies.""" + + if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): + session.skip("cpp implementation is not supported in python 3.11+") + + # Install test environment dependencies + session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') + + # Install the package without dependencies + session.install('-e', '.', '--no-deps') + + # We test the minimum dependency versions using the minimum Python + # version so the lowest python runtime that we test has a corresponding constraints + # file, located at `testing/constraints--.txt`, which contains all of the + # dependencies and extras. + with open( + CURRENT_DIRECTORY + / "testing" + / f"constraints-{ALL_PYTHON[0]}.txt", + encoding="utf-8", + ) as constraints_file: + constraints_text = constraints_file.read() + + # Ignore leading whitespace and comment lines. + constraints_deps = [ + match.group(1) + for match in re.finditer( + r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE + ) + ] + + session.install(*constraints_deps) + + prerel_deps = [ + "googleapis-common-protos", + "google-api-core", + "google-auth", + # Exclude grpcio!=1.67.0rc1 which does not support python 3.13 + "grpcio!=1.67.0rc1", + "grpcio-status", + "protobuf", + "proto-plus", + ] + + for dep in prerel_deps: + session.install("--pre", "--no-deps", "--upgrade", dep) + + # Remaining dependencies + other_deps = [ + "requests", + ] + session.install(*other_deps) + + # Print out prerelease package versions + + session.run("python", "-c", "import google.api_core; print(google.api_core.__version__)") + session.run("python", "-c", "import google.auth; print(google.auth.__version__)") + session.run("python", "-c", "import grpc; print(grpc.__version__)") + session.run( + "python", "-c", "import google.protobuf; print(google.protobuf.__version__)" + ) + session.run( + "python", "-c", "import proto; print(proto.__version__)" + ) + + session.run( + 'py.test', + '--quiet', + '--cov=google/cloud/container_v1/', + '--cov=tests/', + '--cov-config=.coveragerc', + '--cov-report=term', + '--cov-report=html', + os.path.join('tests', 'unit', ''.join(session.posargs)), + env={ + "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, + }, + ) + + +@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', + '-p', + '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==7.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, + ) diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_async.py new file mode 100644 index 000000000000..dd70d24e20ce --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CancelOperation +# 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-container + + +# [START container_v1_generated_ClusterManager_CancelOperation_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 import container_v1 + + +async def sample_cancel_operation(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CancelOperationRequest( + ) + + # Make the request + await client.cancel_operation(request=request) + + +# [END container_v1_generated_ClusterManager_CancelOperation_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_sync.py new file mode 100644 index 000000000000..4cbf6a8798ae --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CancelOperation +# 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-container + + +# [START container_v1_generated_ClusterManager_CancelOperation_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 import container_v1 + + +def sample_cancel_operation(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CancelOperationRequest( + ) + + # Make the request + client.cancel_operation(request=request) + + +# [END container_v1_generated_ClusterManager_CancelOperation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py new file mode 100644 index 000000000000..43365c3acaaa --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CheckAutopilotCompatibility +# 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-container + + +# [START container_v1_generated_ClusterManager_CheckAutopilotCompatibility_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 import container_v1 + + +async def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = await client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py new file mode 100644 index 000000000000..6f9dbb1be73f --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CheckAutopilotCompatibility +# 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-container + + +# [START container_v1_generated_ClusterManager_CheckAutopilotCompatibility_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 import container_v1 + + +def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_CheckAutopilotCompatibility_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_async.py new file mode 100644 index 000000000000..df4c0aa503ee --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CompleteIPRotation +# 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-container + + +# [START container_v1_generated_ClusterManager_CompleteIPRotation_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 import container_v1 + + +async def sample_complete_ip_rotation(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CompleteIPRotationRequest( + ) + + # Make the request + response = await client.complete_ip_rotation(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_CompleteIPRotation_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_sync.py new file mode 100644 index 000000000000..80ff9867f440 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CompleteIPRotation +# 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-container + + +# [START container_v1_generated_ClusterManager_CompleteIPRotation_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 import container_v1 + + +def sample_complete_ip_rotation(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CompleteIPRotationRequest( + ) + + # Make the request + response = client.complete_ip_rotation(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_CompleteIPRotation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py new file mode 100644 index 000000000000..522c62eace86 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CompleteNodePoolUpgrade +# 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-container + + +# [START container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_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 import container_v1 + + +async def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + await client.complete_node_pool_upgrade(request=request) + + +# [END container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py new file mode 100644 index 000000000000..95fc00346f52 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CompleteNodePoolUpgrade +# 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-container + + +# [START container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_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 import container_v1 + + +def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + client.complete_node_pool_upgrade(request=request) + + +# [END container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_async.py new file mode 100644 index 000000000000..854d9fc9588f --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CreateCluster +# 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-container + + +# [START container_v1_generated_ClusterManager_CreateCluster_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 import container_v1 + + +async def sample_create_cluster(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CreateClusterRequest( + ) + + # Make the request + response = await client.create_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_CreateCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_sync.py new file mode 100644 index 000000000000..39a23f38fdac --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CreateCluster +# 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-container + + +# [START container_v1_generated_ClusterManager_CreateCluster_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 import container_v1 + + +def sample_create_cluster(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CreateClusterRequest( + ) + + # Make the request + response = client.create_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_CreateCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_async.py new file mode 100644 index 000000000000..c68610be2818 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CreateNodePool +# 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-container + + +# [START container_v1_generated_ClusterManager_CreateNodePool_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 import container_v1 + + +async def sample_create_node_pool(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CreateNodePoolRequest( + ) + + # Make the request + response = await client.create_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_CreateNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_sync.py new file mode 100644 index 000000000000..cccfe7fc46c0 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CreateNodePool +# 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-container + + +# [START container_v1_generated_ClusterManager_CreateNodePool_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 import container_v1 + + +def sample_create_node_pool(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CreateNodePoolRequest( + ) + + # Make the request + response = client.create_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_CreateNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_async.py new file mode 100644 index 000000000000..1602e612c901 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 DeleteCluster +# 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-container + + +# [START container_v1_generated_ClusterManager_DeleteCluster_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 import container_v1 + + +async def sample_delete_cluster(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.DeleteClusterRequest( + ) + + # Make the request + response = await client.delete_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_DeleteCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_sync.py new file mode 100644 index 000000000000..3d001beac35e --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 DeleteCluster +# 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-container + + +# [START container_v1_generated_ClusterManager_DeleteCluster_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 import container_v1 + + +def sample_delete_cluster(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.DeleteClusterRequest( + ) + + # Make the request + response = client.delete_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_DeleteCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_async.py new file mode 100644 index 000000000000..9e6205a0950f --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 DeleteNodePool +# 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-container + + +# [START container_v1_generated_ClusterManager_DeleteNodePool_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 import container_v1 + + +async def sample_delete_node_pool(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.DeleteNodePoolRequest( + ) + + # Make the request + response = await client.delete_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_DeleteNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_sync.py new file mode 100644 index 000000000000..175051c61d8c --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 DeleteNodePool +# 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-container + + +# [START container_v1_generated_ClusterManager_DeleteNodePool_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 import container_v1 + + +def sample_delete_node_pool(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.DeleteNodePoolRequest( + ) + + # Make the request + response = client.delete_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_DeleteNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_async.py new file mode 100644 index 000000000000..aae40af786b5 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetCluster +# 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-container + + +# [START container_v1_generated_ClusterManager_GetCluster_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 import container_v1 + + +async def sample_get_cluster(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.GetClusterRequest( + ) + + # Make the request + response = await client.get_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_GetCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_sync.py new file mode 100644 index 000000000000..4a8000c32663 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetCluster +# 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-container + + +# [START container_v1_generated_ClusterManager_GetCluster_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 import container_v1 + + +def sample_get_cluster(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.GetClusterRequest( + ) + + # Make the request + response = client.get_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_GetCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_async.py new file mode 100644 index 000000000000..5204ffcb60dc --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetJSONWebKeys +# 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-container + + +# [START container_v1_generated_ClusterManager_GetJSONWebKeys_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 import container_v1 + + +async def sample_get_json_web_keys(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.GetJSONWebKeysRequest( + ) + + # Make the request + response = await client.get_json_web_keys(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_GetJSONWebKeys_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_sync.py new file mode 100644 index 000000000000..8ae4a8c07717 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetJSONWebKeys +# 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-container + + +# [START container_v1_generated_ClusterManager_GetJSONWebKeys_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 import container_v1 + + +def sample_get_json_web_keys(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.GetJSONWebKeysRequest( + ) + + # Make the request + response = client.get_json_web_keys(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_GetJSONWebKeys_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_async.py new file mode 100644 index 000000000000..466818b0187d --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetNodePool +# 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-container + + +# [START container_v1_generated_ClusterManager_GetNodePool_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 import container_v1 + + +async def sample_get_node_pool(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.GetNodePoolRequest( + ) + + # Make the request + response = await client.get_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_GetNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_sync.py new file mode 100644 index 000000000000..2c53ec36853a --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetNodePool +# 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-container + + +# [START container_v1_generated_ClusterManager_GetNodePool_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 import container_v1 + + +def sample_get_node_pool(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.GetNodePoolRequest( + ) + + # Make the request + response = client.get_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_GetNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_async.py new file mode 100644 index 000000000000..23d35891f194 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetOperation +# 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-container + + +# [START container_v1_generated_ClusterManager_GetOperation_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 import container_v1 + + +async def sample_get_operation(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.GetOperationRequest( + ) + + # Make the request + response = await client.get_operation(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_GetOperation_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_sync.py new file mode 100644 index 000000000000..8e4859308765 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetOperation +# 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-container + + +# [START container_v1_generated_ClusterManager_GetOperation_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 import container_v1 + + +def sample_get_operation(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.GetOperationRequest( + ) + + # Make the request + response = client.get_operation(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_GetOperation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_async.py new file mode 100644 index 000000000000..8dfebf6b3eef --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetServerConfig +# 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-container + + +# [START container_v1_generated_ClusterManager_GetServerConfig_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 import container_v1 + + +async def sample_get_server_config(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.GetServerConfigRequest( + ) + + # Make the request + response = await client.get_server_config(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_GetServerConfig_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_sync.py new file mode 100644 index 000000000000..cf55088d66d9 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetServerConfig +# 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-container + + +# [START container_v1_generated_ClusterManager_GetServerConfig_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 import container_v1 + + +def sample_get_server_config(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.GetServerConfigRequest( + ) + + # Make the request + response = client.get_server_config(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_GetServerConfig_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_async.py new file mode 100644 index 000000000000..a31644c16c35 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListClusters +# 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-container + + +# [START container_v1_generated_ClusterManager_ListClusters_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 import container_v1 + + +async def sample_list_clusters(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.ListClustersRequest( + ) + + # Make the request + response = await client.list_clusters(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_ListClusters_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_sync.py new file mode 100644 index 000000000000..8461fc23a969 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListClusters +# 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-container + + +# [START container_v1_generated_ClusterManager_ListClusters_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 import container_v1 + + +def sample_list_clusters(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.ListClustersRequest( + ) + + # Make the request + response = client.list_clusters(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_ListClusters_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_async.py new file mode 100644 index 000000000000..f5e12b53eb95 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListNodePools +# 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-container + + +# [START container_v1_generated_ClusterManager_ListNodePools_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 import container_v1 + + +async def sample_list_node_pools(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.ListNodePoolsRequest( + ) + + # Make the request + response = await client.list_node_pools(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_ListNodePools_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_sync.py new file mode 100644 index 000000000000..f983793d6e8c --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListNodePools +# 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-container + + +# [START container_v1_generated_ClusterManager_ListNodePools_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 import container_v1 + + +def sample_list_node_pools(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.ListNodePoolsRequest( + ) + + # Make the request + response = client.list_node_pools(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_ListNodePools_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_async.py new file mode 100644 index 000000000000..40562e00eaf3 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListOperations +# 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-container + + +# [START container_v1_generated_ClusterManager_ListOperations_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 import container_v1 + + +async def sample_list_operations(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.ListOperationsRequest( + ) + + # Make the request + response = await client.list_operations(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_ListOperations_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_sync.py new file mode 100644 index 000000000000..25b21217990e --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListOperations +# 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-container + + +# [START container_v1_generated_ClusterManager_ListOperations_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 import container_v1 + + +def sample_list_operations(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.ListOperationsRequest( + ) + + # Make the request + response = client.list_operations(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_ListOperations_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_async.py new file mode 100644 index 000000000000..691ab32d5d22 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListUsableSubnetworks +# 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-container + + +# [START container_v1_generated_ClusterManager_ListUsableSubnetworks_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 import container_v1 + + +async def sample_list_usable_subnetworks(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.ListUsableSubnetworksRequest( + ) + + # Make the request + page_result = client.list_usable_subnetworks(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END container_v1_generated_ClusterManager_ListUsableSubnetworks_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_sync.py new file mode 100644 index 000000000000..e6cddf613c8f --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListUsableSubnetworks +# 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-container + + +# [START container_v1_generated_ClusterManager_ListUsableSubnetworks_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 import container_v1 + + +def sample_list_usable_subnetworks(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.ListUsableSubnetworksRequest( + ) + + # Make the request + page_result = client.list_usable_subnetworks(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END container_v1_generated_ClusterManager_ListUsableSubnetworks_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_async.py new file mode 100644 index 000000000000..5d578a274811 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 RollbackNodePoolUpgrade +# 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-container + + +# [START container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_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 import container_v1 + + +async def sample_rollback_node_pool_upgrade(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.RollbackNodePoolUpgradeRequest( + ) + + # Make the request + response = await client.rollback_node_pool_upgrade(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py new file mode 100644 index 000000000000..a9484a8410e3 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 RollbackNodePoolUpgrade +# 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-container + + +# [START container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_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 import container_v1 + + +def sample_rollback_node_pool_upgrade(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.RollbackNodePoolUpgradeRequest( + ) + + # Make the request + response = client.rollback_node_pool_upgrade(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_async.py new file mode 100644 index 000000000000..4a80f4059037 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetAddonsConfig +# 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-container + + +# [START container_v1_generated_ClusterManager_SetAddonsConfig_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 import container_v1 + + +async def sample_set_addons_config(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetAddonsConfigRequest( + ) + + # Make the request + response = await client.set_addons_config(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetAddonsConfig_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_sync.py new file mode 100644 index 000000000000..7c74c9c5b1f3 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetAddonsConfig +# 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-container + + +# [START container_v1_generated_ClusterManager_SetAddonsConfig_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 import container_v1 + + +def sample_set_addons_config(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetAddonsConfigRequest( + ) + + # Make the request + response = client.set_addons_config(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetAddonsConfig_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_async.py new file mode 100644 index 000000000000..0855ecdebefe --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLabels +# 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-container + + +# [START container_v1_generated_ClusterManager_SetLabels_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 import container_v1 + + +async def sample_set_labels(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetLabelsRequest( + label_fingerprint="label_fingerprint_value", + ) + + # Make the request + response = await client.set_labels(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetLabels_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_sync.py new file mode 100644 index 000000000000..444f86368adf --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLabels +# 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-container + + +# [START container_v1_generated_ClusterManager_SetLabels_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 import container_v1 + + +def sample_set_labels(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetLabelsRequest( + label_fingerprint="label_fingerprint_value", + ) + + # Make the request + response = client.set_labels(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetLabels_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_async.py new file mode 100644 index 000000000000..bf4704f3b3a3 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLegacyAbac +# 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-container + + +# [START container_v1_generated_ClusterManager_SetLegacyAbac_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 import container_v1 + + +async def sample_set_legacy_abac(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetLegacyAbacRequest( + enabled=True, + ) + + # Make the request + response = await client.set_legacy_abac(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetLegacyAbac_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_sync.py new file mode 100644 index 000000000000..18ab0c4a2769 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLegacyAbac +# 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-container + + +# [START container_v1_generated_ClusterManager_SetLegacyAbac_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 import container_v1 + + +def sample_set_legacy_abac(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetLegacyAbacRequest( + enabled=True, + ) + + # Make the request + response = client.set_legacy_abac(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetLegacyAbac_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_async.py new file mode 100644 index 000000000000..db8973f93242 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLocations +# 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-container + + +# [START container_v1_generated_ClusterManager_SetLocations_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 import container_v1 + + +async def sample_set_locations(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetLocationsRequest( + locations=['locations_value1', 'locations_value2'], + ) + + # Make the request + response = await client.set_locations(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetLocations_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_sync.py new file mode 100644 index 000000000000..46d75ef6f450 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLocations +# 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-container + + +# [START container_v1_generated_ClusterManager_SetLocations_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 import container_v1 + + +def sample_set_locations(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetLocationsRequest( + locations=['locations_value1', 'locations_value2'], + ) + + # Make the request + response = client.set_locations(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetLocations_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_async.py new file mode 100644 index 000000000000..4102c4ea493d --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLoggingService +# 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-container + + +# [START container_v1_generated_ClusterManager_SetLoggingService_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 import container_v1 + + +async def sample_set_logging_service(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetLoggingServiceRequest( + logging_service="logging_service_value", + ) + + # Make the request + response = await client.set_logging_service(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetLoggingService_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_sync.py new file mode 100644 index 000000000000..239afd4a6372 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLoggingService +# 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-container + + +# [START container_v1_generated_ClusterManager_SetLoggingService_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 import container_v1 + + +def sample_set_logging_service(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetLoggingServiceRequest( + logging_service="logging_service_value", + ) + + # Make the request + response = client.set_logging_service(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetLoggingService_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_async.py new file mode 100644 index 000000000000..4e60498c151f --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetMaintenancePolicy +# 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-container + + +# [START container_v1_generated_ClusterManager_SetMaintenancePolicy_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 import container_v1 + + +async def sample_set_maintenance_policy(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetMaintenancePolicyRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.set_maintenance_policy(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetMaintenancePolicy_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_sync.py new file mode 100644 index 000000000000..3aff379c43d9 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetMaintenancePolicy +# 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-container + + +# [START container_v1_generated_ClusterManager_SetMaintenancePolicy_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 import container_v1 + + +def sample_set_maintenance_policy(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetMaintenancePolicyRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.set_maintenance_policy(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetMaintenancePolicy_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_async.py new file mode 100644 index 000000000000..dea630333a1d --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetMasterAuth +# 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-container + + +# [START container_v1_generated_ClusterManager_SetMasterAuth_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 import container_v1 + + +async def sample_set_master_auth(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetMasterAuthRequest( + action="SET_USERNAME", + ) + + # Make the request + response = await client.set_master_auth(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetMasterAuth_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_sync.py new file mode 100644 index 000000000000..e2c70a02bdd6 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetMasterAuth +# 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-container + + +# [START container_v1_generated_ClusterManager_SetMasterAuth_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 import container_v1 + + +def sample_set_master_auth(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetMasterAuthRequest( + action="SET_USERNAME", + ) + + # Make the request + response = client.set_master_auth(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetMasterAuth_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_async.py new file mode 100644 index 000000000000..d9eab4c409af --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetMonitoringService +# 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-container + + +# [START container_v1_generated_ClusterManager_SetMonitoringService_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 import container_v1 + + +async def sample_set_monitoring_service(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetMonitoringServiceRequest( + monitoring_service="monitoring_service_value", + ) + + # Make the request + response = await client.set_monitoring_service(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetMonitoringService_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_sync.py new file mode 100644 index 000000000000..89fd21bf294b --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetMonitoringService +# 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-container + + +# [START container_v1_generated_ClusterManager_SetMonitoringService_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 import container_v1 + + +def sample_set_monitoring_service(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetMonitoringServiceRequest( + monitoring_service="monitoring_service_value", + ) + + # Make the request + response = client.set_monitoring_service(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetMonitoringService_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_async.py new file mode 100644 index 000000000000..886f596caea0 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNetworkPolicy +# 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-container + + +# [START container_v1_generated_ClusterManager_SetNetworkPolicy_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 import container_v1 + + +async def sample_set_network_policy(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetNetworkPolicyRequest( + ) + + # Make the request + response = await client.set_network_policy(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetNetworkPolicy_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_sync.py new file mode 100644 index 000000000000..f6f31b6c20f5 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNetworkPolicy +# 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-container + + +# [START container_v1_generated_ClusterManager_SetNetworkPolicy_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 import container_v1 + + +def sample_set_network_policy(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetNetworkPolicyRequest( + ) + + # Make the request + response = client.set_network_policy(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetNetworkPolicy_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_async.py new file mode 100644 index 000000000000..633c0d8482ce --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNodePoolAutoscaling +# 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-container + + +# [START container_v1_generated_ClusterManager_SetNodePoolAutoscaling_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 import container_v1 + + +async def sample_set_node_pool_autoscaling(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetNodePoolAutoscalingRequest( + ) + + # Make the request + response = await client.set_node_pool_autoscaling(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetNodePoolAutoscaling_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_sync.py new file mode 100644 index 000000000000..0793797e02bd --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNodePoolAutoscaling +# 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-container + + +# [START container_v1_generated_ClusterManager_SetNodePoolAutoscaling_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 import container_v1 + + +def sample_set_node_pool_autoscaling(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetNodePoolAutoscalingRequest( + ) + + # Make the request + response = client.set_node_pool_autoscaling(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetNodePoolAutoscaling_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_async.py new file mode 100644 index 000000000000..a722f458e2d6 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNodePoolManagement +# 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-container + + +# [START container_v1_generated_ClusterManager_SetNodePoolManagement_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 import container_v1 + + +async def sample_set_node_pool_management(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetNodePoolManagementRequest( + ) + + # Make the request + response = await client.set_node_pool_management(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetNodePoolManagement_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_sync.py new file mode 100644 index 000000000000..5b6ce089a1e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNodePoolManagement +# 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-container + + +# [START container_v1_generated_ClusterManager_SetNodePoolManagement_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 import container_v1 + + +def sample_set_node_pool_management(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetNodePoolManagementRequest( + ) + + # Make the request + response = client.set_node_pool_management(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetNodePoolManagement_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_async.py new file mode 100644 index 000000000000..b3e197d6de6a --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNodePoolSize +# 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-container + + +# [START container_v1_generated_ClusterManager_SetNodePoolSize_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 import container_v1 + + +async def sample_set_node_pool_size(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.SetNodePoolSizeRequest( + node_count=1070, + ) + + # Make the request + response = await client.set_node_pool_size(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetNodePoolSize_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_sync.py new file mode 100644 index 000000000000..89892f89ddd5 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNodePoolSize +# 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-container + + +# [START container_v1_generated_ClusterManager_SetNodePoolSize_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 import container_v1 + + +def sample_set_node_pool_size(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.SetNodePoolSizeRequest( + node_count=1070, + ) + + # Make the request + response = client.set_node_pool_size(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_SetNodePoolSize_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_async.py new file mode 100644 index 000000000000..1988441499b6 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 StartIPRotation +# 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-container + + +# [START container_v1_generated_ClusterManager_StartIPRotation_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 import container_v1 + + +async def sample_start_ip_rotation(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.StartIPRotationRequest( + ) + + # Make the request + response = await client.start_ip_rotation(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_StartIPRotation_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_sync.py new file mode 100644 index 000000000000..37ffde003bd0 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 StartIPRotation +# 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-container + + +# [START container_v1_generated_ClusterManager_StartIPRotation_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 import container_v1 + + +def sample_start_ip_rotation(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.StartIPRotationRequest( + ) + + # Make the request + response = client.start_ip_rotation(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_StartIPRotation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_async.py new file mode 100644 index 000000000000..df96b74f48ed --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 UpdateCluster +# 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-container + + +# [START container_v1_generated_ClusterManager_UpdateCluster_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 import container_v1 + + +async def sample_update_cluster(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.UpdateClusterRequest( + ) + + # Make the request + response = await client.update_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_UpdateCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_sync.py new file mode 100644 index 000000000000..4df40327670d --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 UpdateCluster +# 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-container + + +# [START container_v1_generated_ClusterManager_UpdateCluster_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 import container_v1 + + +def sample_update_cluster(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.UpdateClusterRequest( + ) + + # Make the request + response = client.update_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_UpdateCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_async.py new file mode 100644 index 000000000000..00265e753ac9 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 UpdateMaster +# 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-container + + +# [START container_v1_generated_ClusterManager_UpdateMaster_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 import container_v1 + + +async def sample_update_master(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.UpdateMasterRequest( + master_version="master_version_value", + ) + + # Make the request + response = await client.update_master(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_UpdateMaster_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_sync.py new file mode 100644 index 000000000000..f5571b170ef5 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 UpdateMaster +# 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-container + + +# [START container_v1_generated_ClusterManager_UpdateMaster_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 import container_v1 + + +def sample_update_master(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.UpdateMasterRequest( + master_version="master_version_value", + ) + + # Make the request + response = client.update_master(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_UpdateMaster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_async.py new file mode 100644 index 000000000000..4b9298daec5d --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 UpdateNodePool +# 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-container + + +# [START container_v1_generated_ClusterManager_UpdateNodePool_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 import container_v1 + + +async def sample_update_node_pool(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.UpdateNodePoolRequest( + node_version="node_version_value", + image_type="image_type_value", + ) + + # Make the request + response = await client.update_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_UpdateNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_sync.py new file mode 100644 index 000000000000..6b282f9e92ea --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 UpdateNodePool +# 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-container + + +# [START container_v1_generated_ClusterManager_UpdateNodePool_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 import container_v1 + + +def sample_update_node_pool(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.UpdateNodePoolRequest( + node_version="node_version_value", + image_type="image_type_value", + ) + + # Make the request + response = client.update_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_UpdateNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/snippet_metadata_google.container.v1.json b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/snippet_metadata_google.container.v1.json new file mode 100644 index 000000000000..815ec00b3982 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/snippet_metadata_google.container.v1.json @@ -0,0 +1,6053 @@ +{ + "clientLibrary": { + "apis": [ + { + "id": "google.container.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-container", + "version": "0.1.0" + }, + "snippets": [ + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.cancel_operation", + "method": { + "fullName": "google.container.v1.ClusterManager.CancelOperation", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CancelOperation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CancelOperationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "operation_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "shortName": "cancel_operation" + }, + "description": "Sample for CancelOperation", + "file": "container_v1_generated_cluster_manager_cancel_operation_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CancelOperation_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_cancel_operation_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.cancel_operation", + "method": { + "fullName": "google.container.v1.ClusterManager.CancelOperation", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CancelOperation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CancelOperationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "operation_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "shortName": "cancel_operation" + }, + "description": "Sample for CancelOperation", + "file": "container_v1_generated_cluster_manager_cancel_operation_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CancelOperation_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_cancel_operation_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.check_autopilot_compatibility", + "method": { + "fullName": "google.container.v1.ClusterManager.CheckAutopilotCompatibility", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CheckAutopilotCompatibility" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CheckAutopilotCompatibilityRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.CheckAutopilotCompatibilityResponse", + "shortName": "check_autopilot_compatibility" + }, + "description": "Sample for CheckAutopilotCompatibility", + "file": "container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.check_autopilot_compatibility", + "method": { + "fullName": "google.container.v1.ClusterManager.CheckAutopilotCompatibility", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CheckAutopilotCompatibility" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CheckAutopilotCompatibilityRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.CheckAutopilotCompatibilityResponse", + "shortName": "check_autopilot_compatibility" + }, + "description": "Sample for CheckAutopilotCompatibility", + "file": "container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CheckAutopilotCompatibility_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.complete_ip_rotation", + "method": { + "fullName": "google.container.v1.ClusterManager.CompleteIPRotation", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CompleteIPRotation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CompleteIPRotationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "complete_ip_rotation" + }, + "description": "Sample for CompleteIPRotation", + "file": "container_v1_generated_cluster_manager_complete_ip_rotation_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CompleteIPRotation_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_complete_ip_rotation_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.complete_ip_rotation", + "method": { + "fullName": "google.container.v1.ClusterManager.CompleteIPRotation", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CompleteIPRotation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CompleteIPRotationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "complete_ip_rotation" + }, + "description": "Sample for CompleteIPRotation", + "file": "container_v1_generated_cluster_manager_complete_ip_rotation_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CompleteIPRotation_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_complete_ip_rotation_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.complete_node_pool_upgrade", + "method": { + "fullName": "google.container.v1.ClusterManager.CompleteNodePoolUpgrade", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CompleteNodePoolUpgrade" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CompleteNodePoolUpgradeRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "shortName": "complete_node_pool_upgrade" + }, + "description": "Sample for CompleteNodePoolUpgrade", + "file": "container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.complete_node_pool_upgrade", + "method": { + "fullName": "google.container.v1.ClusterManager.CompleteNodePoolUpgrade", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CompleteNodePoolUpgrade" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CompleteNodePoolUpgradeRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "shortName": "complete_node_pool_upgrade" + }, + "description": "Sample for CompleteNodePoolUpgrade", + "file": "container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.create_cluster", + "method": { + "fullName": "google.container.v1.ClusterManager.CreateCluster", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CreateCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CreateClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster", + "type": "google.cloud.container_v1.types.Cluster" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "create_cluster" + }, + "description": "Sample for CreateCluster", + "file": "container_v1_generated_cluster_manager_create_cluster_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CreateCluster_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_create_cluster_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.create_cluster", + "method": { + "fullName": "google.container.v1.ClusterManager.CreateCluster", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CreateCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CreateClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster", + "type": "google.cloud.container_v1.types.Cluster" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "create_cluster" + }, + "description": "Sample for CreateCluster", + "file": "container_v1_generated_cluster_manager_create_cluster_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CreateCluster_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_create_cluster_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.create_node_pool", + "method": { + "fullName": "google.container.v1.ClusterManager.CreateNodePool", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CreateNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CreateNodePoolRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool", + "type": "google.cloud.container_v1.types.NodePool" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "create_node_pool" + }, + "description": "Sample for CreateNodePool", + "file": "container_v1_generated_cluster_manager_create_node_pool_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CreateNodePool_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_create_node_pool_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.create_node_pool", + "method": { + "fullName": "google.container.v1.ClusterManager.CreateNodePool", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CreateNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CreateNodePoolRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool", + "type": "google.cloud.container_v1.types.NodePool" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "create_node_pool" + }, + "description": "Sample for CreateNodePool", + "file": "container_v1_generated_cluster_manager_create_node_pool_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CreateNodePool_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_create_node_pool_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.delete_cluster", + "method": { + "fullName": "google.container.v1.ClusterManager.DeleteCluster", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "DeleteCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.DeleteClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "delete_cluster" + }, + "description": "Sample for DeleteCluster", + "file": "container_v1_generated_cluster_manager_delete_cluster_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_DeleteCluster_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_delete_cluster_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.delete_cluster", + "method": { + "fullName": "google.container.v1.ClusterManager.DeleteCluster", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "DeleteCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.DeleteClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "delete_cluster" + }, + "description": "Sample for DeleteCluster", + "file": "container_v1_generated_cluster_manager_delete_cluster_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_DeleteCluster_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_delete_cluster_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.delete_node_pool", + "method": { + "fullName": "google.container.v1.ClusterManager.DeleteNodePool", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "DeleteNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.DeleteNodePoolRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "delete_node_pool" + }, + "description": "Sample for DeleteNodePool", + "file": "container_v1_generated_cluster_manager_delete_node_pool_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_DeleteNodePool_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_delete_node_pool_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.delete_node_pool", + "method": { + "fullName": "google.container.v1.ClusterManager.DeleteNodePool", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "DeleteNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.DeleteNodePoolRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "delete_node_pool" + }, + "description": "Sample for DeleteNodePool", + "file": "container_v1_generated_cluster_manager_delete_node_pool_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_DeleteNodePool_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_delete_node_pool_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.get_cluster", + "method": { + "fullName": "google.container.v1.ClusterManager.GetCluster", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.GetClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Cluster", + "shortName": "get_cluster" + }, + "description": "Sample for GetCluster", + "file": "container_v1_generated_cluster_manager_get_cluster_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_GetCluster_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_get_cluster_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.get_cluster", + "method": { + "fullName": "google.container.v1.ClusterManager.GetCluster", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.GetClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Cluster", + "shortName": "get_cluster" + }, + "description": "Sample for GetCluster", + "file": "container_v1_generated_cluster_manager_get_cluster_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_GetCluster_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_get_cluster_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.get_json_web_keys", + "method": { + "fullName": "google.container.v1.ClusterManager.GetJSONWebKeys", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetJSONWebKeys" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.GetJSONWebKeysRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.GetJSONWebKeysResponse", + "shortName": "get_json_web_keys" + }, + "description": "Sample for GetJSONWebKeys", + "file": "container_v1_generated_cluster_manager_get_json_web_keys_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_GetJSONWebKeys_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_get_json_web_keys_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.get_json_web_keys", + "method": { + "fullName": "google.container.v1.ClusterManager.GetJSONWebKeys", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetJSONWebKeys" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.GetJSONWebKeysRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.GetJSONWebKeysResponse", + "shortName": "get_json_web_keys" + }, + "description": "Sample for GetJSONWebKeys", + "file": "container_v1_generated_cluster_manager_get_json_web_keys_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_GetJSONWebKeys_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_get_json_web_keys_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.get_node_pool", + "method": { + "fullName": "google.container.v1.ClusterManager.GetNodePool", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.GetNodePoolRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.NodePool", + "shortName": "get_node_pool" + }, + "description": "Sample for GetNodePool", + "file": "container_v1_generated_cluster_manager_get_node_pool_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_GetNodePool_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_get_node_pool_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.get_node_pool", + "method": { + "fullName": "google.container.v1.ClusterManager.GetNodePool", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.GetNodePoolRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.NodePool", + "shortName": "get_node_pool" + }, + "description": "Sample for GetNodePool", + "file": "container_v1_generated_cluster_manager_get_node_pool_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_GetNodePool_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_get_node_pool_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.get_operation", + "method": { + "fullName": "google.container.v1.ClusterManager.GetOperation", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetOperation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.GetOperationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "operation_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "get_operation" + }, + "description": "Sample for GetOperation", + "file": "container_v1_generated_cluster_manager_get_operation_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_GetOperation_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_get_operation_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.get_operation", + "method": { + "fullName": "google.container.v1.ClusterManager.GetOperation", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetOperation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.GetOperationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "operation_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "get_operation" + }, + "description": "Sample for GetOperation", + "file": "container_v1_generated_cluster_manager_get_operation_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_GetOperation_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_get_operation_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.get_server_config", + "method": { + "fullName": "google.container.v1.ClusterManager.GetServerConfig", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetServerConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.GetServerConfigRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.ServerConfig", + "shortName": "get_server_config" + }, + "description": "Sample for GetServerConfig", + "file": "container_v1_generated_cluster_manager_get_server_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_GetServerConfig_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_get_server_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.get_server_config", + "method": { + "fullName": "google.container.v1.ClusterManager.GetServerConfig", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetServerConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.GetServerConfigRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.ServerConfig", + "shortName": "get_server_config" + }, + "description": "Sample for GetServerConfig", + "file": "container_v1_generated_cluster_manager_get_server_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_GetServerConfig_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_get_server_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.list_clusters", + "method": { + "fullName": "google.container.v1.ClusterManager.ListClusters", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListClusters" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.ListClustersRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.ListClustersResponse", + "shortName": "list_clusters" + }, + "description": "Sample for ListClusters", + "file": "container_v1_generated_cluster_manager_list_clusters_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_ListClusters_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_list_clusters_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.list_clusters", + "method": { + "fullName": "google.container.v1.ClusterManager.ListClusters", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListClusters" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.ListClustersRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.ListClustersResponse", + "shortName": "list_clusters" + }, + "description": "Sample for ListClusters", + "file": "container_v1_generated_cluster_manager_list_clusters_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_ListClusters_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_list_clusters_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.list_node_pools", + "method": { + "fullName": "google.container.v1.ClusterManager.ListNodePools", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListNodePools" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.ListNodePoolsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.ListNodePoolsResponse", + "shortName": "list_node_pools" + }, + "description": "Sample for ListNodePools", + "file": "container_v1_generated_cluster_manager_list_node_pools_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_ListNodePools_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_list_node_pools_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.list_node_pools", + "method": { + "fullName": "google.container.v1.ClusterManager.ListNodePools", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListNodePools" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.ListNodePoolsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.ListNodePoolsResponse", + "shortName": "list_node_pools" + }, + "description": "Sample for ListNodePools", + "file": "container_v1_generated_cluster_manager_list_node_pools_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_ListNodePools_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_list_node_pools_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.list_operations", + "method": { + "fullName": "google.container.v1.ClusterManager.ListOperations", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListOperations" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.ListOperationsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.ListOperationsResponse", + "shortName": "list_operations" + }, + "description": "Sample for ListOperations", + "file": "container_v1_generated_cluster_manager_list_operations_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_ListOperations_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_list_operations_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.list_operations", + "method": { + "fullName": "google.container.v1.ClusterManager.ListOperations", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListOperations" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.ListOperationsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.ListOperationsResponse", + "shortName": "list_operations" + }, + "description": "Sample for ListOperations", + "file": "container_v1_generated_cluster_manager_list_operations_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_ListOperations_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_list_operations_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.list_usable_subnetworks", + "method": { + "fullName": "google.container.v1.ClusterManager.ListUsableSubnetworks", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListUsableSubnetworks" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.ListUsableSubnetworksRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.services.cluster_manager.pagers.ListUsableSubnetworksAsyncPager", + "shortName": "list_usable_subnetworks" + }, + "description": "Sample for ListUsableSubnetworks", + "file": "container_v1_generated_cluster_manager_list_usable_subnetworks_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_ListUsableSubnetworks_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_list_usable_subnetworks_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.list_usable_subnetworks", + "method": { + "fullName": "google.container.v1.ClusterManager.ListUsableSubnetworks", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListUsableSubnetworks" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.ListUsableSubnetworksRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.services.cluster_manager.pagers.ListUsableSubnetworksPager", + "shortName": "list_usable_subnetworks" + }, + "description": "Sample for ListUsableSubnetworks", + "file": "container_v1_generated_cluster_manager_list_usable_subnetworks_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_ListUsableSubnetworks_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_list_usable_subnetworks_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.rollback_node_pool_upgrade", + "method": { + "fullName": "google.container.v1.ClusterManager.RollbackNodePoolUpgrade", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "RollbackNodePoolUpgrade" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.RollbackNodePoolUpgradeRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "rollback_node_pool_upgrade" + }, + "description": "Sample for RollbackNodePoolUpgrade", + "file": "container_v1_generated_cluster_manager_rollback_node_pool_upgrade_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_rollback_node_pool_upgrade_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.rollback_node_pool_upgrade", + "method": { + "fullName": "google.container.v1.ClusterManager.RollbackNodePoolUpgrade", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "RollbackNodePoolUpgrade" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.RollbackNodePoolUpgradeRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "rollback_node_pool_upgrade" + }, + "description": "Sample for RollbackNodePoolUpgrade", + "file": "container_v1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_addons_config", + "method": { + "fullName": "google.container.v1.ClusterManager.SetAddonsConfig", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetAddonsConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetAddonsConfigRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "addons_config", + "type": "google.cloud.container_v1.types.AddonsConfig" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_addons_config" + }, + "description": "Sample for SetAddonsConfig", + "file": "container_v1_generated_cluster_manager_set_addons_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetAddonsConfig_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_set_addons_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.set_addons_config", + "method": { + "fullName": "google.container.v1.ClusterManager.SetAddonsConfig", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetAddonsConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetAddonsConfigRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "addons_config", + "type": "google.cloud.container_v1.types.AddonsConfig" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_addons_config" + }, + "description": "Sample for SetAddonsConfig", + "file": "container_v1_generated_cluster_manager_set_addons_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetAddonsConfig_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_set_addons_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_labels", + "method": { + "fullName": "google.container.v1.ClusterManager.SetLabels", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLabels" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetLabelsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_labels" + }, + "description": "Sample for SetLabels", + "file": "container_v1_generated_cluster_manager_set_labels_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetLabels_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": "container_v1_generated_cluster_manager_set_labels_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.set_labels", + "method": { + "fullName": "google.container.v1.ClusterManager.SetLabels", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLabels" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetLabelsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_labels" + }, + "description": "Sample for SetLabels", + "file": "container_v1_generated_cluster_manager_set_labels_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetLabels_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": "container_v1_generated_cluster_manager_set_labels_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_legacy_abac", + "method": { + "fullName": "google.container.v1.ClusterManager.SetLegacyAbac", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLegacyAbac" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetLegacyAbacRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "enabled", + "type": "bool" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_legacy_abac" + }, + "description": "Sample for SetLegacyAbac", + "file": "container_v1_generated_cluster_manager_set_legacy_abac_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetLegacyAbac_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": "container_v1_generated_cluster_manager_set_legacy_abac_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.set_legacy_abac", + "method": { + "fullName": "google.container.v1.ClusterManager.SetLegacyAbac", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLegacyAbac" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetLegacyAbacRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "enabled", + "type": "bool" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_legacy_abac" + }, + "description": "Sample for SetLegacyAbac", + "file": "container_v1_generated_cluster_manager_set_legacy_abac_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetLegacyAbac_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": "container_v1_generated_cluster_manager_set_legacy_abac_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_locations", + "method": { + "fullName": "google.container.v1.ClusterManager.SetLocations", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLocations" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetLocationsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "locations", + "type": "MutableSequence[str]" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_locations" + }, + "description": "Sample for SetLocations", + "file": "container_v1_generated_cluster_manager_set_locations_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetLocations_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": "container_v1_generated_cluster_manager_set_locations_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.set_locations", + "method": { + "fullName": "google.container.v1.ClusterManager.SetLocations", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLocations" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetLocationsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "locations", + "type": "MutableSequence[str]" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_locations" + }, + "description": "Sample for SetLocations", + "file": "container_v1_generated_cluster_manager_set_locations_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetLocations_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": "container_v1_generated_cluster_manager_set_locations_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_logging_service", + "method": { + "fullName": "google.container.v1.ClusterManager.SetLoggingService", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLoggingService" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetLoggingServiceRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "logging_service", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_logging_service" + }, + "description": "Sample for SetLoggingService", + "file": "container_v1_generated_cluster_manager_set_logging_service_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetLoggingService_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": "container_v1_generated_cluster_manager_set_logging_service_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.set_logging_service", + "method": { + "fullName": "google.container.v1.ClusterManager.SetLoggingService", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLoggingService" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetLoggingServiceRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "logging_service", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_logging_service" + }, + "description": "Sample for SetLoggingService", + "file": "container_v1_generated_cluster_manager_set_logging_service_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetLoggingService_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": "container_v1_generated_cluster_manager_set_logging_service_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_maintenance_policy", + "method": { + "fullName": "google.container.v1.ClusterManager.SetMaintenancePolicy", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetMaintenancePolicy" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetMaintenancePolicyRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "maintenance_policy", + "type": "google.cloud.container_v1.types.MaintenancePolicy" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_maintenance_policy" + }, + "description": "Sample for SetMaintenancePolicy", + "file": "container_v1_generated_cluster_manager_set_maintenance_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetMaintenancePolicy_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_set_maintenance_policy_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.set_maintenance_policy", + "method": { + "fullName": "google.container.v1.ClusterManager.SetMaintenancePolicy", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetMaintenancePolicy" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetMaintenancePolicyRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "maintenance_policy", + "type": "google.cloud.container_v1.types.MaintenancePolicy" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_maintenance_policy" + }, + "description": "Sample for SetMaintenancePolicy", + "file": "container_v1_generated_cluster_manager_set_maintenance_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetMaintenancePolicy_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_set_maintenance_policy_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_master_auth", + "method": { + "fullName": "google.container.v1.ClusterManager.SetMasterAuth", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetMasterAuth" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetMasterAuthRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_master_auth" + }, + "description": "Sample for SetMasterAuth", + "file": "container_v1_generated_cluster_manager_set_master_auth_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetMasterAuth_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": "container_v1_generated_cluster_manager_set_master_auth_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.set_master_auth", + "method": { + "fullName": "google.container.v1.ClusterManager.SetMasterAuth", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetMasterAuth" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetMasterAuthRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_master_auth" + }, + "description": "Sample for SetMasterAuth", + "file": "container_v1_generated_cluster_manager_set_master_auth_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetMasterAuth_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": "container_v1_generated_cluster_manager_set_master_auth_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_monitoring_service", + "method": { + "fullName": "google.container.v1.ClusterManager.SetMonitoringService", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetMonitoringService" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetMonitoringServiceRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "monitoring_service", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_monitoring_service" + }, + "description": "Sample for SetMonitoringService", + "file": "container_v1_generated_cluster_manager_set_monitoring_service_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetMonitoringService_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": "container_v1_generated_cluster_manager_set_monitoring_service_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.set_monitoring_service", + "method": { + "fullName": "google.container.v1.ClusterManager.SetMonitoringService", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetMonitoringService" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetMonitoringServiceRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "monitoring_service", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_monitoring_service" + }, + "description": "Sample for SetMonitoringService", + "file": "container_v1_generated_cluster_manager_set_monitoring_service_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetMonitoringService_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": "container_v1_generated_cluster_manager_set_monitoring_service_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_network_policy", + "method": { + "fullName": "google.container.v1.ClusterManager.SetNetworkPolicy", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNetworkPolicy" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetNetworkPolicyRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "network_policy", + "type": "google.cloud.container_v1.types.NetworkPolicy" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_network_policy" + }, + "description": "Sample for SetNetworkPolicy", + "file": "container_v1_generated_cluster_manager_set_network_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetNetworkPolicy_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_set_network_policy_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.set_network_policy", + "method": { + "fullName": "google.container.v1.ClusterManager.SetNetworkPolicy", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNetworkPolicy" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetNetworkPolicyRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "network_policy", + "type": "google.cloud.container_v1.types.NetworkPolicy" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_network_policy" + }, + "description": "Sample for SetNetworkPolicy", + "file": "container_v1_generated_cluster_manager_set_network_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetNetworkPolicy_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_set_network_policy_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_node_pool_autoscaling", + "method": { + "fullName": "google.container.v1.ClusterManager.SetNodePoolAutoscaling", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNodePoolAutoscaling" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetNodePoolAutoscalingRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_node_pool_autoscaling" + }, + "description": "Sample for SetNodePoolAutoscaling", + "file": "container_v1_generated_cluster_manager_set_node_pool_autoscaling_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetNodePoolAutoscaling_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_set_node_pool_autoscaling_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.set_node_pool_autoscaling", + "method": { + "fullName": "google.container.v1.ClusterManager.SetNodePoolAutoscaling", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNodePoolAutoscaling" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetNodePoolAutoscalingRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_node_pool_autoscaling" + }, + "description": "Sample for SetNodePoolAutoscaling", + "file": "container_v1_generated_cluster_manager_set_node_pool_autoscaling_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetNodePoolAutoscaling_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_set_node_pool_autoscaling_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_node_pool_management", + "method": { + "fullName": "google.container.v1.ClusterManager.SetNodePoolManagement", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNodePoolManagement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetNodePoolManagementRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_node_pool_management" + }, + "description": "Sample for SetNodePoolManagement", + "file": "container_v1_generated_cluster_manager_set_node_pool_management_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetNodePoolManagement_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_set_node_pool_management_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.set_node_pool_management", + "method": { + "fullName": "google.container.v1.ClusterManager.SetNodePoolManagement", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNodePoolManagement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetNodePoolManagementRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_node_pool_management" + }, + "description": "Sample for SetNodePoolManagement", + "file": "container_v1_generated_cluster_manager_set_node_pool_management_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetNodePoolManagement_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_set_node_pool_management_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_node_pool_size", + "method": { + "fullName": "google.container.v1.ClusterManager.SetNodePoolSize", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNodePoolSize" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetNodePoolSizeRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_node_pool_size" + }, + "description": "Sample for SetNodePoolSize", + "file": "container_v1_generated_cluster_manager_set_node_pool_size_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetNodePoolSize_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": "container_v1_generated_cluster_manager_set_node_pool_size_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.set_node_pool_size", + "method": { + "fullName": "google.container.v1.ClusterManager.SetNodePoolSize", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNodePoolSize" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.SetNodePoolSizeRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "set_node_pool_size" + }, + "description": "Sample for SetNodePoolSize", + "file": "container_v1_generated_cluster_manager_set_node_pool_size_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_SetNodePoolSize_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": "container_v1_generated_cluster_manager_set_node_pool_size_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.start_ip_rotation", + "method": { + "fullName": "google.container.v1.ClusterManager.StartIPRotation", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "StartIPRotation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.StartIPRotationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "start_ip_rotation" + }, + "description": "Sample for StartIPRotation", + "file": "container_v1_generated_cluster_manager_start_ip_rotation_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_StartIPRotation_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_start_ip_rotation_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.start_ip_rotation", + "method": { + "fullName": "google.container.v1.ClusterManager.StartIPRotation", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "StartIPRotation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.StartIPRotationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "start_ip_rotation" + }, + "description": "Sample for StartIPRotation", + "file": "container_v1_generated_cluster_manager_start_ip_rotation_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_StartIPRotation_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_start_ip_rotation_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.update_cluster", + "method": { + "fullName": "google.container.v1.ClusterManager.UpdateCluster", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "UpdateCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.UpdateClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "update", + "type": "google.cloud.container_v1.types.ClusterUpdate" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "update_cluster" + }, + "description": "Sample for UpdateCluster", + "file": "container_v1_generated_cluster_manager_update_cluster_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_UpdateCluster_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_update_cluster_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.update_cluster", + "method": { + "fullName": "google.container.v1.ClusterManager.UpdateCluster", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "UpdateCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.UpdateClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "update", + "type": "google.cloud.container_v1.types.ClusterUpdate" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "update_cluster" + }, + "description": "Sample for UpdateCluster", + "file": "container_v1_generated_cluster_manager_update_cluster_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_UpdateCluster_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_update_cluster_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.update_master", + "method": { + "fullName": "google.container.v1.ClusterManager.UpdateMaster", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "UpdateMaster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.UpdateMasterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "master_version", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "update_master" + }, + "description": "Sample for UpdateMaster", + "file": "container_v1_generated_cluster_manager_update_master_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_UpdateMaster_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": "container_v1_generated_cluster_manager_update_master_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.update_master", + "method": { + "fullName": "google.container.v1.ClusterManager.UpdateMaster", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "UpdateMaster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.UpdateMasterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "master_version", + "type": "str" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "update_master" + }, + "description": "Sample for UpdateMaster", + "file": "container_v1_generated_cluster_manager_update_master_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_UpdateMaster_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": "container_v1_generated_cluster_manager_update_master_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.update_node_pool", + "method": { + "fullName": "google.container.v1.ClusterManager.UpdateNodePool", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "UpdateNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.UpdateNodePoolRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "update_node_pool" + }, + "description": "Sample for UpdateNodePool", + "file": "container_v1_generated_cluster_manager_update_node_pool_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_UpdateNodePool_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": "container_v1_generated_cluster_manager_update_node_pool_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.update_node_pool", + "method": { + "fullName": "google.container.v1.ClusterManager.UpdateNodePool", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "UpdateNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.UpdateNodePoolRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1.types.Operation", + "shortName": "update_node_pool" + }, + "description": "Sample for UpdateNodePool", + "file": "container_v1_generated_cluster_manager_update_node_pool_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_UpdateNodePool_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": "container_v1_generated_cluster_manager_update_node_pool_sync.py" + } + ] +} diff --git a/owl-bot-staging/google-cloud-container/v1/scripts/fixup_container_v1_keywords.py b/owl-bot-staging/google-cloud-container/v1/scripts/fixup_container_v1_keywords.py new file mode 100644 index 000000000000..5ecd6d887b07 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/scripts/fixup_container_v1_keywords.py @@ -0,0 +1,209 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 containerCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'cancel_operation': ('project_id', 'zone', 'operation_id', 'name', ), + 'check_autopilot_compatibility': ('name', ), + 'complete_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', ), + 'complete_node_pool_upgrade': ('name', ), + 'create_cluster': ('cluster', 'project_id', 'zone', 'parent', ), + 'create_node_pool': ('node_pool', 'project_id', 'zone', 'cluster_id', 'parent', ), + 'delete_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), + 'delete_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'get_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), + 'get_json_web_keys': ('parent', ), + 'get_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'get_operation': ('project_id', 'zone', 'operation_id', 'name', ), + 'get_server_config': ('project_id', 'zone', 'name', ), + 'list_clusters': ('project_id', 'zone', 'parent', ), + 'list_node_pools': ('project_id', 'zone', 'cluster_id', 'parent', ), + 'list_operations': ('project_id', 'zone', 'parent', ), + 'list_usable_subnetworks': ('parent', 'filter', 'page_size', 'page_token', ), + 'rollback_node_pool_upgrade': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', 'respect_pdb', ), + 'set_addons_config': ('addons_config', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_labels': ('resource_labels', 'label_fingerprint', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_legacy_abac': ('enabled', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_locations': ('locations', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_logging_service': ('logging_service', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_maintenance_policy': ('project_id', 'zone', 'cluster_id', 'maintenance_policy', 'name', ), + 'set_master_auth': ('action', 'update', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_monitoring_service': ('monitoring_service', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_network_policy': ('network_policy', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_node_pool_autoscaling': ('autoscaling', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'set_node_pool_management': ('management', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'set_node_pool_size': ('node_count', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'start_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', 'rotate_credentials', ), + 'update_cluster': ('update', 'project_id', 'zone', 'cluster_id', 'name', ), + 'update_master': ('master_version', 'project_id', 'zone', 'cluster_id', 'name', ), + 'update_node_pool': ('node_version', 'image_type', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', 'locations', 'workload_metadata_config', 'upgrade_settings', 'tags', 'taints', 'labels', 'linux_node_config', 'kubelet_config', 'node_network_config', 'gcfs_config', 'confidential_nodes', 'gvnic', 'etag', 'fast_socket', 'logging_config', 'resource_labels', 'windows_node_config', 'accelerators', 'machine_type', 'disk_type', 'disk_size_gb', 'resource_manager_tags', 'containerd_config', 'queued_provisioning', 'storage_pools', ), + } + + 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=containerCallTransformer(), +): + """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 container 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/google-cloud-container/v1/setup.py b/owl-bot-staging/google-cloud-container/v1/setup.py new file mode 100644 index 000000000000..0085de6f1022 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/setup.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 re + +import setuptools # type: ignore + +package_root = os.path.abspath(os.path.dirname(__file__)) + +name = 'google-cloud-container' + + +description = "Google Cloud Container API client library" + +version = None + +with open(os.path.join(package_root, 'google/cloud/container/gapic_version.py')) as fp: + version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read()) + assert (len(version_candidates) == 1) + version = version_candidates[0] + +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.1, <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.*", + # Exclude incompatible versions of `google-auth` + # See https://github.com/googleapis/google-cloud-python/issues/12364 + "google-auth >= 2.14.1, <3.0.0dev,!=2.24.0,!=2.25.0", + "proto-plus >= 1.22.3, <2.0.0dev", + "proto-plus >= 1.25.0, <2.0.0dev; python_version >= '3.13'", + "protobuf>=3.20.2,<6.0.0dev,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", +] +extras = { +} +url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-container" + +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.find_namespace_packages() + if package.startswith("google") +] + +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", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Operating System :: OS Independent", + "Topic :: Internet", + ], + platforms="Posix; MacOS X; Windows", + packages=packages, + python_requires=">=3.7", + install_requires=dependencies, + extras_require=extras, + include_package_data=True, + zip_safe=False, +) diff --git a/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.10.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.10.txt new file mode 100644 index 000000000000..ed7f9aed2559 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1/testing/constraints-3.11.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.11.txt new file mode 100644 index 000000000000..ed7f9aed2559 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1/testing/constraints-3.12.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.12.txt new file mode 100644 index 000000000000..ed7f9aed2559 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1/testing/constraints-3.13.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.13.txt new file mode 100644 index 000000000000..ed7f9aed2559 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.13.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/google-cloud-container/v1/testing/constraints-3.7.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.7.txt new file mode 100644 index 000000000000..fc812592b0ee --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.7.txt @@ -0,0 +1,10 @@ +# 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.1 +google-auth==2.14.1 +proto-plus==1.22.3 +protobuf==3.20.2 diff --git a/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.8.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.8.txt new file mode 100644 index 000000000000..ed7f9aed2559 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1/testing/constraints-3.9.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.9.txt new file mode 100644 index 000000000000..ed7f9aed2559 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1/tests/__init__.py b/owl-bot-staging/google-cloud-container/v1/tests/__init__.py new file mode 100644 index 000000000000..7b3de3117f38 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/tests/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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/google-cloud-container/v1/tests/unit/__init__.py b/owl-bot-staging/google-cloud-container/v1/tests/unit/__init__.py new file mode 100644 index 000000000000..7b3de3117f38 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/tests/unit/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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/google-cloud-container/v1/tests/unit/gapic/__init__.py b/owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/__init__.py new file mode 100644 index 000000000000..7b3de3117f38 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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/google-cloud-container/v1/tests/unit/gapic/container_v1/__init__.py b/owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/container_v1/__init__.py new file mode 100644 index 000000000000..7b3de3117f38 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/container_v1/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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/google-cloud-container/v1/tests/unit/gapic/container_v1/test_cluster_manager.py b/owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/container_v1/test_cluster_manager.py new file mode 100644 index 000000000000..cc38169afc33 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/container_v1/test_cluster_manager.py @@ -0,0 +1,24315 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 +from collections.abc import Iterable, AsyncIterable +from google.protobuf import json_format +import json +import math +import pytest +from google.api_core import api_core_version +from proto.marshal.rules.dates import DurationRule, TimestampRule +from proto.marshal.rules import wrappers +from requests import Response +from requests import Request, PreparedRequest +from requests.sessions import Session +from google.protobuf import json_format + +try: + from google.auth.aio import credentials as ga_credentials_async + HAS_GOOGLE_AUTH_AIO = True +except ImportError: # pragma: NO COVER + HAS_GOOGLE_AUTH_AIO = False + +from google.api_core import client_options +from google.api_core import exceptions as core_exceptions +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 path_template +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.container_v1.services.cluster_manager import ClusterManagerAsyncClient +from google.cloud.container_v1.services.cluster_manager import ClusterManagerClient +from google.cloud.container_v1.services.cluster_manager import pagers +from google.cloud.container_v1.services.cluster_manager import transports +from google.cloud.container_v1.types import cluster_service +from google.oauth2 import service_account +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.protobuf import wrappers_pb2 # type: ignore +from google.rpc import code_pb2 # type: ignore +from google.rpc import status_pb2 # type: ignore +import google.auth + + +async def mock_async_gen(data, chunk_size=1): + for i in range(0, len(data)): # pragma: NO COVER + chunk = data[i : i + chunk_size] + yield chunk.encode("utf-8") + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + +# TODO: use async auth anon credentials by default once the minimum version of google-auth is upgraded. +# See related issue: https://github.com/googleapis/gapic-generator-python/issues/2107. +def async_anonymous_credentials(): + if HAS_GOOGLE_AUTH_AIO: + return ga_credentials_async.AnonymousCredentials() + return ga_credentials.AnonymousCredentials() + +# 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 + +# If default endpoint template is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint template so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint_template(client): + return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE + + +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 ClusterManagerClient._get_default_mtls_endpoint(None) is None + assert ClusterManagerClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint + assert ClusterManagerClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint + assert ClusterManagerClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint + assert ClusterManagerClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint + assert ClusterManagerClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + +def test__read_environment_variables(): + assert ClusterManagerClient._read_environment_variables() == (False, "auto", None) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + assert ClusterManagerClient._read_environment_variables() == (True, "auto", None) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + assert ClusterManagerClient._read_environment_variables() == (False, "auto", None) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): + with pytest.raises(ValueError) as excinfo: + ClusterManagerClient._read_environment_variables() + assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + assert ClusterManagerClient._read_environment_variables() == (False, "never", None) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + assert ClusterManagerClient._read_environment_variables() == (False, "always", None) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}): + assert ClusterManagerClient._read_environment_variables() == (False, "auto", None) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError) as excinfo: + ClusterManagerClient._read_environment_variables() + assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + + with mock.patch.dict(os.environ, {"GOOGLE_CLOUD_UNIVERSE_DOMAIN": "foo.com"}): + assert ClusterManagerClient._read_environment_variables() == (False, "auto", "foo.com") + +def test__get_client_cert_source(): + mock_provided_cert_source = mock.Mock() + mock_default_cert_source = mock.Mock() + + assert ClusterManagerClient._get_client_cert_source(None, False) is None + assert ClusterManagerClient._get_client_cert_source(mock_provided_cert_source, False) is None + assert ClusterManagerClient._get_client_cert_source(mock_provided_cert_source, True) == mock_provided_cert_source + + 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_default_cert_source): + assert ClusterManagerClient._get_client_cert_source(None, True) is mock_default_cert_source + assert ClusterManagerClient._get_client_cert_source(mock_provided_cert_source, "true") is mock_provided_cert_source + +@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) +@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) +def test__get_api_endpoint(): + api_override = "foo.com" + mock_client_cert_source = mock.Mock() + default_universe = ClusterManagerClient._DEFAULT_UNIVERSE + default_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=default_universe) + mock_universe = "bar.com" + mock_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=mock_universe) + + assert ClusterManagerClient._get_api_endpoint(api_override, mock_client_cert_source, default_universe, "always") == api_override + assert ClusterManagerClient._get_api_endpoint(None, mock_client_cert_source, default_universe, "auto") == ClusterManagerClient.DEFAULT_MTLS_ENDPOINT + assert ClusterManagerClient._get_api_endpoint(None, None, default_universe, "auto") == default_endpoint + assert ClusterManagerClient._get_api_endpoint(None, None, default_universe, "always") == ClusterManagerClient.DEFAULT_MTLS_ENDPOINT + assert ClusterManagerClient._get_api_endpoint(None, mock_client_cert_source, default_universe, "always") == ClusterManagerClient.DEFAULT_MTLS_ENDPOINT + assert ClusterManagerClient._get_api_endpoint(None, None, mock_universe, "never") == mock_endpoint + assert ClusterManagerClient._get_api_endpoint(None, None, default_universe, "never") == default_endpoint + + with pytest.raises(MutualTLSChannelError) as excinfo: + ClusterManagerClient._get_api_endpoint(None, mock_client_cert_source, mock_universe, "auto") + assert str(excinfo.value) == "mTLS is not supported in any universe other than googleapis.com." + + +def test__get_universe_domain(): + client_universe_domain = "foo.com" + universe_domain_env = "bar.com" + + assert ClusterManagerClient._get_universe_domain(client_universe_domain, universe_domain_env) == client_universe_domain + assert ClusterManagerClient._get_universe_domain(None, universe_domain_env) == universe_domain_env + assert ClusterManagerClient._get_universe_domain(None, None) == ClusterManagerClient._DEFAULT_UNIVERSE + + with pytest.raises(ValueError) as excinfo: + ClusterManagerClient._get_universe_domain("", None) + assert str(excinfo.value) == "Universe Domain cannot be an empty string." + + +@pytest.mark.parametrize("client_class,transport_name", [ + (ClusterManagerClient, "grpc"), + (ClusterManagerAsyncClient, "grpc_asyncio"), + (ClusterManagerClient, "rest"), +]) +def test_cluster_manager_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 == ( + 'container.googleapis.com:443' + if transport_name in ['grpc', 'grpc_asyncio'] + else + 'https://container.googleapis.com' + ) + + +@pytest.mark.parametrize("transport_class,transport_name", [ + (transports.ClusterManagerGrpcTransport, "grpc"), + (transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio"), + (transports.ClusterManagerRestTransport, "rest"), +]) +def test_cluster_manager_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", [ + (ClusterManagerClient, "grpc"), + (ClusterManagerAsyncClient, "grpc_asyncio"), + (ClusterManagerClient, "rest"), +]) +def test_cluster_manager_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 == ( + 'container.googleapis.com:443' + if transport_name in ['grpc', 'grpc_asyncio'] + else + 'https://container.googleapis.com' + ) + + +def test_cluster_manager_client_get_transport_class(): + transport = ClusterManagerClient.get_transport_class() + available_transports = [ + transports.ClusterManagerGrpcTransport, + transports.ClusterManagerRestTransport, + ] + assert transport in available_transports + + transport = ClusterManagerClient.get_transport_class("grpc") + assert transport == transports.ClusterManagerGrpcTransport + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc"), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio"), + (ClusterManagerClient, transports.ClusterManagerRestTransport, "rest"), +]) +@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) +@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) +def test_cluster_manager_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(ClusterManagerClient, '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(ClusterManagerClient, '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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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) as excinfo: + client = client_class(transport=transport_name) + assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + + # 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) as excinfo: + client = client_class(transport=transport_name) + assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + + # 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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", [ + (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", "true"), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", "true"), + (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", "false"), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", "false"), + (ClusterManagerClient, transports.ClusterManagerRestTransport, "rest", "true"), + (ClusterManagerClient, transports.ClusterManagerRestTransport, "rest", "false"), +]) +@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) +@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE) + 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE) + 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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", [ + ClusterManagerClient, ClusterManagerAsyncClient +]) +@mock.patch.object(ClusterManagerClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ClusterManagerClient)) +@mock.patch.object(ClusterManagerAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ClusterManagerAsyncClient)) +def test_cluster_manager_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 + + # 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) as excinfo: + client_class.get_mtls_endpoint_and_cert_source() + + assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + + # 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) as excinfo: + client_class.get_mtls_endpoint_and_cert_source() + + assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + +@pytest.mark.parametrize("client_class", [ + ClusterManagerClient, ClusterManagerAsyncClient +]) +@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) +@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) +def test_cluster_manager_client_client_api_endpoint(client_class): + mock_client_cert_source = client_cert_source_callback + api_override = "foo.com" + default_universe = ClusterManagerClient._DEFAULT_UNIVERSE + default_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=default_universe) + mock_universe = "bar.com" + mock_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=mock_universe) + + # If ClientOptions.api_endpoint is set and GOOGLE_API_USE_CLIENT_CERTIFICATE="true", + # use ClientOptions.api_endpoint as the api endpoint regardless. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch("google.auth.transport.requests.AuthorizedSession.configure_mtls_channel"): + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=api_override) + client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) + assert client.api_endpoint == api_override + + # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", + # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + client = client_class(credentials=ga_credentials.AnonymousCredentials()) + assert client.api_endpoint == default_endpoint + + # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", + # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + client = client_class(credentials=ga_credentials.AnonymousCredentials()) + assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + + # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), + # GOOGLE_API_USE_CLIENT_CERTIFICATE="false" (default), default cert source doesn't exist, + # and ClientOptions.universe_domain="bar.com", + # use the _DEFAULT_ENDPOINT_TEMPLATE populated with universe domain as the api endpoint. + options = client_options.ClientOptions() + universe_exists = hasattr(options, "universe_domain") + if universe_exists: + options = client_options.ClientOptions(universe_domain=mock_universe) + client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) + else: + client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) + assert client.api_endpoint == (mock_endpoint if universe_exists else default_endpoint) + assert client.universe_domain == (mock_universe if universe_exists else default_universe) + + # If ClientOptions does not have a universe domain attribute and GOOGLE_API_USE_MTLS_ENDPOINT="never", + # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. + options = client_options.ClientOptions() + if hasattr(options, "universe_domain"): + delattr(options, "universe_domain") + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) + assert client.api_endpoint == default_endpoint + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc"), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio"), + (ClusterManagerClient, transports.ClusterManagerRestTransport, "rest"), +]) +def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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", [ + (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", grpc_helpers), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), + (ClusterManagerClient, transports.ClusterManagerRestTransport, "rest", None), +]) +def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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_cluster_manager_client_client_options_from_dict(): + with mock.patch('google.cloud.container_v1.services.cluster_manager.transports.ClusterManagerGrpcTransport.__init__') as grpc_transport: + grpc_transport.return_value = None + client = ClusterManagerClient( + 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", [ + (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", grpc_helpers), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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( + "container.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="container.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.ListClustersRequest, + dict, +]) +def test_list_clusters(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_clusters), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListClustersResponse( + missing_zones=['missing_zones_value'], + ) + response = client.list_clusters(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.ListClustersRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListClustersResponse) + assert response.missing_zones == ['missing_zones_value'] + + +def test_list_clusters_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.ListClustersRequest( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.list_clusters(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.ListClustersRequest( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + +def test_list_clusters_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.list_clusters in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.list_clusters] = mock_rpc + request = {} + client.list_clusters(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_clusters(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_clusters_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.list_clusters in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.list_clusters] = mock_rpc + + request = {} + await client.list_clusters(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.list_clusters(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_clusters_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListClustersRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_clusters), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse( + missing_zones=['missing_zones_value'], + )) + response = await client.list_clusters(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.ListClustersRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListClustersResponse) + assert response.missing_zones == ['missing_zones_value'] + + +@pytest.mark.asyncio +async def test_list_clusters_async_from_dict(): + await test_list_clusters_async(request_type=dict) + +def test_list_clusters_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListClustersRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + call.return_value = cluster_service.ListClustersResponse() + client.list_clusters(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_clusters_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListClustersRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse()) + await client.list_clusters(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_clusters_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListClustersResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_clusters( + project_id='project_id_value', + zone='zone_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_clusters_flattened_error(): + client = ClusterManagerClient( + 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_clusters( + cluster_service.ListClustersRequest(), + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_clusters_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListClustersResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_clusters( + project_id='project_id_value', + zone='zone_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_clusters_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_clusters( + cluster_service.ListClustersRequest(), + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetClusterRequest, + dict, +]) +def test_get_cluster(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Cluster( + name='name_value', + description='description_value', + initial_node_count=1911, + logging_service='logging_service_value', + monitoring_service='monitoring_service_value', + network='network_value', + cluster_ipv4_cidr='cluster_ipv4_cidr_value', + subnetwork='subnetwork_value', + locations=['locations_value'], + enable_kubernetes_alpha=True, + label_fingerprint='label_fingerprint_value', + self_link='self_link_value', + zone='zone_value', + endpoint='endpoint_value', + initial_cluster_version='initial_cluster_version_value', + current_master_version='current_master_version_value', + current_node_version='current_node_version_value', + create_time='create_time_value', + status=cluster_service.Cluster.Status.PROVISIONING, + status_message='status_message_value', + node_ipv4_cidr_size=1955, + services_ipv4_cidr='services_ipv4_cidr_value', + instance_group_urls=['instance_group_urls_value'], + current_node_count=1936, + expire_time='expire_time_value', + location='location_value', + enable_tpu=True, + tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', + id='id_value', + etag='etag_value', + satisfies_pzs=True, + satisfies_pzi=True, + ) + response = client.get_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.GetClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Cluster) + assert response.name == 'name_value' + assert response.description == 'description_value' + assert response.initial_node_count == 1911 + assert response.logging_service == 'logging_service_value' + assert response.monitoring_service == 'monitoring_service_value' + assert response.network == 'network_value' + assert response.cluster_ipv4_cidr == 'cluster_ipv4_cidr_value' + assert response.subnetwork == 'subnetwork_value' + assert response.locations == ['locations_value'] + assert response.enable_kubernetes_alpha is True + assert response.label_fingerprint == 'label_fingerprint_value' + assert response.self_link == 'self_link_value' + assert response.zone == 'zone_value' + assert response.endpoint == 'endpoint_value' + assert response.initial_cluster_version == 'initial_cluster_version_value' + assert response.current_master_version == 'current_master_version_value' + assert response.current_node_version == 'current_node_version_value' + assert response.create_time == 'create_time_value' + assert response.status == cluster_service.Cluster.Status.PROVISIONING + assert response.status_message == 'status_message_value' + assert response.node_ipv4_cidr_size == 1955 + assert response.services_ipv4_cidr == 'services_ipv4_cidr_value' + assert response.instance_group_urls == ['instance_group_urls_value'] + assert response.current_node_count == 1936 + assert response.expire_time == 'expire_time_value' + assert response.location == 'location_value' + assert response.enable_tpu is True + assert response.tpu_ipv4_cidr_block == 'tpu_ipv4_cidr_block_value' + assert response.id == 'id_value' + assert response.etag == 'etag_value' + assert response.satisfies_pzs is True + assert response.satisfies_pzi is True + + +def test_get_cluster_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.GetClusterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.get_cluster(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.GetClusterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_get_cluster_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_cluster in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_cluster] = mock_rpc + request = {} + client.get_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.get_cluster in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.get_cluster] = mock_rpc + + request = {} + await client.get_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.get_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetClusterRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster( + name='name_value', + description='description_value', + initial_node_count=1911, + logging_service='logging_service_value', + monitoring_service='monitoring_service_value', + network='network_value', + cluster_ipv4_cidr='cluster_ipv4_cidr_value', + subnetwork='subnetwork_value', + locations=['locations_value'], + enable_kubernetes_alpha=True, + label_fingerprint='label_fingerprint_value', + self_link='self_link_value', + zone='zone_value', + endpoint='endpoint_value', + initial_cluster_version='initial_cluster_version_value', + current_master_version='current_master_version_value', + current_node_version='current_node_version_value', + create_time='create_time_value', + status=cluster_service.Cluster.Status.PROVISIONING, + status_message='status_message_value', + node_ipv4_cidr_size=1955, + services_ipv4_cidr='services_ipv4_cidr_value', + instance_group_urls=['instance_group_urls_value'], + current_node_count=1936, + expire_time='expire_time_value', + location='location_value', + enable_tpu=True, + tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', + id='id_value', + etag='etag_value', + satisfies_pzs=True, + satisfies_pzi=True, + )) + response = await client.get_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.GetClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Cluster) + assert response.name == 'name_value' + assert response.description == 'description_value' + assert response.initial_node_count == 1911 + assert response.logging_service == 'logging_service_value' + assert response.monitoring_service == 'monitoring_service_value' + assert response.network == 'network_value' + assert response.cluster_ipv4_cidr == 'cluster_ipv4_cidr_value' + assert response.subnetwork == 'subnetwork_value' + assert response.locations == ['locations_value'] + assert response.enable_kubernetes_alpha is True + assert response.label_fingerprint == 'label_fingerprint_value' + assert response.self_link == 'self_link_value' + assert response.zone == 'zone_value' + assert response.endpoint == 'endpoint_value' + assert response.initial_cluster_version == 'initial_cluster_version_value' + assert response.current_master_version == 'current_master_version_value' + assert response.current_node_version == 'current_node_version_value' + assert response.create_time == 'create_time_value' + assert response.status == cluster_service.Cluster.Status.PROVISIONING + assert response.status_message == 'status_message_value' + assert response.node_ipv4_cidr_size == 1955 + assert response.services_ipv4_cidr == 'services_ipv4_cidr_value' + assert response.instance_group_urls == ['instance_group_urls_value'] + assert response.current_node_count == 1936 + assert response.expire_time == 'expire_time_value' + assert response.location == 'location_value' + assert response.enable_tpu is True + assert response.tpu_ipv4_cidr_block == 'tpu_ipv4_cidr_block_value' + assert response.id == 'id_value' + assert response.etag == 'etag_value' + assert response.satisfies_pzs is True + assert response.satisfies_pzi is True + + +@pytest.mark.asyncio +async def test_get_cluster_async_from_dict(): + await test_get_cluster_async(request_type=dict) + +def test_get_cluster_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetClusterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + call.return_value = cluster_service.Cluster() + client.get_cluster(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_cluster_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetClusterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster()) + await client.get_cluster(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_cluster_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Cluster() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_cluster( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_cluster_flattened_error(): + client = ClusterManagerClient( + 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_cluster( + cluster_service.GetClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_cluster_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Cluster() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_cluster( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_cluster_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_cluster( + cluster_service.GetClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CreateClusterRequest, + dict, +]) +def test_create_cluster(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.create_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.CreateClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_create_cluster_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.CreateClusterRequest( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.create_cluster(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CreateClusterRequest( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + +def test_create_cluster_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.create_cluster in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.create_cluster] = mock_rpc + request = {} + client.create_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.create_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_create_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.create_cluster in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.create_cluster] = mock_rpc + + request = {} + await client.create_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.create_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_create_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CreateClusterRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.create_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.CreateClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_create_cluster_async_from_dict(): + await test_create_cluster_async(request_type=dict) + +def test_create_cluster_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CreateClusterRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.create_cluster(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_cluster_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CreateClusterRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.create_cluster(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_cluster_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_cluster( + project_id='project_id_value', + zone='zone_value', + cluster=cluster_service.Cluster(name='name_value'), + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster + mock_val = cluster_service.Cluster(name='name_value') + assert arg == mock_val + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_create_cluster_flattened_error(): + client = ClusterManagerClient( + 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_cluster( + cluster_service.CreateClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster=cluster_service.Cluster(name='name_value'), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_create_cluster_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_cluster( + project_id='project_id_value', + zone='zone_value', + cluster=cluster_service.Cluster(name='name_value'), + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster + mock_val = cluster_service.Cluster(name='name_value') + assert arg == mock_val + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_cluster_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_cluster( + cluster_service.CreateClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster=cluster_service.Cluster(name='name_value'), + parent='parent_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.UpdateClusterRequest, + dict, +]) +def test_update_cluster(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.update_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.UpdateClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_update_cluster_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.UpdateClusterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.update_cluster(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.UpdateClusterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_update_cluster_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.update_cluster in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.update_cluster] = mock_rpc + request = {} + client.update_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.update_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_update_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.update_cluster in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.update_cluster] = mock_rpc + + request = {} + await client.update_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.update_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_update_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.UpdateClusterRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.update_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.UpdateClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_update_cluster_async_from_dict(): + await test_update_cluster_async(request_type=dict) + +def test_update_cluster_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.UpdateClusterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.update_cluster(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_update_cluster_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.UpdateClusterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.update_cluster(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_update_cluster_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_cluster( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].update + mock_val = cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value') + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_update_cluster_flattened_error(): + client = ClusterManagerClient( + 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_cluster( + cluster_service.UpdateClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_update_cluster_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_cluster( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].update + mock_val = cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value') + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_cluster_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_cluster( + cluster_service.UpdateClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.UpdateNodePoolRequest, + dict, +]) +def test_update_node_pool(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.update_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.UpdateNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_update_node_pool_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.UpdateNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + node_version='node_version_value', + image_type='image_type_value', + name='name_value', + etag='etag_value', + machine_type='machine_type_value', + disk_type='disk_type_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_node_pool), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.update_node_pool(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.UpdateNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + node_version='node_version_value', + image_type='image_type_value', + name='name_value', + etag='etag_value', + machine_type='machine_type_value', + disk_type='disk_type_value', + ) + +def test_update_node_pool_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.update_node_pool in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.update_node_pool] = mock_rpc + request = {} + client.update_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.update_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_update_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.update_node_pool in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.update_node_pool] = mock_rpc + + request = {} + await client.update_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.update_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_update_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.UpdateNodePoolRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.update_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.UpdateNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_update_node_pool_async_from_dict(): + await test_update_node_pool_async(request_type=dict) + +def test_update_node_pool_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.UpdateNodePoolRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_node_pool), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.update_node_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_update_node_pool_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.UpdateNodePoolRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_node_pool), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.update_node_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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetNodePoolAutoscalingRequest, + dict, +]) +def test_set_node_pool_autoscaling(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_node_pool_autoscaling), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_node_pool_autoscaling(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNodePoolAutoscalingRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_node_pool_autoscaling_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetNodePoolAutoscalingRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_autoscaling), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_node_pool_autoscaling(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetNodePoolAutoscalingRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +def test_set_node_pool_autoscaling_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_node_pool_autoscaling in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_node_pool_autoscaling] = mock_rpc + request = {} + client.set_node_pool_autoscaling(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_node_pool_autoscaling(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_node_pool_autoscaling_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_node_pool_autoscaling in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_node_pool_autoscaling] = mock_rpc + + request = {} + await client.set_node_pool_autoscaling(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_node_pool_autoscaling(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_node_pool_autoscaling_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNodePoolAutoscalingRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_node_pool_autoscaling), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_node_pool_autoscaling(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNodePoolAutoscalingRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_node_pool_autoscaling_async_from_dict(): + await test_set_node_pool_autoscaling_async(request_type=dict) + +def test_set_node_pool_autoscaling_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNodePoolAutoscalingRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_autoscaling), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_node_pool_autoscaling(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_set_node_pool_autoscaling_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNodePoolAutoscalingRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_autoscaling), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_node_pool_autoscaling(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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetLoggingServiceRequest, + dict, +]) +def test_set_logging_service(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_logging_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_logging_service(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLoggingServiceRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_logging_service_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetLoggingServiceRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_logging_service(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetLoggingServiceRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_value', + name='name_value', + ) + +def test_set_logging_service_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_logging_service in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_logging_service] = mock_rpc + request = {} + client.set_logging_service(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_logging_service(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_logging_service_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_logging_service in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_logging_service] = mock_rpc + + request = {} + await client.set_logging_service(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_logging_service(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_logging_service_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLoggingServiceRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_logging_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_logging_service(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLoggingServiceRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_logging_service_async_from_dict(): + await test_set_logging_service_async(request_type=dict) + +def test_set_logging_service_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLoggingServiceRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_logging_service(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_set_logging_service_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLoggingServiceRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_logging_service(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_set_logging_service_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_logging_service( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].logging_service + mock_val = 'logging_service_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_set_logging_service_flattened_error(): + client = ClusterManagerClient( + 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.set_logging_service( + cluster_service.SetLoggingServiceRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_value', + name='name_value', + ) + +@pytest.mark.asyncio +async def test_set_logging_service_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_logging_service( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].logging_service + mock_val = 'logging_service_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_logging_service_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_logging_service( + cluster_service.SetLoggingServiceRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_value', + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetMonitoringServiceRequest, + dict, +]) +def test_set_monitoring_service(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_monitoring_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_monitoring_service(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetMonitoringServiceRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_monitoring_service_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetMonitoringServiceRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_monitoring_service(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetMonitoringServiceRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_value', + name='name_value', + ) + +def test_set_monitoring_service_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_monitoring_service in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_monitoring_service] = mock_rpc + request = {} + client.set_monitoring_service(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_monitoring_service(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_monitoring_service_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_monitoring_service in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_monitoring_service] = mock_rpc + + request = {} + await client.set_monitoring_service(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_monitoring_service(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_monitoring_service_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetMonitoringServiceRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_monitoring_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_monitoring_service(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetMonitoringServiceRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_monitoring_service_async_from_dict(): + await test_set_monitoring_service_async(request_type=dict) + +def test_set_monitoring_service_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetMonitoringServiceRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_monitoring_service(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_set_monitoring_service_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetMonitoringServiceRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_monitoring_service(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_set_monitoring_service_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_monitoring_service( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].monitoring_service + mock_val = 'monitoring_service_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_set_monitoring_service_flattened_error(): + client = ClusterManagerClient( + 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.set_monitoring_service( + cluster_service.SetMonitoringServiceRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_value', + name='name_value', + ) + +@pytest.mark.asyncio +async def test_set_monitoring_service_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_monitoring_service( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].monitoring_service + mock_val = 'monitoring_service_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_monitoring_service_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_monitoring_service( + cluster_service.SetMonitoringServiceRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_value', + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetAddonsConfigRequest, + dict, +]) +def test_set_addons_config(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_addons_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_addons_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetAddonsConfigRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_addons_config_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetAddonsConfigRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_addons_config(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetAddonsConfigRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_set_addons_config_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_addons_config in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_addons_config] = mock_rpc + request = {} + client.set_addons_config(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_addons_config(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_addons_config_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_addons_config in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_addons_config] = mock_rpc + + request = {} + await client.set_addons_config(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_addons_config(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_addons_config_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetAddonsConfigRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_addons_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_addons_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetAddonsConfigRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_addons_config_async_from_dict(): + await test_set_addons_config_async(request_type=dict) + +def test_set_addons_config_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetAddonsConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_addons_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_set_addons_config_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetAddonsConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_addons_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_set_addons_config_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_addons_config( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].addons_config + mock_val = cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)) + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_set_addons_config_flattened_error(): + client = ClusterManagerClient( + 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.set_addons_config( + cluster_service.SetAddonsConfigRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_set_addons_config_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_addons_config( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].addons_config + mock_val = cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)) + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_addons_config_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_addons_config( + cluster_service.SetAddonsConfigRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetLocationsRequest, + dict, +]) +def test_set_locations(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_locations(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLocationsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_locations_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetLocationsRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_locations(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetLocationsRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_set_locations_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_locations in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_locations] = mock_rpc + request = {} + client.set_locations(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_locations(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_locations_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_locations in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_locations] = mock_rpc + + request = {} + await client.set_locations(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_locations(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_locations_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLocationsRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_locations(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLocationsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_locations_async_from_dict(): + await test_set_locations_async(request_type=dict) + +def test_set_locations_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLocationsRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_locations(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_set_locations_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLocationsRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_locations(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_set_locations_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_locations( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + locations=['locations_value'], + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].locations + mock_val = ['locations_value'] + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_set_locations_flattened_error(): + client = ClusterManagerClient( + 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.set_locations( + cluster_service.SetLocationsRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + locations=['locations_value'], + name='name_value', + ) + +@pytest.mark.asyncio +async def test_set_locations_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_locations( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + locations=['locations_value'], + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].locations + mock_val = ['locations_value'] + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_locations_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_locations( + cluster_service.SetLocationsRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + locations=['locations_value'], + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.UpdateMasterRequest, + dict, +]) +def test_update_master(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_master), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.update_master(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.UpdateMasterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_update_master_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.UpdateMasterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.update_master(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.UpdateMasterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_value', + name='name_value', + ) + +def test_update_master_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.update_master in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.update_master] = mock_rpc + request = {} + client.update_master(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.update_master(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_update_master_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.update_master in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.update_master] = mock_rpc + + request = {} + await client.update_master(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.update_master(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_update_master_async(transport: str = 'grpc_asyncio', request_type=cluster_service.UpdateMasterRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_master), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.update_master(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.UpdateMasterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_update_master_async_from_dict(): + await test_update_master_async(request_type=dict) + +def test_update_master_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.UpdateMasterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.update_master(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_update_master_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.UpdateMasterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.update_master(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_update_master_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_master( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].master_version + mock_val = 'master_version_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_update_master_flattened_error(): + client = ClusterManagerClient( + 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_master( + cluster_service.UpdateMasterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_value', + name='name_value', + ) + +@pytest.mark.asyncio +async def test_update_master_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_master( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].master_version + mock_val = 'master_version_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_master_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_master( + cluster_service.UpdateMasterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_value', + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetMasterAuthRequest, + dict, +]) +def test_set_master_auth(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_master_auth), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_master_auth(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetMasterAuthRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_master_auth_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetMasterAuthRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_master_auth), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_master_auth(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetMasterAuthRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_set_master_auth_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_master_auth in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_master_auth] = mock_rpc + request = {} + client.set_master_auth(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_master_auth(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_master_auth_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_master_auth in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_master_auth] = mock_rpc + + request = {} + await client.set_master_auth(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_master_auth(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_master_auth_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetMasterAuthRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_master_auth), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_master_auth(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetMasterAuthRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_master_auth_async_from_dict(): + await test_set_master_auth_async(request_type=dict) + +def test_set_master_auth_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetMasterAuthRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_master_auth), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_master_auth(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_set_master_auth_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetMasterAuthRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_master_auth), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_master_auth(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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.DeleteClusterRequest, + dict, +]) +def test_delete_cluster(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.delete_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.DeleteClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_delete_cluster_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.DeleteClusterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.delete_cluster(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.DeleteClusterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_delete_cluster_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.delete_cluster in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.delete_cluster] = mock_rpc + request = {} + client.delete_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.delete_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_delete_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.delete_cluster in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.delete_cluster] = mock_rpc + + request = {} + await client.delete_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.delete_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_delete_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.DeleteClusterRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.delete_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.DeleteClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_delete_cluster_async_from_dict(): + await test_delete_cluster_async(request_type=dict) + +def test_delete_cluster_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.DeleteClusterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.delete_cluster(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_cluster_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.DeleteClusterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.delete_cluster(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_cluster_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_cluster( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_cluster_flattened_error(): + client = ClusterManagerClient( + 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_cluster( + cluster_service.DeleteClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +@pytest.mark.asyncio +async def test_delete_cluster_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_cluster( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_cluster_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_cluster( + cluster_service.DeleteClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.ListOperationsRequest, + dict, +]) +def test_list_operations(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_operations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListOperationsResponse( + missing_zones=['missing_zones_value'], + ) + response = client.list_operations(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.ListOperationsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListOperationsResponse) + assert response.missing_zones == ['missing_zones_value'] + + +def test_list_operations_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.ListOperationsRequest( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.list_operations(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.ListOperationsRequest( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + +def test_list_operations_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.list_operations in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.list_operations] = mock_rpc + request = {} + client.list_operations(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_operations(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_operations_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.list_operations in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.list_operations] = mock_rpc + + request = {} + await client.list_operations(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.list_operations(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_operations_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListOperationsRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_operations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse( + missing_zones=['missing_zones_value'], + )) + response = await client.list_operations(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.ListOperationsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListOperationsResponse) + assert response.missing_zones == ['missing_zones_value'] + + +@pytest.mark.asyncio +async def test_list_operations_async_from_dict(): + await test_list_operations_async(request_type=dict) + +def test_list_operations_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListOperationsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + call.return_value = cluster_service.ListOperationsResponse() + client.list_operations(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_operations_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListOperationsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse()) + await client.list_operations(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_operations_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListOperationsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_operations( + project_id='project_id_value', + zone='zone_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_operations_flattened_error(): + client = ClusterManagerClient( + 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_operations( + cluster_service.ListOperationsRequest(), + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListOperationsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_operations( + project_id='project_id_value', + zone='zone_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_operations_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_operations( + cluster_service.ListOperationsRequest(), + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetOperationRequest, + dict, +]) +def test_get_operation(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.get_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.GetOperationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_get_operation_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.GetOperationRequest( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.get_operation(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.GetOperationRequest( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + +def test_get_operation_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_operation in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_operation] = mock_rpc + request = {} + client.get_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_operation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_operation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.get_operation in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.get_operation] = mock_rpc + + request = {} + await client.get_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.get_operation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_operation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetOperationRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.get_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.GetOperationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_get_operation_async_from_dict(): + await test_get_operation_async(request_type=dict) + +def test_get_operation_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetOperationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.get_operation(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_operation_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetOperationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.get_operation(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_operation_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_operation( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].operation_id + mock_val = 'operation_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_operation_flattened_error(): + client = ClusterManagerClient( + 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_operation( + cluster_service.GetOperationRequest(), + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_operation( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].operation_id + mock_val = 'operation_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_operation_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_operation( + cluster_service.GetOperationRequest(), + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CancelOperationRequest, + dict, +]) +def test_cancel_operation(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.cancel_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.cancel_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.CancelOperationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +def test_cancel_operation_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.CancelOperationRequest( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.cancel_operation(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CancelOperationRequest( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + +def test_cancel_operation_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.cancel_operation in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.cancel_operation] = mock_rpc + request = {} + client.cancel_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.cancel_operation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_cancel_operation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.cancel_operation in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.cancel_operation] = mock_rpc + + request = {} + await client.cancel_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.cancel_operation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_cancel_operation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CancelOperationRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.cancel_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.cancel_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.CancelOperationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_cancel_operation_async_from_dict(): + await test_cancel_operation_async(request_type=dict) + +def test_cancel_operation_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CancelOperationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + call.return_value = None + client.cancel_operation(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_cancel_operation_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CancelOperationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.cancel_operation(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_cancel_operation_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.cancel_operation( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].operation_id + mock_val = 'operation_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_cancel_operation_flattened_error(): + client = ClusterManagerClient( + 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.cancel_operation( + cluster_service.CancelOperationRequest(), + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.cancel_operation( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].operation_id + mock_val = 'operation_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.cancel_operation( + cluster_service.CancelOperationRequest(), + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetServerConfigRequest, + dict, +]) +def test_get_server_config(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_server_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ServerConfig( + default_cluster_version='default_cluster_version_value', + valid_node_versions=['valid_node_versions_value'], + default_image_type='default_image_type_value', + valid_image_types=['valid_image_types_value'], + valid_master_versions=['valid_master_versions_value'], + ) + response = client.get_server_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.GetServerConfigRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ServerConfig) + assert response.default_cluster_version == 'default_cluster_version_value' + assert response.valid_node_versions == ['valid_node_versions_value'] + assert response.default_image_type == 'default_image_type_value' + assert response.valid_image_types == ['valid_image_types_value'] + assert response.valid_master_versions == ['valid_master_versions_value'] + + +def test_get_server_config_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.GetServerConfigRequest( + project_id='project_id_value', + zone='zone_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.get_server_config(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.GetServerConfigRequest( + project_id='project_id_value', + zone='zone_value', + name='name_value', + ) + +def test_get_server_config_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_server_config in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_server_config] = mock_rpc + request = {} + client.get_server_config(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_server_config(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_server_config_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.get_server_config in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.get_server_config] = mock_rpc + + request = {} + await client.get_server_config(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.get_server_config(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_server_config_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetServerConfigRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_server_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig( + default_cluster_version='default_cluster_version_value', + valid_node_versions=['valid_node_versions_value'], + default_image_type='default_image_type_value', + valid_image_types=['valid_image_types_value'], + valid_master_versions=['valid_master_versions_value'], + )) + response = await client.get_server_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.GetServerConfigRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ServerConfig) + assert response.default_cluster_version == 'default_cluster_version_value' + assert response.valid_node_versions == ['valid_node_versions_value'] + assert response.default_image_type == 'default_image_type_value' + assert response.valid_image_types == ['valid_image_types_value'] + assert response.valid_master_versions == ['valid_master_versions_value'] + + +@pytest.mark.asyncio +async def test_get_server_config_async_from_dict(): + await test_get_server_config_async(request_type=dict) + +def test_get_server_config_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetServerConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + call.return_value = cluster_service.ServerConfig() + client.get_server_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_server_config_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetServerConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig()) + await client.get_server_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_server_config_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ServerConfig() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_server_config( + project_id='project_id_value', + zone='zone_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_server_config_flattened_error(): + client = ClusterManagerClient( + 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_server_config( + cluster_service.GetServerConfigRequest(), + project_id='project_id_value', + zone='zone_value', + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_server_config_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ServerConfig() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_server_config( + project_id='project_id_value', + zone='zone_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_server_config_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_server_config( + cluster_service.GetServerConfigRequest(), + project_id='project_id_value', + zone='zone_value', + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetJSONWebKeysRequest, + dict, +]) +def test_get_json_web_keys(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_json_web_keys), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.GetJSONWebKeysResponse( + ) + response = client.get_json_web_keys(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.GetJSONWebKeysRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.GetJSONWebKeysResponse) + + +def test_get_json_web_keys_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.GetJSONWebKeysRequest( + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_json_web_keys), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.get_json_web_keys(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.GetJSONWebKeysRequest( + parent='parent_value', + ) + +def test_get_json_web_keys_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_json_web_keys in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_json_web_keys] = mock_rpc + request = {} + client.get_json_web_keys(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_json_web_keys(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_json_web_keys_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.get_json_web_keys in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.get_json_web_keys] = mock_rpc + + request = {} + await client.get_json_web_keys(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.get_json_web_keys(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_json_web_keys_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetJSONWebKeysRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_json_web_keys), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.GetJSONWebKeysResponse( + )) + response = await client.get_json_web_keys(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.GetJSONWebKeysRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.GetJSONWebKeysResponse) + + +@pytest.mark.asyncio +async def test_get_json_web_keys_async_from_dict(): + await test_get_json_web_keys_async(request_type=dict) + +def test_get_json_web_keys_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetJSONWebKeysRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_json_web_keys), + '__call__') as call: + call.return_value = cluster_service.GetJSONWebKeysResponse() + client.get_json_web_keys(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_get_json_web_keys_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetJSONWebKeysRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_json_web_keys), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.GetJSONWebKeysResponse()) + await client.get_json_web_keys(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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.ListNodePoolsRequest, + dict, +]) +def test_list_node_pools(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_node_pools), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListNodePoolsResponse( + ) + response = client.list_node_pools(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.ListNodePoolsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListNodePoolsResponse) + + +def test_list_node_pools_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.ListNodePoolsRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.list_node_pools(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.ListNodePoolsRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + parent='parent_value', + ) + +def test_list_node_pools_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.list_node_pools in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.list_node_pools] = mock_rpc + request = {} + client.list_node_pools(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_node_pools(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_node_pools_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.list_node_pools in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.list_node_pools] = mock_rpc + + request = {} + await client.list_node_pools(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.list_node_pools(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_node_pools_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListNodePoolsRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_node_pools), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse( + )) + response = await client.list_node_pools(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.ListNodePoolsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListNodePoolsResponse) + + +@pytest.mark.asyncio +async def test_list_node_pools_async_from_dict(): + await test_list_node_pools_async(request_type=dict) + +def test_list_node_pools_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListNodePoolsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + call.return_value = cluster_service.ListNodePoolsResponse() + client.list_node_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_node_pools_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListNodePoolsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse()) + await client.list_node_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_node_pools_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListNodePoolsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_node_pools( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_node_pools_flattened_error(): + client = ClusterManagerClient( + 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_node_pools( + cluster_service.ListNodePoolsRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_node_pools_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListNodePoolsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_node_pools( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_node_pools_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_node_pools( + cluster_service.ListNodePoolsRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + parent='parent_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetNodePoolRequest, + dict, +]) +def test_get_node_pool(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.NodePool( + name='name_value', + initial_node_count=1911, + locations=['locations_value'], + self_link='self_link_value', + version='version_value', + instance_group_urls=['instance_group_urls_value'], + status=cluster_service.NodePool.Status.PROVISIONING, + status_message='status_message_value', + pod_ipv4_cidr_size=1856, + etag='etag_value', + ) + response = client.get_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.GetNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.NodePool) + assert response.name == 'name_value' + assert response.initial_node_count == 1911 + assert response.locations == ['locations_value'] + assert response.self_link == 'self_link_value' + assert response.version == 'version_value' + assert response.instance_group_urls == ['instance_group_urls_value'] + assert response.status == cluster_service.NodePool.Status.PROVISIONING + assert response.status_message == 'status_message_value' + assert response.pod_ipv4_cidr_size == 1856 + assert response.etag == 'etag_value' + + +def test_get_node_pool_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.GetNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.get_node_pool(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.GetNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +def test_get_node_pool_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_node_pool in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_node_pool] = mock_rpc + request = {} + client.get_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.get_node_pool in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.get_node_pool] = mock_rpc + + request = {} + await client.get_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.get_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetNodePoolRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool( + name='name_value', + initial_node_count=1911, + locations=['locations_value'], + self_link='self_link_value', + version='version_value', + instance_group_urls=['instance_group_urls_value'], + status=cluster_service.NodePool.Status.PROVISIONING, + status_message='status_message_value', + pod_ipv4_cidr_size=1856, + etag='etag_value', + )) + response = await client.get_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.GetNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.NodePool) + assert response.name == 'name_value' + assert response.initial_node_count == 1911 + assert response.locations == ['locations_value'] + assert response.self_link == 'self_link_value' + assert response.version == 'version_value' + assert response.instance_group_urls == ['instance_group_urls_value'] + assert response.status == cluster_service.NodePool.Status.PROVISIONING + assert response.status_message == 'status_message_value' + assert response.pod_ipv4_cidr_size == 1856 + assert response.etag == 'etag_value' + + +@pytest.mark.asyncio +async def test_get_node_pool_async_from_dict(): + await test_get_node_pool_async(request_type=dict) + +def test_get_node_pool_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetNodePoolRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + call.return_value = cluster_service.NodePool() + client.get_node_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_node_pool_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetNodePoolRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool()) + await client.get_node_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_node_pool_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.NodePool() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_node_pool( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_node_pool_flattened_error(): + client = ClusterManagerClient( + 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_node_pool( + cluster_service.GetNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_node_pool_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.NodePool() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_node_pool( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_node_pool_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_node_pool( + cluster_service.GetNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CreateNodePoolRequest, + dict, +]) +def test_create_node_pool(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.create_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.CreateNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_create_node_pool_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.CreateNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.create_node_pool(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CreateNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + parent='parent_value', + ) + +def test_create_node_pool_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.create_node_pool in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.create_node_pool] = mock_rpc + request = {} + client.create_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.create_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_create_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.create_node_pool in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.create_node_pool] = mock_rpc + + request = {} + await client.create_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.create_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_create_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CreateNodePoolRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.create_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.CreateNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_create_node_pool_async_from_dict(): + await test_create_node_pool_async(request_type=dict) + +def test_create_node_pool_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CreateNodePoolRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.create_node_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_node_pool_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CreateNodePoolRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.create_node_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_node_pool_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_node_pool( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool=cluster_service.NodePool(name='name_value'), + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool + mock_val = cluster_service.NodePool(name='name_value') + assert arg == mock_val + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_create_node_pool_flattened_error(): + client = ClusterManagerClient( + 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_node_pool( + cluster_service.CreateNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool=cluster_service.NodePool(name='name_value'), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_create_node_pool_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_node_pool( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool=cluster_service.NodePool(name='name_value'), + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool + mock_val = cluster_service.NodePool(name='name_value') + assert arg == mock_val + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_node_pool_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_node_pool( + cluster_service.CreateNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool=cluster_service.NodePool(name='name_value'), + parent='parent_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.DeleteNodePoolRequest, + dict, +]) +def test_delete_node_pool(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.delete_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.DeleteNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_delete_node_pool_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.DeleteNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.delete_node_pool(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.DeleteNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +def test_delete_node_pool_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.delete_node_pool in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.delete_node_pool] = mock_rpc + request = {} + client.delete_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.delete_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_delete_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.delete_node_pool in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.delete_node_pool] = mock_rpc + + request = {} + await client.delete_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.delete_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_delete_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.DeleteNodePoolRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.delete_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.DeleteNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_delete_node_pool_async_from_dict(): + await test_delete_node_pool_async(request_type=dict) + +def test_delete_node_pool_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.DeleteNodePoolRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.delete_node_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_node_pool_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.DeleteNodePoolRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.delete_node_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_node_pool_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_node_pool( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_node_pool_flattened_error(): + client = ClusterManagerClient( + 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_node_pool( + cluster_service.DeleteNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +@pytest.mark.asyncio +async def test_delete_node_pool_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_node_pool( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_node_pool_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_node_pool( + cluster_service.DeleteNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CompleteNodePoolUpgradeRequest, + dict, +]) +def test_complete_node_pool_upgrade(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.complete_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.CompleteNodePoolUpgradeRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +def test_complete_node_pool_upgrade_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.CompleteNodePoolUpgradeRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.complete_node_pool_upgrade(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CompleteNodePoolUpgradeRequest( + name='name_value', + ) + +def test_complete_node_pool_upgrade_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.complete_node_pool_upgrade in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.complete_node_pool_upgrade] = mock_rpc + request = {} + client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.complete_node_pool_upgrade(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.complete_node_pool_upgrade in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.complete_node_pool_upgrade] = mock_rpc + + request = {} + await client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.complete_node_pool_upgrade(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CompleteNodePoolUpgradeRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.complete_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.CompleteNodePoolUpgradeRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_async_from_dict(): + await test_complete_node_pool_upgrade_async(request_type=dict) + +def test_complete_node_pool_upgrade_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CompleteNodePoolUpgradeRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), + '__call__') as call: + call.return_value = None + client.complete_node_pool_upgrade(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_complete_node_pool_upgrade_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CompleteNodePoolUpgradeRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.complete_node_pool_upgrade(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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.RollbackNodePoolUpgradeRequest, + dict, +]) +def test_rollback_node_pool_upgrade(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.rollback_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.rollback_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.RollbackNodePoolUpgradeRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_rollback_node_pool_upgrade_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.RollbackNodePoolUpgradeRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.rollback_node_pool_upgrade(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +def test_rollback_node_pool_upgrade_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.rollback_node_pool_upgrade in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.rollback_node_pool_upgrade] = mock_rpc + request = {} + client.rollback_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.rollback_node_pool_upgrade(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_rollback_node_pool_upgrade_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.rollback_node_pool_upgrade in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.rollback_node_pool_upgrade] = mock_rpc + + request = {} + await client.rollback_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.rollback_node_pool_upgrade(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_rollback_node_pool_upgrade_async(transport: str = 'grpc_asyncio', request_type=cluster_service.RollbackNodePoolUpgradeRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.rollback_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.rollback_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.RollbackNodePoolUpgradeRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_rollback_node_pool_upgrade_async_from_dict(): + await test_rollback_node_pool_upgrade_async(request_type=dict) + +def test_rollback_node_pool_upgrade_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.RollbackNodePoolUpgradeRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.rollback_node_pool_upgrade(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_rollback_node_pool_upgrade_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.RollbackNodePoolUpgradeRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.rollback_node_pool_upgrade(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_rollback_node_pool_upgrade_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.rollback_node_pool_upgrade( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_rollback_node_pool_upgrade_flattened_error(): + client = ClusterManagerClient( + 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.rollback_node_pool_upgrade( + cluster_service.RollbackNodePoolUpgradeRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +@pytest.mark.asyncio +async def test_rollback_node_pool_upgrade_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.rollback_node_pool_upgrade( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_rollback_node_pool_upgrade_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.rollback_node_pool_upgrade( + cluster_service.RollbackNodePoolUpgradeRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetNodePoolManagementRequest, + dict, +]) +def test_set_node_pool_management(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_node_pool_management), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_node_pool_management(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNodePoolManagementRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_node_pool_management_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetNodePoolManagementRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_node_pool_management(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetNodePoolManagementRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +def test_set_node_pool_management_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_node_pool_management in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_node_pool_management] = mock_rpc + request = {} + client.set_node_pool_management(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_node_pool_management(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_node_pool_management_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_node_pool_management in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_node_pool_management] = mock_rpc + + request = {} + await client.set_node_pool_management(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_node_pool_management(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_node_pool_management_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNodePoolManagementRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_node_pool_management), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_node_pool_management(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNodePoolManagementRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_node_pool_management_async_from_dict(): + await test_set_node_pool_management_async(request_type=dict) + +def test_set_node_pool_management_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNodePoolManagementRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_node_pool_management(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_set_node_pool_management_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNodePoolManagementRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_node_pool_management(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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetLabelsRequest, + dict, +]) +def test_set_labels(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_labels), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_labels(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLabelsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_labels_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetLabelsRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + label_fingerprint='label_fingerprint_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_labels), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_labels(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetLabelsRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + label_fingerprint='label_fingerprint_value', + name='name_value', + ) + +def test_set_labels_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_labels in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_labels] = mock_rpc + request = {} + client.set_labels(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_labels(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_labels_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_labels in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_labels] = mock_rpc + + request = {} + await client.set_labels(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_labels(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_labels_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLabelsRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_labels), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_labels(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLabelsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_labels_async_from_dict(): + await test_set_labels_async(request_type=dict) + +def test_set_labels_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLabelsRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_labels), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_labels(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_set_labels_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLabelsRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_labels), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_labels(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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetLegacyAbacRequest, + dict, +]) +def test_set_legacy_abac(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_legacy_abac), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_legacy_abac(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLegacyAbacRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_legacy_abac_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetLegacyAbacRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_legacy_abac(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetLegacyAbacRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_set_legacy_abac_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_legacy_abac in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_legacy_abac] = mock_rpc + request = {} + client.set_legacy_abac(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_legacy_abac(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_legacy_abac_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_legacy_abac in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_legacy_abac] = mock_rpc + + request = {} + await client.set_legacy_abac(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_legacy_abac(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_legacy_abac_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLegacyAbacRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_legacy_abac), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_legacy_abac(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLegacyAbacRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_legacy_abac_async_from_dict(): + await test_set_legacy_abac_async(request_type=dict) + +def test_set_legacy_abac_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLegacyAbacRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_legacy_abac(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_set_legacy_abac_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLegacyAbacRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_legacy_abac(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_set_legacy_abac_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_legacy_abac( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + enabled=True, + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].enabled + mock_val = True + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_set_legacy_abac_flattened_error(): + client = ClusterManagerClient( + 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.set_legacy_abac( + cluster_service.SetLegacyAbacRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + enabled=True, + name='name_value', + ) + +@pytest.mark.asyncio +async def test_set_legacy_abac_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_legacy_abac( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + enabled=True, + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].enabled + mock_val = True + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_legacy_abac_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_legacy_abac( + cluster_service.SetLegacyAbacRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + enabled=True, + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.StartIPRotationRequest, + dict, +]) +def test_start_ip_rotation(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.start_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.start_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.StartIPRotationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_start_ip_rotation_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.StartIPRotationRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.start_ip_rotation(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.StartIPRotationRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_start_ip_rotation_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.start_ip_rotation in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.start_ip_rotation] = mock_rpc + request = {} + client.start_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.start_ip_rotation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_start_ip_rotation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.start_ip_rotation in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.start_ip_rotation] = mock_rpc + + request = {} + await client.start_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.start_ip_rotation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_start_ip_rotation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.StartIPRotationRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.start_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.start_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.StartIPRotationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_start_ip_rotation_async_from_dict(): + await test_start_ip_rotation_async(request_type=dict) + +def test_start_ip_rotation_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.StartIPRotationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.start_ip_rotation(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_start_ip_rotation_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.StartIPRotationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.start_ip_rotation(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_start_ip_rotation_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.start_ip_rotation( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_start_ip_rotation_flattened_error(): + client = ClusterManagerClient( + 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.start_ip_rotation( + cluster_service.StartIPRotationRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +@pytest.mark.asyncio +async def test_start_ip_rotation_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.start_ip_rotation( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_start_ip_rotation_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.start_ip_rotation( + cluster_service.StartIPRotationRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CompleteIPRotationRequest, + dict, +]) +def test_complete_ip_rotation(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.complete_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.complete_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.CompleteIPRotationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_complete_ip_rotation_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.CompleteIPRotationRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.complete_ip_rotation(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CompleteIPRotationRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_complete_ip_rotation_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.complete_ip_rotation in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.complete_ip_rotation] = mock_rpc + request = {} + client.complete_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.complete_ip_rotation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_complete_ip_rotation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.complete_ip_rotation in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.complete_ip_rotation] = mock_rpc + + request = {} + await client.complete_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.complete_ip_rotation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_complete_ip_rotation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CompleteIPRotationRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.complete_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.complete_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.CompleteIPRotationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_complete_ip_rotation_async_from_dict(): + await test_complete_ip_rotation_async(request_type=dict) + +def test_complete_ip_rotation_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CompleteIPRotationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.complete_ip_rotation(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_complete_ip_rotation_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CompleteIPRotationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.complete_ip_rotation(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_complete_ip_rotation_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.complete_ip_rotation( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_complete_ip_rotation_flattened_error(): + client = ClusterManagerClient( + 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.complete_ip_rotation( + cluster_service.CompleteIPRotationRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +@pytest.mark.asyncio +async def test_complete_ip_rotation_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.complete_ip_rotation( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_complete_ip_rotation_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.complete_ip_rotation( + cluster_service.CompleteIPRotationRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetNodePoolSizeRequest, + dict, +]) +def test_set_node_pool_size(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_node_pool_size), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_node_pool_size(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNodePoolSizeRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_node_pool_size_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetNodePoolSizeRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_size), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_node_pool_size(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetNodePoolSizeRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +def test_set_node_pool_size_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_node_pool_size in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_node_pool_size] = mock_rpc + request = {} + client.set_node_pool_size(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_node_pool_size(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_node_pool_size_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_node_pool_size in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_node_pool_size] = mock_rpc + + request = {} + await client.set_node_pool_size(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_node_pool_size(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_node_pool_size_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNodePoolSizeRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_node_pool_size), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_node_pool_size(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNodePoolSizeRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_node_pool_size_async_from_dict(): + await test_set_node_pool_size_async(request_type=dict) + +def test_set_node_pool_size_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNodePoolSizeRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_size), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_node_pool_size(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_set_node_pool_size_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNodePoolSizeRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_size), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_node_pool_size(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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetNetworkPolicyRequest, + dict, +]) +def test_set_network_policy(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_network_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_network_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNetworkPolicyRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_network_policy_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetNetworkPolicyRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_network_policy(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetNetworkPolicyRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_set_network_policy_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_network_policy in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_network_policy] = mock_rpc + request = {} + client.set_network_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_network_policy(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_network_policy_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_network_policy in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_network_policy] = mock_rpc + + request = {} + await client.set_network_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_network_policy(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_network_policy_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNetworkPolicyRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_network_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_network_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNetworkPolicyRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_network_policy_async_from_dict(): + await test_set_network_policy_async(request_type=dict) + +def test_set_network_policy_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNetworkPolicyRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_network_policy(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_set_network_policy_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNetworkPolicyRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_network_policy(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_set_network_policy_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_network_policy( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].network_policy + mock_val = cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO) + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_set_network_policy_flattened_error(): + client = ClusterManagerClient( + 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.set_network_policy( + cluster_service.SetNetworkPolicyRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_set_network_policy_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_network_policy( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].network_policy + mock_val = cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO) + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_network_policy_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_network_policy( + cluster_service.SetNetworkPolicyRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetMaintenancePolicyRequest, + dict, +]) +def test_set_maintenance_policy(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_maintenance_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_maintenance_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetMaintenancePolicyRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_maintenance_policy_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetMaintenancePolicyRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_maintenance_policy(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetMaintenancePolicyRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_set_maintenance_policy_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_maintenance_policy in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_maintenance_policy] = mock_rpc + request = {} + client.set_maintenance_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_maintenance_policy(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_maintenance_policy_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_maintenance_policy in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_maintenance_policy] = mock_rpc + + request = {} + await client.set_maintenance_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_maintenance_policy(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_maintenance_policy_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetMaintenancePolicyRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_maintenance_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_maintenance_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetMaintenancePolicyRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_maintenance_policy_async_from_dict(): + await test_set_maintenance_policy_async(request_type=dict) + +def test_set_maintenance_policy_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetMaintenancePolicyRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_maintenance_policy(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_set_maintenance_policy_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetMaintenancePolicyRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_maintenance_policy(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_set_maintenance_policy_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_maintenance_policy( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].maintenance_policy + mock_val = cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))) + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_set_maintenance_policy_flattened_error(): + client = ClusterManagerClient( + 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.set_maintenance_policy( + cluster_service.SetMaintenancePolicyRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_set_maintenance_policy_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_maintenance_policy( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), + 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].maintenance_policy + mock_val = cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))) + assert arg == mock_val + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_maintenance_policy_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_maintenance_policy( + cluster_service.SetMaintenancePolicyRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.ListUsableSubnetworksRequest, + dict, +]) +def test_list_usable_subnetworks(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_usable_subnetworks), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListUsableSubnetworksResponse( + next_page_token='next_page_token_value', + ) + response = client.list_usable_subnetworks(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.ListUsableSubnetworksRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListUsableSubnetworksPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_usable_subnetworks_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.ListUsableSubnetworksRequest( + parent='parent_value', + filter='filter_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.list_usable_subnetworks(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.ListUsableSubnetworksRequest( + parent='parent_value', + filter='filter_value', + page_token='page_token_value', + ) + +def test_list_usable_subnetworks_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.list_usable_subnetworks in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.list_usable_subnetworks] = mock_rpc + request = {} + client.list_usable_subnetworks(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_usable_subnetworks(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_usable_subnetworks_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.list_usable_subnetworks in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.list_usable_subnetworks] = mock_rpc + + request = {} + await client.list_usable_subnetworks(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.list_usable_subnetworks(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_usable_subnetworks_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListUsableSubnetworksRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_usable_subnetworks), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_usable_subnetworks(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.ListUsableSubnetworksRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListUsableSubnetworksAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_usable_subnetworks_async_from_dict(): + await test_list_usable_subnetworks_async(request_type=dict) + +def test_list_usable_subnetworks_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListUsableSubnetworksRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__') as call: + call.return_value = cluster_service.ListUsableSubnetworksResponse() + client.list_usable_subnetworks(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_usable_subnetworks_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListUsableSubnetworksRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse()) + await client.list_usable_subnetworks(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_usable_subnetworks_pager(transport_name: str = "grpc"): + client = ClusterManagerClient( + 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_usable_subnetworks), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + next_page_token='abc', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[], + next_page_token='def', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + ], + next_page_token='ghi', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + ), + RuntimeError, + ) + + expected_metadata = () + retry = retries.Retry() + timeout = 5 + expected_metadata = tuple(expected_metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_usable_subnetworks(request={}, retry=retry, timeout=timeout) + + assert pager._metadata == expected_metadata + assert pager._retry == retry + assert pager._timeout == timeout + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, cluster_service.UsableSubnetwork) + for i in results) +def test_list_usable_subnetworks_pages(transport_name: str = "grpc"): + client = ClusterManagerClient( + 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_usable_subnetworks), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + next_page_token='abc', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[], + next_page_token='def', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + ], + next_page_token='ghi', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + ), + RuntimeError, + ) + pages = list(client.list_usable_subnetworks(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_usable_subnetworks_async_pager(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + next_page_token='abc', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[], + next_page_token='def', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + ], + next_page_token='ghi', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_usable_subnetworks(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, cluster_service.UsableSubnetwork) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_usable_subnetworks_async_pages(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + next_page_token='abc', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[], + next_page_token='def', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + ], + next_page_token='ghi', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + ), + RuntimeError, + ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_usable_subnetworks(request={}) + ).pages: + 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", [ + cluster_service.CheckAutopilotCompatibilityRequest, + dict, +]) +def test_check_autopilot_compatibility(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.check_autopilot_compatibility), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.CheckAutopilotCompatibilityResponse( + summary='summary_value', + ) + response = client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.CheckAutopilotCompatibilityRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) + assert response.summary == 'summary_value' + + +def test_check_autopilot_compatibility_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.CheckAutopilotCompatibilityRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.check_autopilot_compatibility(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CheckAutopilotCompatibilityRequest( + name='name_value', + ) + +def test_check_autopilot_compatibility_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.check_autopilot_compatibility in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.check_autopilot_compatibility] = mock_rpc + request = {} + client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.check_autopilot_compatibility(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.check_autopilot_compatibility in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.check_autopilot_compatibility] = mock_rpc + + request = {} + await client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.check_autopilot_compatibility(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CheckAutopilotCompatibilityRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.check_autopilot_compatibility), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.CheckAutopilotCompatibilityResponse( + summary='summary_value', + )) + response = await client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.CheckAutopilotCompatibilityRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) + assert response.summary == 'summary_value' + + +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_async_from_dict(): + await test_check_autopilot_compatibility_async(request_type=dict) + +def test_check_autopilot_compatibility_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CheckAutopilotCompatibilityRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), + '__call__') as call: + call.return_value = cluster_service.CheckAutopilotCompatibilityResponse() + client.check_autopilot_compatibility(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_check_autopilot_compatibility_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CheckAutopilotCompatibilityRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.CheckAutopilotCompatibilityResponse()) + await client.check_autopilot_compatibility(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_list_clusters_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.list_clusters in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.list_clusters] = mock_rpc + + request = {} + client.list_clusters(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_clusters(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_list_clusters_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.ListClustersResponse() + + # get arguments that satisfy an http rule for this method + sample_request = {'parent': 'projects/sample1/locations/sample2'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.ListClustersResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.list_clusters(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{parent=projects/*/locations/*}/clusters" % client.transport._host, args[1]) + + +def test_list_clusters_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_clusters( + cluster_service.ListClustersRequest(), + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + + +def test_get_cluster_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_cluster in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_cluster] = mock_rpc + + request = {} + client.get_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_get_cluster_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Cluster() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Cluster.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.get_cluster(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}" % client.transport._host, args[1]) + + +def test_get_cluster_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_cluster( + cluster_service.GetClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + +def test_create_cluster_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.create_cluster in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.create_cluster] = mock_rpc + + request = {} + client.create_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.create_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_create_cluster_rest_required_fields(request_type=cluster_service.CreateClusterRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).create_cluster._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).create_cluster._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.create_cluster(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_create_cluster_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.create_cluster._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("cluster", ))) + + +def test_create_cluster_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'parent': 'projects/sample1/locations/sample2'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster=cluster_service.Cluster(name='name_value'), + parent='parent_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.create_cluster(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{parent=projects/*/locations/*}/clusters" % client.transport._host, args[1]) + + +def test_create_cluster_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_cluster( + cluster_service.CreateClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster=cluster_service.Cluster(name='name_value'), + parent='parent_value', + ) + + +def test_update_cluster_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.update_cluster in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.update_cluster] = mock_rpc + + request = {} + client.update_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.update_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_update_cluster_rest_required_fields(request_type=cluster_service.UpdateClusterRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).update_cluster._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).update_cluster._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "put", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.update_cluster(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_update_cluster_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.update_cluster._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("update", ))) + + +def test_update_cluster_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.update_cluster(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}" % client.transport._host, args[1]) + + +def test_update_cluster_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_cluster( + cluster_service.UpdateClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), + name='name_value', + ) + + +def test_update_node_pool_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.update_node_pool in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.update_node_pool] = mock_rpc + + request = {} + client.update_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.update_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_update_node_pool_rest_required_fields(request_type=cluster_service.UpdateNodePoolRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request_init["node_version"] = "" + request_init["image_type"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).update_node_pool._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["nodeVersion"] = 'node_version_value' + jsonified_request["imageType"] = 'image_type_value' + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).update_node_pool._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "nodeVersion" in jsonified_request + assert jsonified_request["nodeVersion"] == 'node_version_value' + assert "imageType" in jsonified_request + assert jsonified_request["imageType"] == 'image_type_value' + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "put", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.update_node_pool(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_update_node_pool_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.update_node_pool._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("nodeVersion", "imageType", ))) + + +def test_set_node_pool_autoscaling_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_node_pool_autoscaling in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_node_pool_autoscaling] = mock_rpc + + request = {} + client.set_node_pool_autoscaling(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_node_pool_autoscaling(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_set_node_pool_autoscaling_rest_required_fields(request_type=cluster_service.SetNodePoolAutoscalingRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_node_pool_autoscaling._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_node_pool_autoscaling._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.set_node_pool_autoscaling(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_set_node_pool_autoscaling_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.set_node_pool_autoscaling._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("autoscaling", ))) + + +def test_set_logging_service_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_logging_service in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_logging_service] = mock_rpc + + request = {} + client.set_logging_service(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_logging_service(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_set_logging_service_rest_required_fields(request_type=cluster_service.SetLoggingServiceRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request_init["logging_service"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_logging_service._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["loggingService"] = 'logging_service_value' + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_logging_service._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "loggingService" in jsonified_request + assert jsonified_request["loggingService"] == 'logging_service_value' + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.set_logging_service(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_set_logging_service_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.set_logging_service._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("loggingService", ))) + + +def test_set_logging_service_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_value', + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.set_logging_service(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setLogging" % client.transport._host, args[1]) + + +def test_set_logging_service_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.set_logging_service( + cluster_service.SetLoggingServiceRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_value', + name='name_value', + ) + + +def test_set_monitoring_service_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_monitoring_service in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_monitoring_service] = mock_rpc + + request = {} + client.set_monitoring_service(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_monitoring_service(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_set_monitoring_service_rest_required_fields(request_type=cluster_service.SetMonitoringServiceRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request_init["monitoring_service"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_monitoring_service._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["monitoringService"] = 'monitoring_service_value' + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_monitoring_service._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "monitoringService" in jsonified_request + assert jsonified_request["monitoringService"] == 'monitoring_service_value' + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.set_monitoring_service(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_set_monitoring_service_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.set_monitoring_service._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("monitoringService", ))) + + +def test_set_monitoring_service_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_value', + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.set_monitoring_service(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setMonitoring" % client.transport._host, args[1]) + + +def test_set_monitoring_service_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.set_monitoring_service( + cluster_service.SetMonitoringServiceRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_value', + name='name_value', + ) + + +def test_set_addons_config_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_addons_config in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_addons_config] = mock_rpc + + request = {} + client.set_addons_config(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_addons_config(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_set_addons_config_rest_required_fields(request_type=cluster_service.SetAddonsConfigRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_addons_config._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_addons_config._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.set_addons_config(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_set_addons_config_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.set_addons_config._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("addonsConfig", ))) + + +def test_set_addons_config_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.set_addons_config(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setAddons" % client.transport._host, args[1]) + + +def test_set_addons_config_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.set_addons_config( + cluster_service.SetAddonsConfigRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), + name='name_value', + ) + + +def test_set_locations_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_locations in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_locations] = mock_rpc + + request = {} + client.set_locations(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_locations(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_set_locations_rest_required_fields(request_type=cluster_service.SetLocationsRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request_init["locations"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_locations._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["locations"] = 'locations_value' + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_locations._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "locations" in jsonified_request + assert jsonified_request["locations"] == 'locations_value' + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.set_locations(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_set_locations_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.set_locations._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("locations", ))) + + +def test_set_locations_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + locations=['locations_value'], + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.set_locations(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setLocations" % client.transport._host, args[1]) + + +def test_set_locations_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.set_locations( + cluster_service.SetLocationsRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + locations=['locations_value'], + name='name_value', + ) + + +def test_update_master_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.update_master in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.update_master] = mock_rpc + + request = {} + client.update_master(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.update_master(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_update_master_rest_required_fields(request_type=cluster_service.UpdateMasterRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request_init["master_version"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).update_master._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["masterVersion"] = 'master_version_value' + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).update_master._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "masterVersion" in jsonified_request + assert jsonified_request["masterVersion"] == 'master_version_value' + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.update_master(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_update_master_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.update_master._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("masterVersion", ))) + + +def test_update_master_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_value', + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.update_master(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:updateMaster" % client.transport._host, args[1]) + + +def test_update_master_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_master( + cluster_service.UpdateMasterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_value', + name='name_value', + ) + + +def test_set_master_auth_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_master_auth in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_master_auth] = mock_rpc + + request = {} + client.set_master_auth(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_master_auth(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_set_master_auth_rest_required_fields(request_type=cluster_service.SetMasterAuthRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_master_auth._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_master_auth._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.set_master_auth(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_set_master_auth_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.set_master_auth._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("action", "update", ))) + + +def test_delete_cluster_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.delete_cluster in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.delete_cluster] = mock_rpc + + request = {} + client.delete_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.delete_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_delete_cluster_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.delete_cluster(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}" % client.transport._host, args[1]) + + +def test_delete_cluster_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_cluster( + cluster_service.DeleteClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + +def test_list_operations_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.list_operations in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.list_operations] = mock_rpc + + request = {} + client.list_operations(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_operations(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_list_operations_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.ListOperationsResponse() + + # get arguments that satisfy an http rule for this method + sample_request = {'parent': 'projects/sample1/locations/sample2'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.ListOperationsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.list_operations(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{parent=projects/*/locations/*}/operations" % client.transport._host, args[1]) + + +def test_list_operations_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_operations( + cluster_service.ListOperationsRequest(), + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + + +def test_get_operation_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_operation in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_operation] = mock_rpc + + request = {} + client.get_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_operation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_get_operation_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/operations/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.get_operation(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/operations/*}" % client.transport._host, args[1]) + + +def test_get_operation_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_operation( + cluster_service.GetOperationRequest(), + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + + +def test_cancel_operation_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.cancel_operation in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.cancel_operation] = mock_rpc + + request = {} + client.cancel_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.cancel_operation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_cancel_operation_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = None + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/operations/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = '' + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.cancel_operation(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/operations/*}:cancel" % client.transport._host, args[1]) + + +def test_cancel_operation_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.cancel_operation( + cluster_service.CancelOperationRequest(), + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + + +def test_get_server_config_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_server_config in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_server_config] = mock_rpc + + request = {} + client.get_server_config(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_server_config(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_get_server_config_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.ServerConfig() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.ServerConfig.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.get_server_config(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*}/serverConfig" % client.transport._host, args[1]) + + +def test_get_server_config_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_server_config( + cluster_service.GetServerConfigRequest(), + project_id='project_id_value', + zone='zone_value', + name='name_value', + ) + + +def test_get_json_web_keys_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_json_web_keys in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_json_web_keys] = mock_rpc + + request = {} + client.get_json_web_keys(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_json_web_keys(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_list_node_pools_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.list_node_pools in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.list_node_pools] = mock_rpc + + request = {} + client.list_node_pools(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_node_pools(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_list_node_pools_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.ListNodePoolsResponse() + + # get arguments that satisfy an http rule for this method + sample_request = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + parent='parent_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.ListNodePoolsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.list_node_pools(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{parent=projects/*/locations/*/clusters/*}/nodePools" % client.transport._host, args[1]) + + +def test_list_node_pools_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_node_pools( + cluster_service.ListNodePoolsRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + parent='parent_value', + ) + + +def test_get_node_pool_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_node_pool in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_node_pool] = mock_rpc + + request = {} + client.get_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_get_node_pool_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.NodePool() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.NodePool.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.get_node_pool(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}" % client.transport._host, args[1]) + + +def test_get_node_pool_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_node_pool( + cluster_service.GetNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + +def test_create_node_pool_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.create_node_pool in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.create_node_pool] = mock_rpc + + request = {} + client.create_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.create_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_create_node_pool_rest_required_fields(request_type=cluster_service.CreateNodePoolRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).create_node_pool._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).create_node_pool._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.create_node_pool(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_create_node_pool_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.create_node_pool._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("nodePool", ))) + + +def test_create_node_pool_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool=cluster_service.NodePool(name='name_value'), + parent='parent_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.create_node_pool(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{parent=projects/*/locations/*/clusters/*}/nodePools" % client.transport._host, args[1]) + + +def test_create_node_pool_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_node_pool( + cluster_service.CreateNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool=cluster_service.NodePool(name='name_value'), + parent='parent_value', + ) + + +def test_delete_node_pool_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.delete_node_pool in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.delete_node_pool] = mock_rpc + + request = {} + client.delete_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.delete_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_delete_node_pool_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.delete_node_pool(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}" % client.transport._host, args[1]) + + +def test_delete_node_pool_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_node_pool( + cluster_service.DeleteNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + +def test_complete_node_pool_upgrade_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.complete_node_pool_upgrade in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.complete_node_pool_upgrade] = mock_rpc + + request = {} + client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.complete_node_pool_upgrade(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_rollback_node_pool_upgrade_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.rollback_node_pool_upgrade in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.rollback_node_pool_upgrade] = mock_rpc + + request = {} + client.rollback_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.rollback_node_pool_upgrade(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_rollback_node_pool_upgrade_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.rollback_node_pool_upgrade(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:rollback" % client.transport._host, args[1]) + + +def test_rollback_node_pool_upgrade_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.rollback_node_pool_upgrade( + cluster_service.RollbackNodePoolUpgradeRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + +def test_set_node_pool_management_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_node_pool_management in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_node_pool_management] = mock_rpc + + request = {} + client.set_node_pool_management(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_node_pool_management(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_set_node_pool_management_rest_required_fields(request_type=cluster_service.SetNodePoolManagementRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_node_pool_management._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_node_pool_management._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.set_node_pool_management(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_set_node_pool_management_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.set_node_pool_management._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("management", ))) + + +def test_set_labels_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_labels in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_labels] = mock_rpc + + request = {} + client.set_labels(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_labels(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_set_labels_rest_required_fields(request_type=cluster_service.SetLabelsRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request_init["label_fingerprint"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_labels._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["labelFingerprint"] = 'label_fingerprint_value' + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_labels._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "labelFingerprint" in jsonified_request + assert jsonified_request["labelFingerprint"] == 'label_fingerprint_value' + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.set_labels(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_set_labels_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.set_labels._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("resourceLabels", "labelFingerprint", ))) + + +def test_set_legacy_abac_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_legacy_abac in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_legacy_abac] = mock_rpc + + request = {} + client.set_legacy_abac(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_legacy_abac(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_set_legacy_abac_rest_required_fields(request_type=cluster_service.SetLegacyAbacRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request_init["enabled"] = False + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_legacy_abac._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["enabled"] = True + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_legacy_abac._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "enabled" in jsonified_request + assert jsonified_request["enabled"] == True + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.set_legacy_abac(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_set_legacy_abac_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.set_legacy_abac._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("enabled", ))) + + +def test_set_legacy_abac_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + enabled=True, + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.set_legacy_abac(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setLegacyAbac" % client.transport._host, args[1]) + + +def test_set_legacy_abac_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.set_legacy_abac( + cluster_service.SetLegacyAbacRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + enabled=True, + name='name_value', + ) + + +def test_start_ip_rotation_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.start_ip_rotation in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.start_ip_rotation] = mock_rpc + + request = {} + client.start_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.start_ip_rotation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_start_ip_rotation_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.start_ip_rotation(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:startIpRotation" % client.transport._host, args[1]) + + +def test_start_ip_rotation_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.start_ip_rotation( + cluster_service.StartIPRotationRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + +def test_complete_ip_rotation_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.complete_ip_rotation in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.complete_ip_rotation] = mock_rpc + + request = {} + client.complete_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.complete_ip_rotation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_complete_ip_rotation_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.complete_ip_rotation(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:completeIpRotation" % client.transport._host, args[1]) + + +def test_complete_ip_rotation_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.complete_ip_rotation( + cluster_service.CompleteIPRotationRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + +def test_set_node_pool_size_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_node_pool_size in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_node_pool_size] = mock_rpc + + request = {} + client.set_node_pool_size(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_node_pool_size(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_set_node_pool_size_rest_required_fields(request_type=cluster_service.SetNodePoolSizeRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request_init["node_count"] = 0 + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_node_pool_size._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["nodeCount"] = 1070 + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_node_pool_size._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "nodeCount" in jsonified_request + assert jsonified_request["nodeCount"] == 1070 + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.set_node_pool_size(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_set_node_pool_size_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.set_node_pool_size._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("nodeCount", ))) + + +def test_set_network_policy_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_network_policy in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_network_policy] = mock_rpc + + request = {} + client.set_network_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_network_policy(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_set_network_policy_rest_required_fields(request_type=cluster_service.SetNetworkPolicyRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_network_policy._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_network_policy._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.set_network_policy(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_set_network_policy_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.set_network_policy._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("networkPolicy", ))) + + +def test_set_network_policy_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.set_network_policy(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setNetworkPolicy" % client.transport._host, args[1]) + + +def test_set_network_policy_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.set_network_policy( + cluster_service.SetNetworkPolicyRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), + name='name_value', + ) + + +def test_set_maintenance_policy_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_maintenance_policy in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_maintenance_policy] = mock_rpc + + request = {} + client.set_maintenance_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_maintenance_policy(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_set_maintenance_policy_rest_required_fields(request_type=cluster_service.SetMaintenancePolicyRequest): + transport_class = transports.ClusterManagerRestTransport + + request_init = {} + request_init["project_id"] = "" + request_init["zone"] = "" + request_init["cluster_id"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads(json_format.MessageToJson( + pb_request, + use_integers_for_enums=False + )) + + # verify fields with default values are dropped + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_maintenance_policy._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["projectId"] = 'project_id_value' + jsonified_request["zone"] = 'zone_value' + jsonified_request["clusterId"] = 'cluster_id_value' + + unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_maintenance_policy._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "projectId" in jsonified_request + assert jsonified_request["projectId"] == 'project_id_value' + assert "zone" in jsonified_request + assert jsonified_request["zone"] == 'zone_value' + assert "clusterId" in jsonified_request + assert jsonified_request["clusterId"] == 'cluster_id_value' + + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='rest', + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, 'transcode') as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + 'uri': 'v1/sample_method', + 'method': "post", + 'query_params': pb_request, + } + transcode_result['body'] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + response = client.set_maintenance_policy(request) + + expected_params = [ + ('$alt', 'json;enum-encoding=int') + ] + actual_params = req.call_args.kwargs['params'] + assert expected_params == actual_params + + +def test_set_maintenance_policy_rest_unset_required_fields(): + transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) + + unset_fields = transport.set_maintenance_policy._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("projectId", "zone", "clusterId", "maintenancePolicy", ))) + + +def test_set_maintenance_policy_rest_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation() + + # get arguments that satisfy an http rule for this method + sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + + # get truthy value for each flattened field + mock_args = dict( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), + name='name_value', + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + client.set_maintenance_policy(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setMaintenancePolicy" % client.transport._host, args[1]) + + +def test_set_maintenance_policy_rest_flattened_error(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.set_maintenance_policy( + cluster_service.SetMaintenancePolicyRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), + name='name_value', + ) + + +def test_list_usable_subnetworks_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.list_usable_subnetworks in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.list_usable_subnetworks] = mock_rpc + + request = {} + client.list_usable_subnetworks(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_usable_subnetworks(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_list_usable_subnetworks_rest_pager(transport: str = 'rest'): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, 'request') as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + #with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + next_page_token='abc', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[], + next_page_token='def', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + ], + next_page_token='ghi', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple(cluster_service.ListUsableSubnetworksResponse.to_json(x) for x in response) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode('UTF-8') + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {'parent': 'projects/sample1'} + + pager = client.list_usable_subnetworks(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, cluster_service.UsableSubnetwork) + for i in results) + + pages = list(client.list_usable_subnetworks(request=sample_request).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + + +def test_check_autopilot_compatibility_rest_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.check_autopilot_compatibility in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.check_autopilot_compatibility] = mock_rpc + + request = {} + client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.check_autopilot_compatibility(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.ClusterManagerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.ClusterManagerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ClusterManagerClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.ClusterManagerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = ClusterManagerClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = ClusterManagerClient( + client_options=options, + credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.ClusterManagerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ClusterManagerClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.ClusterManagerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = ClusterManagerClient(transport=transport) + assert client.transport is transport + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.ClusterManagerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.ClusterManagerGrpcAsyncIOTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + +@pytest.mark.parametrize("transport_class", [ + transports.ClusterManagerGrpcTransport, + transports.ClusterManagerGrpcAsyncIOTransport, + transports.ClusterManagerRestTransport, +]) +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() + +def test_transport_kind_grpc(): + transport = ClusterManagerClient.get_transport_class("grpc")( + credentials=ga_credentials.AnonymousCredentials() + ) + assert transport.kind == "grpc" + + +def test_initialize_client_w_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc" + ) + assert client is not None + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_clusters_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + call.return_value = cluster_service.ListClustersResponse() + client.list_clusters(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListClustersRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_cluster_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + call.return_value = cluster_service.Cluster() + client.get_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_create_cluster_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.create_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CreateClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_cluster_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.update_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_node_pool_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_node_pool), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.update_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_node_pool_autoscaling_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_autoscaling), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_node_pool_autoscaling(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolAutoscalingRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_logging_service_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_logging_service(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLoggingServiceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_monitoring_service_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_monitoring_service(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMonitoringServiceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_addons_config_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_addons_config(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetAddonsConfigRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_locations_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_locations(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLocationsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_master_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.update_master(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateMasterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_master_auth_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_master_auth), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_master_auth(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMasterAuthRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_cluster_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.delete_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.DeleteClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_operations_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + call.return_value = cluster_service.ListOperationsResponse() + client.list_operations(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListOperationsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_operation_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.get_operation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetOperationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_cancel_operation_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + call.return_value = None + client.cancel_operation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CancelOperationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_server_config_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + call.return_value = cluster_service.ServerConfig() + client.get_server_config(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetServerConfigRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_json_web_keys_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_json_web_keys), + '__call__') as call: + call.return_value = cluster_service.GetJSONWebKeysResponse() + client.get_json_web_keys(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetJSONWebKeysRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_node_pools_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + call.return_value = cluster_service.ListNodePoolsResponse() + client.list_node_pools(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListNodePoolsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_node_pool_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + call.return_value = cluster_service.NodePool() + client.get_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_create_node_pool_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.create_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CreateNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_node_pool_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.delete_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.DeleteNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_complete_node_pool_upgrade_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), + '__call__') as call: + call.return_value = None + client.complete_node_pool_upgrade(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CompleteNodePoolUpgradeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_rollback_node_pool_upgrade_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.rollback_node_pool_upgrade(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.RollbackNodePoolUpgradeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_node_pool_management_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_node_pool_management(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolManagementRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_labels_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_labels), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_labels(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLabelsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_legacy_abac_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_legacy_abac(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLegacyAbacRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_start_ip_rotation_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.start_ip_rotation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.StartIPRotationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_complete_ip_rotation_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.complete_ip_rotation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CompleteIPRotationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_node_pool_size_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_size), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_node_pool_size(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolSizeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_network_policy_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_network_policy(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNetworkPolicyRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_maintenance_policy_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_maintenance_policy(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMaintenancePolicyRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_usable_subnetworks_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__') as call: + call.return_value = cluster_service.ListUsableSubnetworksResponse() + client.list_usable_subnetworks(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListUsableSubnetworksRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_check_autopilot_compatibility_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), + '__call__') as call: + call.return_value = cluster_service.CheckAutopilotCompatibilityResponse() + client.check_autopilot_compatibility(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CheckAutopilotCompatibilityRequest() + + assert args[0] == request_msg + + +def test_transport_kind_grpc_asyncio(): + transport = ClusterManagerAsyncClient.get_transport_class("grpc_asyncio")( + credentials=async_anonymous_credentials() + ) + assert transport.kind == "grpc_asyncio" + + +def test_initialize_client_w_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio" + ) + assert client is not None + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_list_clusters_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse( + missing_zones=['missing_zones_value'], + )) + await client.list_clusters(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListClustersRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_cluster_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster( + name='name_value', + description='description_value', + initial_node_count=1911, + logging_service='logging_service_value', + monitoring_service='monitoring_service_value', + network='network_value', + cluster_ipv4_cidr='cluster_ipv4_cidr_value', + subnetwork='subnetwork_value', + locations=['locations_value'], + enable_kubernetes_alpha=True, + label_fingerprint='label_fingerprint_value', + self_link='self_link_value', + zone='zone_value', + endpoint='endpoint_value', + initial_cluster_version='initial_cluster_version_value', + current_master_version='current_master_version_value', + current_node_version='current_node_version_value', + create_time='create_time_value', + status=cluster_service.Cluster.Status.PROVISIONING, + status_message='status_message_value', + node_ipv4_cidr_size=1955, + services_ipv4_cidr='services_ipv4_cidr_value', + instance_group_urls=['instance_group_urls_value'], + current_node_count=1936, + expire_time='expire_time_value', + location='location_value', + enable_tpu=True, + tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', + id='id_value', + etag='etag_value', + satisfies_pzs=True, + satisfies_pzi=True, + )) + await client.get_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_create_cluster_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.create_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CreateClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_update_cluster_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.update_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_update_node_pool_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.update_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_node_pool_autoscaling_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_autoscaling), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_node_pool_autoscaling(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolAutoscalingRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_logging_service_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_logging_service(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLoggingServiceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_monitoring_service_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_monitoring_service(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMonitoringServiceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_addons_config_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_addons_config(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetAddonsConfigRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_locations_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_locations(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLocationsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_update_master_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.update_master(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateMasterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_master_auth_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_master_auth), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_master_auth(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMasterAuthRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_delete_cluster_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.delete_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.DeleteClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_list_operations_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse( + missing_zones=['missing_zones_value'], + )) + await client.list_operations(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListOperationsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_operation_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.get_operation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetOperationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_cancel_operation_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.cancel_operation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CancelOperationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_server_config_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig( + default_cluster_version='default_cluster_version_value', + valid_node_versions=['valid_node_versions_value'], + default_image_type='default_image_type_value', + valid_image_types=['valid_image_types_value'], + valid_master_versions=['valid_master_versions_value'], + )) + await client.get_server_config(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetServerConfigRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_json_web_keys_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_json_web_keys), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.GetJSONWebKeysResponse( + )) + await client.get_json_web_keys(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetJSONWebKeysRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_list_node_pools_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse( + )) + await client.list_node_pools(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListNodePoolsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_node_pool_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool( + name='name_value', + initial_node_count=1911, + locations=['locations_value'], + self_link='self_link_value', + version='version_value', + instance_group_urls=['instance_group_urls_value'], + status=cluster_service.NodePool.Status.PROVISIONING, + status_message='status_message_value', + pod_ipv4_cidr_size=1856, + etag='etag_value', + )) + await client.get_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_create_node_pool_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.create_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CreateNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_delete_node_pool_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.delete_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.DeleteNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.complete_node_pool_upgrade(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CompleteNodePoolUpgradeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_rollback_node_pool_upgrade_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.rollback_node_pool_upgrade(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.RollbackNodePoolUpgradeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_node_pool_management_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_node_pool_management(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolManagementRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_labels_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_labels), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_labels(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLabelsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_legacy_abac_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_legacy_abac(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLegacyAbacRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_start_ip_rotation_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.start_ip_rotation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.StartIPRotationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_complete_ip_rotation_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.complete_ip_rotation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CompleteIPRotationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_node_pool_size_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_size), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_node_pool_size(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolSizeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_network_policy_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_network_policy(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNetworkPolicyRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_maintenance_policy_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_maintenance_policy(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMaintenancePolicyRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_list_usable_subnetworks_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse( + next_page_token='next_page_token_value', + )) + await client.list_usable_subnetworks(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListUsableSubnetworksRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.CheckAutopilotCompatibilityResponse( + summary='summary_value', + )) + await client.check_autopilot_compatibility(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CheckAutopilotCompatibilityRequest() + + assert args[0] == request_msg + + +def test_transport_kind_rest(): + transport = ClusterManagerClient.get_transport_class("rest")( + credentials=ga_credentials.AnonymousCredentials() + ) + assert transport.kind == "rest" + + +def test_list_clusters_rest_bad_request(request_type=cluster_service.ListClustersRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1/locations/sample2'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.list_clusters(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.ListClustersRequest, + dict, +]) +def test_list_clusters_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1/locations/sample2'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.ListClustersResponse( + missing_zones=['missing_zones_value'], + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.ListClustersResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.list_clusters(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListClustersResponse) + assert response.missing_zones == ['missing_zones_value'] + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_clusters_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_list_clusters") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_list_clusters") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.ListClustersRequest.pb(cluster_service.ListClustersRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.ListClustersResponse.to_json(cluster_service.ListClustersResponse()) + req.return_value.content = return_value + + request = cluster_service.ListClustersRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.ListClustersResponse() + + client.list_clusters(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_cluster_rest_bad_request(request_type=cluster_service.GetClusterRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.get_cluster(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetClusterRequest, + dict, +]) +def test_get_cluster_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Cluster( + name='name_value', + description='description_value', + initial_node_count=1911, + logging_service='logging_service_value', + monitoring_service='monitoring_service_value', + network='network_value', + cluster_ipv4_cidr='cluster_ipv4_cidr_value', + subnetwork='subnetwork_value', + locations=['locations_value'], + enable_kubernetes_alpha=True, + label_fingerprint='label_fingerprint_value', + self_link='self_link_value', + zone='zone_value', + endpoint='endpoint_value', + initial_cluster_version='initial_cluster_version_value', + current_master_version='current_master_version_value', + current_node_version='current_node_version_value', + create_time='create_time_value', + status=cluster_service.Cluster.Status.PROVISIONING, + status_message='status_message_value', + node_ipv4_cidr_size=1955, + services_ipv4_cidr='services_ipv4_cidr_value', + instance_group_urls=['instance_group_urls_value'], + current_node_count=1936, + expire_time='expire_time_value', + location='location_value', + enable_tpu=True, + tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', + id='id_value', + etag='etag_value', + satisfies_pzs=True, + satisfies_pzi=True, + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Cluster.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.get_cluster(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Cluster) + assert response.name == 'name_value' + assert response.description == 'description_value' + assert response.initial_node_count == 1911 + assert response.logging_service == 'logging_service_value' + assert response.monitoring_service == 'monitoring_service_value' + assert response.network == 'network_value' + assert response.cluster_ipv4_cidr == 'cluster_ipv4_cidr_value' + assert response.subnetwork == 'subnetwork_value' + assert response.locations == ['locations_value'] + assert response.enable_kubernetes_alpha is True + assert response.label_fingerprint == 'label_fingerprint_value' + assert response.self_link == 'self_link_value' + assert response.zone == 'zone_value' + assert response.endpoint == 'endpoint_value' + assert response.initial_cluster_version == 'initial_cluster_version_value' + assert response.current_master_version == 'current_master_version_value' + assert response.current_node_version == 'current_node_version_value' + assert response.create_time == 'create_time_value' + assert response.status == cluster_service.Cluster.Status.PROVISIONING + assert response.status_message == 'status_message_value' + assert response.node_ipv4_cidr_size == 1955 + assert response.services_ipv4_cidr == 'services_ipv4_cidr_value' + assert response.instance_group_urls == ['instance_group_urls_value'] + assert response.current_node_count == 1936 + assert response.expire_time == 'expire_time_value' + assert response.location == 'location_value' + assert response.enable_tpu is True + assert response.tpu_ipv4_cidr_block == 'tpu_ipv4_cidr_block_value' + assert response.id == 'id_value' + assert response.etag == 'etag_value' + assert response.satisfies_pzs is True + assert response.satisfies_pzi is True + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_cluster_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_get_cluster") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_get_cluster") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.GetClusterRequest.pb(cluster_service.GetClusterRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Cluster.to_json(cluster_service.Cluster()) + req.return_value.content = return_value + + request = cluster_service.GetClusterRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Cluster() + + client.get_cluster(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_create_cluster_rest_bad_request(request_type=cluster_service.CreateClusterRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1/locations/sample2'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.create_cluster(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CreateClusterRequest, + dict, +]) +def test_create_cluster_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1/locations/sample2'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.create_cluster(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_create_cluster_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_create_cluster") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_create_cluster") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.CreateClusterRequest.pb(cluster_service.CreateClusterRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.CreateClusterRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.create_cluster(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_update_cluster_rest_bad_request(request_type=cluster_service.UpdateClusterRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.update_cluster(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.UpdateClusterRequest, + dict, +]) +def test_update_cluster_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.update_cluster(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_update_cluster_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_update_cluster") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_update_cluster") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.UpdateClusterRequest.pb(cluster_service.UpdateClusterRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.UpdateClusterRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.update_cluster(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_update_node_pool_rest_bad_request(request_type=cluster_service.UpdateNodePoolRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.update_node_pool(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.UpdateNodePoolRequest, + dict, +]) +def test_update_node_pool_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.update_node_pool(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_update_node_pool_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_update_node_pool") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_update_node_pool") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.UpdateNodePoolRequest.pb(cluster_service.UpdateNodePoolRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.UpdateNodePoolRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.update_node_pool(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_node_pool_autoscaling_rest_bad_request(request_type=cluster_service.SetNodePoolAutoscalingRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.set_node_pool_autoscaling(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetNodePoolAutoscalingRequest, + dict, +]) +def test_set_node_pool_autoscaling_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.set_node_pool_autoscaling(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_node_pool_autoscaling_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_node_pool_autoscaling") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_node_pool_autoscaling") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.SetNodePoolAutoscalingRequest.pb(cluster_service.SetNodePoolAutoscalingRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.SetNodePoolAutoscalingRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.set_node_pool_autoscaling(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_logging_service_rest_bad_request(request_type=cluster_service.SetLoggingServiceRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.set_logging_service(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetLoggingServiceRequest, + dict, +]) +def test_set_logging_service_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.set_logging_service(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_logging_service_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_logging_service") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_logging_service") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.SetLoggingServiceRequest.pb(cluster_service.SetLoggingServiceRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.SetLoggingServiceRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.set_logging_service(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_monitoring_service_rest_bad_request(request_type=cluster_service.SetMonitoringServiceRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.set_monitoring_service(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetMonitoringServiceRequest, + dict, +]) +def test_set_monitoring_service_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.set_monitoring_service(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_monitoring_service_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_monitoring_service") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_monitoring_service") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.SetMonitoringServiceRequest.pb(cluster_service.SetMonitoringServiceRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.SetMonitoringServiceRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.set_monitoring_service(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_addons_config_rest_bad_request(request_type=cluster_service.SetAddonsConfigRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.set_addons_config(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetAddonsConfigRequest, + dict, +]) +def test_set_addons_config_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.set_addons_config(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_addons_config_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_addons_config") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_addons_config") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.SetAddonsConfigRequest.pb(cluster_service.SetAddonsConfigRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.SetAddonsConfigRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.set_addons_config(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_locations_rest_bad_request(request_type=cluster_service.SetLocationsRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.set_locations(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetLocationsRequest, + dict, +]) +def test_set_locations_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.set_locations(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_locations_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_locations") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_locations") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.SetLocationsRequest.pb(cluster_service.SetLocationsRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.SetLocationsRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.set_locations(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_update_master_rest_bad_request(request_type=cluster_service.UpdateMasterRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.update_master(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.UpdateMasterRequest, + dict, +]) +def test_update_master_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.update_master(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_update_master_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_update_master") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_update_master") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.UpdateMasterRequest.pb(cluster_service.UpdateMasterRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.UpdateMasterRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.update_master(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_master_auth_rest_bad_request(request_type=cluster_service.SetMasterAuthRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.set_master_auth(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetMasterAuthRequest, + dict, +]) +def test_set_master_auth_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.set_master_auth(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_master_auth_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_master_auth") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_master_auth") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.SetMasterAuthRequest.pb(cluster_service.SetMasterAuthRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.SetMasterAuthRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.set_master_auth(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_delete_cluster_rest_bad_request(request_type=cluster_service.DeleteClusterRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.delete_cluster(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.DeleteClusterRequest, + dict, +]) +def test_delete_cluster_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.delete_cluster(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_cluster_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_delete_cluster") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_delete_cluster") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.DeleteClusterRequest.pb(cluster_service.DeleteClusterRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.DeleteClusterRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.delete_cluster(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_operations_rest_bad_request(request_type=cluster_service.ListOperationsRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1/locations/sample2'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.list_operations(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.ListOperationsRequest, + dict, +]) +def test_list_operations_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1/locations/sample2'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.ListOperationsResponse( + missing_zones=['missing_zones_value'], + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.ListOperationsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.list_operations(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListOperationsResponse) + assert response.missing_zones == ['missing_zones_value'] + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_operations_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_list_operations") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_list_operations") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.ListOperationsRequest.pb(cluster_service.ListOperationsRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.ListOperationsResponse.to_json(cluster_service.ListOperationsResponse()) + req.return_value.content = return_value + + request = cluster_service.ListOperationsRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.ListOperationsResponse() + + client.list_operations(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_operation_rest_bad_request(request_type=cluster_service.GetOperationRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/operations/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.get_operation(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetOperationRequest, + dict, +]) +def test_get_operation_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/operations/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.get_operation(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_operation_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_get_operation") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_get_operation") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.GetOperationRequest.pb(cluster_service.GetOperationRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.GetOperationRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.get_operation(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_cancel_operation_rest_bad_request(request_type=cluster_service.CancelOperationRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/operations/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.cancel_operation(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CancelOperationRequest, + dict, +]) +def test_cancel_operation_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/operations/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = None + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = '' + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.cancel_operation(request) + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_cancel_operation_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_cancel_operation") as pre: + pre.assert_not_called() + pb_message = cluster_service.CancelOperationRequest.pb(cluster_service.CancelOperationRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + request = cluster_service.CancelOperationRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + + client.cancel_operation(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + + +def test_get_server_config_rest_bad_request(request_type=cluster_service.GetServerConfigRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.get_server_config(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetServerConfigRequest, + dict, +]) +def test_get_server_config_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.ServerConfig( + default_cluster_version='default_cluster_version_value', + valid_node_versions=['valid_node_versions_value'], + default_image_type='default_image_type_value', + valid_image_types=['valid_image_types_value'], + valid_master_versions=['valid_master_versions_value'], + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.ServerConfig.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.get_server_config(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ServerConfig) + assert response.default_cluster_version == 'default_cluster_version_value' + assert response.valid_node_versions == ['valid_node_versions_value'] + assert response.default_image_type == 'default_image_type_value' + assert response.valid_image_types == ['valid_image_types_value'] + assert response.valid_master_versions == ['valid_master_versions_value'] + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_server_config_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_get_server_config") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_get_server_config") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.GetServerConfigRequest.pb(cluster_service.GetServerConfigRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.ServerConfig.to_json(cluster_service.ServerConfig()) + req.return_value.content = return_value + + request = cluster_service.GetServerConfigRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.ServerConfig() + + client.get_server_config(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_json_web_keys_rest_bad_request(request_type=cluster_service.GetJSONWebKeysRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.get_json_web_keys(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetJSONWebKeysRequest, + dict, +]) +def test_get_json_web_keys_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.GetJSONWebKeysResponse( + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.GetJSONWebKeysResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.get_json_web_keys(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.GetJSONWebKeysResponse) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_json_web_keys_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_get_json_web_keys") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_get_json_web_keys") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.GetJSONWebKeysRequest.pb(cluster_service.GetJSONWebKeysRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.GetJSONWebKeysResponse.to_json(cluster_service.GetJSONWebKeysResponse()) + req.return_value.content = return_value + + request = cluster_service.GetJSONWebKeysRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.GetJSONWebKeysResponse() + + client.get_json_web_keys(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_node_pools_rest_bad_request(request_type=cluster_service.ListNodePoolsRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.list_node_pools(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.ListNodePoolsRequest, + dict, +]) +def test_list_node_pools_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.ListNodePoolsResponse( + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.ListNodePoolsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.list_node_pools(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListNodePoolsResponse) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_node_pools_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_list_node_pools") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_list_node_pools") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.ListNodePoolsRequest.pb(cluster_service.ListNodePoolsRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.ListNodePoolsResponse.to_json(cluster_service.ListNodePoolsResponse()) + req.return_value.content = return_value + + request = cluster_service.ListNodePoolsRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.ListNodePoolsResponse() + + client.list_node_pools(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_node_pool_rest_bad_request(request_type=cluster_service.GetNodePoolRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.get_node_pool(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetNodePoolRequest, + dict, +]) +def test_get_node_pool_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.NodePool( + name='name_value', + initial_node_count=1911, + locations=['locations_value'], + self_link='self_link_value', + version='version_value', + instance_group_urls=['instance_group_urls_value'], + status=cluster_service.NodePool.Status.PROVISIONING, + status_message='status_message_value', + pod_ipv4_cidr_size=1856, + etag='etag_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.NodePool.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.get_node_pool(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.NodePool) + assert response.name == 'name_value' + assert response.initial_node_count == 1911 + assert response.locations == ['locations_value'] + assert response.self_link == 'self_link_value' + assert response.version == 'version_value' + assert response.instance_group_urls == ['instance_group_urls_value'] + assert response.status == cluster_service.NodePool.Status.PROVISIONING + assert response.status_message == 'status_message_value' + assert response.pod_ipv4_cidr_size == 1856 + assert response.etag == 'etag_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_node_pool_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_get_node_pool") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_get_node_pool") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.GetNodePoolRequest.pb(cluster_service.GetNodePoolRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.NodePool.to_json(cluster_service.NodePool()) + req.return_value.content = return_value + + request = cluster_service.GetNodePoolRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.NodePool() + + client.get_node_pool(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_create_node_pool_rest_bad_request(request_type=cluster_service.CreateNodePoolRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.create_node_pool(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CreateNodePoolRequest, + dict, +]) +def test_create_node_pool_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.create_node_pool(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_create_node_pool_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_create_node_pool") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_create_node_pool") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.CreateNodePoolRequest.pb(cluster_service.CreateNodePoolRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.CreateNodePoolRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.create_node_pool(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_delete_node_pool_rest_bad_request(request_type=cluster_service.DeleteNodePoolRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.delete_node_pool(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.DeleteNodePoolRequest, + dict, +]) +def test_delete_node_pool_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.delete_node_pool(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_node_pool_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_delete_node_pool") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_delete_node_pool") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.DeleteNodePoolRequest.pb(cluster_service.DeleteNodePoolRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.DeleteNodePoolRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.delete_node_pool(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_complete_node_pool_upgrade_rest_bad_request(request_type=cluster_service.CompleteNodePoolUpgradeRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.complete_node_pool_upgrade(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CompleteNodePoolUpgradeRequest, + dict, +]) +def test_complete_node_pool_upgrade_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = None + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + json_return_value = '' + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.complete_node_pool_upgrade(request) + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_complete_node_pool_upgrade_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_complete_node_pool_upgrade") as pre: + pre.assert_not_called() + pb_message = cluster_service.CompleteNodePoolUpgradeRequest.pb(cluster_service.CompleteNodePoolUpgradeRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + + request = cluster_service.CompleteNodePoolUpgradeRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + + client.complete_node_pool_upgrade(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + + +def test_rollback_node_pool_upgrade_rest_bad_request(request_type=cluster_service.RollbackNodePoolUpgradeRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.rollback_node_pool_upgrade(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.RollbackNodePoolUpgradeRequest, + dict, +]) +def test_rollback_node_pool_upgrade_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.rollback_node_pool_upgrade(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_rollback_node_pool_upgrade_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_rollback_node_pool_upgrade") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_rollback_node_pool_upgrade") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.RollbackNodePoolUpgradeRequest.pb(cluster_service.RollbackNodePoolUpgradeRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.RollbackNodePoolUpgradeRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.rollback_node_pool_upgrade(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_node_pool_management_rest_bad_request(request_type=cluster_service.SetNodePoolManagementRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.set_node_pool_management(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetNodePoolManagementRequest, + dict, +]) +def test_set_node_pool_management_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.set_node_pool_management(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_node_pool_management_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_node_pool_management") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_node_pool_management") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.SetNodePoolManagementRequest.pb(cluster_service.SetNodePoolManagementRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.SetNodePoolManagementRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.set_node_pool_management(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_labels_rest_bad_request(request_type=cluster_service.SetLabelsRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.set_labels(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetLabelsRequest, + dict, +]) +def test_set_labels_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.set_labels(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_labels_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_labels") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_labels") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.SetLabelsRequest.pb(cluster_service.SetLabelsRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.SetLabelsRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.set_labels(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_legacy_abac_rest_bad_request(request_type=cluster_service.SetLegacyAbacRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.set_legacy_abac(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetLegacyAbacRequest, + dict, +]) +def test_set_legacy_abac_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.set_legacy_abac(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_legacy_abac_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_legacy_abac") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_legacy_abac") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.SetLegacyAbacRequest.pb(cluster_service.SetLegacyAbacRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.SetLegacyAbacRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.set_legacy_abac(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_start_ip_rotation_rest_bad_request(request_type=cluster_service.StartIPRotationRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.start_ip_rotation(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.StartIPRotationRequest, + dict, +]) +def test_start_ip_rotation_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.start_ip_rotation(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_start_ip_rotation_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_start_ip_rotation") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_start_ip_rotation") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.StartIPRotationRequest.pb(cluster_service.StartIPRotationRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.StartIPRotationRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.start_ip_rotation(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_complete_ip_rotation_rest_bad_request(request_type=cluster_service.CompleteIPRotationRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.complete_ip_rotation(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CompleteIPRotationRequest, + dict, +]) +def test_complete_ip_rotation_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.complete_ip_rotation(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_complete_ip_rotation_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_complete_ip_rotation") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_complete_ip_rotation") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.CompleteIPRotationRequest.pb(cluster_service.CompleteIPRotationRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.CompleteIPRotationRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.complete_ip_rotation(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_node_pool_size_rest_bad_request(request_type=cluster_service.SetNodePoolSizeRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.set_node_pool_size(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetNodePoolSizeRequest, + dict, +]) +def test_set_node_pool_size_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.set_node_pool_size(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_node_pool_size_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_node_pool_size") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_node_pool_size") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.SetNodePoolSizeRequest.pb(cluster_service.SetNodePoolSizeRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.SetNodePoolSizeRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.set_node_pool_size(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_network_policy_rest_bad_request(request_type=cluster_service.SetNetworkPolicyRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.set_network_policy(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetNetworkPolicyRequest, + dict, +]) +def test_set_network_policy_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.set_network_policy(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_network_policy_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_network_policy") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_network_policy") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.SetNetworkPolicyRequest.pb(cluster_service.SetNetworkPolicyRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.SetNetworkPolicyRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.set_network_policy(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_set_maintenance_policy_rest_bad_request(request_type=cluster_service.SetMaintenancePolicyRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.set_maintenance_policy(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetMaintenancePolicyRequest, + dict, +]) +def test_set_maintenance_policy_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.Operation.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.set_maintenance_policy(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_set_maintenance_policy_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_maintenance_policy") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_maintenance_policy") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.SetMaintenancePolicyRequest.pb(cluster_service.SetMaintenancePolicyRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.Operation.to_json(cluster_service.Operation()) + req.return_value.content = return_value + + request = cluster_service.SetMaintenancePolicyRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.Operation() + + client.set_maintenance_policy(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_usable_subnetworks_rest_bad_request(request_type=cluster_service.ListUsableSubnetworksRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.list_usable_subnetworks(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.ListUsableSubnetworksRequest, + dict, +]) +def test_list_usable_subnetworks_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'parent': 'projects/sample1'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.ListUsableSubnetworksResponse( + next_page_token='next_page_token_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.ListUsableSubnetworksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.list_usable_subnetworks(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListUsableSubnetworksPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_usable_subnetworks_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_list_usable_subnetworks") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_list_usable_subnetworks") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.ListUsableSubnetworksRequest.pb(cluster_service.ListUsableSubnetworksRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.ListUsableSubnetworksResponse.to_json(cluster_service.ListUsableSubnetworksResponse()) + req.return_value.content = return_value + + request = cluster_service.ListUsableSubnetworksRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.ListUsableSubnetworksResponse() + + client.list_usable_subnetworks(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + + +def test_check_autopilot_compatibility_rest_bad_request(request_type=cluster_service.CheckAutopilotCompatibilityRequest): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): + # Wrap the value into a proper Response obj + response_value = mock.Mock() + json_return_value = '' + response_value.json = mock.Mock(return_value={}) + response_value.status_code = 400 + response_value.request = mock.Mock() + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + client.check_autopilot_compatibility(request) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CheckAutopilotCompatibilityRequest, + dict, +]) +def test_check_autopilot_compatibility_rest_call_success(request_type): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + + # send a request that will satisfy transcoding + request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), 'request') as req: + # Designate an appropriate value for the returned response. + return_value = cluster_service.CheckAutopilotCompatibilityResponse( + summary='summary_value', + ) + + # Wrap the value into a proper Response obj + response_value = mock.Mock() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = cluster_service.CheckAutopilotCompatibilityResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value.content = json_return_value.encode('UTF-8') + req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + response = client.check_autopilot_compatibility(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) + assert response.summary == 'summary_value' + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_check_autopilot_compatibility_rest_interceptors(null_interceptor): + transport = transports.ClusterManagerRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), + ) + client = ClusterManagerClient(transport=transport) + + with mock.patch.object(type(client.transport._session), "request") as req, \ + mock.patch.object(path_template, "transcode") as transcode, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "post_check_autopilot_compatibility") as post, \ + mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_check_autopilot_compatibility") as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = cluster_service.CheckAutopilotCompatibilityRequest.pb(cluster_service.CheckAutopilotCompatibilityRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = mock.Mock() + req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} + return_value = cluster_service.CheckAutopilotCompatibilityResponse.to_json(cluster_service.CheckAutopilotCompatibilityResponse()) + req.return_value.content = return_value + + request = cluster_service.CheckAutopilotCompatibilityRequest() + metadata =[ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = cluster_service.CheckAutopilotCompatibilityResponse() + + client.check_autopilot_compatibility(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) + + pre.assert_called_once() + post.assert_called_once() + +def test_initialize_client_w_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + assert client is not None + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_clusters_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + client.list_clusters(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListClustersRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_cluster_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + client.get_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_create_cluster_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + client.create_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CreateClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_cluster_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + client.update_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_node_pool_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_node_pool), + '__call__') as call: + client.update_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_node_pool_autoscaling_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_autoscaling), + '__call__') as call: + client.set_node_pool_autoscaling(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolAutoscalingRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_logging_service_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + client.set_logging_service(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLoggingServiceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_monitoring_service_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + client.set_monitoring_service(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMonitoringServiceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_addons_config_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + client.set_addons_config(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetAddonsConfigRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_locations_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + client.set_locations(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLocationsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_master_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + client.update_master(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateMasterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_master_auth_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_master_auth), + '__call__') as call: + client.set_master_auth(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMasterAuthRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_cluster_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + client.delete_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.DeleteClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_operations_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + client.list_operations(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListOperationsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_operation_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + client.get_operation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetOperationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_cancel_operation_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + client.cancel_operation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CancelOperationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_server_config_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + client.get_server_config(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetServerConfigRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_json_web_keys_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_json_web_keys), + '__call__') as call: + client.get_json_web_keys(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetJSONWebKeysRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_node_pools_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + client.list_node_pools(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListNodePoolsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_node_pool_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + client.get_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_create_node_pool_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + client.create_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CreateNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_node_pool_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + client.delete_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.DeleteNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_complete_node_pool_upgrade_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), + '__call__') as call: + client.complete_node_pool_upgrade(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CompleteNodePoolUpgradeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_rollback_node_pool_upgrade_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + client.rollback_node_pool_upgrade(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.RollbackNodePoolUpgradeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_node_pool_management_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), + '__call__') as call: + client.set_node_pool_management(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolManagementRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_labels_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_labels), + '__call__') as call: + client.set_labels(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLabelsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_legacy_abac_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + client.set_legacy_abac(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLegacyAbacRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_start_ip_rotation_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + client.start_ip_rotation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.StartIPRotationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_complete_ip_rotation_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + client.complete_ip_rotation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CompleteIPRotationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_node_pool_size_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_size), + '__call__') as call: + client.set_node_pool_size(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolSizeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_network_policy_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + client.set_network_policy(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNetworkPolicyRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_maintenance_policy_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + client.set_maintenance_policy(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMaintenancePolicyRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_usable_subnetworks_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__') as call: + client.list_usable_subnetworks(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListUsableSubnetworksRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_check_autopilot_compatibility_empty_call_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), + '__call__') as call: + client.check_autopilot_compatibility(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CheckAutopilotCompatibilityRequest() + + assert args[0] == request_msg + + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ClusterManagerGrpcTransport, + ) + +def test_cluster_manager_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.ClusterManagerTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json" + ) + + +def test_cluster_manager_base_transport(): + # Instantiate the base transport. + with mock.patch('google.cloud.container_v1.services.cluster_manager.transports.ClusterManagerTransport.__init__') as Transport: + Transport.return_value = None + transport = transports.ClusterManagerTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + 'list_clusters', + 'get_cluster', + 'create_cluster', + 'update_cluster', + 'update_node_pool', + 'set_node_pool_autoscaling', + 'set_logging_service', + 'set_monitoring_service', + 'set_addons_config', + 'set_locations', + 'update_master', + 'set_master_auth', + 'delete_cluster', + 'list_operations', + 'get_operation', + 'cancel_operation', + 'get_server_config', + 'get_json_web_keys', + 'list_node_pools', + 'get_node_pool', + 'create_node_pool', + 'delete_node_pool', + 'complete_node_pool_upgrade', + 'rollback_node_pool_upgrade', + 'set_node_pool_management', + 'set_labels', + 'set_legacy_abac', + 'start_ip_rotation', + 'complete_ip_rotation', + 'set_node_pool_size', + 'set_network_policy', + 'set_maintenance_policy', + 'list_usable_subnetworks', + 'check_autopilot_compatibility', + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + with pytest.raises(NotImplementedError): + transport.close() + + # Catch all for all remaining methods and properties + remainder = [ + 'kind', + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + + +def test_cluster_manager_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.container_v1.services.cluster_manager.transports.ClusterManagerTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.ClusterManagerTransport( + 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_cluster_manager_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.container_v1.services.cluster_manager.transports.ClusterManagerTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.ClusterManagerTransport() + adc.assert_called_once() + + +def test_cluster_manager_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) + ClusterManagerClient() + 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.ClusterManagerGrpcTransport, + transports.ClusterManagerGrpcAsyncIOTransport, + ], +) +def test_cluster_manager_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.ClusterManagerGrpcTransport, + transports.ClusterManagerGrpcAsyncIOTransport, + transports.ClusterManagerRestTransport, + ], +) +def test_cluster_manager_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.ClusterManagerGrpcTransport, grpc_helpers), + (transports.ClusterManagerGrpcAsyncIOTransport, grpc_helpers_async) + ], +) +def test_cluster_manager_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( + "container.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="container.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("transport_class", [transports.ClusterManagerGrpcTransport, transports.ClusterManagerGrpcAsyncIOTransport]) +def test_cluster_manager_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 + ) + +def test_cluster_manager_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch("google.auth.transport.requests.AuthorizedSession.configure_mtls_channel") as mock_configure_mtls_channel: + transports.ClusterManagerRestTransport ( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + +@pytest.mark.parametrize("transport_name", [ + "grpc", + "grpc_asyncio", + "rest", +]) +def test_cluster_manager_host_no_port(transport_name): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='container.googleapis.com'), + transport=transport_name, + ) + assert client.transport._host == ( + 'container.googleapis.com:443' + if transport_name in ['grpc', 'grpc_asyncio'] + else 'https://container.googleapis.com' + ) + +@pytest.mark.parametrize("transport_name", [ + "grpc", + "grpc_asyncio", + "rest", +]) +def test_cluster_manager_host_with_port(transport_name): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='container.googleapis.com:8000'), + transport=transport_name, + ) + assert client.transport._host == ( + 'container.googleapis.com:8000' + if transport_name in ['grpc', 'grpc_asyncio'] + else 'https://container.googleapis.com:8000' + ) + +@pytest.mark.parametrize("transport_name", [ + "rest", +]) +def test_cluster_manager_client_transport_session_collision(transport_name): + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() + client1 = ClusterManagerClient( + credentials=creds1, + transport=transport_name, + ) + client2 = ClusterManagerClient( + credentials=creds2, + transport=transport_name, + ) + session1 = client1.transport.list_clusters._session + session2 = client2.transport.list_clusters._session + assert session1 != session2 + session1 = client1.transport.get_cluster._session + session2 = client2.transport.get_cluster._session + assert session1 != session2 + session1 = client1.transport.create_cluster._session + session2 = client2.transport.create_cluster._session + assert session1 != session2 + session1 = client1.transport.update_cluster._session + session2 = client2.transport.update_cluster._session + assert session1 != session2 + session1 = client1.transport.update_node_pool._session + session2 = client2.transport.update_node_pool._session + assert session1 != session2 + session1 = client1.transport.set_node_pool_autoscaling._session + session2 = client2.transport.set_node_pool_autoscaling._session + assert session1 != session2 + session1 = client1.transport.set_logging_service._session + session2 = client2.transport.set_logging_service._session + assert session1 != session2 + session1 = client1.transport.set_monitoring_service._session + session2 = client2.transport.set_monitoring_service._session + assert session1 != session2 + session1 = client1.transport.set_addons_config._session + session2 = client2.transport.set_addons_config._session + assert session1 != session2 + session1 = client1.transport.set_locations._session + session2 = client2.transport.set_locations._session + assert session1 != session2 + session1 = client1.transport.update_master._session + session2 = client2.transport.update_master._session + assert session1 != session2 + session1 = client1.transport.set_master_auth._session + session2 = client2.transport.set_master_auth._session + assert session1 != session2 + session1 = client1.transport.delete_cluster._session + session2 = client2.transport.delete_cluster._session + assert session1 != session2 + session1 = client1.transport.list_operations._session + session2 = client2.transport.list_operations._session + assert session1 != session2 + session1 = client1.transport.get_operation._session + session2 = client2.transport.get_operation._session + assert session1 != session2 + session1 = client1.transport.cancel_operation._session + session2 = client2.transport.cancel_operation._session + assert session1 != session2 + session1 = client1.transport.get_server_config._session + session2 = client2.transport.get_server_config._session + assert session1 != session2 + session1 = client1.transport.get_json_web_keys._session + session2 = client2.transport.get_json_web_keys._session + assert session1 != session2 + session1 = client1.transport.list_node_pools._session + session2 = client2.transport.list_node_pools._session + assert session1 != session2 + session1 = client1.transport.get_node_pool._session + session2 = client2.transport.get_node_pool._session + assert session1 != session2 + session1 = client1.transport.create_node_pool._session + session2 = client2.transport.create_node_pool._session + assert session1 != session2 + session1 = client1.transport.delete_node_pool._session + session2 = client2.transport.delete_node_pool._session + assert session1 != session2 + session1 = client1.transport.complete_node_pool_upgrade._session + session2 = client2.transport.complete_node_pool_upgrade._session + assert session1 != session2 + session1 = client1.transport.rollback_node_pool_upgrade._session + session2 = client2.transport.rollback_node_pool_upgrade._session + assert session1 != session2 + session1 = client1.transport.set_node_pool_management._session + session2 = client2.transport.set_node_pool_management._session + assert session1 != session2 + session1 = client1.transport.set_labels._session + session2 = client2.transport.set_labels._session + assert session1 != session2 + session1 = client1.transport.set_legacy_abac._session + session2 = client2.transport.set_legacy_abac._session + assert session1 != session2 + session1 = client1.transport.start_ip_rotation._session + session2 = client2.transport.start_ip_rotation._session + assert session1 != session2 + session1 = client1.transport.complete_ip_rotation._session + session2 = client2.transport.complete_ip_rotation._session + assert session1 != session2 + session1 = client1.transport.set_node_pool_size._session + session2 = client2.transport.set_node_pool_size._session + assert session1 != session2 + session1 = client1.transport.set_network_policy._session + session2 = client2.transport.set_network_policy._session + assert session1 != session2 + session1 = client1.transport.set_maintenance_policy._session + session2 = client2.transport.set_maintenance_policy._session + assert session1 != session2 + session1 = client1.transport.list_usable_subnetworks._session + session2 = client2.transport.list_usable_subnetworks._session + assert session1 != session2 + session1 = client1.transport.check_autopilot_compatibility._session + session2 = client2.transport.check_autopilot_compatibility._session + assert session1 != session2 +def test_cluster_manager_grpc_transport_channel(): + channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.ClusterManagerGrpcTransport( + 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_cluster_manager_grpc_asyncio_transport_channel(): + channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.ClusterManagerGrpcAsyncIOTransport( + 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.ClusterManagerGrpcTransport, transports.ClusterManagerGrpcAsyncIOTransport]) +def test_cluster_manager_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.ClusterManagerGrpcTransport, transports.ClusterManagerGrpcAsyncIOTransport]) +def test_cluster_manager_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_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 = ClusterManagerClient.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 = ClusterManagerClient.ca_pool_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.parse_ca_pool_path(path) + assert expected == actual + +def test_crypto_key_version_path(): + project = "cuttlefish" + location = "mussel" + key_ring = "winkle" + crypto_key = "nautilus" + crypto_key_version = "scallop" + expected = "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}".format(project=project, location=location, key_ring=key_ring, crypto_key=crypto_key, crypto_key_version=crypto_key_version, ) + actual = ClusterManagerClient.crypto_key_version_path(project, location, key_ring, crypto_key, crypto_key_version) + assert expected == actual + + +def test_parse_crypto_key_version_path(): + expected = { + "project": "abalone", + "location": "squid", + "key_ring": "clam", + "crypto_key": "whelk", + "crypto_key_version": "octopus", + } + path = ClusterManagerClient.crypto_key_version_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.parse_crypto_key_version_path(path) + assert expected == actual + +def test_topic_path(): + project = "oyster" + topic = "nudibranch" + expected = "projects/{project}/topics/{topic}".format(project=project, topic=topic, ) + actual = ClusterManagerClient.topic_path(project, topic) + assert expected == actual + + +def test_parse_topic_path(): + expected = { + "project": "cuttlefish", + "topic": "mussel", + } + path = ClusterManagerClient.topic_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.parse_topic_path(path) + assert expected == actual + +def test_common_billing_account_path(): + billing_account = "winkle" + expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + actual = ClusterManagerClient.common_billing_account_path(billing_account) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "nautilus", + } + path = ClusterManagerClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.parse_common_billing_account_path(path) + assert expected == actual + +def test_common_folder_path(): + folder = "scallop" + expected = "folders/{folder}".format(folder=folder, ) + actual = ClusterManagerClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "abalone", + } + path = ClusterManagerClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.parse_common_folder_path(path) + assert expected == actual + +def test_common_organization_path(): + organization = "squid" + expected = "organizations/{organization}".format(organization=organization, ) + actual = ClusterManagerClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "clam", + } + path = ClusterManagerClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.parse_common_organization_path(path) + assert expected == actual + +def test_common_project_path(): + project = "whelk" + expected = "projects/{project}".format(project=project, ) + actual = ClusterManagerClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "octopus", + } + path = ClusterManagerClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.parse_common_project_path(path) + assert expected == actual + +def test_common_location_path(): + project = "oyster" + location = "nudibranch" + expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) + actual = ClusterManagerClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "cuttlefish", + "location": "mussel", + } + path = ClusterManagerClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.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.ClusterManagerTransport, '_prep_wrapped_messages') as prep: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object(transports.ClusterManagerTransport, '_prep_wrapped_messages') as prep: + transport_class = ClusterManagerClient.get_transport_class() + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + +def test_transport_close_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc" + ) + with mock.patch.object(type(getattr(client.transport, "_grpc_channel")), "close") as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +@pytest.mark.asyncio +async def test_transport_close_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_rest(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest" + ) + with mock.patch.object(type(getattr(client.transport, "_session")), "close") as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +def test_client_ctx(): + transports = [ + 'rest', + 'grpc', + ] + for transport in transports: + client = ClusterManagerClient( + 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", [ + (ClusterManagerClient, transports.ClusterManagerGrpcTransport), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport), +]) +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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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/google-cloud-container/v1beta1/.coveragerc b/owl-bot-staging/google-cloud-container/v1beta1/.coveragerc new file mode 100644 index 000000000000..113f6dbccc9f --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/.coveragerc @@ -0,0 +1,13 @@ +[run] +branch = True + +[report] +show_missing = True +omit = + google/cloud/container/__init__.py + google/cloud/container/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/google-cloud-container/v1beta1/.flake8 b/owl-bot-staging/google-cloud-container/v1beta1/.flake8 new file mode 100644 index 000000000000..29227d4cf419 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1beta1/MANIFEST.in b/owl-bot-staging/google-cloud-container/v1beta1/MANIFEST.in new file mode 100644 index 000000000000..d046233379ae --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/MANIFEST.in @@ -0,0 +1,2 @@ +recursive-include google/cloud/container *.py +recursive-include google/cloud/container_v1beta1 *.py diff --git a/owl-bot-staging/google-cloud-container/v1beta1/README.rst b/owl-bot-staging/google-cloud-container/v1beta1/README.rst new file mode 100644 index 000000000000..4f18726b102d --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/README.rst @@ -0,0 +1,49 @@ +Python Client for Google Cloud Container 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 Container 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/google-cloud-container/v1beta1/docs/_static/custom.css b/owl-bot-staging/google-cloud-container/v1beta1/docs/_static/custom.css new file mode 100644 index 000000000000..06423be0b592 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/docs/_static/custom.css @@ -0,0 +1,3 @@ +dl.field-list > dt { + min-width: 100px +} diff --git a/owl-bot-staging/google-cloud-container/v1beta1/docs/conf.py b/owl-bot-staging/google-cloud-container/v1beta1/docs/conf.py new file mode 100644 index 000000000000..5a9f847ff28e --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/docs/conf.py @@ -0,0 +1,376 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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-container 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-container" +copyright = u"2023, 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 = 'en' + +# 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 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-container-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-container.tex", + u"google-cloud-container 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-container", + u"Google Cloud Container 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-container", + u"google-cloud-container Documentation", + author, + "google-cloud-container", + "GAPIC library for Google Cloud Container 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/google-cloud-container/v1beta1/docs/container_v1beta1/cluster_manager.rst b/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/cluster_manager.rst new file mode 100644 index 000000000000..3a3a443d5810 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/cluster_manager.rst @@ -0,0 +1,10 @@ +ClusterManager +-------------------------------- + +.. automodule:: google.cloud.container_v1beta1.services.cluster_manager + :members: + :inherited-members: + +.. automodule:: google.cloud.container_v1beta1.services.cluster_manager.pagers + :members: + :inherited-members: diff --git a/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/services_.rst b/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/services_.rst new file mode 100644 index 000000000000..8b6dae4d5e90 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/services_.rst @@ -0,0 +1,6 @@ +Services for Google Cloud Container v1beta1 API +=============================================== +.. toctree:: + :maxdepth: 2 + + cluster_manager diff --git a/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/types_.rst b/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/types_.rst new file mode 100644 index 000000000000..d4baa1c5101b --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/types_.rst @@ -0,0 +1,6 @@ +Types for Google Cloud Container v1beta1 API +============================================ + +.. automodule:: google.cloud.container_v1beta1.types + :members: + :show-inheritance: diff --git a/owl-bot-staging/google-cloud-container/v1beta1/docs/index.rst b/owl-bot-staging/google-cloud-container/v1beta1/docs/index.rst new file mode 100644 index 000000000000..5f9a4d460489 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/docs/index.rst @@ -0,0 +1,7 @@ +API Reference +------------- +.. toctree:: + :maxdepth: 2 + + container_v1beta1/services_ + container_v1beta1/types_ diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/__init__.py new file mode 100644 index 000000000000..ddc4611b552a --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/__init__.py @@ -0,0 +1,407 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.container import gapic_version as package_version + +__version__ = package_version.__version__ + + +from google.cloud.container_v1beta1.services.cluster_manager.client import ClusterManagerClient +from google.cloud.container_v1beta1.services.cluster_manager.async_client import ClusterManagerAsyncClient + +from google.cloud.container_v1beta1.types.cluster_service import AcceleratorConfig +from google.cloud.container_v1beta1.types.cluster_service import AdditionalNodeNetworkConfig +from google.cloud.container_v1beta1.types.cluster_service import AdditionalPodNetworkConfig +from google.cloud.container_v1beta1.types.cluster_service import AdditionalPodRangesConfig +from google.cloud.container_v1beta1.types.cluster_service import AddonsConfig +from google.cloud.container_v1beta1.types.cluster_service import AdvancedDatapathObservabilityConfig +from google.cloud.container_v1beta1.types.cluster_service import AdvancedMachineFeatures +from google.cloud.container_v1beta1.types.cluster_service import AuthenticatorGroupsConfig +from google.cloud.container_v1beta1.types.cluster_service import Autopilot +from google.cloud.container_v1beta1.types.cluster_service import AutopilotCompatibilityIssue +from google.cloud.container_v1beta1.types.cluster_service import AutopilotConversionStatus +from google.cloud.container_v1beta1.types.cluster_service import AutoprovisioningNodePoolDefaults +from google.cloud.container_v1beta1.types.cluster_service import AutoUpgradeOptions +from google.cloud.container_v1beta1.types.cluster_service import BestEffortProvisioning +from google.cloud.container_v1beta1.types.cluster_service import BinaryAuthorization +from google.cloud.container_v1beta1.types.cluster_service import BlueGreenSettings +from google.cloud.container_v1beta1.types.cluster_service import CancelOperationRequest +from google.cloud.container_v1beta1.types.cluster_service import CheckAutopilotCompatibilityRequest +from google.cloud.container_v1beta1.types.cluster_service import CheckAutopilotCompatibilityResponse +from google.cloud.container_v1beta1.types.cluster_service import ClientCertificateConfig +from google.cloud.container_v1beta1.types.cluster_service import CloudRunConfig +from google.cloud.container_v1beta1.types.cluster_service import Cluster +from google.cloud.container_v1beta1.types.cluster_service import ClusterAutoscaling +from google.cloud.container_v1beta1.types.cluster_service import ClusterTelemetry +from google.cloud.container_v1beta1.types.cluster_service import ClusterUpdate +from google.cloud.container_v1beta1.types.cluster_service import CompleteIPRotationRequest +from google.cloud.container_v1beta1.types.cluster_service import CompleteNodePoolUpgradeRequest +from google.cloud.container_v1beta1.types.cluster_service import CompliancePostureConfig +from google.cloud.container_v1beta1.types.cluster_service import ConfidentialNodes +from google.cloud.container_v1beta1.types.cluster_service import ConfigConnectorConfig +from google.cloud.container_v1beta1.types.cluster_service import ContainerdConfig +from google.cloud.container_v1beta1.types.cluster_service import CostManagementConfig +from google.cloud.container_v1beta1.types.cluster_service import CreateClusterRequest +from google.cloud.container_v1beta1.types.cluster_service import CreateNodePoolRequest +from google.cloud.container_v1beta1.types.cluster_service import DailyMaintenanceWindow +from google.cloud.container_v1beta1.types.cluster_service import DatabaseEncryption +from google.cloud.container_v1beta1.types.cluster_service import DefaultSnatStatus +from google.cloud.container_v1beta1.types.cluster_service import DeleteClusterRequest +from google.cloud.container_v1beta1.types.cluster_service import DeleteNodePoolRequest +from google.cloud.container_v1beta1.types.cluster_service import DnsCacheConfig +from google.cloud.container_v1beta1.types.cluster_service import DNSConfig +from google.cloud.container_v1beta1.types.cluster_service import EnterpriseConfig +from google.cloud.container_v1beta1.types.cluster_service import EphemeralStorageConfig +from google.cloud.container_v1beta1.types.cluster_service import EphemeralStorageLocalSsdConfig +from google.cloud.container_v1beta1.types.cluster_service import FastSocket +from google.cloud.container_v1beta1.types.cluster_service import Fleet +from google.cloud.container_v1beta1.types.cluster_service import GatewayAPIConfig +from google.cloud.container_v1beta1.types.cluster_service import GcePersistentDiskCsiDriverConfig +from google.cloud.container_v1beta1.types.cluster_service import GcfsConfig +from google.cloud.container_v1beta1.types.cluster_service import GcpFilestoreCsiDriverConfig +from google.cloud.container_v1beta1.types.cluster_service import GcsFuseCsiDriverConfig +from google.cloud.container_v1beta1.types.cluster_service import GetClusterRequest +from google.cloud.container_v1beta1.types.cluster_service import GetJSONWebKeysRequest +from google.cloud.container_v1beta1.types.cluster_service import GetJSONWebKeysResponse +from google.cloud.container_v1beta1.types.cluster_service import GetNodePoolRequest +from google.cloud.container_v1beta1.types.cluster_service import GetOpenIDConfigRequest +from google.cloud.container_v1beta1.types.cluster_service import GetOpenIDConfigResponse +from google.cloud.container_v1beta1.types.cluster_service import GetOperationRequest +from google.cloud.container_v1beta1.types.cluster_service import GetServerConfigRequest +from google.cloud.container_v1beta1.types.cluster_service import GkeBackupAgentConfig +from google.cloud.container_v1beta1.types.cluster_service import GPUDriverInstallationConfig +from google.cloud.container_v1beta1.types.cluster_service import GPUSharingConfig +from google.cloud.container_v1beta1.types.cluster_service import HorizontalPodAutoscaling +from google.cloud.container_v1beta1.types.cluster_service import HostMaintenancePolicy +from google.cloud.container_v1beta1.types.cluster_service import HttpLoadBalancing +from google.cloud.container_v1beta1.types.cluster_service import IdentityServiceConfig +from google.cloud.container_v1beta1.types.cluster_service import ILBSubsettingConfig +from google.cloud.container_v1beta1.types.cluster_service import IntraNodeVisibilityConfig +from google.cloud.container_v1beta1.types.cluster_service import IPAllocationPolicy +from google.cloud.container_v1beta1.types.cluster_service import IstioConfig +from google.cloud.container_v1beta1.types.cluster_service import Jwk +from google.cloud.container_v1beta1.types.cluster_service import K8sBetaAPIConfig +from google.cloud.container_v1beta1.types.cluster_service import KalmConfig +from google.cloud.container_v1beta1.types.cluster_service import KubernetesDashboard +from google.cloud.container_v1beta1.types.cluster_service import LegacyAbac +from google.cloud.container_v1beta1.types.cluster_service import LinuxNodeConfig +from google.cloud.container_v1beta1.types.cluster_service import ListClustersRequest +from google.cloud.container_v1beta1.types.cluster_service import ListClustersResponse +from google.cloud.container_v1beta1.types.cluster_service import ListLocationsRequest +from google.cloud.container_v1beta1.types.cluster_service import ListLocationsResponse +from google.cloud.container_v1beta1.types.cluster_service import ListNodePoolsRequest +from google.cloud.container_v1beta1.types.cluster_service import ListNodePoolsResponse +from google.cloud.container_v1beta1.types.cluster_service import ListOperationsRequest +from google.cloud.container_v1beta1.types.cluster_service import ListOperationsResponse +from google.cloud.container_v1beta1.types.cluster_service import ListUsableSubnetworksRequest +from google.cloud.container_v1beta1.types.cluster_service import ListUsableSubnetworksResponse +from google.cloud.container_v1beta1.types.cluster_service import LocalNvmeSsdBlockConfig +from google.cloud.container_v1beta1.types.cluster_service import Location +from google.cloud.container_v1beta1.types.cluster_service import LoggingComponentConfig +from google.cloud.container_v1beta1.types.cluster_service import LoggingConfig +from google.cloud.container_v1beta1.types.cluster_service import LoggingVariantConfig +from google.cloud.container_v1beta1.types.cluster_service import MaintenanceExclusionOptions +from google.cloud.container_v1beta1.types.cluster_service import MaintenancePolicy +from google.cloud.container_v1beta1.types.cluster_service import MaintenanceWindow +from google.cloud.container_v1beta1.types.cluster_service import ManagedPrometheusConfig +from google.cloud.container_v1beta1.types.cluster_service import Master +from google.cloud.container_v1beta1.types.cluster_service import MasterAuth +from google.cloud.container_v1beta1.types.cluster_service import MasterAuthorizedNetworksConfig +from google.cloud.container_v1beta1.types.cluster_service import MaxPodsConstraint +from google.cloud.container_v1beta1.types.cluster_service import MeshCertificates +from google.cloud.container_v1beta1.types.cluster_service import MonitoringComponentConfig +from google.cloud.container_v1beta1.types.cluster_service import MonitoringConfig +from google.cloud.container_v1beta1.types.cluster_service import NetworkConfig +from google.cloud.container_v1beta1.types.cluster_service import NetworkPolicy +from google.cloud.container_v1beta1.types.cluster_service import NetworkPolicyConfig +from google.cloud.container_v1beta1.types.cluster_service import NetworkTags +from google.cloud.container_v1beta1.types.cluster_service import NodeConfig +from google.cloud.container_v1beta1.types.cluster_service import NodeConfigDefaults +from google.cloud.container_v1beta1.types.cluster_service import NodeKubeletConfig +from google.cloud.container_v1beta1.types.cluster_service import NodeLabels +from google.cloud.container_v1beta1.types.cluster_service import NodeManagement +from google.cloud.container_v1beta1.types.cluster_service import NodeNetworkConfig +from google.cloud.container_v1beta1.types.cluster_service import NodePool +from google.cloud.container_v1beta1.types.cluster_service import NodePoolAutoConfig +from google.cloud.container_v1beta1.types.cluster_service import NodePoolAutoscaling +from google.cloud.container_v1beta1.types.cluster_service import NodePoolDefaults +from google.cloud.container_v1beta1.types.cluster_service import NodePoolLoggingConfig +from google.cloud.container_v1beta1.types.cluster_service import NodeTaint +from google.cloud.container_v1beta1.types.cluster_service import NodeTaints +from google.cloud.container_v1beta1.types.cluster_service import NotificationConfig +from google.cloud.container_v1beta1.types.cluster_service import Operation +from google.cloud.container_v1beta1.types.cluster_service import OperationProgress +from google.cloud.container_v1beta1.types.cluster_service import PodCIDROverprovisionConfig +from google.cloud.container_v1beta1.types.cluster_service import PodSecurityPolicyConfig +from google.cloud.container_v1beta1.types.cluster_service import PrivateClusterConfig +from google.cloud.container_v1beta1.types.cluster_service import PrivateClusterMasterGlobalAccessConfig +from google.cloud.container_v1beta1.types.cluster_service import ProtectConfig +from google.cloud.container_v1beta1.types.cluster_service import RangeInfo +from google.cloud.container_v1beta1.types.cluster_service import RayClusterLoggingConfig +from google.cloud.container_v1beta1.types.cluster_service import RayClusterMonitoringConfig +from google.cloud.container_v1beta1.types.cluster_service import RayOperatorConfig +from google.cloud.container_v1beta1.types.cluster_service import RecurringTimeWindow +from google.cloud.container_v1beta1.types.cluster_service import ReleaseChannel +from google.cloud.container_v1beta1.types.cluster_service import ReservationAffinity +from google.cloud.container_v1beta1.types.cluster_service import ResourceLabels +from google.cloud.container_v1beta1.types.cluster_service import ResourceLimit +from google.cloud.container_v1beta1.types.cluster_service import ResourceManagerTags +from google.cloud.container_v1beta1.types.cluster_service import ResourceUsageExportConfig +from google.cloud.container_v1beta1.types.cluster_service import RollbackNodePoolUpgradeRequest +from google.cloud.container_v1beta1.types.cluster_service import SandboxConfig +from google.cloud.container_v1beta1.types.cluster_service import SecondaryBootDisk +from google.cloud.container_v1beta1.types.cluster_service import SecondaryBootDiskUpdateStrategy +from google.cloud.container_v1beta1.types.cluster_service import SecretManagerConfig +from google.cloud.container_v1beta1.types.cluster_service import SecurityBulletinEvent +from google.cloud.container_v1beta1.types.cluster_service import SecurityPostureConfig +from google.cloud.container_v1beta1.types.cluster_service import ServerConfig +from google.cloud.container_v1beta1.types.cluster_service import ServiceExternalIPsConfig +from google.cloud.container_v1beta1.types.cluster_service import SetAddonsConfigRequest +from google.cloud.container_v1beta1.types.cluster_service import SetLabelsRequest +from google.cloud.container_v1beta1.types.cluster_service import SetLegacyAbacRequest +from google.cloud.container_v1beta1.types.cluster_service import SetLocationsRequest +from google.cloud.container_v1beta1.types.cluster_service import SetLoggingServiceRequest +from google.cloud.container_v1beta1.types.cluster_service import SetMaintenancePolicyRequest +from google.cloud.container_v1beta1.types.cluster_service import SetMasterAuthRequest +from google.cloud.container_v1beta1.types.cluster_service import SetMonitoringServiceRequest +from google.cloud.container_v1beta1.types.cluster_service import SetNetworkPolicyRequest +from google.cloud.container_v1beta1.types.cluster_service import SetNodePoolAutoscalingRequest +from google.cloud.container_v1beta1.types.cluster_service import SetNodePoolManagementRequest +from google.cloud.container_v1beta1.types.cluster_service import SetNodePoolSizeRequest +from google.cloud.container_v1beta1.types.cluster_service import ShieldedInstanceConfig +from google.cloud.container_v1beta1.types.cluster_service import ShieldedNodes +from google.cloud.container_v1beta1.types.cluster_service import SoleTenantConfig +from google.cloud.container_v1beta1.types.cluster_service import StartIPRotationRequest +from google.cloud.container_v1beta1.types.cluster_service import StatefulHAConfig +from google.cloud.container_v1beta1.types.cluster_service import StatusCondition +from google.cloud.container_v1beta1.types.cluster_service import TimeWindow +from google.cloud.container_v1beta1.types.cluster_service import TpuConfig +from google.cloud.container_v1beta1.types.cluster_service import UpdateClusterRequest +from google.cloud.container_v1beta1.types.cluster_service import UpdateMasterRequest +from google.cloud.container_v1beta1.types.cluster_service import UpdateNodePoolRequest +from google.cloud.container_v1beta1.types.cluster_service import UpgradeAvailableEvent +from google.cloud.container_v1beta1.types.cluster_service import UpgradeEvent +from google.cloud.container_v1beta1.types.cluster_service import UsableSubnetwork +from google.cloud.container_v1beta1.types.cluster_service import UsableSubnetworkSecondaryRange +from google.cloud.container_v1beta1.types.cluster_service import VerticalPodAutoscaling +from google.cloud.container_v1beta1.types.cluster_service import VirtualNIC +from google.cloud.container_v1beta1.types.cluster_service import WindowsNodeConfig +from google.cloud.container_v1beta1.types.cluster_service import WindowsVersions +from google.cloud.container_v1beta1.types.cluster_service import WorkloadALTSConfig +from google.cloud.container_v1beta1.types.cluster_service import WorkloadCertificates +from google.cloud.container_v1beta1.types.cluster_service import WorkloadConfig +from google.cloud.container_v1beta1.types.cluster_service import WorkloadIdentityConfig +from google.cloud.container_v1beta1.types.cluster_service import WorkloadMetadataConfig +from google.cloud.container_v1beta1.types.cluster_service import WorkloadPolicyConfig +from google.cloud.container_v1beta1.types.cluster_service import DatapathProvider +from google.cloud.container_v1beta1.types.cluster_service import InTransitEncryptionConfig +from google.cloud.container_v1beta1.types.cluster_service import NodePoolUpdateStrategy +from google.cloud.container_v1beta1.types.cluster_service import PrivateIPv6GoogleAccess +from google.cloud.container_v1beta1.types.cluster_service import StackType +from google.cloud.container_v1beta1.types.cluster_service import UpgradeResourceType + +__all__ = ('ClusterManagerClient', + 'ClusterManagerAsyncClient', + 'AcceleratorConfig', + 'AdditionalNodeNetworkConfig', + 'AdditionalPodNetworkConfig', + 'AdditionalPodRangesConfig', + 'AddonsConfig', + 'AdvancedDatapathObservabilityConfig', + 'AdvancedMachineFeatures', + 'AuthenticatorGroupsConfig', + 'Autopilot', + 'AutopilotCompatibilityIssue', + 'AutopilotConversionStatus', + 'AutoprovisioningNodePoolDefaults', + 'AutoUpgradeOptions', + 'BestEffortProvisioning', + 'BinaryAuthorization', + 'BlueGreenSettings', + 'CancelOperationRequest', + 'CheckAutopilotCompatibilityRequest', + 'CheckAutopilotCompatibilityResponse', + 'ClientCertificateConfig', + 'CloudRunConfig', + 'Cluster', + 'ClusterAutoscaling', + 'ClusterTelemetry', + 'ClusterUpdate', + 'CompleteIPRotationRequest', + 'CompleteNodePoolUpgradeRequest', + 'CompliancePostureConfig', + 'ConfidentialNodes', + 'ConfigConnectorConfig', + 'ContainerdConfig', + 'CostManagementConfig', + 'CreateClusterRequest', + 'CreateNodePoolRequest', + 'DailyMaintenanceWindow', + 'DatabaseEncryption', + 'DefaultSnatStatus', + 'DeleteClusterRequest', + 'DeleteNodePoolRequest', + 'DnsCacheConfig', + 'DNSConfig', + 'EnterpriseConfig', + 'EphemeralStorageConfig', + 'EphemeralStorageLocalSsdConfig', + 'FastSocket', + 'Fleet', + 'GatewayAPIConfig', + 'GcePersistentDiskCsiDriverConfig', + 'GcfsConfig', + 'GcpFilestoreCsiDriverConfig', + 'GcsFuseCsiDriverConfig', + 'GetClusterRequest', + 'GetJSONWebKeysRequest', + 'GetJSONWebKeysResponse', + 'GetNodePoolRequest', + 'GetOpenIDConfigRequest', + 'GetOpenIDConfigResponse', + 'GetOperationRequest', + 'GetServerConfigRequest', + 'GkeBackupAgentConfig', + 'GPUDriverInstallationConfig', + 'GPUSharingConfig', + 'HorizontalPodAutoscaling', + 'HostMaintenancePolicy', + 'HttpLoadBalancing', + 'IdentityServiceConfig', + 'ILBSubsettingConfig', + 'IntraNodeVisibilityConfig', + 'IPAllocationPolicy', + 'IstioConfig', + 'Jwk', + 'K8sBetaAPIConfig', + 'KalmConfig', + 'KubernetesDashboard', + 'LegacyAbac', + 'LinuxNodeConfig', + 'ListClustersRequest', + 'ListClustersResponse', + 'ListLocationsRequest', + 'ListLocationsResponse', + 'ListNodePoolsRequest', + 'ListNodePoolsResponse', + 'ListOperationsRequest', + 'ListOperationsResponse', + 'ListUsableSubnetworksRequest', + 'ListUsableSubnetworksResponse', + 'LocalNvmeSsdBlockConfig', + 'Location', + 'LoggingComponentConfig', + 'LoggingConfig', + 'LoggingVariantConfig', + 'MaintenanceExclusionOptions', + 'MaintenancePolicy', + 'MaintenanceWindow', + 'ManagedPrometheusConfig', + 'Master', + 'MasterAuth', + 'MasterAuthorizedNetworksConfig', + 'MaxPodsConstraint', + 'MeshCertificates', + 'MonitoringComponentConfig', + 'MonitoringConfig', + 'NetworkConfig', + 'NetworkPolicy', + 'NetworkPolicyConfig', + 'NetworkTags', + 'NodeConfig', + 'NodeConfigDefaults', + 'NodeKubeletConfig', + 'NodeLabels', + 'NodeManagement', + 'NodeNetworkConfig', + 'NodePool', + 'NodePoolAutoConfig', + 'NodePoolAutoscaling', + 'NodePoolDefaults', + 'NodePoolLoggingConfig', + 'NodeTaint', + 'NodeTaints', + 'NotificationConfig', + 'Operation', + 'OperationProgress', + 'PodCIDROverprovisionConfig', + 'PodSecurityPolicyConfig', + 'PrivateClusterConfig', + 'PrivateClusterMasterGlobalAccessConfig', + 'ProtectConfig', + 'RangeInfo', + 'RayClusterLoggingConfig', + 'RayClusterMonitoringConfig', + 'RayOperatorConfig', + 'RecurringTimeWindow', + 'ReleaseChannel', + 'ReservationAffinity', + 'ResourceLabels', + 'ResourceLimit', + 'ResourceManagerTags', + 'ResourceUsageExportConfig', + 'RollbackNodePoolUpgradeRequest', + 'SandboxConfig', + 'SecondaryBootDisk', + 'SecondaryBootDiskUpdateStrategy', + 'SecretManagerConfig', + 'SecurityBulletinEvent', + 'SecurityPostureConfig', + 'ServerConfig', + 'ServiceExternalIPsConfig', + 'SetAddonsConfigRequest', + 'SetLabelsRequest', + 'SetLegacyAbacRequest', + 'SetLocationsRequest', + 'SetLoggingServiceRequest', + 'SetMaintenancePolicyRequest', + 'SetMasterAuthRequest', + 'SetMonitoringServiceRequest', + 'SetNetworkPolicyRequest', + 'SetNodePoolAutoscalingRequest', + 'SetNodePoolManagementRequest', + 'SetNodePoolSizeRequest', + 'ShieldedInstanceConfig', + 'ShieldedNodes', + 'SoleTenantConfig', + 'StartIPRotationRequest', + 'StatefulHAConfig', + 'StatusCondition', + 'TimeWindow', + 'TpuConfig', + 'UpdateClusterRequest', + 'UpdateMasterRequest', + 'UpdateNodePoolRequest', + 'UpgradeAvailableEvent', + 'UpgradeEvent', + 'UsableSubnetwork', + 'UsableSubnetworkSecondaryRange', + 'VerticalPodAutoscaling', + 'VirtualNIC', + 'WindowsNodeConfig', + 'WindowsVersions', + 'WorkloadALTSConfig', + 'WorkloadCertificates', + 'WorkloadConfig', + 'WorkloadIdentityConfig', + 'WorkloadMetadataConfig', + 'WorkloadPolicyConfig', + 'DatapathProvider', + 'InTransitEncryptionConfig', + 'NodePoolUpdateStrategy', + 'PrivateIPv6GoogleAccess', + 'StackType', + 'UpgradeResourceType', +) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/gapic_version.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/gapic_version.py new file mode 100644 index 000000000000..558c8aab67c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.0.0" # {x-release-please-version} diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/py.typed b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/py.typed new file mode 100644 index 000000000000..d5b0e29f91b4 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-container package uses inline types. diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/__init__.py new file mode 100644 index 000000000000..67decca14bd8 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/__init__.py @@ -0,0 +1,408 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.container_v1beta1 import gapic_version as package_version + +__version__ = package_version.__version__ + + +from .services.cluster_manager import ClusterManagerClient +from .services.cluster_manager import ClusterManagerAsyncClient + +from .types.cluster_service import AcceleratorConfig +from .types.cluster_service import AdditionalNodeNetworkConfig +from .types.cluster_service import AdditionalPodNetworkConfig +from .types.cluster_service import AdditionalPodRangesConfig +from .types.cluster_service import AddonsConfig +from .types.cluster_service import AdvancedDatapathObservabilityConfig +from .types.cluster_service import AdvancedMachineFeatures +from .types.cluster_service import AuthenticatorGroupsConfig +from .types.cluster_service import Autopilot +from .types.cluster_service import AutopilotCompatibilityIssue +from .types.cluster_service import AutopilotConversionStatus +from .types.cluster_service import AutoprovisioningNodePoolDefaults +from .types.cluster_service import AutoUpgradeOptions +from .types.cluster_service import BestEffortProvisioning +from .types.cluster_service import BinaryAuthorization +from .types.cluster_service import BlueGreenSettings +from .types.cluster_service import CancelOperationRequest +from .types.cluster_service import CheckAutopilotCompatibilityRequest +from .types.cluster_service import CheckAutopilotCompatibilityResponse +from .types.cluster_service import ClientCertificateConfig +from .types.cluster_service import CloudRunConfig +from .types.cluster_service import Cluster +from .types.cluster_service import ClusterAutoscaling +from .types.cluster_service import ClusterTelemetry +from .types.cluster_service import ClusterUpdate +from .types.cluster_service import CompleteIPRotationRequest +from .types.cluster_service import CompleteNodePoolUpgradeRequest +from .types.cluster_service import CompliancePostureConfig +from .types.cluster_service import ConfidentialNodes +from .types.cluster_service import ConfigConnectorConfig +from .types.cluster_service import ContainerdConfig +from .types.cluster_service import CostManagementConfig +from .types.cluster_service import CreateClusterRequest +from .types.cluster_service import CreateNodePoolRequest +from .types.cluster_service import DailyMaintenanceWindow +from .types.cluster_service import DatabaseEncryption +from .types.cluster_service import DefaultSnatStatus +from .types.cluster_service import DeleteClusterRequest +from .types.cluster_service import DeleteNodePoolRequest +from .types.cluster_service import DnsCacheConfig +from .types.cluster_service import DNSConfig +from .types.cluster_service import EnterpriseConfig +from .types.cluster_service import EphemeralStorageConfig +from .types.cluster_service import EphemeralStorageLocalSsdConfig +from .types.cluster_service import FastSocket +from .types.cluster_service import Fleet +from .types.cluster_service import GatewayAPIConfig +from .types.cluster_service import GcePersistentDiskCsiDriverConfig +from .types.cluster_service import GcfsConfig +from .types.cluster_service import GcpFilestoreCsiDriverConfig +from .types.cluster_service import GcsFuseCsiDriverConfig +from .types.cluster_service import GetClusterRequest +from .types.cluster_service import GetJSONWebKeysRequest +from .types.cluster_service import GetJSONWebKeysResponse +from .types.cluster_service import GetNodePoolRequest +from .types.cluster_service import GetOpenIDConfigRequest +from .types.cluster_service import GetOpenIDConfigResponse +from .types.cluster_service import GetOperationRequest +from .types.cluster_service import GetServerConfigRequest +from .types.cluster_service import GkeBackupAgentConfig +from .types.cluster_service import GPUDriverInstallationConfig +from .types.cluster_service import GPUSharingConfig +from .types.cluster_service import HorizontalPodAutoscaling +from .types.cluster_service import HostMaintenancePolicy +from .types.cluster_service import HttpLoadBalancing +from .types.cluster_service import IdentityServiceConfig +from .types.cluster_service import ILBSubsettingConfig +from .types.cluster_service import IntraNodeVisibilityConfig +from .types.cluster_service import IPAllocationPolicy +from .types.cluster_service import IstioConfig +from .types.cluster_service import Jwk +from .types.cluster_service import K8sBetaAPIConfig +from .types.cluster_service import KalmConfig +from .types.cluster_service import KubernetesDashboard +from .types.cluster_service import LegacyAbac +from .types.cluster_service import LinuxNodeConfig +from .types.cluster_service import ListClustersRequest +from .types.cluster_service import ListClustersResponse +from .types.cluster_service import ListLocationsRequest +from .types.cluster_service import ListLocationsResponse +from .types.cluster_service import ListNodePoolsRequest +from .types.cluster_service import ListNodePoolsResponse +from .types.cluster_service import ListOperationsRequest +from .types.cluster_service import ListOperationsResponse +from .types.cluster_service import ListUsableSubnetworksRequest +from .types.cluster_service import ListUsableSubnetworksResponse +from .types.cluster_service import LocalNvmeSsdBlockConfig +from .types.cluster_service import Location +from .types.cluster_service import LoggingComponentConfig +from .types.cluster_service import LoggingConfig +from .types.cluster_service import LoggingVariantConfig +from .types.cluster_service import MaintenanceExclusionOptions +from .types.cluster_service import MaintenancePolicy +from .types.cluster_service import MaintenanceWindow +from .types.cluster_service import ManagedPrometheusConfig +from .types.cluster_service import Master +from .types.cluster_service import MasterAuth +from .types.cluster_service import MasterAuthorizedNetworksConfig +from .types.cluster_service import MaxPodsConstraint +from .types.cluster_service import MeshCertificates +from .types.cluster_service import MonitoringComponentConfig +from .types.cluster_service import MonitoringConfig +from .types.cluster_service import NetworkConfig +from .types.cluster_service import NetworkPolicy +from .types.cluster_service import NetworkPolicyConfig +from .types.cluster_service import NetworkTags +from .types.cluster_service import NodeConfig +from .types.cluster_service import NodeConfigDefaults +from .types.cluster_service import NodeKubeletConfig +from .types.cluster_service import NodeLabels +from .types.cluster_service import NodeManagement +from .types.cluster_service import NodeNetworkConfig +from .types.cluster_service import NodePool +from .types.cluster_service import NodePoolAutoConfig +from .types.cluster_service import NodePoolAutoscaling +from .types.cluster_service import NodePoolDefaults +from .types.cluster_service import NodePoolLoggingConfig +from .types.cluster_service import NodeTaint +from .types.cluster_service import NodeTaints +from .types.cluster_service import NotificationConfig +from .types.cluster_service import Operation +from .types.cluster_service import OperationProgress +from .types.cluster_service import PodCIDROverprovisionConfig +from .types.cluster_service import PodSecurityPolicyConfig +from .types.cluster_service import PrivateClusterConfig +from .types.cluster_service import PrivateClusterMasterGlobalAccessConfig +from .types.cluster_service import ProtectConfig +from .types.cluster_service import RangeInfo +from .types.cluster_service import RayClusterLoggingConfig +from .types.cluster_service import RayClusterMonitoringConfig +from .types.cluster_service import RayOperatorConfig +from .types.cluster_service import RecurringTimeWindow +from .types.cluster_service import ReleaseChannel +from .types.cluster_service import ReservationAffinity +from .types.cluster_service import ResourceLabels +from .types.cluster_service import ResourceLimit +from .types.cluster_service import ResourceManagerTags +from .types.cluster_service import ResourceUsageExportConfig +from .types.cluster_service import RollbackNodePoolUpgradeRequest +from .types.cluster_service import SandboxConfig +from .types.cluster_service import SecondaryBootDisk +from .types.cluster_service import SecondaryBootDiskUpdateStrategy +from .types.cluster_service import SecretManagerConfig +from .types.cluster_service import SecurityBulletinEvent +from .types.cluster_service import SecurityPostureConfig +from .types.cluster_service import ServerConfig +from .types.cluster_service import ServiceExternalIPsConfig +from .types.cluster_service import SetAddonsConfigRequest +from .types.cluster_service import SetLabelsRequest +from .types.cluster_service import SetLegacyAbacRequest +from .types.cluster_service import SetLocationsRequest +from .types.cluster_service import SetLoggingServiceRequest +from .types.cluster_service import SetMaintenancePolicyRequest +from .types.cluster_service import SetMasterAuthRequest +from .types.cluster_service import SetMonitoringServiceRequest +from .types.cluster_service import SetNetworkPolicyRequest +from .types.cluster_service import SetNodePoolAutoscalingRequest +from .types.cluster_service import SetNodePoolManagementRequest +from .types.cluster_service import SetNodePoolSizeRequest +from .types.cluster_service import ShieldedInstanceConfig +from .types.cluster_service import ShieldedNodes +from .types.cluster_service import SoleTenantConfig +from .types.cluster_service import StartIPRotationRequest +from .types.cluster_service import StatefulHAConfig +from .types.cluster_service import StatusCondition +from .types.cluster_service import TimeWindow +from .types.cluster_service import TpuConfig +from .types.cluster_service import UpdateClusterRequest +from .types.cluster_service import UpdateMasterRequest +from .types.cluster_service import UpdateNodePoolRequest +from .types.cluster_service import UpgradeAvailableEvent +from .types.cluster_service import UpgradeEvent +from .types.cluster_service import UsableSubnetwork +from .types.cluster_service import UsableSubnetworkSecondaryRange +from .types.cluster_service import VerticalPodAutoscaling +from .types.cluster_service import VirtualNIC +from .types.cluster_service import WindowsNodeConfig +from .types.cluster_service import WindowsVersions +from .types.cluster_service import WorkloadALTSConfig +from .types.cluster_service import WorkloadCertificates +from .types.cluster_service import WorkloadConfig +from .types.cluster_service import WorkloadIdentityConfig +from .types.cluster_service import WorkloadMetadataConfig +from .types.cluster_service import WorkloadPolicyConfig +from .types.cluster_service import DatapathProvider +from .types.cluster_service import InTransitEncryptionConfig +from .types.cluster_service import NodePoolUpdateStrategy +from .types.cluster_service import PrivateIPv6GoogleAccess +from .types.cluster_service import StackType +from .types.cluster_service import UpgradeResourceType + +__all__ = ( + 'ClusterManagerAsyncClient', +'AcceleratorConfig', +'AdditionalNodeNetworkConfig', +'AdditionalPodNetworkConfig', +'AdditionalPodRangesConfig', +'AddonsConfig', +'AdvancedDatapathObservabilityConfig', +'AdvancedMachineFeatures', +'AuthenticatorGroupsConfig', +'AutoUpgradeOptions', +'Autopilot', +'AutopilotCompatibilityIssue', +'AutopilotConversionStatus', +'AutoprovisioningNodePoolDefaults', +'BestEffortProvisioning', +'BinaryAuthorization', +'BlueGreenSettings', +'CancelOperationRequest', +'CheckAutopilotCompatibilityRequest', +'CheckAutopilotCompatibilityResponse', +'ClientCertificateConfig', +'CloudRunConfig', +'Cluster', +'ClusterAutoscaling', +'ClusterManagerClient', +'ClusterTelemetry', +'ClusterUpdate', +'CompleteIPRotationRequest', +'CompleteNodePoolUpgradeRequest', +'CompliancePostureConfig', +'ConfidentialNodes', +'ConfigConnectorConfig', +'ContainerdConfig', +'CostManagementConfig', +'CreateClusterRequest', +'CreateNodePoolRequest', +'DNSConfig', +'DailyMaintenanceWindow', +'DatabaseEncryption', +'DatapathProvider', +'DefaultSnatStatus', +'DeleteClusterRequest', +'DeleteNodePoolRequest', +'DnsCacheConfig', +'EnterpriseConfig', +'EphemeralStorageConfig', +'EphemeralStorageLocalSsdConfig', +'FastSocket', +'Fleet', +'GPUDriverInstallationConfig', +'GPUSharingConfig', +'GatewayAPIConfig', +'GcePersistentDiskCsiDriverConfig', +'GcfsConfig', +'GcpFilestoreCsiDriverConfig', +'GcsFuseCsiDriverConfig', +'GetClusterRequest', +'GetJSONWebKeysRequest', +'GetJSONWebKeysResponse', +'GetNodePoolRequest', +'GetOpenIDConfigRequest', +'GetOpenIDConfigResponse', +'GetOperationRequest', +'GetServerConfigRequest', +'GkeBackupAgentConfig', +'HorizontalPodAutoscaling', +'HostMaintenancePolicy', +'HttpLoadBalancing', +'ILBSubsettingConfig', +'IPAllocationPolicy', +'IdentityServiceConfig', +'InTransitEncryptionConfig', +'IntraNodeVisibilityConfig', +'IstioConfig', +'Jwk', +'K8sBetaAPIConfig', +'KalmConfig', +'KubernetesDashboard', +'LegacyAbac', +'LinuxNodeConfig', +'ListClustersRequest', +'ListClustersResponse', +'ListLocationsRequest', +'ListLocationsResponse', +'ListNodePoolsRequest', +'ListNodePoolsResponse', +'ListOperationsRequest', +'ListOperationsResponse', +'ListUsableSubnetworksRequest', +'ListUsableSubnetworksResponse', +'LocalNvmeSsdBlockConfig', +'Location', +'LoggingComponentConfig', +'LoggingConfig', +'LoggingVariantConfig', +'MaintenanceExclusionOptions', +'MaintenancePolicy', +'MaintenanceWindow', +'ManagedPrometheusConfig', +'Master', +'MasterAuth', +'MasterAuthorizedNetworksConfig', +'MaxPodsConstraint', +'MeshCertificates', +'MonitoringComponentConfig', +'MonitoringConfig', +'NetworkConfig', +'NetworkPolicy', +'NetworkPolicyConfig', +'NetworkTags', +'NodeConfig', +'NodeConfigDefaults', +'NodeKubeletConfig', +'NodeLabels', +'NodeManagement', +'NodeNetworkConfig', +'NodePool', +'NodePoolAutoConfig', +'NodePoolAutoscaling', +'NodePoolDefaults', +'NodePoolLoggingConfig', +'NodePoolUpdateStrategy', +'NodeTaint', +'NodeTaints', +'NotificationConfig', +'Operation', +'OperationProgress', +'PodCIDROverprovisionConfig', +'PodSecurityPolicyConfig', +'PrivateClusterConfig', +'PrivateClusterMasterGlobalAccessConfig', +'PrivateIPv6GoogleAccess', +'ProtectConfig', +'RangeInfo', +'RayClusterLoggingConfig', +'RayClusterMonitoringConfig', +'RayOperatorConfig', +'RecurringTimeWindow', +'ReleaseChannel', +'ReservationAffinity', +'ResourceLabels', +'ResourceLimit', +'ResourceManagerTags', +'ResourceUsageExportConfig', +'RollbackNodePoolUpgradeRequest', +'SandboxConfig', +'SecondaryBootDisk', +'SecondaryBootDiskUpdateStrategy', +'SecretManagerConfig', +'SecurityBulletinEvent', +'SecurityPostureConfig', +'ServerConfig', +'ServiceExternalIPsConfig', +'SetAddonsConfigRequest', +'SetLabelsRequest', +'SetLegacyAbacRequest', +'SetLocationsRequest', +'SetLoggingServiceRequest', +'SetMaintenancePolicyRequest', +'SetMasterAuthRequest', +'SetMonitoringServiceRequest', +'SetNetworkPolicyRequest', +'SetNodePoolAutoscalingRequest', +'SetNodePoolManagementRequest', +'SetNodePoolSizeRequest', +'ShieldedInstanceConfig', +'ShieldedNodes', +'SoleTenantConfig', +'StackType', +'StartIPRotationRequest', +'StatefulHAConfig', +'StatusCondition', +'TimeWindow', +'TpuConfig', +'UpdateClusterRequest', +'UpdateMasterRequest', +'UpdateNodePoolRequest', +'UpgradeAvailableEvent', +'UpgradeEvent', +'UpgradeResourceType', +'UsableSubnetwork', +'UsableSubnetworkSecondaryRange', +'VerticalPodAutoscaling', +'VirtualNIC', +'WindowsNodeConfig', +'WindowsVersions', +'WorkloadALTSConfig', +'WorkloadCertificates', +'WorkloadConfig', +'WorkloadIdentityConfig', +'WorkloadMetadataConfig', +'WorkloadPolicyConfig', +) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_metadata.json new file mode 100644 index 000000000000..b925b82155e0 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_metadata.json @@ -0,0 +1,373 @@ + { + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "python", + "libraryPackage": "google.cloud.container_v1beta1", + "protoPackage": "google.container.v1beta1", + "schema": "1.0", + "services": { + "ClusterManager": { + "clients": { + "grpc": { + "libraryClient": "ClusterManagerClient", + "rpcs": { + "CancelOperation": { + "methods": [ + "cancel_operation" + ] + }, + "CheckAutopilotCompatibility": { + "methods": [ + "check_autopilot_compatibility" + ] + }, + "CompleteIPRotation": { + "methods": [ + "complete_ip_rotation" + ] + }, + "CompleteNodePoolUpgrade": { + "methods": [ + "complete_node_pool_upgrade" + ] + }, + "CreateCluster": { + "methods": [ + "create_cluster" + ] + }, + "CreateNodePool": { + "methods": [ + "create_node_pool" + ] + }, + "DeleteCluster": { + "methods": [ + "delete_cluster" + ] + }, + "DeleteNodePool": { + "methods": [ + "delete_node_pool" + ] + }, + "GetCluster": { + "methods": [ + "get_cluster" + ] + }, + "GetJSONWebKeys": { + "methods": [ + "get_json_web_keys" + ] + }, + "GetNodePool": { + "methods": [ + "get_node_pool" + ] + }, + "GetOperation": { + "methods": [ + "get_operation" + ] + }, + "GetServerConfig": { + "methods": [ + "get_server_config" + ] + }, + "ListClusters": { + "methods": [ + "list_clusters" + ] + }, + "ListLocations": { + "methods": [ + "list_locations" + ] + }, + "ListNodePools": { + "methods": [ + "list_node_pools" + ] + }, + "ListOperations": { + "methods": [ + "list_operations" + ] + }, + "ListUsableSubnetworks": { + "methods": [ + "list_usable_subnetworks" + ] + }, + "RollbackNodePoolUpgrade": { + "methods": [ + "rollback_node_pool_upgrade" + ] + }, + "SetAddonsConfig": { + "methods": [ + "set_addons_config" + ] + }, + "SetLabels": { + "methods": [ + "set_labels" + ] + }, + "SetLegacyAbac": { + "methods": [ + "set_legacy_abac" + ] + }, + "SetLocations": { + "methods": [ + "set_locations" + ] + }, + "SetLoggingService": { + "methods": [ + "set_logging_service" + ] + }, + "SetMaintenancePolicy": { + "methods": [ + "set_maintenance_policy" + ] + }, + "SetMasterAuth": { + "methods": [ + "set_master_auth" + ] + }, + "SetMonitoringService": { + "methods": [ + "set_monitoring_service" + ] + }, + "SetNetworkPolicy": { + "methods": [ + "set_network_policy" + ] + }, + "SetNodePoolAutoscaling": { + "methods": [ + "set_node_pool_autoscaling" + ] + }, + "SetNodePoolManagement": { + "methods": [ + "set_node_pool_management" + ] + }, + "SetNodePoolSize": { + "methods": [ + "set_node_pool_size" + ] + }, + "StartIPRotation": { + "methods": [ + "start_ip_rotation" + ] + }, + "UpdateCluster": { + "methods": [ + "update_cluster" + ] + }, + "UpdateMaster": { + "methods": [ + "update_master" + ] + }, + "UpdateNodePool": { + "methods": [ + "update_node_pool" + ] + } + } + }, + "grpc-async": { + "libraryClient": "ClusterManagerAsyncClient", + "rpcs": { + "CancelOperation": { + "methods": [ + "cancel_operation" + ] + }, + "CheckAutopilotCompatibility": { + "methods": [ + "check_autopilot_compatibility" + ] + }, + "CompleteIPRotation": { + "methods": [ + "complete_ip_rotation" + ] + }, + "CompleteNodePoolUpgrade": { + "methods": [ + "complete_node_pool_upgrade" + ] + }, + "CreateCluster": { + "methods": [ + "create_cluster" + ] + }, + "CreateNodePool": { + "methods": [ + "create_node_pool" + ] + }, + "DeleteCluster": { + "methods": [ + "delete_cluster" + ] + }, + "DeleteNodePool": { + "methods": [ + "delete_node_pool" + ] + }, + "GetCluster": { + "methods": [ + "get_cluster" + ] + }, + "GetJSONWebKeys": { + "methods": [ + "get_json_web_keys" + ] + }, + "GetNodePool": { + "methods": [ + "get_node_pool" + ] + }, + "GetOperation": { + "methods": [ + "get_operation" + ] + }, + "GetServerConfig": { + "methods": [ + "get_server_config" + ] + }, + "ListClusters": { + "methods": [ + "list_clusters" + ] + }, + "ListLocations": { + "methods": [ + "list_locations" + ] + }, + "ListNodePools": { + "methods": [ + "list_node_pools" + ] + }, + "ListOperations": { + "methods": [ + "list_operations" + ] + }, + "ListUsableSubnetworks": { + "methods": [ + "list_usable_subnetworks" + ] + }, + "RollbackNodePoolUpgrade": { + "methods": [ + "rollback_node_pool_upgrade" + ] + }, + "SetAddonsConfig": { + "methods": [ + "set_addons_config" + ] + }, + "SetLabels": { + "methods": [ + "set_labels" + ] + }, + "SetLegacyAbac": { + "methods": [ + "set_legacy_abac" + ] + }, + "SetLocations": { + "methods": [ + "set_locations" + ] + }, + "SetLoggingService": { + "methods": [ + "set_logging_service" + ] + }, + "SetMaintenancePolicy": { + "methods": [ + "set_maintenance_policy" + ] + }, + "SetMasterAuth": { + "methods": [ + "set_master_auth" + ] + }, + "SetMonitoringService": { + "methods": [ + "set_monitoring_service" + ] + }, + "SetNetworkPolicy": { + "methods": [ + "set_network_policy" + ] + }, + "SetNodePoolAutoscaling": { + "methods": [ + "set_node_pool_autoscaling" + ] + }, + "SetNodePoolManagement": { + "methods": [ + "set_node_pool_management" + ] + }, + "SetNodePoolSize": { + "methods": [ + "set_node_pool_size" + ] + }, + "StartIPRotation": { + "methods": [ + "start_ip_rotation" + ] + }, + "UpdateCluster": { + "methods": [ + "update_cluster" + ] + }, + "UpdateMaster": { + "methods": [ + "update_master" + ] + }, + "UpdateNodePool": { + "methods": [ + "update_node_pool" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_version.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_version.py new file mode 100644 index 000000000000..558c8aab67c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.0.0" # {x-release-please-version} diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/py.typed b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/py.typed new file mode 100644 index 000000000000..d5b0e29f91b4 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-container package uses inline types. diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/__init__.py new file mode 100644 index 000000000000..8f6cf068242c --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/__init__.py new file mode 100644 index 000000000000..f3aa6cc7d359 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ClusterManagerClient +from .async_client import ClusterManagerAsyncClient + +__all__ = ( + 'ClusterManagerClient', + 'ClusterManagerAsyncClient', +) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/async_client.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/async_client.py new file mode 100644 index 000000000000..403a15d2da94 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/async_client.py @@ -0,0 +1,4885 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 logging as std_logging +from collections import OrderedDict +import re +from typing import Dict, Callable, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union +import warnings + +from google.cloud.container_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_async as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + + +try: + OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore + +from google.cloud.container_v1beta1.services.cluster_manager import pagers +from google.cloud.container_v1beta1.types import cluster_service +from google.rpc import status_pb2 # type: ignore +from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import ClusterManagerGrpcAsyncIOTransport +from .client import ClusterManagerClient + +try: + from google.api_core import client_logging # type: ignore + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + +class ClusterManagerAsyncClient: + """Google Kubernetes Engine Cluster Manager v1beta1""" + + _client: ClusterManagerClient + + # Copy defaults from the synchronous client for use here. + # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead. + DEFAULT_ENDPOINT = ClusterManagerClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = ClusterManagerClient.DEFAULT_MTLS_ENDPOINT + _DEFAULT_ENDPOINT_TEMPLATE = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE + _DEFAULT_UNIVERSE = ClusterManagerClient._DEFAULT_UNIVERSE + + topic_path = staticmethod(ClusterManagerClient.topic_path) + parse_topic_path = staticmethod(ClusterManagerClient.parse_topic_path) + common_billing_account_path = staticmethod(ClusterManagerClient.common_billing_account_path) + parse_common_billing_account_path = staticmethod(ClusterManagerClient.parse_common_billing_account_path) + common_folder_path = staticmethod(ClusterManagerClient.common_folder_path) + parse_common_folder_path = staticmethod(ClusterManagerClient.parse_common_folder_path) + common_organization_path = staticmethod(ClusterManagerClient.common_organization_path) + parse_common_organization_path = staticmethod(ClusterManagerClient.parse_common_organization_path) + common_project_path = staticmethod(ClusterManagerClient.common_project_path) + parse_common_project_path = staticmethod(ClusterManagerClient.parse_common_project_path) + common_location_path = staticmethod(ClusterManagerClient.common_location_path) + parse_common_location_path = staticmethod(ClusterManagerClient.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: + ClusterManagerAsyncClient: The constructed client. + """ + return ClusterManagerClient.from_service_account_info.__func__(ClusterManagerAsyncClient, 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: + ClusterManagerAsyncClient: The constructed client. + """ + return ClusterManagerClient.from_service_account_file.__func__(ClusterManagerAsyncClient, 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 ClusterManagerClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + + @property + def transport(self) -> ClusterManagerTransport: + """Returns the transport used by the client instance. + + Returns: + ClusterManagerTransport: The transport used by the client instance. + """ + return self._client.transport + + @property + def api_endpoint(self): + """Return the API endpoint used by the client instance. + + Returns: + str: The API endpoint used by the client instance. + """ + return self._client._api_endpoint + + @property + def universe_domain(self) -> str: + """Return the universe domain used by the client instance. + + Returns: + str: The universe domain used + by the client instance. + """ + return self._client._universe_domain + + get_transport_class = ClusterManagerClient.get_transport_class + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Optional[Union[str, ClusterManagerTransport, Callable[..., ClusterManagerTransport]]] = "grpc_asyncio", + client_options: Optional[ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the cluster manager async 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 (Optional[Union[str,ClusterManagerTransport,Callable[..., ClusterManagerTransport]]]): + The transport to use, or a Callable that constructs and returns a new transport to use. + If a Callable is given, it will be called with the same set of initialization + arguments as used in the ClusterManagerTransport constructor. + 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. + + 1. The ``api_endpoint`` property can be used to override the + default endpoint provided by the client when ``transport`` is + not explicitly provided. Only if this property is not set and + ``transport`` was not explicitly provided, the endpoint is + determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment + variable, which have one of the following values: + "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). + + 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide a client certificate for mTLS 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. + + 3. The ``universe_domain`` property can be used to override the + default "googleapis.com" universe. Note that ``api_endpoint`` + property still takes precedence; and ``universe_domain`` is + currently not supported for mTLS. + + 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. + """ + self._client = ClusterManagerClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + + ) + + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.container_v1beta1.ClusterManagerAsyncClient`.", + extra = { + "serviceName": "google.container.v1beta1.ClusterManager", + "universeDomain": getattr(self._client._transport._credentials, "universe_domain", ""), + "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}", + "credentialsInfo": getattr(self.transport._credentials, "get_cred_info", lambda: None)(), + } if hasattr(self._client._transport, "_credentials") else { + "serviceName": "google.container.v1beta1.ClusterManager", + "credentialsType": None, + } + ) + + async def list_clusters(self, + request: Optional[Union[cluster_service.ListClustersRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListClustersResponse: + r"""Lists all clusters owned by a project in either the + specified zone or all zones. + + .. 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 import container_v1beta1 + + async def sample_list_clusters(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.ListClustersRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = await client.list_clusters(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.ListClustersRequest, dict]]): + The request object. ListClustersRequest lists clusters. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides, or "-" for all zones. This + field has been deprecated and replaced by the parent + field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.ListClustersResponse: + ListClustersResponse is the result of + ListClustersRequest. + + """ + # 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([project_id, zone]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListClustersRequest): + request = cluster_service.ListClustersRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.list_clusters] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_cluster(self, + request: Optional[Union[cluster_service.GetClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Cluster: + r"""Gets the details for a specific cluster. + + .. 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 import container_v1beta1 + + async def sample_get_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.GetClusterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.get_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.GetClusterRequest, dict]]): + The request object. GetClusterRequest gets the settings + of a cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster to retrieve. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Cluster: + A Google Kubernetes Engine cluster. + """ + # 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([project_id, zone, cluster_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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetClusterRequest): + request = cluster_service.GetClusterRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.get_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_cluster(self, + request: Optional[Union[cluster_service.CreateClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster: Optional[cluster_service.Cluster] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Creates a cluster, consisting of the specified number and type + of Google Compute Engine instances. + + By default, the cluster is created in the project's `default + network `__. + + One firewall is added for the cluster. After cluster creation, + the Kubelet creates routes for each node to allow the containers + on that node to communicate with all other instances in the + cluster. + + Finally, an entry is added to the project's global metadata + indicating which CIDR range the cluster is using. + + .. 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 import container_v1beta1 + + async def sample_create_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CreateClusterRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = await client.create_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.CreateClusterRequest, dict]]): + The request object. CreateClusterRequest creates a + cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the parent field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster (:class:`google.cloud.container_v1beta1.types.Cluster`): + Required. A `cluster + resource `__ + + This corresponds to the ``cluster`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CreateClusterRequest): + request = cluster_service.CreateClusterRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster is not None: + request.cluster = cluster + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.create_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_cluster(self, + request: Optional[Union[cluster_service.UpdateClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + update: Optional[cluster_service.ClusterUpdate] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Updates the settings for a specific cluster. + + .. 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 import container_v1beta1 + + async def sample_update_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.UpdateClusterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.update_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.UpdateClusterRequest, dict]]): + The request object. UpdateClusterRequest updates the + settings of a cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update (:class:`google.cloud.container_v1beta1.types.ClusterUpdate`): + Required. A description of the + update. + + This corresponds to the ``update`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, update]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.UpdateClusterRequest): + request = cluster_service.UpdateClusterRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if update is not None: + request.update = update + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.update_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_node_pool(self, + request: Optional[Union[cluster_service.UpdateNodePoolRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Updates the version and/or image type of a specific + node pool. + + .. 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 import container_v1beta1 + + async def sample_update_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.UpdateNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + node_version="node_version_value", + image_type="image_type_value", + ) + + # Make the request + response = await client.update_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.UpdateNodePoolRequest, dict]]): + The request object. SetNodePoolVersionRequest updates the + version of a node pool. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.UpdateNodePoolRequest): + request = cluster_service.UpdateNodePoolRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.update_node_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_node_pool_autoscaling(self, + request: Optional[Union[cluster_service.SetNodePoolAutoscalingRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the autoscaling settings of a specific node + pool. + + .. 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 import container_v1beta1 + + async def sample_set_node_pool_autoscaling(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNodePoolAutoscalingRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = await client.set_node_pool_autoscaling(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.SetNodePoolAutoscalingRequest, dict]]): + The request object. SetNodePoolAutoscalingRequest sets + the autoscaler settings of a node pool. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNodePoolAutoscalingRequest): + request = cluster_service.SetNodePoolAutoscalingRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_node_pool_autoscaling] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_logging_service(self, + request: Optional[Union[cluster_service.SetLoggingServiceRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + logging_service: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the logging service for a specific cluster. + + .. 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 import container_v1beta1 + + async def sample_set_logging_service(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLoggingServiceRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + logging_service="logging_service_value", + ) + + # Make the request + response = await client.set_logging_service(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.SetLoggingServiceRequest, dict]]): + The request object. SetLoggingServiceRequest sets the + logging service of a cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + logging_service (:class:`str`): + Required. The logging service the cluster should use to + write logs. Currently available options: + + - ``logging.googleapis.com/kubernetes`` - The Cloud + Logging service with a Kubernetes-native resource + model + - ``logging.googleapis.com`` - The legacy Cloud Logging + service (no longer available as of GKE 1.15). + - ``none`` - no logs will be exported from the cluster. + + If left as an empty + string,\ ``logging.googleapis.com/kubernetes`` will be + used for GKE 1.14+ or ``logging.googleapis.com`` for + earlier versions. + + This corresponds to the ``logging_service`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, logging_service]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLoggingServiceRequest): + request = cluster_service.SetLoggingServiceRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if logging_service is not None: + request.logging_service = logging_service + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_logging_service] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_monitoring_service(self, + request: Optional[Union[cluster_service.SetMonitoringServiceRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + monitoring_service: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the monitoring service for a specific cluster. + + .. 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 import container_v1beta1 + + async def sample_set_monitoring_service(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetMonitoringServiceRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + monitoring_service="monitoring_service_value", + ) + + # Make the request + response = await client.set_monitoring_service(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.SetMonitoringServiceRequest, dict]]): + The request object. SetMonitoringServiceRequest sets the + monitoring service of a cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + monitoring_service (:class:`str`): + Required. The monitoring service the cluster should use + to write metrics. Currently available options: + + - "monitoring.googleapis.com/kubernetes" - The Cloud + Monitoring service with a Kubernetes-native resource + model + - ``monitoring.googleapis.com`` - The legacy Cloud + Monitoring service (no longer available as of GKE + 1.15). + - ``none`` - No metrics will be exported from the + cluster. + + If left as an empty + string,\ ``monitoring.googleapis.com/kubernetes`` will + be used for GKE 1.14+ or ``monitoring.googleapis.com`` + for earlier versions. + + This corresponds to the ``monitoring_service`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, monitoring_service]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetMonitoringServiceRequest): + request = cluster_service.SetMonitoringServiceRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if monitoring_service is not None: + request.monitoring_service = monitoring_service + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_monitoring_service] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_addons_config(self, + request: Optional[Union[cluster_service.SetAddonsConfigRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + addons_config: Optional[cluster_service.AddonsConfig] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the addons for a specific cluster. + + .. 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 import container_v1beta1 + + async def sample_set_addons_config(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetAddonsConfigRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.set_addons_config(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.SetAddonsConfigRequest, dict]]): + The request object. SetAddonsRequest sets the addons + associated with the cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + addons_config (:class:`google.cloud.container_v1beta1.types.AddonsConfig`): + Required. The desired configurations + for the various addons available to run + in the cluster. + + This corresponds to the ``addons_config`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, addons_config]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetAddonsConfigRequest): + request = cluster_service.SetAddonsConfigRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if addons_config is not None: + request.addons_config = addons_config + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_addons_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_locations(self, + request: Optional[Union[cluster_service.SetLocationsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + locations: Optional[MutableSequence[str]] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the locations for a specific cluster. Deprecated. Use + `projects.locations.clusters.update `__ + instead. + + .. 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 import container_v1beta1 + + async def sample_set_locations(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLocationsRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + locations=['locations_value1', 'locations_value2'], + ) + + # Make the request + response = await client.set_locations(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.SetLocationsRequest, dict]]): + The request object. SetLocationsRequest sets the + locations of the cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + locations (:class:`MutableSequence[str]`): + Required. The desired list of Google Compute Engine + `zones `__ + in which the cluster's nodes should be located. Changing + the locations a cluster is in will result in nodes being + either created or removed from the cluster, depending on + whether locations are being added or removed. + + This list must always include the cluster's primary + zone. + + This corresponds to the ``locations`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + warnings.warn("ClusterManagerAsyncClient.set_locations is deprecated", + DeprecationWarning) + + # 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([project_id, zone, cluster_id, locations]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLocationsRequest): + request = cluster_service.SetLocationsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if locations: + request.locations.extend(locations) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_locations] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_master(self, + request: Optional[Union[cluster_service.UpdateMasterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + master_version: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Updates the master for a specific cluster. + + .. 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 import container_v1beta1 + + async def sample_update_master(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.UpdateMasterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + master_version="master_version_value", + ) + + # Make the request + response = await client.update_master(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.UpdateMasterRequest, dict]]): + The request object. UpdateMasterRequest updates the + master of the cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + master_version (:class:`str`): + Required. The Kubernetes version to + change the master to. + Users may specify either explicit + versions offered by Kubernetes Engine or + version aliases, which have the + following behavior: + + - "latest": picks the highest valid + Kubernetes version + - "1.X": picks the highest valid + patch+gke.N patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N + patch in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit + Kubernetes version + - "-": picks the default Kubernetes + version + + This corresponds to the ``master_version`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, master_version]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.UpdateMasterRequest): + request = cluster_service.UpdateMasterRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if master_version is not None: + request.master_version = master_version + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.update_master] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_master_auth(self, + request: Optional[Union[cluster_service.SetMasterAuthRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets master auth materials. Currently supports + changing the admin password or a specific cluster, + either via password generation or explicitly setting the + password. + + .. 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 import container_v1beta1 + + async def sample_set_master_auth(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetMasterAuthRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + action="SET_USERNAME", + ) + + # Make the request + response = await client.set_master_auth(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.SetMasterAuthRequest, dict]]): + The request object. SetMasterAuthRequest updates the + admin password of a cluster. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetMasterAuthRequest): + request = cluster_service.SetMasterAuthRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_master_auth] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_cluster(self, + request: Optional[Union[cluster_service.DeleteClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Deletes the cluster, including the Kubernetes + endpoint and all worker nodes. + + Firewalls and routes that were configured during cluster + creation are also deleted. + + Other Google Compute Engine resources that might be in + use by the cluster, such as load balancer resources, are + not deleted if they weren't present when the cluster was + initially created. + + .. 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 import container_v1beta1 + + async def sample_delete_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.DeleteClusterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.delete_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.DeleteClusterRequest, dict]]): + The request object. DeleteClusterRequest deletes a + cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster to delete. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.DeleteClusterRequest): + request = cluster_service.DeleteClusterRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.delete_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_operations(self, + request: Optional[Union[cluster_service.ListOperationsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListOperationsResponse: + r"""Lists all operations in a project in the specified + zone or all zones. + + .. 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 import container_v1beta1 + + async def sample_list_operations(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.ListOperationsRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = await client.list_operations(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.ListOperationsRequest, dict]]): + The request object. ListOperationsRequest lists + operations. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + to return operations for, or ``-`` for all zones. This + field has been deprecated and replaced by the parent + field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.ListOperationsResponse: + ListOperationsResponse is the result + of ListOperationsRequest. + + """ + # 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([project_id, zone]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListOperationsRequest): + request = cluster_service.ListOperationsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.list_operations] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_operation(self, + request: Optional[Union[cluster_service.GetOperationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + operation_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Gets the specified operation. + + .. 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 import container_v1beta1 + + async def sample_get_operation(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.GetOperationRequest( + project_id="project_id_value", + zone="zone_value", + operation_id="operation_id_value", + ) + + # Make the request + response = await client.get_operation(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.GetOperationRequest, dict]]): + The request object. GetOperationRequest gets a single + operation. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + operation_id (:class:`str`): + Required. Deprecated. The server-assigned ``name`` of + the operation. This field has been deprecated and + replaced by the name field. + + This corresponds to the ``operation_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, operation_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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetOperationRequest): + request = cluster_service.GetOperationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if operation_id is not None: + request.operation_id = operation_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.get_operation] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def cancel_operation(self, + request: Optional[Union[cluster_service.CancelOperationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + operation_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> None: + r"""Cancels the specified operation. + + .. 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 import container_v1beta1 + + async def sample_cancel_operation(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CancelOperationRequest( + project_id="project_id_value", + zone="zone_value", + operation_id="operation_id_value", + ) + + # Make the request + await client.cancel_operation(request=request) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.CancelOperationRequest, dict]]): + The request object. CancelOperationRequest cancels a + single operation. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the operation resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + operation_id (:class:`str`): + Required. Deprecated. The server-assigned ``name`` of + the operation. This field has been deprecated and + replaced by the name field. + + This corresponds to the ``operation_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + # 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([project_id, zone, operation_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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CancelOperationRequest): + request = cluster_service.CancelOperationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if operation_id is not None: + request.operation_id = operation_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.cancel_operation] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + async def get_server_config(self, + request: Optional[Union[cluster_service.GetServerConfigRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ServerConfig: + r"""Returns configuration info about the Google + Kubernetes Engine service. + + .. 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 import container_v1beta1 + + async def sample_get_server_config(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.GetServerConfigRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = await client.get_server_config(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.GetServerConfigRequest, dict]]): + The request object. Gets the current Kubernetes Engine + service configuration. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + to return operations for. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.ServerConfig: + Kubernetes Engine service + configuration. + + """ + # 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([project_id, zone]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetServerConfigRequest): + request = cluster_service.GetServerConfigRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.get_server_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_json_web_keys(self, + request: Optional[Union[cluster_service.GetJSONWebKeysRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.GetJSONWebKeysResponse: + r"""Gets the public component of the cluster signing keys + in JSON Web Key format. + + .. 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 import container_v1beta1 + + async def sample_get_json_web_keys(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.GetJSONWebKeysRequest( + ) + + # Make the request + response = await client.get_json_web_keys(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.GetJSONWebKeysRequest, dict]]): + The request object. GetJSONWebKeysRequest gets the public component of the + keys used by the cluster to sign token requests. This + will be the jwks_uri for the discover document returned + by getOpenIDConfig. See the OpenID Connect Discovery 1.0 + specification for details. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.GetJSONWebKeysResponse: + GetJSONWebKeysResponse is a valid + JSON Web Key Set as specififed in rfc + 7517 + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetJSONWebKeysRequest): + request = cluster_service.GetJSONWebKeysRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.get_json_web_keys] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_node_pools(self, + request: Optional[Union[cluster_service.ListNodePoolsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListNodePoolsResponse: + r"""Lists the node pools for a cluster. + + .. 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 import container_v1beta1 + + async def sample_list_node_pools(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.ListNodePoolsRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.list_node_pools(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.ListNodePoolsRequest, dict]]): + The request object. ListNodePoolsRequest lists the node + pool(s) for a cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the parent field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the parent field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.ListNodePoolsResponse: + ListNodePoolsResponse is the result + of ListNodePoolsRequest. + + """ + # 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([project_id, zone, cluster_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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListNodePoolsRequest): + request = cluster_service.ListNodePoolsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.list_node_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_node_pool(self, + request: Optional[Union[cluster_service.GetNodePoolRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.NodePool: + r"""Retrieves the requested node pool. + + .. 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 import container_v1beta1 + + async def sample_get_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.GetNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = await client.get_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.GetNodePoolRequest, dict]]): + The request object. GetNodePoolRequest retrieves a node + pool for a cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (:class:`str`): + Required. Deprecated. The name of the + node pool. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``node_pool_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.NodePool: + NodePool contains the name and + configuration for a cluster's node pool. + Node pools are a set of nodes (i.e. + VM's), with a common configuration and + specification, under the control of the + cluster master. They may have a set of + Kubernetes labels applied to them, which + may be used to reference them during pod + scheduling. They may also be resized up + or down, to accommodate the workload. + + """ + # 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([project_id, zone, cluster_id, node_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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetNodePoolRequest): + request = cluster_service.GetNodePoolRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.get_node_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_node_pool(self, + request: Optional[Union[cluster_service.CreateNodePoolRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool: Optional[cluster_service.NodePool] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Creates a node pool for a cluster. + + .. 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 import container_v1beta1 + + async def sample_create_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CreateNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.create_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.CreateNodePoolRequest, dict]]): + The request object. CreateNodePoolRequest creates a node + pool for a cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the parent field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the parent field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool (:class:`google.cloud.container_v1beta1.types.NodePool`): + Required. The node pool to create. + This corresponds to the ``node_pool`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CreateNodePoolRequest): + request = cluster_service.CreateNodePoolRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool is not None: + request.node_pool = node_pool + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.create_node_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_node_pool(self, + request: Optional[Union[cluster_service.DeleteNodePoolRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Deletes a node pool from a cluster. + + .. 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 import container_v1beta1 + + async def sample_delete_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.DeleteNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = await client.delete_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.DeleteNodePoolRequest, dict]]): + The request object. DeleteNodePoolRequest deletes a node + pool for a cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (:class:`str`): + Required. Deprecated. The name of the + node pool to delete. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``node_pool_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.DeleteNodePoolRequest): + request = cluster_service.DeleteNodePoolRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.delete_node_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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def complete_node_pool_upgrade(self, + request: Optional[Union[cluster_service.CompleteNodePoolUpgradeRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> None: + r"""CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + .. 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 import container_v1beta1 + + async def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + await client.complete_node_pool_upgrade(request=request) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.CompleteNodePoolUpgradeRequest, dict]]): + The request object. CompleteNodePoolUpgradeRequest sets + the name of target node pool to complete + upgrade. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CompleteNodePoolUpgradeRequest): + request = cluster_service.CompleteNodePoolUpgradeRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.complete_node_pool_upgrade] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + async def rollback_node_pool_upgrade(self, + request: Optional[Union[cluster_service.RollbackNodePoolUpgradeRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Rolls back a previously Aborted or Failed NodePool + upgrade. This makes no changes if the last upgrade + successfully completed. + + .. 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 import container_v1beta1 + + async def sample_rollback_node_pool_upgrade(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.RollbackNodePoolUpgradeRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = await client.rollback_node_pool_upgrade(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.RollbackNodePoolUpgradeRequest, dict]]): + The request object. RollbackNodePoolUpgradeRequest + rollbacks the previously Aborted or + Failed NodePool upgrade. This will be an + no-op if the last upgrade successfully + completed. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster to rollback. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (:class:`str`): + Required. Deprecated. The name of the + node pool to rollback. This field has + been deprecated and replaced by the name + field. + + This corresponds to the ``node_pool_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.RollbackNodePoolUpgradeRequest): + request = cluster_service.RollbackNodePoolUpgradeRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.rollback_node_pool_upgrade] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_node_pool_management(self, + request: Optional[Union[cluster_service.SetNodePoolManagementRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + management: Optional[cluster_service.NodeManagement] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the NodeManagement options for a node pool. + + .. 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 import container_v1beta1 + + async def sample_set_node_pool_management(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNodePoolManagementRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = await client.set_node_pool_management(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.SetNodePoolManagementRequest, dict]]): + The request object. SetNodePoolManagementRequest sets the + node management properties of a node + pool. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster to update. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (:class:`str`): + Required. Deprecated. The name of the + node pool to update. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``node_pool_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + management (:class:`google.cloud.container_v1beta1.types.NodeManagement`): + Required. NodeManagement + configuration for the node pool. + + This corresponds to the ``management`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_pool_id, management]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNodePoolManagementRequest): + request = cluster_service.SetNodePoolManagementRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + if management is not None: + request.management = management + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_node_pool_management] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_labels(self, + request: Optional[Union[cluster_service.SetLabelsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + resource_labels: Optional[MutableMapping[str, str]] = None, + label_fingerprint: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets labels on a cluster. + + .. 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 import container_v1beta1 + + async def sample_set_labels(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLabelsRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + label_fingerprint="label_fingerprint_value", + ) + + # Make the request + response = await client.set_labels(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.SetLabelsRequest, dict]]): + The request object. SetLabelsRequest sets the Google + Cloud Platform labels on a Google + Container Engine cluster, which will in + turn set them for Google Compute Engine + resources used by that cluster + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + resource_labels (:class:`MutableMapping[str, str]`): + Required. The labels to set for that + cluster. + + This corresponds to the ``resource_labels`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + label_fingerprint (:class:`str`): + Required. The fingerprint of the previous set of labels + for this resource, used to detect conflicts. The + fingerprint is initially generated by Kubernetes Engine + and changes after every request to modify or update + labels. You must always provide an up-to-date + fingerprint hash when updating or changing labels. Make + a ``get()`` request to the resource to get the latest + fingerprint. + + This corresponds to the ``label_fingerprint`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, resource_labels, label_fingerprint]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLabelsRequest): + request = cluster_service.SetLabelsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if label_fingerprint is not None: + request.label_fingerprint = label_fingerprint + + if resource_labels: + request.resource_labels.update(resource_labels) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_labels] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_legacy_abac(self, + request: Optional[Union[cluster_service.SetLegacyAbacRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + enabled: Optional[bool] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Enables or disables the ABAC authorization mechanism + on a cluster. + + .. 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 import container_v1beta1 + + async def sample_set_legacy_abac(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLegacyAbacRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + enabled=True, + ) + + # Make the request + response = await client.set_legacy_abac(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.SetLegacyAbacRequest, dict]]): + The request object. SetLegacyAbacRequest enables or + disables the ABAC authorization + mechanism for a cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster to update. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + enabled (:class:`bool`): + Required. Whether ABAC authorization + will be enabled in the cluster. + + This corresponds to the ``enabled`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, enabled]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLegacyAbacRequest): + request = cluster_service.SetLegacyAbacRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if enabled is not None: + request.enabled = enabled + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_legacy_abac] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def start_ip_rotation(self, + request: Optional[Union[cluster_service.StartIPRotationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Starts master IP rotation. + + .. 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 import container_v1beta1 + + async def sample_start_ip_rotation(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.StartIPRotationRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.start_ip_rotation(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.StartIPRotationRequest, dict]]): + The request object. StartIPRotationRequest creates a new + IP for the cluster and then performs a + node upgrade on each node pool to point + to the new IP. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.StartIPRotationRequest): + request = cluster_service.StartIPRotationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.start_ip_rotation] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def complete_ip_rotation(self, + request: Optional[Union[cluster_service.CompleteIPRotationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Completes master IP rotation. + + .. 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 import container_v1beta1 + + async def sample_complete_ip_rotation(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CompleteIPRotationRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.complete_ip_rotation(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.CompleteIPRotationRequest, dict]]): + The request object. CompleteIPRotationRequest moves the + cluster master back into single-IP mode. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CompleteIPRotationRequest): + request = cluster_service.CompleteIPRotationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.complete_ip_rotation] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_node_pool_size(self, + request: Optional[Union[cluster_service.SetNodePoolSizeRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""SetNodePoolSizeRequest sets the size of a node pool. The new + size will be used for all replicas, including future replicas + created by modifying + [NodePool.locations][google.container.v1beta1.NodePool.locations]. + + .. 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 import container_v1beta1 + + async def sample_set_node_pool_size(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNodePoolSizeRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + node_count=1070, + ) + + # Make the request + response = await client.set_node_pool_size(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.SetNodePoolSizeRequest, dict]]): + The request object. SetNodePoolSizeRequest sets the size + of a node pool. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNodePoolSizeRequest): + request = cluster_service.SetNodePoolSizeRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_node_pool_size] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_network_policy(self, + request: Optional[Union[cluster_service.SetNetworkPolicyRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + network_policy: Optional[cluster_service.NetworkPolicy] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Enables or disables Network Policy for a cluster. + + .. 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 import container_v1beta1 + + async def sample_set_network_policy(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNetworkPolicyRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.set_network_policy(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.SetNetworkPolicyRequest, dict]]): + The request object. SetNetworkPolicyRequest + enables/disables network policy for a + cluster. + project_id (:class:`str`): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + network_policy (:class:`google.cloud.container_v1beta1.types.NetworkPolicy`): + Required. Configuration options for + the NetworkPolicy feature. + + This corresponds to the ``network_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, network_policy]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNetworkPolicyRequest): + request = cluster_service.SetNetworkPolicyRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if network_policy is not None: + request.network_policy = network_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_network_policy] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def set_maintenance_policy(self, + request: Optional[Union[cluster_service.SetMaintenancePolicyRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + maintenance_policy: Optional[cluster_service.MaintenancePolicy] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the maintenance policy for a cluster. + + .. 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 import container_v1beta1 + + async def sample_set_maintenance_policy(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetMaintenancePolicyRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.set_maintenance_policy(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.SetMaintenancePolicyRequest, dict]]): + The request object. SetMaintenancePolicyRequest sets the + maintenance policy for a cluster. + project_id (:class:`str`): + Required. The Google Developers Console `project ID or + project + number `__. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (:class:`str`): + Required. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (:class:`str`): + Required. The name of the cluster to + update. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + maintenance_policy (:class:`google.cloud.container_v1beta1.types.MaintenancePolicy`): + Required. The maintenance policy to + be set for the cluster. An empty field + clears the existing maintenance policy. + + This corresponds to the ``maintenance_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, maintenance_policy]) + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetMaintenancePolicyRequest): + request = cluster_service.SetMaintenancePolicyRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if maintenance_policy is not None: + request.maintenance_policy = maintenance_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.set_maintenance_policy] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_usable_subnetworks(self, + request: Optional[Union[cluster_service.ListUsableSubnetworksRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> pagers.ListUsableSubnetworksAsyncPager: + r"""Lists subnetworks that can be used for creating + clusters in a project. + + .. 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 import container_v1beta1 + + async def sample_list_usable_subnetworks(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.ListUsableSubnetworksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_usable_subnetworks(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.ListUsableSubnetworksRequest, dict]]): + The request object. ListUsableSubnetworksRequest requests + the list of usable subnetworks. + available to a user for creating + clusters. + parent (:class:`str`): + Required. The parent project where subnetworks are + usable. Specified in the format ``projects/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.services.cluster_manager.pagers.ListUsableSubnetworksAsyncPager: + ListUsableSubnetworksResponse is the + response of + ListUsableSubnetworksRequest. + + 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListUsableSubnetworksRequest): + request = cluster_service.ListUsableSubnetworksRequest(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._client._transport._wrapped_methods[self._client._transport.list_usable_subnetworks] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # 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.ListUsableSubnetworksAsyncPager( + method=rpc, + request=request, + response=response, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def check_autopilot_compatibility(self, + request: Optional[Union[cluster_service.CheckAutopilotCompatibilityRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.CheckAutopilotCompatibilityResponse: + r"""Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + .. 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 import container_v1beta1 + + async def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = await client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityRequest, dict]]): + The request object. CheckAutopilotCompatibilityRequest + requests getting the blockers for the + given operation in the cluster. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityResponse: + CheckAutopilotCompatibilityResponse + has a list of compatibility issues. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CheckAutopilotCompatibilityRequest): + request = cluster_service.CheckAutopilotCompatibilityRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._client._transport._wrapped_methods[self._client._transport.check_autopilot_compatibility] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_locations(self, + request: Optional[Union[cluster_service.ListLocationsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListLocationsResponse: + r"""Fetches locations that offer Google Kubernetes + Engine. + + .. 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 import container_v1beta1 + + async def sample_list_locations(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.ListLocationsRequest( + parent="parent_value", + ) + + # Make the request + response = await client.list_locations(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.ListLocationsRequest, dict]]): + The request object. ListLocationsRequest is used to + request the locations that offer GKE. + parent (:class:`str`): + Required. Contains the name of the resource requested. + Specified in the format ``projects/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.ListLocationsResponse: + ListLocationsResponse returns the + list of all GKE locations and their + recommendation state. + + """ + # 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.") + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListLocationsRequest): + request = cluster_service.ListLocationsRequest(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._client._transport._wrapped_methods[self._client._transport.list_locations] + + # 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), + )), + ) + + # Validate the universe domain. + self._client._validate_universe_domain() + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def __aenter__(self) -> "ClusterManagerAsyncClient": + 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__ = ( + "ClusterManagerAsyncClient", +) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/client.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/client.py new file mode 100644 index 000000000000..8429099a5e51 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/client.py @@ -0,0 +1,5189 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 logging as std_logging +import os +import re +from typing import Dict, Callable, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast +import warnings + +from google.cloud.container_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, None] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object, None] # type: ignore + +try: + from google.api_core import client_logging # type: ignore + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + +from google.cloud.container_v1beta1.services.cluster_manager import pagers +from google.cloud.container_v1beta1.types import cluster_service +from google.rpc import status_pb2 # type: ignore +from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import ClusterManagerGrpcTransport +from .transports.grpc_asyncio import ClusterManagerGrpcAsyncIOTransport + + +class ClusterManagerClientMeta(type): + """Metaclass for the ClusterManager 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[ClusterManagerTransport]] + _transport_registry["grpc"] = ClusterManagerGrpcTransport + _transport_registry["grpc_asyncio"] = ClusterManagerGrpcAsyncIOTransport + + def get_transport_class(cls, + label: Optional[str] = None, + ) -> Type[ClusterManagerTransport]: + """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 ClusterManagerClient(metaclass=ClusterManagerClientMeta): + """Google Kubernetes Engine Cluster Manager v1beta1""" + + @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") + + # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead. + DEFAULT_ENDPOINT = "container.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + _DEFAULT_ENDPOINT_TEMPLATE = "container.{UNIVERSE_DOMAIN}" + _DEFAULT_UNIVERSE = "googleapis.com" + + @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: + ClusterManagerClient: 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: + ClusterManagerClient: 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) -> ClusterManagerTransport: + """Returns the transport used by the client instance. + + Returns: + ClusterManagerTransport: The transport used by the client + instance. + """ + return self._transport + + @staticmethod + def topic_path(project: str,topic: str,) -> str: + """Returns a fully-qualified topic string.""" + return "projects/{project}/topics/{topic}".format(project=project, topic=topic, ) + + @staticmethod + def parse_topic_path(path: str) -> Dict[str,str]: + """Parses a topic path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/topics/(?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): + """Deprecated. 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. + """ + + warnings.warn("get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.", + DeprecationWarning) + 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 + + @staticmethod + def _read_environment_variables(): + """Returns the environment variables used by the client. + + Returns: + Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE, + GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables. + + Raises: + ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not + any of ["true", "false"]. + google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT + is not any of ["auto", "never", "always"]. + """ + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false").lower() + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower() + universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN") + 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`") + return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + + @staticmethod + def _get_client_cert_source(provided_cert_source, use_cert_flag): + """Return the client cert source to be used by the client. + + Args: + provided_cert_source (bytes): The client certificate source provided. + use_cert_flag (bool): A flag indicating whether to use the client certificate. + + Returns: + bytes or None: The client cert source to be used by the client. + """ + client_cert_source = None + if use_cert_flag: + if provided_cert_source: + client_cert_source = provided_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + return client_cert_source + + @staticmethod + def _get_api_endpoint(api_override, client_cert_source, universe_domain, use_mtls_endpoint): + """Return the API endpoint used by the client. + + Args: + api_override (str): The API endpoint override. If specified, this is always + the return value of this function and the other arguments are not used. + client_cert_source (bytes): The client certificate source used by the client. + universe_domain (str): The universe domain used by the client. + use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters. + Possible values are "always", "auto", or "never". + + Returns: + str: The API endpoint to be used by the client. + """ + if api_override is not None: + api_endpoint = api_override + elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): + _default_universe = ClusterManagerClient._DEFAULT_UNIVERSE + if universe_domain != _default_universe: + raise MutualTLSChannelError(f"mTLS is not supported in any universe other than {_default_universe}.") + api_endpoint = ClusterManagerClient.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=universe_domain) + return api_endpoint + + @staticmethod + def _get_universe_domain(client_universe_domain: Optional[str], universe_domain_env: Optional[str]) -> str: + """Return the universe domain used by the client. + + Args: + client_universe_domain (Optional[str]): The universe domain configured via the client options. + universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable. + + Returns: + str: The universe domain to be used by the client. + + Raises: + ValueError: If the universe domain is an empty string. + """ + universe_domain = ClusterManagerClient._DEFAULT_UNIVERSE + if client_universe_domain is not None: + universe_domain = client_universe_domain + elif universe_domain_env is not None: + universe_domain = universe_domain_env + if len(universe_domain.strip()) == 0: + raise ValueError("Universe Domain cannot be an empty string.") + return universe_domain + + def _validate_universe_domain(self): + """Validates client's and credentials' universe domains are consistent. + + Returns: + bool: True iff the configured universe domain is valid. + + Raises: + ValueError: If the configured universe domain is not valid. + """ + + # NOTE (b/349488459): universe validation is disabled until further notice. + return True + + @property + def api_endpoint(self): + """Return the API endpoint used by the client instance. + + Returns: + str: The API endpoint used by the client instance. + """ + return self._api_endpoint + + @property + def universe_domain(self) -> str: + """Return the universe domain used by the client instance. + + Returns: + str: The universe domain used by the client instance. + """ + return self._universe_domain + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Optional[Union[str, ClusterManagerTransport, Callable[..., ClusterManagerTransport]]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the cluster manager 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 (Optional[Union[str,ClusterManagerTransport,Callable[..., ClusterManagerTransport]]]): + The transport to use, or a Callable that constructs and returns a new transport. + If a Callable is given, it will be called with the same set of initialization + arguments as used in the ClusterManagerTransport constructor. + 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. + + 1. The ``api_endpoint`` property can be used to override the + default endpoint provided by the client when ``transport`` is + not explicitly provided. Only if this property is not set and + ``transport`` was not explicitly provided, the endpoint is + determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment + variable, which have one of the following values: + "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). + + 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide a client certificate for mTLS 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. + + 3. The ``universe_domain`` property can be used to override the + default "googleapis.com" universe. Note that the ``api_endpoint`` + property still takes precedence; and ``universe_domain`` is + currently not supported for mTLS. + + 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. + """ + self._client_options = client_options + if isinstance(self._client_options, dict): + self._client_options = client_options_lib.from_dict(self._client_options) + if self._client_options is None: + self._client_options = client_options_lib.ClientOptions() + self._client_options = cast(client_options_lib.ClientOptions, self._client_options) + + universe_domain_opt = getattr(self._client_options, 'universe_domain', None) + + self._use_client_cert, self._use_mtls_endpoint, self._universe_domain_env = ClusterManagerClient._read_environment_variables() + self._client_cert_source = ClusterManagerClient._get_client_cert_source(self._client_options.client_cert_source, self._use_client_cert) + self._universe_domain = ClusterManagerClient._get_universe_domain(universe_domain_opt, self._universe_domain_env) + self._api_endpoint = None # updated below, depending on `transport` + + # Initialize the universe domain validation. + self._is_universe_domain_valid = False + + if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER + # Setup logging. + client_logging.initialize_logging() + + api_key_value = getattr(self._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. + transport_provided = isinstance(transport, ClusterManagerTransport) + if transport_provided: + # transport is a ClusterManagerTransport instance. + if credentials or self._client_options.credentials_file or api_key_value: + raise ValueError("When providing a transport instance, " + "provide its credentials directly.") + if self._client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = cast(ClusterManagerTransport, transport) + self._api_endpoint = self._transport.host + + self._api_endpoint = (self._api_endpoint or + ClusterManagerClient._get_api_endpoint( + self._client_options.api_endpoint, + self._client_cert_source, + self._universe_domain, + self._use_mtls_endpoint)) + + if not transport_provided: + 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_init: Union[Type[ClusterManagerTransport], Callable[..., ClusterManagerTransport]] = ( + ClusterManagerClient.get_transport_class(transport) + if isinstance(transport, str) or transport is None + else cast(Callable[..., ClusterManagerTransport], transport) + ) + # initialize with the provided callable or the passed in class + self._transport = transport_init( + credentials=credentials, + credentials_file=self._client_options.credentials_file, + host=self._api_endpoint, + scopes=self._client_options.scopes, + client_cert_source_for_mtls=self._client_cert_source, + quota_project_id=self._client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + api_audience=self._client_options.api_audience, + ) + + if "async" not in str(self._transport): + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.container_v1beta1.ClusterManagerClient`.", + extra = { + "serviceName": "google.container.v1beta1.ClusterManager", + "universeDomain": getattr(self._transport._credentials, "universe_domain", ""), + "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}", + "credentialsInfo": getattr(self.transport._credentials, "get_cred_info", lambda: None)(), + } if hasattr(self._transport, "_credentials") else { + "serviceName": "google.container.v1beta1.ClusterManager", + "credentialsType": None, + } + ) + + def list_clusters(self, + request: Optional[Union[cluster_service.ListClustersRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListClustersResponse: + r"""Lists all clusters owned by a project in either the + specified zone or all zones. + + .. 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 import container_v1beta1 + + def sample_list_clusters(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.ListClustersRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = client.list_clusters(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.ListClustersRequest, dict]): + The request object. ListClustersRequest lists clusters. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides, or "-" for all zones. This + field has been deprecated and replaced by the parent + field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.ListClustersResponse: + ListClustersResponse is the result of + ListClustersRequest. + + """ + # 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([project_id, zone]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListClustersRequest): + request = cluster_service.ListClustersRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_clusters] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_cluster(self, + request: Optional[Union[cluster_service.GetClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Cluster: + r"""Gets the details for a specific cluster. + + .. 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 import container_v1beta1 + + def sample_get_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.GetClusterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.get_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.GetClusterRequest, dict]): + The request object. GetClusterRequest gets the settings + of a cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster to retrieve. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Cluster: + A Google Kubernetes Engine cluster. + """ + # 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([project_id, zone, cluster_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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetClusterRequest): + request = cluster_service.GetClusterRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_cluster(self, + request: Optional[Union[cluster_service.CreateClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster: Optional[cluster_service.Cluster] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Creates a cluster, consisting of the specified number and type + of Google Compute Engine instances. + + By default, the cluster is created in the project's `default + network `__. + + One firewall is added for the cluster. After cluster creation, + the Kubelet creates routes for each node to allow the containers + on that node to communicate with all other instances in the + cluster. + + Finally, an entry is added to the project's global metadata + indicating which CIDR range the cluster is using. + + .. 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 import container_v1beta1 + + def sample_create_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CreateClusterRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = client.create_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.CreateClusterRequest, dict]): + The request object. CreateClusterRequest creates a + cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the parent field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster (google.cloud.container_v1beta1.types.Cluster): + Required. A `cluster + resource `__ + + This corresponds to the ``cluster`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CreateClusterRequest): + request = cluster_service.CreateClusterRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster is not None: + request.cluster = cluster + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_cluster(self, + request: Optional[Union[cluster_service.UpdateClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + update: Optional[cluster_service.ClusterUpdate] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Updates the settings for a specific cluster. + + .. 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 import container_v1beta1 + + def sample_update_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.UpdateClusterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.update_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.UpdateClusterRequest, dict]): + The request object. UpdateClusterRequest updates the + settings of a cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update (google.cloud.container_v1beta1.types.ClusterUpdate): + Required. A description of the + update. + + This corresponds to the ``update`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, update]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.UpdateClusterRequest): + request = cluster_service.UpdateClusterRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if update is not None: + request.update = update + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_node_pool(self, + request: Optional[Union[cluster_service.UpdateNodePoolRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Updates the version and/or image type of a specific + node pool. + + .. 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 import container_v1beta1 + + def sample_update_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.UpdateNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + node_version="node_version_value", + image_type="image_type_value", + ) + + # Make the request + response = client.update_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.UpdateNodePoolRequest, dict]): + The request object. SetNodePoolVersionRequest updates the + version of a node pool. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.UpdateNodePoolRequest): + request = cluster_service.UpdateNodePoolRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_node_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_node_pool_autoscaling(self, + request: Optional[Union[cluster_service.SetNodePoolAutoscalingRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the autoscaling settings of a specific node + pool. + + .. 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 import container_v1beta1 + + def sample_set_node_pool_autoscaling(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNodePoolAutoscalingRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = client.set_node_pool_autoscaling(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.SetNodePoolAutoscalingRequest, dict]): + The request object. SetNodePoolAutoscalingRequest sets + the autoscaler settings of a node pool. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNodePoolAutoscalingRequest): + request = cluster_service.SetNodePoolAutoscalingRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_node_pool_autoscaling] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_logging_service(self, + request: Optional[Union[cluster_service.SetLoggingServiceRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + logging_service: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the logging service for a specific cluster. + + .. 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 import container_v1beta1 + + def sample_set_logging_service(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLoggingServiceRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + logging_service="logging_service_value", + ) + + # Make the request + response = client.set_logging_service(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.SetLoggingServiceRequest, dict]): + The request object. SetLoggingServiceRequest sets the + logging service of a cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + logging_service (str): + Required. The logging service the cluster should use to + write logs. Currently available options: + + - ``logging.googleapis.com/kubernetes`` - The Cloud + Logging service with a Kubernetes-native resource + model + - ``logging.googleapis.com`` - The legacy Cloud Logging + service (no longer available as of GKE 1.15). + - ``none`` - no logs will be exported from the cluster. + + If left as an empty + string,\ ``logging.googleapis.com/kubernetes`` will be + used for GKE 1.14+ or ``logging.googleapis.com`` for + earlier versions. + + This corresponds to the ``logging_service`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, logging_service]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLoggingServiceRequest): + request = cluster_service.SetLoggingServiceRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if logging_service is not None: + request.logging_service = logging_service + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_logging_service] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_monitoring_service(self, + request: Optional[Union[cluster_service.SetMonitoringServiceRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + monitoring_service: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the monitoring service for a specific cluster. + + .. 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 import container_v1beta1 + + def sample_set_monitoring_service(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetMonitoringServiceRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + monitoring_service="monitoring_service_value", + ) + + # Make the request + response = client.set_monitoring_service(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.SetMonitoringServiceRequest, dict]): + The request object. SetMonitoringServiceRequest sets the + monitoring service of a cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + monitoring_service (str): + Required. The monitoring service the cluster should use + to write metrics. Currently available options: + + - "monitoring.googleapis.com/kubernetes" - The Cloud + Monitoring service with a Kubernetes-native resource + model + - ``monitoring.googleapis.com`` - The legacy Cloud + Monitoring service (no longer available as of GKE + 1.15). + - ``none`` - No metrics will be exported from the + cluster. + + If left as an empty + string,\ ``monitoring.googleapis.com/kubernetes`` will + be used for GKE 1.14+ or ``monitoring.googleapis.com`` + for earlier versions. + + This corresponds to the ``monitoring_service`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, monitoring_service]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetMonitoringServiceRequest): + request = cluster_service.SetMonitoringServiceRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if monitoring_service is not None: + request.monitoring_service = monitoring_service + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_monitoring_service] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_addons_config(self, + request: Optional[Union[cluster_service.SetAddonsConfigRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + addons_config: Optional[cluster_service.AddonsConfig] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the addons for a specific cluster. + + .. 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 import container_v1beta1 + + def sample_set_addons_config(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetAddonsConfigRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.set_addons_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.SetAddonsConfigRequest, dict]): + The request object. SetAddonsRequest sets the addons + associated with the cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + addons_config (google.cloud.container_v1beta1.types.AddonsConfig): + Required. The desired configurations + for the various addons available to run + in the cluster. + + This corresponds to the ``addons_config`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, addons_config]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetAddonsConfigRequest): + request = cluster_service.SetAddonsConfigRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if addons_config is not None: + request.addons_config = addons_config + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_addons_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_locations(self, + request: Optional[Union[cluster_service.SetLocationsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + locations: Optional[MutableSequence[str]] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the locations for a specific cluster. Deprecated. Use + `projects.locations.clusters.update `__ + instead. + + .. 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 import container_v1beta1 + + def sample_set_locations(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLocationsRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + locations=['locations_value1', 'locations_value2'], + ) + + # Make the request + response = client.set_locations(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.SetLocationsRequest, dict]): + The request object. SetLocationsRequest sets the + locations of the cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + locations (MutableSequence[str]): + Required. The desired list of Google Compute Engine + `zones `__ + in which the cluster's nodes should be located. Changing + the locations a cluster is in will result in nodes being + either created or removed from the cluster, depending on + whether locations are being added or removed. + + This list must always include the cluster's primary + zone. + + This corresponds to the ``locations`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + warnings.warn("ClusterManagerClient.set_locations is deprecated", + DeprecationWarning) + + # 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([project_id, zone, cluster_id, locations]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLocationsRequest): + request = cluster_service.SetLocationsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if locations is not None: + request.locations = locations + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_locations] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_master(self, + request: Optional[Union[cluster_service.UpdateMasterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + master_version: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Updates the master for a specific cluster. + + .. 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 import container_v1beta1 + + def sample_update_master(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.UpdateMasterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + master_version="master_version_value", + ) + + # Make the request + response = client.update_master(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.UpdateMasterRequest, dict]): + The request object. UpdateMasterRequest updates the + master of the cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster to upgrade. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + master_version (str): + Required. The Kubernetes version to + change the master to. + Users may specify either explicit + versions offered by Kubernetes Engine or + version aliases, which have the + following behavior: + + - "latest": picks the highest valid + Kubernetes version + - "1.X": picks the highest valid + patch+gke.N patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N + patch in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit + Kubernetes version + - "-": picks the default Kubernetes + version + + This corresponds to the ``master_version`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, master_version]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.UpdateMasterRequest): + request = cluster_service.UpdateMasterRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if master_version is not None: + request.master_version = master_version + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_master] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_master_auth(self, + request: Optional[Union[cluster_service.SetMasterAuthRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets master auth materials. Currently supports + changing the admin password or a specific cluster, + either via password generation or explicitly setting the + password. + + .. 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 import container_v1beta1 + + def sample_set_master_auth(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetMasterAuthRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + action="SET_USERNAME", + ) + + # Make the request + response = client.set_master_auth(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.SetMasterAuthRequest, dict]): + The request object. SetMasterAuthRequest updates the + admin password of a cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetMasterAuthRequest): + request = cluster_service.SetMasterAuthRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_master_auth] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_cluster(self, + request: Optional[Union[cluster_service.DeleteClusterRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Deletes the cluster, including the Kubernetes + endpoint and all worker nodes. + + Firewalls and routes that were configured during cluster + creation are also deleted. + + Other Google Compute Engine resources that might be in + use by the cluster, such as load balancer resources, are + not deleted if they weren't present when the cluster was + initially created. + + .. 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 import container_v1beta1 + + def sample_delete_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.DeleteClusterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.delete_cluster(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.DeleteClusterRequest, dict]): + The request object. DeleteClusterRequest deletes a + cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster to delete. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.DeleteClusterRequest): + request = cluster_service.DeleteClusterRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_cluster] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_operations(self, + request: Optional[Union[cluster_service.ListOperationsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListOperationsResponse: + r"""Lists all operations in a project in the specified + zone or all zones. + + .. 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 import container_v1beta1 + + def sample_list_operations(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.ListOperationsRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = client.list_operations(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.ListOperationsRequest, dict]): + The request object. ListOperationsRequest lists + operations. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + to return operations for, or ``-`` for all zones. This + field has been deprecated and replaced by the parent + field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.ListOperationsResponse: + ListOperationsResponse is the result + of ListOperationsRequest. + + """ + # 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([project_id, zone]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListOperationsRequest): + request = cluster_service.ListOperationsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_operations] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_operation(self, + request: Optional[Union[cluster_service.GetOperationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + operation_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Gets the specified operation. + + .. 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 import container_v1beta1 + + def sample_get_operation(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.GetOperationRequest( + project_id="project_id_value", + zone="zone_value", + operation_id="operation_id_value", + ) + + # Make the request + response = client.get_operation(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.GetOperationRequest, dict]): + The request object. GetOperationRequest gets a single + operation. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + operation_id (str): + Required. Deprecated. The server-assigned ``name`` of + the operation. This field has been deprecated and + replaced by the name field. + + This corresponds to the ``operation_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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, operation_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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetOperationRequest): + request = cluster_service.GetOperationRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if operation_id is not None: + request.operation_id = operation_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_operation] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def cancel_operation(self, + request: Optional[Union[cluster_service.CancelOperationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + operation_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> None: + r"""Cancels the specified operation. + + .. 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 import container_v1beta1 + + def sample_cancel_operation(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CancelOperationRequest( + project_id="project_id_value", + zone="zone_value", + operation_id="operation_id_value", + ) + + # Make the request + client.cancel_operation(request=request) + + Args: + request (Union[google.cloud.container_v1beta1.types.CancelOperationRequest, dict]): + The request object. CancelOperationRequest cancels a + single operation. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the operation resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + operation_id (str): + Required. Deprecated. The server-assigned ``name`` of + the operation. This field has been deprecated and + replaced by the name field. + + This corresponds to the ``operation_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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + # 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([project_id, zone, operation_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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CancelOperationRequest): + request = cluster_service.CancelOperationRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if operation_id is not None: + request.operation_id = operation_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.cancel_operation] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + def get_server_config(self, + request: Optional[Union[cluster_service.GetServerConfigRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ServerConfig: + r"""Returns configuration info about the Google + Kubernetes Engine service. + + .. 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 import container_v1beta1 + + def sample_get_server_config(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.GetServerConfigRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = client.get_server_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.GetServerConfigRequest, dict]): + The request object. Gets the current Kubernetes Engine + service configuration. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + to return operations for. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.ServerConfig: + Kubernetes Engine service + configuration. + + """ + # 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([project_id, zone]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetServerConfigRequest): + request = cluster_service.GetServerConfigRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_server_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_json_web_keys(self, + request: Optional[Union[cluster_service.GetJSONWebKeysRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.GetJSONWebKeysResponse: + r"""Gets the public component of the cluster signing keys + in JSON Web Key format. + + .. 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 import container_v1beta1 + + def sample_get_json_web_keys(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.GetJSONWebKeysRequest( + ) + + # Make the request + response = client.get_json_web_keys(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.GetJSONWebKeysRequest, dict]): + The request object. GetJSONWebKeysRequest gets the public component of the + keys used by the cluster to sign token requests. This + will be the jwks_uri for the discover document returned + by getOpenIDConfig. See the OpenID Connect Discovery 1.0 + specification for details. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.GetJSONWebKeysResponse: + GetJSONWebKeysResponse is a valid + JSON Web Key Set as specififed in rfc + 7517 + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetJSONWebKeysRequest): + request = cluster_service.GetJSONWebKeysRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_json_web_keys] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_node_pools(self, + request: Optional[Union[cluster_service.ListNodePoolsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListNodePoolsResponse: + r"""Lists the node pools for a cluster. + + .. 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 import container_v1beta1 + + def sample_list_node_pools(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.ListNodePoolsRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.list_node_pools(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.ListNodePoolsRequest, dict]): + The request object. ListNodePoolsRequest lists the node + pool(s) for a cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the parent field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the parent field. + + This corresponds to the ``cluster_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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.ListNodePoolsResponse: + ListNodePoolsResponse is the result + of ListNodePoolsRequest. + + """ + # 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([project_id, zone, cluster_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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListNodePoolsRequest): + request = cluster_service.ListNodePoolsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_node_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_node_pool(self, + request: Optional[Union[cluster_service.GetNodePoolRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.NodePool: + r"""Retrieves the requested node pool. + + .. 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 import container_v1beta1 + + def sample_get_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.GetNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = client.get_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.GetNodePoolRequest, dict]): + The request object. GetNodePoolRequest retrieves a node + pool for a cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (str): + Required. Deprecated. The name of the + node pool. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``node_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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.NodePool: + NodePool contains the name and + configuration for a cluster's node pool. + Node pools are a set of nodes (i.e. + VM's), with a common configuration and + specification, under the control of the + cluster master. They may have a set of + Kubernetes labels applied to them, which + may be used to reference them during pod + scheduling. They may also be resized up + or down, to accommodate the workload. + + """ + # 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([project_id, zone, cluster_id, node_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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.GetNodePoolRequest): + request = cluster_service.GetNodePoolRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_node_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_node_pool(self, + request: Optional[Union[cluster_service.CreateNodePoolRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool: Optional[cluster_service.NodePool] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Creates a node pool for a cluster. + + .. 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 import container_v1beta1 + + def sample_create_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CreateNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.create_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.CreateNodePoolRequest, dict]): + The request object. CreateNodePoolRequest creates a node + pool for a cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the + parent field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the parent field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the parent field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool (google.cloud.container_v1beta1.types.NodePool): + Required. The node pool to create. + This corresponds to the ``node_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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CreateNodePoolRequest): + request = cluster_service.CreateNodePoolRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool is not None: + request.node_pool = node_pool + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_node_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_node_pool(self, + request: Optional[Union[cluster_service.DeleteNodePoolRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Deletes a node pool from a cluster. + + .. 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 import container_v1beta1 + + def sample_delete_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.DeleteNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = client.delete_node_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.DeleteNodePoolRequest, dict]): + The request object. DeleteNodePoolRequest deletes a node + pool for a cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (str): + Required. Deprecated. The name of the + node pool to delete. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``node_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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.DeleteNodePoolRequest): + request = cluster_service.DeleteNodePoolRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_node_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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def complete_node_pool_upgrade(self, + request: Optional[Union[cluster_service.CompleteNodePoolUpgradeRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> None: + r"""CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + .. 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 import container_v1beta1 + + def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + client.complete_node_pool_upgrade(request=request) + + Args: + request (Union[google.cloud.container_v1beta1.types.CompleteNodePoolUpgradeRequest, dict]): + The request object. CompleteNodePoolUpgradeRequest sets + the name of target node pool to complete + upgrade. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CompleteNodePoolUpgradeRequest): + request = cluster_service.CompleteNodePoolUpgradeRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.complete_node_pool_upgrade] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + def rollback_node_pool_upgrade(self, + request: Optional[Union[cluster_service.RollbackNodePoolUpgradeRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Rolls back a previously Aborted or Failed NodePool + upgrade. This makes no changes if the last upgrade + successfully completed. + + .. 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 import container_v1beta1 + + def sample_rollback_node_pool_upgrade(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.RollbackNodePoolUpgradeRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = client.rollback_node_pool_upgrade(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.RollbackNodePoolUpgradeRequest, dict]): + The request object. RollbackNodePoolUpgradeRequest + rollbacks the previously Aborted or + Failed NodePool upgrade. This will be an + no-op if the last upgrade successfully + completed. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster to rollback. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (str): + Required. Deprecated. The name of the + node pool to rollback. This field has + been deprecated and replaced by the name + field. + + This corresponds to the ``node_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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.RollbackNodePoolUpgradeRequest): + request = cluster_service.RollbackNodePoolUpgradeRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.rollback_node_pool_upgrade] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_node_pool_management(self, + request: Optional[Union[cluster_service.SetNodePoolManagementRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + node_pool_id: Optional[str] = None, + management: Optional[cluster_service.NodeManagement] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the NodeManagement options for a node pool. + + .. 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 import container_v1beta1 + + def sample_set_node_pool_management(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNodePoolManagementRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = client.set_node_pool_management(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.SetNodePoolManagementRequest, dict]): + The request object. SetNodePoolManagementRequest sets the + node management properties of a node + pool. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster to update. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + node_pool_id (str): + Required. Deprecated. The name of the + node pool to update. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``node_pool_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + management (google.cloud.container_v1beta1.types.NodeManagement): + Required. NodeManagement + configuration for the node pool. + + This corresponds to the ``management`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, node_pool_id, management]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNodePoolManagementRequest): + request = cluster_service.SetNodePoolManagementRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if node_pool_id is not None: + request.node_pool_id = node_pool_id + if management is not None: + request.management = management + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_node_pool_management] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_labels(self, + request: Optional[Union[cluster_service.SetLabelsRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + resource_labels: Optional[MutableMapping[str, str]] = None, + label_fingerprint: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets labels on a cluster. + + .. 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 import container_v1beta1 + + def sample_set_labels(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLabelsRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + label_fingerprint="label_fingerprint_value", + ) + + # Make the request + response = client.set_labels(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.SetLabelsRequest, dict]): + The request object. SetLabelsRequest sets the Google + Cloud Platform labels on a Google + Container Engine cluster, which will in + turn set them for Google Compute Engine + resources used by that cluster + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + resource_labels (MutableMapping[str, str]): + Required. The labels to set for that + cluster. + + This corresponds to the ``resource_labels`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + label_fingerprint (str): + Required. The fingerprint of the previous set of labels + for this resource, used to detect conflicts. The + fingerprint is initially generated by Kubernetes Engine + and changes after every request to modify or update + labels. You must always provide an up-to-date + fingerprint hash when updating or changing labels. Make + a ``get()`` request to the resource to get the latest + fingerprint. + + This corresponds to the ``label_fingerprint`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, resource_labels, label_fingerprint]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLabelsRequest): + request = cluster_service.SetLabelsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if resource_labels is not None: + request.resource_labels = resource_labels + if label_fingerprint is not None: + request.label_fingerprint = label_fingerprint + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_labels] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_legacy_abac(self, + request: Optional[Union[cluster_service.SetLegacyAbacRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + enabled: Optional[bool] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Enables or disables the ABAC authorization mechanism + on a cluster. + + .. 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 import container_v1beta1 + + def sample_set_legacy_abac(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLegacyAbacRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + enabled=True, + ) + + # Make the request + response = client.set_legacy_abac(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.SetLegacyAbacRequest, dict]): + The request object. SetLegacyAbacRequest enables or + disables the ABAC authorization + mechanism for a cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster to update. This field has been + deprecated and replaced by the name + field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + enabled (bool): + Required. Whether ABAC authorization + will be enabled in the cluster. + + This corresponds to the ``enabled`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, enabled]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetLegacyAbacRequest): + request = cluster_service.SetLegacyAbacRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if enabled is not None: + request.enabled = enabled + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_legacy_abac] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def start_ip_rotation(self, + request: Optional[Union[cluster_service.StartIPRotationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Starts master IP rotation. + + .. 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 import container_v1beta1 + + def sample_start_ip_rotation(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.StartIPRotationRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.start_ip_rotation(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.StartIPRotationRequest, dict]): + The request object. StartIPRotationRequest creates a new + IP for the cluster and then performs a + node upgrade on each node pool to point + to the new IP. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``cluster_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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.StartIPRotationRequest): + request = cluster_service.StartIPRotationRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.start_ip_rotation] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def complete_ip_rotation(self, + request: Optional[Union[cluster_service.CompleteIPRotationRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Completes master IP rotation. + + .. 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 import container_v1beta1 + + def sample_complete_ip_rotation(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CompleteIPRotationRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.complete_ip_rotation(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.CompleteIPRotationRequest, dict]): + The request object. CompleteIPRotationRequest moves the + cluster master back into single-IP mode. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``cluster_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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CompleteIPRotationRequest): + request = cluster_service.CompleteIPRotationRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.complete_ip_rotation] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_node_pool_size(self, + request: Optional[Union[cluster_service.SetNodePoolSizeRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""SetNodePoolSizeRequest sets the size of a node pool. The new + size will be used for all replicas, including future replicas + created by modifying + [NodePool.locations][google.container.v1beta1.NodePool.locations]. + + .. 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 import container_v1beta1 + + def sample_set_node_pool_size(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNodePoolSizeRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + node_count=1070, + ) + + # Make the request + response = client.set_node_pool_size(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.SetNodePoolSizeRequest, dict]): + The request object. SetNodePoolSizeRequest sets the size + of a node pool. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNodePoolSizeRequest): + request = cluster_service.SetNodePoolSizeRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_node_pool_size] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_network_policy(self, + request: Optional[Union[cluster_service.SetNetworkPolicyRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + network_policy: Optional[cluster_service.NetworkPolicy] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Enables or disables Network Policy for a cluster. + + .. 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 import container_v1beta1 + + def sample_set_network_policy(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNetworkPolicyRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.set_network_policy(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.SetNetworkPolicyRequest, dict]): + The request object. SetNetworkPolicyRequest + enables/disables network policy for a + cluster. + project_id (str): + Required. Deprecated. The Google Developers Console + `project ID or project + number `__. + This field has been deprecated and replaced by the name + field. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. Deprecated. The name of the Google Compute + Engine + `zone `__ + in which the cluster resides. This field has been + deprecated and replaced by the name field. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated + and replaced by the name field. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + network_policy (google.cloud.container_v1beta1.types.NetworkPolicy): + Required. Configuration options for + the NetworkPolicy feature. + + This corresponds to the ``network_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, network_policy]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetNetworkPolicyRequest): + request = cluster_service.SetNetworkPolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if network_policy is not None: + request.network_policy = network_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_network_policy] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def set_maintenance_policy(self, + request: Optional[Union[cluster_service.SetMaintenancePolicyRequest, dict]] = None, + *, + project_id: Optional[str] = None, + zone: Optional[str] = None, + cluster_id: Optional[str] = None, + maintenance_policy: Optional[cluster_service.MaintenancePolicy] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.Operation: + r"""Sets the maintenance policy for a cluster. + + .. 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 import container_v1beta1 + + def sample_set_maintenance_policy(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetMaintenancePolicyRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.set_maintenance_policy(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.SetMaintenancePolicyRequest, dict]): + The request object. SetMaintenancePolicyRequest sets the + maintenance policy for a cluster. + project_id (str): + Required. The Google Developers Console `project ID or + project + number `__. + + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + zone (str): + Required. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. + + This corresponds to the ``zone`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + cluster_id (str): + Required. The name of the cluster to + update. + + This corresponds to the ``cluster_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + maintenance_policy (google.cloud.container_v1beta1.types.MaintenancePolicy): + Required. The maintenance policy to + be set for the cluster. An empty field + clears the existing maintenance policy. + + This corresponds to the ``maintenance_policy`` field + on the ``request`` instance; if ``request`` is provided, this + should not 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.Operation: + This operation resource represents + operations that may have happened or are + happening on the cluster. All fields are + output only. + + """ + # 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([project_id, zone, cluster_id, maintenance_policy]) + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.SetMaintenancePolicyRequest): + request = cluster_service.SetMaintenancePolicyRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_id is not None: + request.project_id = project_id + if zone is not None: + request.zone = zone + if cluster_id is not None: + request.cluster_id = cluster_id + if maintenance_policy is not None: + request.maintenance_policy = maintenance_policy + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_maintenance_policy] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_usable_subnetworks(self, + request: Optional[Union[cluster_service.ListUsableSubnetworksRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> pagers.ListUsableSubnetworksPager: + r"""Lists subnetworks that can be used for creating + clusters in a project. + + .. 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 import container_v1beta1 + + def sample_list_usable_subnetworks(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.ListUsableSubnetworksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_usable_subnetworks(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.ListUsableSubnetworksRequest, dict]): + The request object. ListUsableSubnetworksRequest requests + the list of usable subnetworks. + available to a user for creating + clusters. + parent (str): + Required. The parent project where subnetworks are + usable. Specified in the format ``projects/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.services.cluster_manager.pagers.ListUsableSubnetworksPager: + ListUsableSubnetworksResponse is the + response of + ListUsableSubnetworksRequest. + + 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListUsableSubnetworksRequest): + request = cluster_service.ListUsableSubnetworksRequest(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_usable_subnetworks] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # 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.ListUsableSubnetworksPager( + method=rpc, + request=request, + response=response, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def check_autopilot_compatibility(self, + request: Optional[Union[cluster_service.CheckAutopilotCompatibilityRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.CheckAutopilotCompatibilityResponse: + r"""Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + .. 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 import container_v1beta1 + + def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityRequest, dict]): + The request object. CheckAutopilotCompatibilityRequest + requests getting the blockers for the + given operation in the cluster. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityResponse: + CheckAutopilotCompatibilityResponse + has a list of compatibility issues. + + """ + # Create or coerce a protobuf request object. + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.CheckAutopilotCompatibilityRequest): + request = cluster_service.CheckAutopilotCompatibilityRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.check_autopilot_compatibility] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_locations(self, + request: Optional[Union[cluster_service.ListLocationsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), + ) -> cluster_service.ListLocationsResponse: + r"""Fetches locations that offer Google Kubernetes + Engine. + + .. 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 import container_v1beta1 + + def sample_list_locations(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.ListLocationsRequest( + parent="parent_value", + ) + + # Make the request + response = client.list_locations(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.ListLocationsRequest, dict]): + The request object. ListLocationsRequest is used to + request the locations that offer GKE. + parent (str): + Required. Contains the name of the resource requested. + Specified in the format ``projects/*``. + + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + + Returns: + google.cloud.container_v1beta1.types.ListLocationsResponse: + ListLocationsResponse returns the + list of all GKE locations and their + recommendation state. + + """ + # 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.') + + # - Use the request object if provided (there's no risk of modifying the input as + # there are no flattened fields), or create one. + if not isinstance(request, cluster_service.ListLocationsRequest): + request = cluster_service.ListLocationsRequest(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_locations] + + # 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), + )), + ) + + # Validate the universe domain. + self._validate_universe_domain() + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def __enter__(self) -> "ClusterManagerClient": + 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__ = ( + "ClusterManagerClient", +) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/pagers.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/pagers.py new file mode 100644 index 000000000000..fe4ef8628a0f --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/pagers.py @@ -0,0 +1,166 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.api_core import gapic_v1 +from google.api_core import retry as retries +from google.api_core import retry_async as retries_async +from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator, Union +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] + OptionalAsyncRetry = Union[retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object, None] # type: ignore + OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore + +from google.cloud.container_v1beta1.types import cluster_service + + +class ListUsableSubnetworksPager: + """A pager for iterating through ``list_usable_subnetworks`` requests. + + This class thinly wraps an initial + :class:`google.cloud.container_v1beta1.types.ListUsableSubnetworksResponse` object, and + provides an ``__iter__`` method to iterate through its + ``subnetworks`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListUsableSubnetworks`` requests and continue to iterate + through the ``subnetworks`` field on the + corresponding responses. + + All the usual :class:`google.cloud.container_v1beta1.types.ListUsableSubnetworksResponse` + 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[..., cluster_service.ListUsableSubnetworksResponse], + request: cluster_service.ListUsableSubnetworksRequest, + response: cluster_service.ListUsableSubnetworksResponse, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.container_v1beta1.types.ListUsableSubnetworksRequest): + The initial request object. + response (google.cloud.container_v1beta1.types.ListUsableSubnetworksResponse): + The initial response object. + 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, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + self._method = method + self._request = cluster_service.ListUsableSubnetworksRequest(request) + self._response = response + self._retry = retry + self._timeout = timeout + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[cluster_service.ListUsableSubnetworksResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, retry=self._retry, timeout=self._timeout, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[cluster_service.UsableSubnetwork]: + for page in self.pages: + yield from page.subnetworks + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListUsableSubnetworksAsyncPager: + """A pager for iterating through ``list_usable_subnetworks`` requests. + + This class thinly wraps an initial + :class:`google.cloud.container_v1beta1.types.ListUsableSubnetworksResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``subnetworks`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListUsableSubnetworks`` requests and continue to iterate + through the ``subnetworks`` field on the + corresponding responses. + + All the usual :class:`google.cloud.container_v1beta1.types.ListUsableSubnetworksResponse` + 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[cluster_service.ListUsableSubnetworksResponse]], + request: cluster_service.ListUsableSubnetworksRequest, + response: cluster_service.ListUsableSubnetworksResponse, + *, + retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.container_v1beta1.types.ListUsableSubnetworksRequest): + The initial request object. + response (google.cloud.container_v1beta1.types.ListUsableSubnetworksResponse): + The initial response object. + retry (google.api_core.retry.AsyncRetry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. + """ + self._method = method + self._request = cluster_service.ListUsableSubnetworksRequest(request) + self._response = response + self._retry = retry + self._timeout = timeout + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[cluster_service.ListUsableSubnetworksResponse]: + 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, retry=self._retry, timeout=self._timeout, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[cluster_service.UsableSubnetwork]: + async def async_generator(): + async for page in self.pages: + for response in page.subnetworks: + 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/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/README.rst b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/README.rst new file mode 100644 index 000000000000..4b8234a968af --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/README.rst @@ -0,0 +1,9 @@ + +transport inheritance structure +_______________________________ + +`ClusterManagerTransport` is the ABC for all transports. +- public child `ClusterManagerGrpcTransport` for sync gRPC transport (defined in `grpc.py`). +- public child `ClusterManagerGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). +- private child `_BaseClusterManagerRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). +- public child `ClusterManagerRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/__init__.py new file mode 100644 index 000000000000..5779d92b56f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/__init__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ClusterManagerTransport +from .grpc import ClusterManagerGrpcTransport +from .grpc_asyncio import ClusterManagerGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[ClusterManagerTransport]] +_transport_registry['grpc'] = ClusterManagerGrpcTransport +_transport_registry['grpc_asyncio'] = ClusterManagerGrpcAsyncIOTransport + +__all__ = ( + 'ClusterManagerTransport', + 'ClusterManagerGrpcTransport', + 'ClusterManagerGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py new file mode 100644 index 000000000000..4ab66ced7fa1 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py @@ -0,0 +1,741 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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.container_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.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.container_v1beta1.types import cluster_service +from google.protobuf import empty_pb2 # type: ignore + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) + + +class ClusterManagerTransport(abc.ABC): + """Abstract transport class for ClusterManager.""" + + AUTH_SCOPES = ( + 'https://www.googleapis.com/auth/cloud-platform', + ) + + DEFAULT_HOST: str = 'container.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 (default: 'container.googleapis.com'). + 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 not hasattr(self, "_ignore_credentials"): + self._ignore_credentials: bool = False + + # 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 and not self._ignore_credentials: + 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 + + @property + def host(self): + return self._host + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.list_clusters: gapic_v1.method.wrap_method( + self.list_clusters, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_cluster: gapic_v1.method.wrap_method( + self.get_cluster, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.create_cluster: gapic_v1.method.wrap_method( + self.create_cluster, + default_timeout=45.0, + client_info=client_info, + ), + self.update_cluster: gapic_v1.method.wrap_method( + self.update_cluster, + default_timeout=45.0, + client_info=client_info, + ), + self.update_node_pool: gapic_v1.method.wrap_method( + self.update_node_pool, + default_timeout=45.0, + client_info=client_info, + ), + self.set_node_pool_autoscaling: gapic_v1.method.wrap_method( + self.set_node_pool_autoscaling, + default_timeout=45.0, + client_info=client_info, + ), + self.set_logging_service: gapic_v1.method.wrap_method( + self.set_logging_service, + default_timeout=45.0, + client_info=client_info, + ), + self.set_monitoring_service: gapic_v1.method.wrap_method( + self.set_monitoring_service, + default_timeout=45.0, + client_info=client_info, + ), + self.set_addons_config: gapic_v1.method.wrap_method( + self.set_addons_config, + default_timeout=45.0, + client_info=client_info, + ), + self.set_locations: gapic_v1.method.wrap_method( + self.set_locations, + default_timeout=45.0, + client_info=client_info, + ), + self.update_master: gapic_v1.method.wrap_method( + self.update_master, + default_timeout=45.0, + client_info=client_info, + ), + self.set_master_auth: gapic_v1.method.wrap_method( + self.set_master_auth, + default_timeout=45.0, + client_info=client_info, + ), + self.delete_cluster: gapic_v1.method.wrap_method( + self.delete_cluster, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.list_operations: gapic_v1.method.wrap_method( + self.list_operations, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_operation: gapic_v1.method.wrap_method( + self.get_operation, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.cancel_operation: gapic_v1.method.wrap_method( + self.cancel_operation, + default_timeout=45.0, + client_info=client_info, + ), + self.get_server_config: gapic_v1.method.wrap_method( + self.get_server_config, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_json_web_keys: gapic_v1.method.wrap_method( + self.get_json_web_keys, + default_timeout=None, + client_info=client_info, + ), + self.list_node_pools: gapic_v1.method.wrap_method( + self.list_node_pools, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_node_pool: gapic_v1.method.wrap_method( + self.get_node_pool, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.create_node_pool: gapic_v1.method.wrap_method( + self.create_node_pool, + default_timeout=45.0, + client_info=client_info, + ), + self.delete_node_pool: gapic_v1.method.wrap_method( + self.delete_node_pool, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.complete_node_pool_upgrade: gapic_v1.method.wrap_method( + self.complete_node_pool_upgrade, + default_timeout=None, + client_info=client_info, + ), + self.rollback_node_pool_upgrade: gapic_v1.method.wrap_method( + self.rollback_node_pool_upgrade, + default_timeout=45.0, + client_info=client_info, + ), + self.set_node_pool_management: gapic_v1.method.wrap_method( + self.set_node_pool_management, + default_timeout=45.0, + client_info=client_info, + ), + self.set_labels: gapic_v1.method.wrap_method( + self.set_labels, + default_timeout=45.0, + client_info=client_info, + ), + self.set_legacy_abac: gapic_v1.method.wrap_method( + self.set_legacy_abac, + default_timeout=45.0, + client_info=client_info, + ), + self.start_ip_rotation: gapic_v1.method.wrap_method( + self.start_ip_rotation, + default_timeout=45.0, + client_info=client_info, + ), + self.complete_ip_rotation: gapic_v1.method.wrap_method( + self.complete_ip_rotation, + default_timeout=45.0, + client_info=client_info, + ), + self.set_node_pool_size: gapic_v1.method.wrap_method( + self.set_node_pool_size, + default_timeout=45.0, + client_info=client_info, + ), + self.set_network_policy: gapic_v1.method.wrap_method( + self.set_network_policy, + default_timeout=45.0, + client_info=client_info, + ), + self.set_maintenance_policy: gapic_v1.method.wrap_method( + self.set_maintenance_policy, + default_timeout=45.0, + client_info=client_info, + ), + self.list_usable_subnetworks: gapic_v1.method.wrap_method( + self.list_usable_subnetworks, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.check_autopilot_compatibility: gapic_v1.method.wrap_method( + self.check_autopilot_compatibility, + default_timeout=None, + client_info=client_info, + ), + self.list_locations: gapic_v1.method.wrap_method( + self.list_locations, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + 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 list_clusters(self) -> Callable[ + [cluster_service.ListClustersRequest], + Union[ + cluster_service.ListClustersResponse, + Awaitable[cluster_service.ListClustersResponse] + ]]: + raise NotImplementedError() + + @property + def get_cluster(self) -> Callable[ + [cluster_service.GetClusterRequest], + Union[ + cluster_service.Cluster, + Awaitable[cluster_service.Cluster] + ]]: + raise NotImplementedError() + + @property + def create_cluster(self) -> Callable[ + [cluster_service.CreateClusterRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def update_cluster(self) -> Callable[ + [cluster_service.UpdateClusterRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def update_node_pool(self) -> Callable[ + [cluster_service.UpdateNodePoolRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_node_pool_autoscaling(self) -> Callable[ + [cluster_service.SetNodePoolAutoscalingRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_logging_service(self) -> Callable[ + [cluster_service.SetLoggingServiceRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_monitoring_service(self) -> Callable[ + [cluster_service.SetMonitoringServiceRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_addons_config(self) -> Callable[ + [cluster_service.SetAddonsConfigRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_locations(self) -> Callable[ + [cluster_service.SetLocationsRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def update_master(self) -> Callable[ + [cluster_service.UpdateMasterRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_master_auth(self) -> Callable[ + [cluster_service.SetMasterAuthRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def delete_cluster(self) -> Callable[ + [cluster_service.DeleteClusterRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def list_operations(self) -> Callable[ + [cluster_service.ListOperationsRequest], + Union[ + cluster_service.ListOperationsResponse, + Awaitable[cluster_service.ListOperationsResponse] + ]]: + raise NotImplementedError() + + @property + def get_operation(self) -> Callable[ + [cluster_service.GetOperationRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def cancel_operation(self) -> Callable[ + [cluster_service.CancelOperationRequest], + Union[ + empty_pb2.Empty, + Awaitable[empty_pb2.Empty] + ]]: + raise NotImplementedError() + + @property + def get_server_config(self) -> Callable[ + [cluster_service.GetServerConfigRequest], + Union[ + cluster_service.ServerConfig, + Awaitable[cluster_service.ServerConfig] + ]]: + raise NotImplementedError() + + @property + def get_json_web_keys(self) -> Callable[ + [cluster_service.GetJSONWebKeysRequest], + Union[ + cluster_service.GetJSONWebKeysResponse, + Awaitable[cluster_service.GetJSONWebKeysResponse] + ]]: + raise NotImplementedError() + + @property + def list_node_pools(self) -> Callable[ + [cluster_service.ListNodePoolsRequest], + Union[ + cluster_service.ListNodePoolsResponse, + Awaitable[cluster_service.ListNodePoolsResponse] + ]]: + raise NotImplementedError() + + @property + def get_node_pool(self) -> Callable[ + [cluster_service.GetNodePoolRequest], + Union[ + cluster_service.NodePool, + Awaitable[cluster_service.NodePool] + ]]: + raise NotImplementedError() + + @property + def create_node_pool(self) -> Callable[ + [cluster_service.CreateNodePoolRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def delete_node_pool(self) -> Callable[ + [cluster_service.DeleteNodePoolRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def complete_node_pool_upgrade(self) -> Callable[ + [cluster_service.CompleteNodePoolUpgradeRequest], + Union[ + empty_pb2.Empty, + Awaitable[empty_pb2.Empty] + ]]: + raise NotImplementedError() + + @property + def rollback_node_pool_upgrade(self) -> Callable[ + [cluster_service.RollbackNodePoolUpgradeRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_node_pool_management(self) -> Callable[ + [cluster_service.SetNodePoolManagementRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_labels(self) -> Callable[ + [cluster_service.SetLabelsRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_legacy_abac(self) -> Callable[ + [cluster_service.SetLegacyAbacRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def start_ip_rotation(self) -> Callable[ + [cluster_service.StartIPRotationRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def complete_ip_rotation(self) -> Callable[ + [cluster_service.CompleteIPRotationRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_node_pool_size(self) -> Callable[ + [cluster_service.SetNodePoolSizeRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_network_policy(self) -> Callable[ + [cluster_service.SetNetworkPolicyRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def set_maintenance_policy(self) -> Callable[ + [cluster_service.SetMaintenancePolicyRequest], + Union[ + cluster_service.Operation, + Awaitable[cluster_service.Operation] + ]]: + raise NotImplementedError() + + @property + def list_usable_subnetworks(self) -> Callable[ + [cluster_service.ListUsableSubnetworksRequest], + Union[ + cluster_service.ListUsableSubnetworksResponse, + Awaitable[cluster_service.ListUsableSubnetworksResponse] + ]]: + raise NotImplementedError() + + @property + def check_autopilot_compatibility(self) -> Callable[ + [cluster_service.CheckAutopilotCompatibilityRequest], + Union[ + cluster_service.CheckAutopilotCompatibilityResponse, + Awaitable[cluster_service.CheckAutopilotCompatibilityResponse] + ]]: + raise NotImplementedError() + + @property + def list_locations(self) -> Callable[ + [cluster_service.ListLocationsRequest], + Union[ + cluster_service.ListLocationsResponse, + Awaitable[cluster_service.ListLocationsResponse] + ]]: + raise NotImplementedError() + + @property + def kind(self) -> str: + raise NotImplementedError() + + +__all__ = ( + 'ClusterManagerTransport', +) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py new file mode 100644 index 000000000000..68ec13dc2ea3 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py @@ -0,0 +1,1274 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 json +import logging as std_logging +import pickle +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import grpc_helpers +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 +from google.protobuf.json_format import MessageToJson +import google.protobuf.message + +import grpc # type: ignore +import proto # type: ignore + +from google.cloud.container_v1beta1.types import cluster_service +from google.protobuf import empty_pb2 # type: ignore +from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO + +try: + from google.api_core import client_logging # type: ignore + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER + def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra = { + "serviceName": "google.container.v1beta1.ClusterManager", + "rpcName": client_call_details.method, + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + + response = continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = dict([(k, str(v)) for k, v in response_metadata]) if response_metadata else None + result = response.result() + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response for {client_call_details.method}.", + extra = { + "serviceName": "google.container.v1beta1.ClusterManager", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + + +class ClusterManagerGrpcTransport(ClusterManagerTransport): + """gRPC backend transport for ClusterManager. + + Google Kubernetes Engine Cluster Manager v1beta1 + + 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 = 'container.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[Union[grpc.Channel, Callable[..., 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 (default: 'container.googleapis.com'). + 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 a ``channel`` instance 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 a ``channel`` instance is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if a ``channel`` instance is provided. + channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]): + A ``Channel`` instance through which to make calls, or a Callable + that constructs and returns one. If set to None, ``self.create_channel`` + is used to create the channel. If a Callable is given, it will be called + with the same arguments as used in ``self.create_channel``. + 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 a ``channel`` instance 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 a ``channel`` instance 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] = {} + + 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 isinstance(channel, grpc.Channel): + # Ignore credentials if a channel was passed. + credentials = None + self._ignore_credentials = True + # 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: + # initialize with the provided callable or the default channel + channel_init = channel or type(self).create_channel + self._grpc_channel = channel_init( + 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), + ], + ) + + self._interceptor = _LoggingClientInterceptor() + self._logged_channel = grpc.intercept_channel(self._grpc_channel, self._interceptor) + + # Wrap messages. This must be done after self._logged_channel exists + self._prep_wrapped_messages(client_info) + + @classmethod + def create_channel(cls, + host: str = 'container.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 list_clusters(self) -> Callable[ + [cluster_service.ListClustersRequest], + cluster_service.ListClustersResponse]: + r"""Return a callable for the list clusters method over gRPC. + + Lists all clusters owned by a project in either the + specified zone or all zones. + + Returns: + Callable[[~.ListClustersRequest], + ~.ListClustersResponse]: + 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_clusters' not in self._stubs: + self._stubs['list_clusters'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/ListClusters', + request_serializer=cluster_service.ListClustersRequest.serialize, + response_deserializer=cluster_service.ListClustersResponse.deserialize, + ) + return self._stubs['list_clusters'] + + @property + def get_cluster(self) -> Callable[ + [cluster_service.GetClusterRequest], + cluster_service.Cluster]: + r"""Return a callable for the get cluster method over gRPC. + + Gets the details for a specific cluster. + + Returns: + Callable[[~.GetClusterRequest], + ~.Cluster]: + 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_cluster' not in self._stubs: + self._stubs['get_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/GetCluster', + request_serializer=cluster_service.GetClusterRequest.serialize, + response_deserializer=cluster_service.Cluster.deserialize, + ) + return self._stubs['get_cluster'] + + @property + def create_cluster(self) -> Callable[ + [cluster_service.CreateClusterRequest], + cluster_service.Operation]: + r"""Return a callable for the create cluster method over gRPC. + + Creates a cluster, consisting of the specified number and type + of Google Compute Engine instances. + + By default, the cluster is created in the project's `default + network `__. + + One firewall is added for the cluster. After cluster creation, + the Kubelet creates routes for each node to allow the containers + on that node to communicate with all other instances in the + cluster. + + Finally, an entry is added to the project's global metadata + indicating which CIDR range the cluster is using. + + Returns: + Callable[[~.CreateClusterRequest], + ~.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_cluster' not in self._stubs: + self._stubs['create_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/CreateCluster', + request_serializer=cluster_service.CreateClusterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['create_cluster'] + + @property + def update_cluster(self) -> Callable[ + [cluster_service.UpdateClusterRequest], + cluster_service.Operation]: + r"""Return a callable for the update cluster method over gRPC. + + Updates the settings for a specific cluster. + + Returns: + Callable[[~.UpdateClusterRequest], + ~.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_cluster' not in self._stubs: + self._stubs['update_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/UpdateCluster', + request_serializer=cluster_service.UpdateClusterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['update_cluster'] + + @property + def update_node_pool(self) -> Callable[ + [cluster_service.UpdateNodePoolRequest], + cluster_service.Operation]: + r"""Return a callable for the update node pool method over gRPC. + + Updates the version and/or image type of a specific + node pool. + + Returns: + Callable[[~.UpdateNodePoolRequest], + ~.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_node_pool' not in self._stubs: + self._stubs['update_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/UpdateNodePool', + request_serializer=cluster_service.UpdateNodePoolRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['update_node_pool'] + + @property + def set_node_pool_autoscaling(self) -> Callable[ + [cluster_service.SetNodePoolAutoscalingRequest], + cluster_service.Operation]: + r"""Return a callable for the set node pool autoscaling method over gRPC. + + Sets the autoscaling settings of a specific node + pool. + + Returns: + Callable[[~.SetNodePoolAutoscalingRequest], + ~.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 'set_node_pool_autoscaling' not in self._stubs: + self._stubs['set_node_pool_autoscaling'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetNodePoolAutoscaling', + request_serializer=cluster_service.SetNodePoolAutoscalingRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_node_pool_autoscaling'] + + @property + def set_logging_service(self) -> Callable[ + [cluster_service.SetLoggingServiceRequest], + cluster_service.Operation]: + r"""Return a callable for the set logging service method over gRPC. + + Sets the logging service for a specific cluster. + + Returns: + Callable[[~.SetLoggingServiceRequest], + ~.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 'set_logging_service' not in self._stubs: + self._stubs['set_logging_service'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetLoggingService', + request_serializer=cluster_service.SetLoggingServiceRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_logging_service'] + + @property + def set_monitoring_service(self) -> Callable[ + [cluster_service.SetMonitoringServiceRequest], + cluster_service.Operation]: + r"""Return a callable for the set monitoring service method over gRPC. + + Sets the monitoring service for a specific cluster. + + Returns: + Callable[[~.SetMonitoringServiceRequest], + ~.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 'set_monitoring_service' not in self._stubs: + self._stubs['set_monitoring_service'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetMonitoringService', + request_serializer=cluster_service.SetMonitoringServiceRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_monitoring_service'] + + @property + def set_addons_config(self) -> Callable[ + [cluster_service.SetAddonsConfigRequest], + cluster_service.Operation]: + r"""Return a callable for the set addons config method over gRPC. + + Sets the addons for a specific cluster. + + Returns: + Callable[[~.SetAddonsConfigRequest], + ~.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 'set_addons_config' not in self._stubs: + self._stubs['set_addons_config'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetAddonsConfig', + request_serializer=cluster_service.SetAddonsConfigRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_addons_config'] + + @property + def set_locations(self) -> Callable[ + [cluster_service.SetLocationsRequest], + cluster_service.Operation]: + r"""Return a callable for the set locations method over gRPC. + + Sets the locations for a specific cluster. Deprecated. Use + `projects.locations.clusters.update `__ + instead. + + Returns: + Callable[[~.SetLocationsRequest], + ~.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 'set_locations' not in self._stubs: + self._stubs['set_locations'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetLocations', + request_serializer=cluster_service.SetLocationsRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_locations'] + + @property + def update_master(self) -> Callable[ + [cluster_service.UpdateMasterRequest], + cluster_service.Operation]: + r"""Return a callable for the update master method over gRPC. + + Updates the master for a specific cluster. + + Returns: + Callable[[~.UpdateMasterRequest], + ~.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_master' not in self._stubs: + self._stubs['update_master'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/UpdateMaster', + request_serializer=cluster_service.UpdateMasterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['update_master'] + + @property + def set_master_auth(self) -> Callable[ + [cluster_service.SetMasterAuthRequest], + cluster_service.Operation]: + r"""Return a callable for the set master auth method over gRPC. + + Sets master auth materials. Currently supports + changing the admin password or a specific cluster, + either via password generation or explicitly setting the + password. + + Returns: + Callable[[~.SetMasterAuthRequest], + ~.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 'set_master_auth' not in self._stubs: + self._stubs['set_master_auth'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetMasterAuth', + request_serializer=cluster_service.SetMasterAuthRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_master_auth'] + + @property + def delete_cluster(self) -> Callable[ + [cluster_service.DeleteClusterRequest], + cluster_service.Operation]: + r"""Return a callable for the delete cluster method over gRPC. + + Deletes the cluster, including the Kubernetes + endpoint and all worker nodes. + + Firewalls and routes that were configured during cluster + creation are also deleted. + + Other Google Compute Engine resources that might be in + use by the cluster, such as load balancer resources, are + not deleted if they weren't present when the cluster was + initially created. + + Returns: + Callable[[~.DeleteClusterRequest], + ~.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_cluster' not in self._stubs: + self._stubs['delete_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/DeleteCluster', + request_serializer=cluster_service.DeleteClusterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['delete_cluster'] + + @property + def list_operations(self) -> Callable[ + [cluster_service.ListOperationsRequest], + cluster_service.ListOperationsResponse]: + r"""Return a callable for the list operations method over gRPC. + + Lists all operations in a project in the specified + zone or all zones. + + Returns: + Callable[[~.ListOperationsRequest], + ~.ListOperationsResponse]: + 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_operations' not in self._stubs: + self._stubs['list_operations'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/ListOperations', + request_serializer=cluster_service.ListOperationsRequest.serialize, + response_deserializer=cluster_service.ListOperationsResponse.deserialize, + ) + return self._stubs['list_operations'] + + @property + def get_operation(self) -> Callable[ + [cluster_service.GetOperationRequest], + cluster_service.Operation]: + r"""Return a callable for the get operation method over gRPC. + + Gets the specified operation. + + Returns: + Callable[[~.GetOperationRequest], + ~.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 'get_operation' not in self._stubs: + self._stubs['get_operation'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/GetOperation', + request_serializer=cluster_service.GetOperationRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['get_operation'] + + @property + def cancel_operation(self) -> Callable[ + [cluster_service.CancelOperationRequest], + empty_pb2.Empty]: + r"""Return a callable for the cancel operation method over gRPC. + + Cancels the specified operation. + + Returns: + Callable[[~.CancelOperationRequest], + ~.Empty]: + 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 'cancel_operation' not in self._stubs: + self._stubs['cancel_operation'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/CancelOperation', + request_serializer=cluster_service.CancelOperationRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['cancel_operation'] + + @property + def get_server_config(self) -> Callable[ + [cluster_service.GetServerConfigRequest], + cluster_service.ServerConfig]: + r"""Return a callable for the get server config method over gRPC. + + Returns configuration info about the Google + Kubernetes Engine service. + + Returns: + Callable[[~.GetServerConfigRequest], + ~.ServerConfig]: + 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_server_config' not in self._stubs: + self._stubs['get_server_config'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/GetServerConfig', + request_serializer=cluster_service.GetServerConfigRequest.serialize, + response_deserializer=cluster_service.ServerConfig.deserialize, + ) + return self._stubs['get_server_config'] + + @property + def get_json_web_keys(self) -> Callable[ + [cluster_service.GetJSONWebKeysRequest], + cluster_service.GetJSONWebKeysResponse]: + r"""Return a callable for the get json web keys method over gRPC. + + Gets the public component of the cluster signing keys + in JSON Web Key format. + + Returns: + Callable[[~.GetJSONWebKeysRequest], + ~.GetJSONWebKeysResponse]: + 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_json_web_keys' not in self._stubs: + self._stubs['get_json_web_keys'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/GetJSONWebKeys', + request_serializer=cluster_service.GetJSONWebKeysRequest.serialize, + response_deserializer=cluster_service.GetJSONWebKeysResponse.deserialize, + ) + return self._stubs['get_json_web_keys'] + + @property + def list_node_pools(self) -> Callable[ + [cluster_service.ListNodePoolsRequest], + cluster_service.ListNodePoolsResponse]: + r"""Return a callable for the list node pools method over gRPC. + + Lists the node pools for a cluster. + + Returns: + Callable[[~.ListNodePoolsRequest], + ~.ListNodePoolsResponse]: + 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_node_pools' not in self._stubs: + self._stubs['list_node_pools'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/ListNodePools', + request_serializer=cluster_service.ListNodePoolsRequest.serialize, + response_deserializer=cluster_service.ListNodePoolsResponse.deserialize, + ) + return self._stubs['list_node_pools'] + + @property + def get_node_pool(self) -> Callable[ + [cluster_service.GetNodePoolRequest], + cluster_service.NodePool]: + r"""Return a callable for the get node pool method over gRPC. + + Retrieves the requested node pool. + + Returns: + Callable[[~.GetNodePoolRequest], + ~.NodePool]: + 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_node_pool' not in self._stubs: + self._stubs['get_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/GetNodePool', + request_serializer=cluster_service.GetNodePoolRequest.serialize, + response_deserializer=cluster_service.NodePool.deserialize, + ) + return self._stubs['get_node_pool'] + + @property + def create_node_pool(self) -> Callable[ + [cluster_service.CreateNodePoolRequest], + cluster_service.Operation]: + r"""Return a callable for the create node pool method over gRPC. + + Creates a node pool for a cluster. + + Returns: + Callable[[~.CreateNodePoolRequest], + ~.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_node_pool' not in self._stubs: + self._stubs['create_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/CreateNodePool', + request_serializer=cluster_service.CreateNodePoolRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['create_node_pool'] + + @property + def delete_node_pool(self) -> Callable[ + [cluster_service.DeleteNodePoolRequest], + cluster_service.Operation]: + r"""Return a callable for the delete node pool method over gRPC. + + Deletes a node pool from a cluster. + + Returns: + Callable[[~.DeleteNodePoolRequest], + ~.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_node_pool' not in self._stubs: + self._stubs['delete_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/DeleteNodePool', + request_serializer=cluster_service.DeleteNodePoolRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['delete_node_pool'] + + @property + def complete_node_pool_upgrade(self) -> Callable[ + [cluster_service.CompleteNodePoolUpgradeRequest], + empty_pb2.Empty]: + r"""Return a callable for the complete node pool upgrade method over gRPC. + + CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + Returns: + Callable[[~.CompleteNodePoolUpgradeRequest], + ~.Empty]: + 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 'complete_node_pool_upgrade' not in self._stubs: + self._stubs['complete_node_pool_upgrade'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/CompleteNodePoolUpgrade', + request_serializer=cluster_service.CompleteNodePoolUpgradeRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['complete_node_pool_upgrade'] + + @property + def rollback_node_pool_upgrade(self) -> Callable[ + [cluster_service.RollbackNodePoolUpgradeRequest], + cluster_service.Operation]: + r"""Return a callable for the rollback node pool upgrade method over gRPC. + + Rolls back a previously Aborted or Failed NodePool + upgrade. This makes no changes if the last upgrade + successfully completed. + + Returns: + Callable[[~.RollbackNodePoolUpgradeRequest], + ~.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 'rollback_node_pool_upgrade' not in self._stubs: + self._stubs['rollback_node_pool_upgrade'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/RollbackNodePoolUpgrade', + request_serializer=cluster_service.RollbackNodePoolUpgradeRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['rollback_node_pool_upgrade'] + + @property + def set_node_pool_management(self) -> Callable[ + [cluster_service.SetNodePoolManagementRequest], + cluster_service.Operation]: + r"""Return a callable for the set node pool management method over gRPC. + + Sets the NodeManagement options for a node pool. + + Returns: + Callable[[~.SetNodePoolManagementRequest], + ~.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 'set_node_pool_management' not in self._stubs: + self._stubs['set_node_pool_management'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetNodePoolManagement', + request_serializer=cluster_service.SetNodePoolManagementRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_node_pool_management'] + + @property + def set_labels(self) -> Callable[ + [cluster_service.SetLabelsRequest], + cluster_service.Operation]: + r"""Return a callable for the set labels method over gRPC. + + Sets labels on a cluster. + + Returns: + Callable[[~.SetLabelsRequest], + ~.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 'set_labels' not in self._stubs: + self._stubs['set_labels'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetLabels', + request_serializer=cluster_service.SetLabelsRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_labels'] + + @property + def set_legacy_abac(self) -> Callable[ + [cluster_service.SetLegacyAbacRequest], + cluster_service.Operation]: + r"""Return a callable for the set legacy abac method over gRPC. + + Enables or disables the ABAC authorization mechanism + on a cluster. + + Returns: + Callable[[~.SetLegacyAbacRequest], + ~.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 'set_legacy_abac' not in self._stubs: + self._stubs['set_legacy_abac'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetLegacyAbac', + request_serializer=cluster_service.SetLegacyAbacRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_legacy_abac'] + + @property + def start_ip_rotation(self) -> Callable[ + [cluster_service.StartIPRotationRequest], + cluster_service.Operation]: + r"""Return a callable for the start ip rotation method over gRPC. + + Starts master IP rotation. + + Returns: + Callable[[~.StartIPRotationRequest], + ~.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 'start_ip_rotation' not in self._stubs: + self._stubs['start_ip_rotation'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/StartIPRotation', + request_serializer=cluster_service.StartIPRotationRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['start_ip_rotation'] + + @property + def complete_ip_rotation(self) -> Callable[ + [cluster_service.CompleteIPRotationRequest], + cluster_service.Operation]: + r"""Return a callable for the complete ip rotation method over gRPC. + + Completes master IP rotation. + + Returns: + Callable[[~.CompleteIPRotationRequest], + ~.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 'complete_ip_rotation' not in self._stubs: + self._stubs['complete_ip_rotation'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/CompleteIPRotation', + request_serializer=cluster_service.CompleteIPRotationRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['complete_ip_rotation'] + + @property + def set_node_pool_size(self) -> Callable[ + [cluster_service.SetNodePoolSizeRequest], + cluster_service.Operation]: + r"""Return a callable for the set node pool size method over gRPC. + + SetNodePoolSizeRequest sets the size of a node pool. The new + size will be used for all replicas, including future replicas + created by modifying + [NodePool.locations][google.container.v1beta1.NodePool.locations]. + + Returns: + Callable[[~.SetNodePoolSizeRequest], + ~.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 'set_node_pool_size' not in self._stubs: + self._stubs['set_node_pool_size'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetNodePoolSize', + request_serializer=cluster_service.SetNodePoolSizeRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_node_pool_size'] + + @property + def set_network_policy(self) -> Callable[ + [cluster_service.SetNetworkPolicyRequest], + cluster_service.Operation]: + r"""Return a callable for the set network policy method over gRPC. + + Enables or disables Network Policy for a cluster. + + Returns: + Callable[[~.SetNetworkPolicyRequest], + ~.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 'set_network_policy' not in self._stubs: + self._stubs['set_network_policy'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetNetworkPolicy', + request_serializer=cluster_service.SetNetworkPolicyRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_network_policy'] + + @property + def set_maintenance_policy(self) -> Callable[ + [cluster_service.SetMaintenancePolicyRequest], + cluster_service.Operation]: + r"""Return a callable for the set maintenance policy method over gRPC. + + Sets the maintenance policy for a cluster. + + Returns: + Callable[[~.SetMaintenancePolicyRequest], + ~.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 'set_maintenance_policy' not in self._stubs: + self._stubs['set_maintenance_policy'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetMaintenancePolicy', + request_serializer=cluster_service.SetMaintenancePolicyRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_maintenance_policy'] + + @property + def list_usable_subnetworks(self) -> Callable[ + [cluster_service.ListUsableSubnetworksRequest], + cluster_service.ListUsableSubnetworksResponse]: + r"""Return a callable for the list usable subnetworks method over gRPC. + + Lists subnetworks that can be used for creating + clusters in a project. + + Returns: + Callable[[~.ListUsableSubnetworksRequest], + ~.ListUsableSubnetworksResponse]: + 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_usable_subnetworks' not in self._stubs: + self._stubs['list_usable_subnetworks'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/ListUsableSubnetworks', + request_serializer=cluster_service.ListUsableSubnetworksRequest.serialize, + response_deserializer=cluster_service.ListUsableSubnetworksResponse.deserialize, + ) + return self._stubs['list_usable_subnetworks'] + + @property + def check_autopilot_compatibility(self) -> Callable[ + [cluster_service.CheckAutopilotCompatibilityRequest], + cluster_service.CheckAutopilotCompatibilityResponse]: + r"""Return a callable for the check autopilot compatibility method over gRPC. + + Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + Returns: + Callable[[~.CheckAutopilotCompatibilityRequest], + ~.CheckAutopilotCompatibilityResponse]: + 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 'check_autopilot_compatibility' not in self._stubs: + self._stubs['check_autopilot_compatibility'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/CheckAutopilotCompatibility', + request_serializer=cluster_service.CheckAutopilotCompatibilityRequest.serialize, + response_deserializer=cluster_service.CheckAutopilotCompatibilityResponse.deserialize, + ) + return self._stubs['check_autopilot_compatibility'] + + @property + def list_locations(self) -> Callable[ + [cluster_service.ListLocationsRequest], + cluster_service.ListLocationsResponse]: + r"""Return a callable for the list locations method over gRPC. + + Fetches locations that offer Google Kubernetes + Engine. + + Returns: + Callable[[~.ListLocationsRequest], + ~.ListLocationsResponse]: + 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_locations' not in self._stubs: + self._stubs['list_locations'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/ListLocations', + request_serializer=cluster_service.ListLocationsRequest.serialize, + response_deserializer=cluster_service.ListLocationsResponse.deserialize, + ) + return self._stubs['list_locations'] + + def close(self): + self._logged_channel.close() + + @property + def kind(self) -> str: + return "grpc" + + +__all__ = ( + 'ClusterManagerGrpcTransport', +) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py new file mode 100644 index 000000000000..cde0c9fe6d26 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py @@ -0,0 +1,1574 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 inspect +import json +import pickle +import logging as std_logging +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 exceptions as core_exceptions +from google.api_core import retry_async as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message + +import grpc # type: ignore +import proto # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.container_v1beta1.types import cluster_service +from google.protobuf import empty_pb2 # type: ignore +from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO +from .grpc import ClusterManagerGrpcTransport + +try: + from google.api_core import client_logging # type: ignore + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientAIOInterceptor(grpc.aio.UnaryUnaryClientInterceptor): # pragma: NO COVER + async def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra = { + "serviceName": "google.container.v1beta1.ClusterManager", + "rpcName": str(client_call_details.method), + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + response = await continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = await response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = dict([(k, str(v)) for k, v in response_metadata]) if response_metadata else None + result = await response + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response to rpc {client_call_details.method}.", + extra = { + "serviceName": "google.container.v1beta1.ClusterManager", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + + +class ClusterManagerGrpcAsyncIOTransport(ClusterManagerTransport): + """gRPC AsyncIO backend transport for ClusterManager. + + Google Kubernetes Engine Cluster Manager v1beta1 + + 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 = 'container.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`. + 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 = 'container.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[Union[aio.Channel, Callable[..., 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 (default: 'container.googleapis.com'). + 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 a ``channel`` instance 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 a ``channel`` instance 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[Union[aio.Channel, Callable[..., aio.Channel]]]): + A ``Channel`` instance through which to make calls, or a Callable + that constructs and returns one. If set to None, ``self.create_channel`` + is used to create the channel. If a Callable is given, it will be called + with the same arguments as used in ``self.create_channel``. + 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 a ``channel`` instance 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 a ``channel`` instance 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] = {} + + 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 isinstance(channel, aio.Channel): + # Ignore credentials if a channel was passed. + credentials = None + self._ignore_credentials = True + # 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: + # initialize with the provided callable or the default channel + channel_init = channel or type(self).create_channel + self._grpc_channel = channel_init( + 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), + ], + ) + + self._interceptor = _LoggingClientAIOInterceptor() + self._grpc_channel._unary_unary_interceptors.append(self._interceptor) + self._logged_channel = self._grpc_channel + self._wrap_with_kind = "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters + # Wrap messages. This must be done after self._logged_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 list_clusters(self) -> Callable[ + [cluster_service.ListClustersRequest], + Awaitable[cluster_service.ListClustersResponse]]: + r"""Return a callable for the list clusters method over gRPC. + + Lists all clusters owned by a project in either the + specified zone or all zones. + + Returns: + Callable[[~.ListClustersRequest], + Awaitable[~.ListClustersResponse]]: + 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_clusters' not in self._stubs: + self._stubs['list_clusters'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/ListClusters', + request_serializer=cluster_service.ListClustersRequest.serialize, + response_deserializer=cluster_service.ListClustersResponse.deserialize, + ) + return self._stubs['list_clusters'] + + @property + def get_cluster(self) -> Callable[ + [cluster_service.GetClusterRequest], + Awaitable[cluster_service.Cluster]]: + r"""Return a callable for the get cluster method over gRPC. + + Gets the details for a specific cluster. + + Returns: + Callable[[~.GetClusterRequest], + Awaitable[~.Cluster]]: + 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_cluster' not in self._stubs: + self._stubs['get_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/GetCluster', + request_serializer=cluster_service.GetClusterRequest.serialize, + response_deserializer=cluster_service.Cluster.deserialize, + ) + return self._stubs['get_cluster'] + + @property + def create_cluster(self) -> Callable[ + [cluster_service.CreateClusterRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the create cluster method over gRPC. + + Creates a cluster, consisting of the specified number and type + of Google Compute Engine instances. + + By default, the cluster is created in the project's `default + network `__. + + One firewall is added for the cluster. After cluster creation, + the Kubelet creates routes for each node to allow the containers + on that node to communicate with all other instances in the + cluster. + + Finally, an entry is added to the project's global metadata + indicating which CIDR range the cluster is using. + + Returns: + Callable[[~.CreateClusterRequest], + 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_cluster' not in self._stubs: + self._stubs['create_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/CreateCluster', + request_serializer=cluster_service.CreateClusterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['create_cluster'] + + @property + def update_cluster(self) -> Callable[ + [cluster_service.UpdateClusterRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the update cluster method over gRPC. + + Updates the settings for a specific cluster. + + Returns: + Callable[[~.UpdateClusterRequest], + 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_cluster' not in self._stubs: + self._stubs['update_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/UpdateCluster', + request_serializer=cluster_service.UpdateClusterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['update_cluster'] + + @property + def update_node_pool(self) -> Callable[ + [cluster_service.UpdateNodePoolRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the update node pool method over gRPC. + + Updates the version and/or image type of a specific + node pool. + + Returns: + Callable[[~.UpdateNodePoolRequest], + 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_node_pool' not in self._stubs: + self._stubs['update_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/UpdateNodePool', + request_serializer=cluster_service.UpdateNodePoolRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['update_node_pool'] + + @property + def set_node_pool_autoscaling(self) -> Callable[ + [cluster_service.SetNodePoolAutoscalingRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set node pool autoscaling method over gRPC. + + Sets the autoscaling settings of a specific node + pool. + + Returns: + Callable[[~.SetNodePoolAutoscalingRequest], + 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 'set_node_pool_autoscaling' not in self._stubs: + self._stubs['set_node_pool_autoscaling'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetNodePoolAutoscaling', + request_serializer=cluster_service.SetNodePoolAutoscalingRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_node_pool_autoscaling'] + + @property + def set_logging_service(self) -> Callable[ + [cluster_service.SetLoggingServiceRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set logging service method over gRPC. + + Sets the logging service for a specific cluster. + + Returns: + Callable[[~.SetLoggingServiceRequest], + 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 'set_logging_service' not in self._stubs: + self._stubs['set_logging_service'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetLoggingService', + request_serializer=cluster_service.SetLoggingServiceRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_logging_service'] + + @property + def set_monitoring_service(self) -> Callable[ + [cluster_service.SetMonitoringServiceRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set monitoring service method over gRPC. + + Sets the monitoring service for a specific cluster. + + Returns: + Callable[[~.SetMonitoringServiceRequest], + 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 'set_monitoring_service' not in self._stubs: + self._stubs['set_monitoring_service'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetMonitoringService', + request_serializer=cluster_service.SetMonitoringServiceRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_monitoring_service'] + + @property + def set_addons_config(self) -> Callable[ + [cluster_service.SetAddonsConfigRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set addons config method over gRPC. + + Sets the addons for a specific cluster. + + Returns: + Callable[[~.SetAddonsConfigRequest], + 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 'set_addons_config' not in self._stubs: + self._stubs['set_addons_config'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetAddonsConfig', + request_serializer=cluster_service.SetAddonsConfigRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_addons_config'] + + @property + def set_locations(self) -> Callable[ + [cluster_service.SetLocationsRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set locations method over gRPC. + + Sets the locations for a specific cluster. Deprecated. Use + `projects.locations.clusters.update `__ + instead. + + Returns: + Callable[[~.SetLocationsRequest], + 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 'set_locations' not in self._stubs: + self._stubs['set_locations'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetLocations', + request_serializer=cluster_service.SetLocationsRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_locations'] + + @property + def update_master(self) -> Callable[ + [cluster_service.UpdateMasterRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the update master method over gRPC. + + Updates the master for a specific cluster. + + Returns: + Callable[[~.UpdateMasterRequest], + 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_master' not in self._stubs: + self._stubs['update_master'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/UpdateMaster', + request_serializer=cluster_service.UpdateMasterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['update_master'] + + @property + def set_master_auth(self) -> Callable[ + [cluster_service.SetMasterAuthRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set master auth method over gRPC. + + Sets master auth materials. Currently supports + changing the admin password or a specific cluster, + either via password generation or explicitly setting the + password. + + Returns: + Callable[[~.SetMasterAuthRequest], + 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 'set_master_auth' not in self._stubs: + self._stubs['set_master_auth'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetMasterAuth', + request_serializer=cluster_service.SetMasterAuthRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_master_auth'] + + @property + def delete_cluster(self) -> Callable[ + [cluster_service.DeleteClusterRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the delete cluster method over gRPC. + + Deletes the cluster, including the Kubernetes + endpoint and all worker nodes. + + Firewalls and routes that were configured during cluster + creation are also deleted. + + Other Google Compute Engine resources that might be in + use by the cluster, such as load balancer resources, are + not deleted if they weren't present when the cluster was + initially created. + + Returns: + Callable[[~.DeleteClusterRequest], + 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_cluster' not in self._stubs: + self._stubs['delete_cluster'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/DeleteCluster', + request_serializer=cluster_service.DeleteClusterRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['delete_cluster'] + + @property + def list_operations(self) -> Callable[ + [cluster_service.ListOperationsRequest], + Awaitable[cluster_service.ListOperationsResponse]]: + r"""Return a callable for the list operations method over gRPC. + + Lists all operations in a project in the specified + zone or all zones. + + Returns: + Callable[[~.ListOperationsRequest], + Awaitable[~.ListOperationsResponse]]: + 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_operations' not in self._stubs: + self._stubs['list_operations'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/ListOperations', + request_serializer=cluster_service.ListOperationsRequest.serialize, + response_deserializer=cluster_service.ListOperationsResponse.deserialize, + ) + return self._stubs['list_operations'] + + @property + def get_operation(self) -> Callable[ + [cluster_service.GetOperationRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the get operation method over gRPC. + + Gets the specified operation. + + Returns: + Callable[[~.GetOperationRequest], + 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 'get_operation' not in self._stubs: + self._stubs['get_operation'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/GetOperation', + request_serializer=cluster_service.GetOperationRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['get_operation'] + + @property + def cancel_operation(self) -> Callable[ + [cluster_service.CancelOperationRequest], + Awaitable[empty_pb2.Empty]]: + r"""Return a callable for the cancel operation method over gRPC. + + Cancels the specified operation. + + Returns: + Callable[[~.CancelOperationRequest], + Awaitable[~.Empty]]: + 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 'cancel_operation' not in self._stubs: + self._stubs['cancel_operation'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/CancelOperation', + request_serializer=cluster_service.CancelOperationRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['cancel_operation'] + + @property + def get_server_config(self) -> Callable[ + [cluster_service.GetServerConfigRequest], + Awaitable[cluster_service.ServerConfig]]: + r"""Return a callable for the get server config method over gRPC. + + Returns configuration info about the Google + Kubernetes Engine service. + + Returns: + Callable[[~.GetServerConfigRequest], + Awaitable[~.ServerConfig]]: + 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_server_config' not in self._stubs: + self._stubs['get_server_config'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/GetServerConfig', + request_serializer=cluster_service.GetServerConfigRequest.serialize, + response_deserializer=cluster_service.ServerConfig.deserialize, + ) + return self._stubs['get_server_config'] + + @property + def get_json_web_keys(self) -> Callable[ + [cluster_service.GetJSONWebKeysRequest], + Awaitable[cluster_service.GetJSONWebKeysResponse]]: + r"""Return a callable for the get json web keys method over gRPC. + + Gets the public component of the cluster signing keys + in JSON Web Key format. + + Returns: + Callable[[~.GetJSONWebKeysRequest], + Awaitable[~.GetJSONWebKeysResponse]]: + 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_json_web_keys' not in self._stubs: + self._stubs['get_json_web_keys'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/GetJSONWebKeys', + request_serializer=cluster_service.GetJSONWebKeysRequest.serialize, + response_deserializer=cluster_service.GetJSONWebKeysResponse.deserialize, + ) + return self._stubs['get_json_web_keys'] + + @property + def list_node_pools(self) -> Callable[ + [cluster_service.ListNodePoolsRequest], + Awaitable[cluster_service.ListNodePoolsResponse]]: + r"""Return a callable for the list node pools method over gRPC. + + Lists the node pools for a cluster. + + Returns: + Callable[[~.ListNodePoolsRequest], + Awaitable[~.ListNodePoolsResponse]]: + 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_node_pools' not in self._stubs: + self._stubs['list_node_pools'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/ListNodePools', + request_serializer=cluster_service.ListNodePoolsRequest.serialize, + response_deserializer=cluster_service.ListNodePoolsResponse.deserialize, + ) + return self._stubs['list_node_pools'] + + @property + def get_node_pool(self) -> Callable[ + [cluster_service.GetNodePoolRequest], + Awaitable[cluster_service.NodePool]]: + r"""Return a callable for the get node pool method over gRPC. + + Retrieves the requested node pool. + + Returns: + Callable[[~.GetNodePoolRequest], + Awaitable[~.NodePool]]: + 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_node_pool' not in self._stubs: + self._stubs['get_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/GetNodePool', + request_serializer=cluster_service.GetNodePoolRequest.serialize, + response_deserializer=cluster_service.NodePool.deserialize, + ) + return self._stubs['get_node_pool'] + + @property + def create_node_pool(self) -> Callable[ + [cluster_service.CreateNodePoolRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the create node pool method over gRPC. + + Creates a node pool for a cluster. + + Returns: + Callable[[~.CreateNodePoolRequest], + 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_node_pool' not in self._stubs: + self._stubs['create_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/CreateNodePool', + request_serializer=cluster_service.CreateNodePoolRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['create_node_pool'] + + @property + def delete_node_pool(self) -> Callable[ + [cluster_service.DeleteNodePoolRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the delete node pool method over gRPC. + + Deletes a node pool from a cluster. + + Returns: + Callable[[~.DeleteNodePoolRequest], + 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_node_pool' not in self._stubs: + self._stubs['delete_node_pool'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/DeleteNodePool', + request_serializer=cluster_service.DeleteNodePoolRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['delete_node_pool'] + + @property + def complete_node_pool_upgrade(self) -> Callable[ + [cluster_service.CompleteNodePoolUpgradeRequest], + Awaitable[empty_pb2.Empty]]: + r"""Return a callable for the complete node pool upgrade method over gRPC. + + CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + Returns: + Callable[[~.CompleteNodePoolUpgradeRequest], + Awaitable[~.Empty]]: + 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 'complete_node_pool_upgrade' not in self._stubs: + self._stubs['complete_node_pool_upgrade'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/CompleteNodePoolUpgrade', + request_serializer=cluster_service.CompleteNodePoolUpgradeRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['complete_node_pool_upgrade'] + + @property + def rollback_node_pool_upgrade(self) -> Callable[ + [cluster_service.RollbackNodePoolUpgradeRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the rollback node pool upgrade method over gRPC. + + Rolls back a previously Aborted or Failed NodePool + upgrade. This makes no changes if the last upgrade + successfully completed. + + Returns: + Callable[[~.RollbackNodePoolUpgradeRequest], + 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 'rollback_node_pool_upgrade' not in self._stubs: + self._stubs['rollback_node_pool_upgrade'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/RollbackNodePoolUpgrade', + request_serializer=cluster_service.RollbackNodePoolUpgradeRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['rollback_node_pool_upgrade'] + + @property + def set_node_pool_management(self) -> Callable[ + [cluster_service.SetNodePoolManagementRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set node pool management method over gRPC. + + Sets the NodeManagement options for a node pool. + + Returns: + Callable[[~.SetNodePoolManagementRequest], + 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 'set_node_pool_management' not in self._stubs: + self._stubs['set_node_pool_management'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetNodePoolManagement', + request_serializer=cluster_service.SetNodePoolManagementRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_node_pool_management'] + + @property + def set_labels(self) -> Callable[ + [cluster_service.SetLabelsRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set labels method over gRPC. + + Sets labels on a cluster. + + Returns: + Callable[[~.SetLabelsRequest], + 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 'set_labels' not in self._stubs: + self._stubs['set_labels'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetLabels', + request_serializer=cluster_service.SetLabelsRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_labels'] + + @property + def set_legacy_abac(self) -> Callable[ + [cluster_service.SetLegacyAbacRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set legacy abac method over gRPC. + + Enables or disables the ABAC authorization mechanism + on a cluster. + + Returns: + Callable[[~.SetLegacyAbacRequest], + 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 'set_legacy_abac' not in self._stubs: + self._stubs['set_legacy_abac'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetLegacyAbac', + request_serializer=cluster_service.SetLegacyAbacRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_legacy_abac'] + + @property + def start_ip_rotation(self) -> Callable[ + [cluster_service.StartIPRotationRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the start ip rotation method over gRPC. + + Starts master IP rotation. + + Returns: + Callable[[~.StartIPRotationRequest], + 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 'start_ip_rotation' not in self._stubs: + self._stubs['start_ip_rotation'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/StartIPRotation', + request_serializer=cluster_service.StartIPRotationRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['start_ip_rotation'] + + @property + def complete_ip_rotation(self) -> Callable[ + [cluster_service.CompleteIPRotationRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the complete ip rotation method over gRPC. + + Completes master IP rotation. + + Returns: + Callable[[~.CompleteIPRotationRequest], + 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 'complete_ip_rotation' not in self._stubs: + self._stubs['complete_ip_rotation'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/CompleteIPRotation', + request_serializer=cluster_service.CompleteIPRotationRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['complete_ip_rotation'] + + @property + def set_node_pool_size(self) -> Callable[ + [cluster_service.SetNodePoolSizeRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set node pool size method over gRPC. + + SetNodePoolSizeRequest sets the size of a node pool. The new + size will be used for all replicas, including future replicas + created by modifying + [NodePool.locations][google.container.v1beta1.NodePool.locations]. + + Returns: + Callable[[~.SetNodePoolSizeRequest], + 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 'set_node_pool_size' not in self._stubs: + self._stubs['set_node_pool_size'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetNodePoolSize', + request_serializer=cluster_service.SetNodePoolSizeRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_node_pool_size'] + + @property + def set_network_policy(self) -> Callable[ + [cluster_service.SetNetworkPolicyRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set network policy method over gRPC. + + Enables or disables Network Policy for a cluster. + + Returns: + Callable[[~.SetNetworkPolicyRequest], + 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 'set_network_policy' not in self._stubs: + self._stubs['set_network_policy'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetNetworkPolicy', + request_serializer=cluster_service.SetNetworkPolicyRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_network_policy'] + + @property + def set_maintenance_policy(self) -> Callable[ + [cluster_service.SetMaintenancePolicyRequest], + Awaitable[cluster_service.Operation]]: + r"""Return a callable for the set maintenance policy method over gRPC. + + Sets the maintenance policy for a cluster. + + Returns: + Callable[[~.SetMaintenancePolicyRequest], + 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 'set_maintenance_policy' not in self._stubs: + self._stubs['set_maintenance_policy'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/SetMaintenancePolicy', + request_serializer=cluster_service.SetMaintenancePolicyRequest.serialize, + response_deserializer=cluster_service.Operation.deserialize, + ) + return self._stubs['set_maintenance_policy'] + + @property + def list_usable_subnetworks(self) -> Callable[ + [cluster_service.ListUsableSubnetworksRequest], + Awaitable[cluster_service.ListUsableSubnetworksResponse]]: + r"""Return a callable for the list usable subnetworks method over gRPC. + + Lists subnetworks that can be used for creating + clusters in a project. + + Returns: + Callable[[~.ListUsableSubnetworksRequest], + Awaitable[~.ListUsableSubnetworksResponse]]: + 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_usable_subnetworks' not in self._stubs: + self._stubs['list_usable_subnetworks'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/ListUsableSubnetworks', + request_serializer=cluster_service.ListUsableSubnetworksRequest.serialize, + response_deserializer=cluster_service.ListUsableSubnetworksResponse.deserialize, + ) + return self._stubs['list_usable_subnetworks'] + + @property + def check_autopilot_compatibility(self) -> Callable[ + [cluster_service.CheckAutopilotCompatibilityRequest], + Awaitable[cluster_service.CheckAutopilotCompatibilityResponse]]: + r"""Return a callable for the check autopilot compatibility method over gRPC. + + Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + Returns: + Callable[[~.CheckAutopilotCompatibilityRequest], + Awaitable[~.CheckAutopilotCompatibilityResponse]]: + 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 'check_autopilot_compatibility' not in self._stubs: + self._stubs['check_autopilot_compatibility'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/CheckAutopilotCompatibility', + request_serializer=cluster_service.CheckAutopilotCompatibilityRequest.serialize, + response_deserializer=cluster_service.CheckAutopilotCompatibilityResponse.deserialize, + ) + return self._stubs['check_autopilot_compatibility'] + + @property + def list_locations(self) -> Callable[ + [cluster_service.ListLocationsRequest], + Awaitable[cluster_service.ListLocationsResponse]]: + r"""Return a callable for the list locations method over gRPC. + + Fetches locations that offer Google Kubernetes + Engine. + + Returns: + Callable[[~.ListLocationsRequest], + Awaitable[~.ListLocationsResponse]]: + 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_locations' not in self._stubs: + self._stubs['list_locations'] = self._logged_channel.unary_unary( + '/google.container.v1beta1.ClusterManager/ListLocations', + request_serializer=cluster_service.ListLocationsRequest.serialize, + response_deserializer=cluster_service.ListLocationsResponse.deserialize, + ) + return self._stubs['list_locations'] + + def _prep_wrapped_messages(self, client_info): + """ Precompute the wrapped methods, overriding the base class method to use async wrappers.""" + self._wrapped_methods = { + self.list_clusters: self._wrap_method( + self.list_clusters, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_cluster: self._wrap_method( + self.get_cluster, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.create_cluster: self._wrap_method( + self.create_cluster, + default_timeout=45.0, + client_info=client_info, + ), + self.update_cluster: self._wrap_method( + self.update_cluster, + default_timeout=45.0, + client_info=client_info, + ), + self.update_node_pool: self._wrap_method( + self.update_node_pool, + default_timeout=45.0, + client_info=client_info, + ), + self.set_node_pool_autoscaling: self._wrap_method( + self.set_node_pool_autoscaling, + default_timeout=45.0, + client_info=client_info, + ), + self.set_logging_service: self._wrap_method( + self.set_logging_service, + default_timeout=45.0, + client_info=client_info, + ), + self.set_monitoring_service: self._wrap_method( + self.set_monitoring_service, + default_timeout=45.0, + client_info=client_info, + ), + self.set_addons_config: self._wrap_method( + self.set_addons_config, + default_timeout=45.0, + client_info=client_info, + ), + self.set_locations: self._wrap_method( + self.set_locations, + default_timeout=45.0, + client_info=client_info, + ), + self.update_master: self._wrap_method( + self.update_master, + default_timeout=45.0, + client_info=client_info, + ), + self.set_master_auth: self._wrap_method( + self.set_master_auth, + default_timeout=45.0, + client_info=client_info, + ), + self.delete_cluster: self._wrap_method( + self.delete_cluster, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.list_operations: self._wrap_method( + self.list_operations, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_operation: self._wrap_method( + self.get_operation, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.cancel_operation: self._wrap_method( + self.cancel_operation, + default_timeout=45.0, + client_info=client_info, + ), + self.get_server_config: self._wrap_method( + self.get_server_config, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_json_web_keys: self._wrap_method( + self.get_json_web_keys, + default_timeout=None, + client_info=client_info, + ), + self.list_node_pools: self._wrap_method( + self.list_node_pools, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.get_node_pool: self._wrap_method( + self.get_node_pool, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.create_node_pool: self._wrap_method( + self.create_node_pool, + default_timeout=45.0, + client_info=client_info, + ), + self.delete_node_pool: self._wrap_method( + self.delete_node_pool, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.complete_node_pool_upgrade: self._wrap_method( + self.complete_node_pool_upgrade, + default_timeout=None, + client_info=client_info, + ), + self.rollback_node_pool_upgrade: self._wrap_method( + self.rollback_node_pool_upgrade, + default_timeout=45.0, + client_info=client_info, + ), + self.set_node_pool_management: self._wrap_method( + self.set_node_pool_management, + default_timeout=45.0, + client_info=client_info, + ), + self.set_labels: self._wrap_method( + self.set_labels, + default_timeout=45.0, + client_info=client_info, + ), + self.set_legacy_abac: self._wrap_method( + self.set_legacy_abac, + default_timeout=45.0, + client_info=client_info, + ), + self.start_ip_rotation: self._wrap_method( + self.start_ip_rotation, + default_timeout=45.0, + client_info=client_info, + ), + self.complete_ip_rotation: self._wrap_method( + self.complete_ip_rotation, + default_timeout=45.0, + client_info=client_info, + ), + self.set_node_pool_size: self._wrap_method( + self.set_node_pool_size, + default_timeout=45.0, + client_info=client_info, + ), + self.set_network_policy: self._wrap_method( + self.set_network_policy, + default_timeout=45.0, + client_info=client_info, + ), + self.set_maintenance_policy: self._wrap_method( + self.set_maintenance_policy, + default_timeout=45.0, + client_info=client_info, + ), + self.list_usable_subnetworks: self._wrap_method( + self.list_usable_subnetworks, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + self.check_autopilot_compatibility: self._wrap_method( + self.check_autopilot_compatibility, + default_timeout=None, + client_info=client_info, + ), + self.list_locations: self._wrap_method( + self.list_locations, + default_retry=retries.AsyncRetry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=20.0, + ), + default_timeout=20.0, + client_info=client_info, + ), + } + + def _wrap_method(self, func, *args, **kwargs): + if self._wrap_with_kind: # pragma: NO COVER + kwargs["kind"] = self.kind + return gapic_v1.method_async.wrap_method(func, *args, **kwargs) + + def close(self): + return self._logged_channel.close() + + @property + def kind(self) -> str: + return "grpc_asyncio" + + +__all__ = ( + 'ClusterManagerGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/__init__.py new file mode 100644 index 000000000000..5940cad92069 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/__init__.py @@ -0,0 +1,400 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 .cluster_service import ( + AcceleratorConfig, + AdditionalNodeNetworkConfig, + AdditionalPodNetworkConfig, + AdditionalPodRangesConfig, + AddonsConfig, + AdvancedDatapathObservabilityConfig, + AdvancedMachineFeatures, + AuthenticatorGroupsConfig, + Autopilot, + AutopilotCompatibilityIssue, + AutopilotConversionStatus, + AutoprovisioningNodePoolDefaults, + AutoUpgradeOptions, + BestEffortProvisioning, + BinaryAuthorization, + BlueGreenSettings, + CancelOperationRequest, + CheckAutopilotCompatibilityRequest, + CheckAutopilotCompatibilityResponse, + ClientCertificateConfig, + CloudRunConfig, + Cluster, + ClusterAutoscaling, + ClusterTelemetry, + ClusterUpdate, + CompleteIPRotationRequest, + CompleteNodePoolUpgradeRequest, + CompliancePostureConfig, + ConfidentialNodes, + ConfigConnectorConfig, + ContainerdConfig, + CostManagementConfig, + CreateClusterRequest, + CreateNodePoolRequest, + DailyMaintenanceWindow, + DatabaseEncryption, + DefaultSnatStatus, + DeleteClusterRequest, + DeleteNodePoolRequest, + DnsCacheConfig, + DNSConfig, + EnterpriseConfig, + EphemeralStorageConfig, + EphemeralStorageLocalSsdConfig, + FastSocket, + Fleet, + GatewayAPIConfig, + GcePersistentDiskCsiDriverConfig, + GcfsConfig, + GcpFilestoreCsiDriverConfig, + GcsFuseCsiDriverConfig, + GetClusterRequest, + GetJSONWebKeysRequest, + GetJSONWebKeysResponse, + GetNodePoolRequest, + GetOpenIDConfigRequest, + GetOpenIDConfigResponse, + GetOperationRequest, + GetServerConfigRequest, + GkeBackupAgentConfig, + GPUDriverInstallationConfig, + GPUSharingConfig, + HorizontalPodAutoscaling, + HostMaintenancePolicy, + HttpLoadBalancing, + IdentityServiceConfig, + ILBSubsettingConfig, + IntraNodeVisibilityConfig, + IPAllocationPolicy, + IstioConfig, + Jwk, + K8sBetaAPIConfig, + KalmConfig, + KubernetesDashboard, + LegacyAbac, + LinuxNodeConfig, + ListClustersRequest, + ListClustersResponse, + ListLocationsRequest, + ListLocationsResponse, + ListNodePoolsRequest, + ListNodePoolsResponse, + ListOperationsRequest, + ListOperationsResponse, + ListUsableSubnetworksRequest, + ListUsableSubnetworksResponse, + LocalNvmeSsdBlockConfig, + Location, + LoggingComponentConfig, + LoggingConfig, + LoggingVariantConfig, + MaintenanceExclusionOptions, + MaintenancePolicy, + MaintenanceWindow, + ManagedPrometheusConfig, + Master, + MasterAuth, + MasterAuthorizedNetworksConfig, + MaxPodsConstraint, + MeshCertificates, + MonitoringComponentConfig, + MonitoringConfig, + NetworkConfig, + NetworkPolicy, + NetworkPolicyConfig, + NetworkTags, + NodeConfig, + NodeConfigDefaults, + NodeKubeletConfig, + NodeLabels, + NodeManagement, + NodeNetworkConfig, + NodePool, + NodePoolAutoConfig, + NodePoolAutoscaling, + NodePoolDefaults, + NodePoolLoggingConfig, + NodeTaint, + NodeTaints, + NotificationConfig, + Operation, + OperationProgress, + PodCIDROverprovisionConfig, + PodSecurityPolicyConfig, + PrivateClusterConfig, + PrivateClusterMasterGlobalAccessConfig, + ProtectConfig, + RangeInfo, + RayClusterLoggingConfig, + RayClusterMonitoringConfig, + RayOperatorConfig, + RecurringTimeWindow, + ReleaseChannel, + ReservationAffinity, + ResourceLabels, + ResourceLimit, + ResourceManagerTags, + ResourceUsageExportConfig, + RollbackNodePoolUpgradeRequest, + SandboxConfig, + SecondaryBootDisk, + SecondaryBootDiskUpdateStrategy, + SecretManagerConfig, + SecurityBulletinEvent, + SecurityPostureConfig, + ServerConfig, + ServiceExternalIPsConfig, + SetAddonsConfigRequest, + SetLabelsRequest, + SetLegacyAbacRequest, + SetLocationsRequest, + SetLoggingServiceRequest, + SetMaintenancePolicyRequest, + SetMasterAuthRequest, + SetMonitoringServiceRequest, + SetNetworkPolicyRequest, + SetNodePoolAutoscalingRequest, + SetNodePoolManagementRequest, + SetNodePoolSizeRequest, + ShieldedInstanceConfig, + ShieldedNodes, + SoleTenantConfig, + StartIPRotationRequest, + StatefulHAConfig, + StatusCondition, + TimeWindow, + TpuConfig, + UpdateClusterRequest, + UpdateMasterRequest, + UpdateNodePoolRequest, + UpgradeAvailableEvent, + UpgradeEvent, + UsableSubnetwork, + UsableSubnetworkSecondaryRange, + VerticalPodAutoscaling, + VirtualNIC, + WindowsNodeConfig, + WindowsVersions, + WorkloadALTSConfig, + WorkloadCertificates, + WorkloadConfig, + WorkloadIdentityConfig, + WorkloadMetadataConfig, + WorkloadPolicyConfig, + DatapathProvider, + InTransitEncryptionConfig, + NodePoolUpdateStrategy, + PrivateIPv6GoogleAccess, + StackType, + UpgradeResourceType, +) + +__all__ = ( + 'AcceleratorConfig', + 'AdditionalNodeNetworkConfig', + 'AdditionalPodNetworkConfig', + 'AdditionalPodRangesConfig', + 'AddonsConfig', + 'AdvancedDatapathObservabilityConfig', + 'AdvancedMachineFeatures', + 'AuthenticatorGroupsConfig', + 'Autopilot', + 'AutopilotCompatibilityIssue', + 'AutopilotConversionStatus', + 'AutoprovisioningNodePoolDefaults', + 'AutoUpgradeOptions', + 'BestEffortProvisioning', + 'BinaryAuthorization', + 'BlueGreenSettings', + 'CancelOperationRequest', + 'CheckAutopilotCompatibilityRequest', + 'CheckAutopilotCompatibilityResponse', + 'ClientCertificateConfig', + 'CloudRunConfig', + 'Cluster', + 'ClusterAutoscaling', + 'ClusterTelemetry', + 'ClusterUpdate', + 'CompleteIPRotationRequest', + 'CompleteNodePoolUpgradeRequest', + 'CompliancePostureConfig', + 'ConfidentialNodes', + 'ConfigConnectorConfig', + 'ContainerdConfig', + 'CostManagementConfig', + 'CreateClusterRequest', + 'CreateNodePoolRequest', + 'DailyMaintenanceWindow', + 'DatabaseEncryption', + 'DefaultSnatStatus', + 'DeleteClusterRequest', + 'DeleteNodePoolRequest', + 'DnsCacheConfig', + 'DNSConfig', + 'EnterpriseConfig', + 'EphemeralStorageConfig', + 'EphemeralStorageLocalSsdConfig', + 'FastSocket', + 'Fleet', + 'GatewayAPIConfig', + 'GcePersistentDiskCsiDriverConfig', + 'GcfsConfig', + 'GcpFilestoreCsiDriverConfig', + 'GcsFuseCsiDriverConfig', + 'GetClusterRequest', + 'GetJSONWebKeysRequest', + 'GetJSONWebKeysResponse', + 'GetNodePoolRequest', + 'GetOpenIDConfigRequest', + 'GetOpenIDConfigResponse', + 'GetOperationRequest', + 'GetServerConfigRequest', + 'GkeBackupAgentConfig', + 'GPUDriverInstallationConfig', + 'GPUSharingConfig', + 'HorizontalPodAutoscaling', + 'HostMaintenancePolicy', + 'HttpLoadBalancing', + 'IdentityServiceConfig', + 'ILBSubsettingConfig', + 'IntraNodeVisibilityConfig', + 'IPAllocationPolicy', + 'IstioConfig', + 'Jwk', + 'K8sBetaAPIConfig', + 'KalmConfig', + 'KubernetesDashboard', + 'LegacyAbac', + 'LinuxNodeConfig', + 'ListClustersRequest', + 'ListClustersResponse', + 'ListLocationsRequest', + 'ListLocationsResponse', + 'ListNodePoolsRequest', + 'ListNodePoolsResponse', + 'ListOperationsRequest', + 'ListOperationsResponse', + 'ListUsableSubnetworksRequest', + 'ListUsableSubnetworksResponse', + 'LocalNvmeSsdBlockConfig', + 'Location', + 'LoggingComponentConfig', + 'LoggingConfig', + 'LoggingVariantConfig', + 'MaintenanceExclusionOptions', + 'MaintenancePolicy', + 'MaintenanceWindow', + 'ManagedPrometheusConfig', + 'Master', + 'MasterAuth', + 'MasterAuthorizedNetworksConfig', + 'MaxPodsConstraint', + 'MeshCertificates', + 'MonitoringComponentConfig', + 'MonitoringConfig', + 'NetworkConfig', + 'NetworkPolicy', + 'NetworkPolicyConfig', + 'NetworkTags', + 'NodeConfig', + 'NodeConfigDefaults', + 'NodeKubeletConfig', + 'NodeLabels', + 'NodeManagement', + 'NodeNetworkConfig', + 'NodePool', + 'NodePoolAutoConfig', + 'NodePoolAutoscaling', + 'NodePoolDefaults', + 'NodePoolLoggingConfig', + 'NodeTaint', + 'NodeTaints', + 'NotificationConfig', + 'Operation', + 'OperationProgress', + 'PodCIDROverprovisionConfig', + 'PodSecurityPolicyConfig', + 'PrivateClusterConfig', + 'PrivateClusterMasterGlobalAccessConfig', + 'ProtectConfig', + 'RangeInfo', + 'RayClusterLoggingConfig', + 'RayClusterMonitoringConfig', + 'RayOperatorConfig', + 'RecurringTimeWindow', + 'ReleaseChannel', + 'ReservationAffinity', + 'ResourceLabels', + 'ResourceLimit', + 'ResourceManagerTags', + 'ResourceUsageExportConfig', + 'RollbackNodePoolUpgradeRequest', + 'SandboxConfig', + 'SecondaryBootDisk', + 'SecondaryBootDiskUpdateStrategy', + 'SecretManagerConfig', + 'SecurityBulletinEvent', + 'SecurityPostureConfig', + 'ServerConfig', + 'ServiceExternalIPsConfig', + 'SetAddonsConfigRequest', + 'SetLabelsRequest', + 'SetLegacyAbacRequest', + 'SetLocationsRequest', + 'SetLoggingServiceRequest', + 'SetMaintenancePolicyRequest', + 'SetMasterAuthRequest', + 'SetMonitoringServiceRequest', + 'SetNetworkPolicyRequest', + 'SetNodePoolAutoscalingRequest', + 'SetNodePoolManagementRequest', + 'SetNodePoolSizeRequest', + 'ShieldedInstanceConfig', + 'ShieldedNodes', + 'SoleTenantConfig', + 'StartIPRotationRequest', + 'StatefulHAConfig', + 'StatusCondition', + 'TimeWindow', + 'TpuConfig', + 'UpdateClusterRequest', + 'UpdateMasterRequest', + 'UpdateNodePoolRequest', + 'UpgradeAvailableEvent', + 'UpgradeEvent', + 'UsableSubnetwork', + 'UsableSubnetworkSecondaryRange', + 'VerticalPodAutoscaling', + 'VirtualNIC', + 'WindowsNodeConfig', + 'WindowsVersions', + 'WorkloadALTSConfig', + 'WorkloadCertificates', + 'WorkloadConfig', + 'WorkloadIdentityConfig', + 'WorkloadMetadataConfig', + 'WorkloadPolicyConfig', + 'DatapathProvider', + 'InTransitEncryptionConfig', + 'NodePoolUpdateStrategy', + 'PrivateIPv6GoogleAccess', + 'StackType', + 'UpgradeResourceType', +) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/cluster_service.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/cluster_service.py new file mode 100644 index 000000000000..f2a6a595d649 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/cluster_service.py @@ -0,0 +1,10986 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 __future__ import annotations + +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 +from google.rpc import code_pb2 # type: ignore +from google.rpc import status_pb2 # type: ignore +from google.type import date_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.container.v1beta1', + manifest={ + 'PrivateIPv6GoogleAccess', + 'UpgradeResourceType', + 'NodePoolUpdateStrategy', + 'DatapathProvider', + 'StackType', + 'InTransitEncryptionConfig', + 'LinuxNodeConfig', + 'WindowsNodeConfig', + 'NodeKubeletConfig', + 'NodeConfig', + 'AdvancedMachineFeatures', + 'NodeNetworkConfig', + 'AdditionalNodeNetworkConfig', + 'AdditionalPodNetworkConfig', + 'ShieldedInstanceConfig', + 'SandboxConfig', + 'EphemeralStorageConfig', + 'LocalNvmeSsdBlockConfig', + 'EphemeralStorageLocalSsdConfig', + 'GcfsConfig', + 'ReservationAffinity', + 'SoleTenantConfig', + 'ContainerdConfig', + 'HostMaintenancePolicy', + 'NodeTaint', + 'NodeTaints', + 'NodeLabels', + 'ResourceLabels', + 'NetworkTags', + 'MasterAuth', + 'ClientCertificateConfig', + 'AddonsConfig', + 'HttpLoadBalancing', + 'HorizontalPodAutoscaling', + 'KubernetesDashboard', + 'NetworkPolicyConfig', + 'DnsCacheConfig', + 'KalmConfig', + 'GkeBackupAgentConfig', + 'StatefulHAConfig', + 'ConfigConnectorConfig', + 'GcePersistentDiskCsiDriverConfig', + 'GcpFilestoreCsiDriverConfig', + 'GcsFuseCsiDriverConfig', + 'RayOperatorConfig', + 'PrivateClusterMasterGlobalAccessConfig', + 'PrivateClusterConfig', + 'IstioConfig', + 'CloudRunConfig', + 'MasterAuthorizedNetworksConfig', + 'LegacyAbac', + 'NetworkPolicy', + 'PodCIDROverprovisionConfig', + 'IPAllocationPolicy', + 'BinaryAuthorization', + 'PodSecurityPolicyConfig', + 'AuthenticatorGroupsConfig', + 'ClusterTelemetry', + 'Cluster', + 'CompliancePostureConfig', + 'K8sBetaAPIConfig', + 'WorkloadConfig', + 'ProtectConfig', + 'SecurityPostureConfig', + 'NodePoolDefaults', + 'NodeConfigDefaults', + 'NodePoolAutoConfig', + 'ClusterUpdate', + 'AdditionalPodRangesConfig', + 'RangeInfo', + 'Operation', + 'OperationProgress', + 'CreateClusterRequest', + 'GetClusterRequest', + 'UpdateClusterRequest', + 'UpdateNodePoolRequest', + 'SetNodePoolAutoscalingRequest', + 'SetLoggingServiceRequest', + 'SetMonitoringServiceRequest', + 'SetAddonsConfigRequest', + 'SetLocationsRequest', + 'UpdateMasterRequest', + 'SetMasterAuthRequest', + 'DeleteClusterRequest', + 'ListClustersRequest', + 'ListClustersResponse', + 'GetOperationRequest', + 'ListOperationsRequest', + 'CancelOperationRequest', + 'ListOperationsResponse', + 'GetServerConfigRequest', + 'ServerConfig', + 'BestEffortProvisioning', + 'WindowsVersions', + 'CreateNodePoolRequest', + 'DeleteNodePoolRequest', + 'ListNodePoolsRequest', + 'GetNodePoolRequest', + 'BlueGreenSettings', + 'NodePool', + 'NodeManagement', + 'AutoUpgradeOptions', + 'MaintenancePolicy', + 'MaintenanceWindow', + 'TimeWindow', + 'MaintenanceExclusionOptions', + 'RecurringTimeWindow', + 'DailyMaintenanceWindow', + 'SetNodePoolManagementRequest', + 'SetNodePoolSizeRequest', + 'CompleteNodePoolUpgradeRequest', + 'RollbackNodePoolUpgradeRequest', + 'ListNodePoolsResponse', + 'ClusterAutoscaling', + 'AutoprovisioningNodePoolDefaults', + 'ResourceLimit', + 'NodePoolAutoscaling', + 'SetLabelsRequest', + 'SetLegacyAbacRequest', + 'StartIPRotationRequest', + 'CompleteIPRotationRequest', + 'AcceleratorConfig', + 'GPUSharingConfig', + 'GPUDriverInstallationConfig', + 'ManagedPrometheusConfig', + 'WorkloadMetadataConfig', + 'SetNetworkPolicyRequest', + 'SetMaintenancePolicyRequest', + 'ListLocationsRequest', + 'ListLocationsResponse', + 'Location', + 'StatusCondition', + 'NetworkConfig', + 'GatewayAPIConfig', + 'ServiceExternalIPsConfig', + 'ListUsableSubnetworksRequest', + 'ListUsableSubnetworksResponse', + 'UsableSubnetworkSecondaryRange', + 'UsableSubnetwork', + 'VerticalPodAutoscaling', + 'DefaultSnatStatus', + 'IntraNodeVisibilityConfig', + 'ILBSubsettingConfig', + 'DNSConfig', + 'MaxPodsConstraint', + 'WorkloadIdentityConfig', + 'WorkloadALTSConfig', + 'WorkloadCertificates', + 'MeshCertificates', + 'DatabaseEncryption', + 'ResourceUsageExportConfig', + 'ShieldedNodes', + 'VirtualNIC', + 'FastSocket', + 'GetOpenIDConfigRequest', + 'GetOpenIDConfigResponse', + 'GetJSONWebKeysRequest', + 'Jwk', + 'GetJSONWebKeysResponse', + 'CheckAutopilotCompatibilityRequest', + 'AutopilotCompatibilityIssue', + 'CheckAutopilotCompatibilityResponse', + 'ReleaseChannel', + 'CostManagementConfig', + 'TpuConfig', + 'Master', + 'AutopilotConversionStatus', + 'Autopilot', + 'WorkloadPolicyConfig', + 'NotificationConfig', + 'ConfidentialNodes', + 'UpgradeEvent', + 'UpgradeAvailableEvent', + 'SecurityBulletinEvent', + 'IdentityServiceConfig', + 'LoggingConfig', + 'LoggingComponentConfig', + 'RayClusterLoggingConfig', + 'MonitoringConfig', + 'AdvancedDatapathObservabilityConfig', + 'RayClusterMonitoringConfig', + 'NodePoolLoggingConfig', + 'LoggingVariantConfig', + 'MonitoringComponentConfig', + 'Fleet', + 'ResourceManagerTags', + 'EnterpriseConfig', + 'SecretManagerConfig', + 'SecondaryBootDisk', + 'SecondaryBootDiskUpdateStrategy', + }, +) + + +class PrivateIPv6GoogleAccess(proto.Enum): + r"""PrivateIPv6GoogleAccess controls whether and how the pods can + communicate with Google Services through gRPC over IPv6. + + Values: + PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED (0): + Default value. Same as DISABLED + PRIVATE_IPV6_GOOGLE_ACCESS_DISABLED (1): + No private access to or from Google Services + PRIVATE_IPV6_GOOGLE_ACCESS_TO_GOOGLE (2): + Enables private IPv6 access to Google + Services from GKE + PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL (3): + Enables private IPv6 access to and from + Google Services + """ + PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED = 0 + PRIVATE_IPV6_GOOGLE_ACCESS_DISABLED = 1 + PRIVATE_IPV6_GOOGLE_ACCESS_TO_GOOGLE = 2 + PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL = 3 + + +class UpgradeResourceType(proto.Enum): + r"""UpgradeResourceType is the resource type that is upgrading. + It is used in upgrade notifications. + + Values: + UPGRADE_RESOURCE_TYPE_UNSPECIFIED (0): + Default value. This shouldn't be used. + MASTER (1): + Master / control plane + NODE_POOL (2): + Node pool + """ + UPGRADE_RESOURCE_TYPE_UNSPECIFIED = 0 + MASTER = 1 + NODE_POOL = 2 + + +class NodePoolUpdateStrategy(proto.Enum): + r"""Strategy used for node pool update. + + Values: + NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED (0): + Default value if unset. GKE internally + defaults the update strategy to SURGE for + unspecified strategies. + BLUE_GREEN (2): + blue-green upgrade. + SURGE (3): + SURGE is the traditional way of upgrading a node pool. + max_surge and max_unavailable determines the level of + upgrade parallelism. + """ + NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED = 0 + BLUE_GREEN = 2 + SURGE = 3 + + +class DatapathProvider(proto.Enum): + r"""The datapath provider selects the implementation of the + Kubernetes networking model for service resolution and network + policy enforcement. + + Values: + DATAPATH_PROVIDER_UNSPECIFIED (0): + Default value. + LEGACY_DATAPATH (1): + Use the IPTables implementation based on + kube-proxy. + ADVANCED_DATAPATH (2): + Use the eBPF based GKE Dataplane V2 with additional + features. See the `GKE Dataplane V2 + documentation `__ + for more. + """ + DATAPATH_PROVIDER_UNSPECIFIED = 0 + LEGACY_DATAPATH = 1 + ADVANCED_DATAPATH = 2 + + +class StackType(proto.Enum): + r"""Possible values for IP stack type + + Values: + STACK_TYPE_UNSPECIFIED (0): + By default, the clusters will be IPV4 only + IPV4 (1): + The value used if the cluster is a IPV4 only + IPV4_IPV6 (2): + The value used if the cluster is a dual stack + cluster + """ + STACK_TYPE_UNSPECIFIED = 0 + IPV4 = 1 + IPV4_IPV6 = 2 + + +class InTransitEncryptionConfig(proto.Enum): + r"""Options for in-transit encryption. + + Values: + IN_TRANSIT_ENCRYPTION_CONFIG_UNSPECIFIED (0): + Unspecified, will be inferred as default - + IN_TRANSIT_ENCRYPTION_UNSPECIFIED. + IN_TRANSIT_ENCRYPTION_DISABLED (1): + In-transit encryption is disabled. + IN_TRANSIT_ENCRYPTION_INTER_NODE_TRANSPARENT (2): + Data in-transit is encrypted using inter-node + transparent encryption. + """ + IN_TRANSIT_ENCRYPTION_CONFIG_UNSPECIFIED = 0 + IN_TRANSIT_ENCRYPTION_DISABLED = 1 + IN_TRANSIT_ENCRYPTION_INTER_NODE_TRANSPARENT = 2 + + +class LinuxNodeConfig(proto.Message): + r"""Parameters that can be configured on Linux nodes. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + sysctls (MutableMapping[str, str]): + The Linux kernel parameters to be applied to the nodes and + all pods running on the nodes. + + The following parameters are supported. + + net.core.busy_poll net.core.busy_read + net.core.netdev_max_backlog net.core.rmem_max + net.core.wmem_default net.core.wmem_max net.core.optmem_max + net.core.somaxconn net.ipv4.tcp_rmem net.ipv4.tcp_wmem + net.ipv4.tcp_tw_reuse + cgroup_mode (google.cloud.container_v1beta1.types.LinuxNodeConfig.CgroupMode): + cgroup_mode specifies the cgroup mode to be used on the + node. + hugepages (google.cloud.container_v1beta1.types.LinuxNodeConfig.HugepagesConfig): + Optional. Amounts for 2M and 1G hugepages + + This field is a member of `oneof`_ ``_hugepages``. + """ + class CgroupMode(proto.Enum): + r"""Possible cgroup modes that can be used. + + Values: + CGROUP_MODE_UNSPECIFIED (0): + CGROUP_MODE_UNSPECIFIED is when unspecified cgroup + configuration is used. The default for the GKE node OS image + will be used. + CGROUP_MODE_V1 (1): + CGROUP_MODE_V1 specifies to use cgroupv1 for the cgroup + configuration on the node image. + CGROUP_MODE_V2 (2): + CGROUP_MODE_V2 specifies to use cgroupv2 for the cgroup + configuration on the node image. + """ + CGROUP_MODE_UNSPECIFIED = 0 + CGROUP_MODE_V1 = 1 + CGROUP_MODE_V2 = 2 + + class HugepagesConfig(proto.Message): + r"""Hugepages amount in both 2m and 1g size + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + hugepage_size2m (int): + Optional. Amount of 2M hugepages + + This field is a member of `oneof`_ ``_hugepage_size2m``. + hugepage_size1g (int): + Optional. Amount of 1G hugepages + + This field is a member of `oneof`_ ``_hugepage_size1g``. + """ + + hugepage_size2m: int = proto.Field( + proto.INT32, + number=1, + optional=True, + ) + hugepage_size1g: int = proto.Field( + proto.INT32, + number=2, + optional=True, + ) + + sysctls: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=1, + ) + cgroup_mode: CgroupMode = proto.Field( + proto.ENUM, + number=2, + enum=CgroupMode, + ) + hugepages: HugepagesConfig = proto.Field( + proto.MESSAGE, + number=3, + optional=True, + message=HugepagesConfig, + ) + + +class WindowsNodeConfig(proto.Message): + r"""Parameters that can be configured on Windows nodes. + Windows Node Config that define the parameters that will be used + to configure the Windows node pool settings + + Attributes: + os_version (google.cloud.container_v1beta1.types.WindowsNodeConfig.OSVersion): + OSVersion specifies the Windows node config + to be used on the node + """ + class OSVersion(proto.Enum): + r"""Possible OS version that can be used. + + Values: + OS_VERSION_UNSPECIFIED (0): + When OSVersion is not specified + OS_VERSION_LTSC2019 (1): + LTSC2019 specifies to use LTSC2019 as the + Windows Servercore Base Image + OS_VERSION_LTSC2022 (2): + LTSC2022 specifies to use LTSC2022 as the + Windows Servercore Base Image + """ + OS_VERSION_UNSPECIFIED = 0 + OS_VERSION_LTSC2019 = 1 + OS_VERSION_LTSC2022 = 2 + + os_version: OSVersion = proto.Field( + proto.ENUM, + number=1, + enum=OSVersion, + ) + + +class NodeKubeletConfig(proto.Message): + r"""Node kubelet configs. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + cpu_manager_policy (str): + Control the CPU management policy on the node. See + https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/ + + The following values are allowed. + + - "none": the default, which represents the existing + scheduling behavior. + - "static": allows pods with certain resource + characteristics to be granted increased CPU affinity and + exclusivity on the node. The default value is 'none' if + unspecified. + cpu_cfs_quota (google.protobuf.wrappers_pb2.BoolValue): + Enable CPU CFS quota enforcement for + containers that specify CPU limits. + This option is enabled by default which makes + kubelet use CFS quota + (https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt) + to enforce container CPU limits. Otherwise, CPU + limits will not be enforced at all. + + Disable this option to mitigate CPU throttling + problems while still having your pods to be in + Guaranteed QoS class by specifying the CPU + limits. + + The default value is 'true' if unspecified. + cpu_cfs_quota_period (str): + Set the CPU CFS quota period value 'cpu.cfs_period_us'. + + The string must be a sequence of decimal numbers, each with + optional fraction and a unit suffix, such as "300ms". Valid + time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". + The value must be a positive duration. + pod_pids_limit (int): + Set the Pod PID limits. See + https://kubernetes.io/docs/concepts/policy/pid-limiting/#pod-pid-limits + + Controls the maximum number of processes allowed + to run in a pod. The value must be greater than + or equal to 1024 and less than 4194304. + insecure_kubelet_readonly_port_enabled (bool): + Enable or disable Kubelet read only port. + + This field is a member of `oneof`_ ``_insecure_kubelet_readonly_port_enabled``. + """ + + cpu_manager_policy: str = proto.Field( + proto.STRING, + number=1, + ) + cpu_cfs_quota: wrappers_pb2.BoolValue = proto.Field( + proto.MESSAGE, + number=2, + message=wrappers_pb2.BoolValue, + ) + cpu_cfs_quota_period: str = proto.Field( + proto.STRING, + number=3, + ) + pod_pids_limit: int = proto.Field( + proto.INT64, + number=4, + ) + insecure_kubelet_readonly_port_enabled: bool = proto.Field( + proto.BOOL, + number=7, + optional=True, + ) + + +class NodeConfig(proto.Message): + r"""Parameters that describe the nodes in a cluster. + + GKE Autopilot clusters do not recognize parameters in + ``NodeConfig``. Use + [AutoprovisioningNodePoolDefaults][google.container.v1beta1.AutoprovisioningNodePoolDefaults] + instead. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + machine_type (str): + The name of a Google Compute Engine `machine + type `__. + + If unspecified, the default machine type is ``e2-medium``. + disk_size_gb (int): + Size of the disk attached to each node, + specified in GB. The smallest allowed disk size + is 10GB. + + If unspecified, the default disk size is 100GB. + oauth_scopes (MutableSequence[str]): + The set of Google API scopes to be made available on all of + the node VMs under the "default" service account. + + The following scopes are recommended, but not required, and + by default are not included: + + - ``https://www.googleapis.com/auth/compute`` is required + for mounting persistent storage on your nodes. + - ``https://www.googleapis.com/auth/devstorage.read_only`` + is required for communicating with **gcr.io** (the + `Google Container + Registry `__). + + If unspecified, no scopes are added, unless Cloud Logging or + Cloud Monitoring are enabled, in which case their required + scopes will be added. + service_account (str): + The Google Cloud Platform Service Account to + be used by the node VMs. Specify the email + address of the Service Account; otherwise, if no + Service Account is specified, the "default" + service account is used. + metadata (MutableMapping[str, str]): + The metadata key/value pairs assigned to instances in the + cluster. + + Keys must conform to the regexp ``[a-zA-Z0-9-_]+`` and be + less than 128 bytes in length. These are reflected as part + of a URL in the metadata server. Additionally, to avoid + ambiguity, keys must not conflict with any other metadata + keys for the project or be one of the reserved keys: + + - "cluster-location" + - "cluster-name" + - "cluster-uid" + - "configure-sh" + - "containerd-configure-sh" + - "enable-oslogin" + - "gci-ensure-gke-docker" + - "gci-metrics-enabled" + - "gci-update-strategy" + - "instance-template" + - "kube-env" + - "startup-script" + - "user-data" + - "disable-address-manager" + - "windows-startup-script-ps1" + - "common-psm1" + - "k8s-node-setup-psm1" + - "install-ssh-psm1" + - "user-profile-psm1" + + Values are free-form strings, and only have meaning as + interpreted by the image running in the instance. The only + restriction placed on them is that each value's size must be + less than or equal to 32 KB. + + The total size of all keys and values must be less than 512 + KB. + image_type (str): + The image type to use for this node. Note + that for a given image type, the latest version + of it will be used. Please see + https://cloud.google.com/kubernetes-engine/docs/concepts/node-images + for available image types. + labels (MutableMapping[str, str]): + The map of Kubernetes labels (key/value + pairs) to be applied to each node. These will + added in addition to any default label(s) that + Kubernetes may apply to the node. + In case of conflict in label keys, the applied + set may differ depending on the Kubernetes + version -- it's best to assume the behavior is + undefined and conflicts should be avoided. + For more information, including usage and the + valid values, see: + + https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + local_ssd_count (int): + The number of local SSD disks to be attached + to the node. + The limit for this value is dependent upon the + maximum number of disks available on a machine + per zone. See: + + https://cloud.google.com/compute/docs/disks/local-ssd + for more information. + tags (MutableSequence[str]): + The list of instance tags applied to all + nodes. Tags are used to identify valid sources + or targets for network firewalls and are + specified by the client during cluster or node + pool creation. Each tag within the list must + comply with RFC1035. + preemptible (bool): + Whether the nodes are created as preemptible + VM instances. See: + https://cloud.google.com/compute/docs/instances/preemptible + for more information about preemptible VM + instances. + accelerators (MutableSequence[google.cloud.container_v1beta1.types.AcceleratorConfig]): + A list of hardware accelerators to be + attached to each node. See + https://cloud.google.com/compute/docs/gpus for + more information about support for GPUs. + sandbox_config (google.cloud.container_v1beta1.types.SandboxConfig): + Sandbox configuration for this node. + node_group (str): + Setting this field will assign instances of this pool to run + on the specified node group. This is useful for running + workloads on `sole tenant + nodes `__. + reservation_affinity (google.cloud.container_v1beta1.types.ReservationAffinity): + The optional reservation affinity. Setting this field will + apply the specified `Zonal Compute + Reservation `__ + to this node pool. + disk_type (str): + Type of the disk attached to each node (e.g. + 'pd-standard', 'pd-ssd' or 'pd-balanced') + + If unspecified, the default disk type is + 'pd-standard' + min_cpu_platform (str): + Minimum CPU platform to be used by this instance. The + instance may be scheduled on the specified or newer CPU + platform. Applicable values are the friendly names of CPU + platforms, such as ``minCpuPlatform: "Intel Haswell"`` or + ``minCpuPlatform: "Intel Sandy Bridge"``. For more + information, read `how to specify min CPU + platform `__. + workload_metadata_config (google.cloud.container_v1beta1.types.WorkloadMetadataConfig): + The workload metadata configuration for this + node. + taints (MutableSequence[google.cloud.container_v1beta1.types.NodeTaint]): + List of kubernetes taints to be applied to + each node. + For more information, including usage and the + valid values, see: + + https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + boot_disk_kms_key (str): + The Customer Managed Encryption Key used to encrypt the boot + disk attached to each node in the node pool. This should be + of the form + projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. + For more information about protecting resources with Cloud + KMS Keys please see: + https://cloud.google.com/compute/docs/disks/customer-managed-encryption + shielded_instance_config (google.cloud.container_v1beta1.types.ShieldedInstanceConfig): + Shielded Instance options. + linux_node_config (google.cloud.container_v1beta1.types.LinuxNodeConfig): + Parameters that can be configured on Linux + nodes. + kubelet_config (google.cloud.container_v1beta1.types.NodeKubeletConfig): + Node kubelet configs. + ephemeral_storage_config (google.cloud.container_v1beta1.types.EphemeralStorageConfig): + Parameters for the ephemeral storage + filesystem. If unspecified, ephemeral storage is + backed by the boot disk. + gcfs_config (google.cloud.container_v1beta1.types.GcfsConfig): + GCFS (Google Container File System) configs. + advanced_machine_features (google.cloud.container_v1beta1.types.AdvancedMachineFeatures): + Advanced features for the Compute Engine VM. + gvnic (google.cloud.container_v1beta1.types.VirtualNIC): + Enable or disable gvnic on the node pool. + spot (bool): + Spot flag for enabling Spot VM, which is a + rebrand of the existing preemptible flag. + confidential_nodes (google.cloud.container_v1beta1.types.ConfidentialNodes): + Confidential nodes config. + All the nodes in the node pool will be + Confidential VM once enabled. + fast_socket (google.cloud.container_v1beta1.types.FastSocket): + Enable or disable NCCL fast socket for the + node pool. + + This field is a member of `oneof`_ ``_fast_socket``. + resource_labels (MutableMapping[str, str]): + The resource labels for the node pool to use + to annotate any related Google Compute Engine + resources. + logging_config (google.cloud.container_v1beta1.types.NodePoolLoggingConfig): + Logging configuration. + windows_node_config (google.cloud.container_v1beta1.types.WindowsNodeConfig): + Parameters that can be configured on Windows + nodes. + local_nvme_ssd_block_config (google.cloud.container_v1beta1.types.LocalNvmeSsdBlockConfig): + Parameters for using raw-block Local NVMe + SSDs. + ephemeral_storage_local_ssd_config (google.cloud.container_v1beta1.types.EphemeralStorageLocalSsdConfig): + Parameters for the node ephemeral storage using Local SSDs. + If unspecified, ephemeral storage is backed by the boot + disk. This field is functionally equivalent to the + ephemeral_storage_config + sole_tenant_config (google.cloud.container_v1beta1.types.SoleTenantConfig): + Parameters for node pools to be backed by + shared sole tenant node groups. + containerd_config (google.cloud.container_v1beta1.types.ContainerdConfig): + Parameters for containerd customization. + host_maintenance_policy (google.cloud.container_v1beta1.types.HostMaintenancePolicy): + HostMaintenancePolicy contains the desired + maintenance policy for the Google Compute Engine + hosts. + resource_manager_tags (google.cloud.container_v1beta1.types.ResourceManagerTags): + A map of resource manager tag keys and values + to be attached to the nodes. + enable_confidential_storage (bool): + Optional. Reserved for future use. + secondary_boot_disks (MutableSequence[google.cloud.container_v1beta1.types.SecondaryBootDisk]): + List of secondary boot disks attached to the + nodes. + secondary_boot_disk_update_strategy (google.cloud.container_v1beta1.types.SecondaryBootDiskUpdateStrategy): + Secondary boot disk update strategy. + + This field is a member of `oneof`_ ``_secondary_boot_disk_update_strategy``. + """ + + machine_type: str = proto.Field( + proto.STRING, + number=1, + ) + disk_size_gb: int = proto.Field( + proto.INT32, + number=2, + ) + oauth_scopes: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + service_account: str = proto.Field( + proto.STRING, + number=9, + ) + metadata: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + image_type: str = proto.Field( + proto.STRING, + number=5, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=6, + ) + local_ssd_count: int = proto.Field( + proto.INT32, + number=7, + ) + tags: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=8, + ) + preemptible: bool = proto.Field( + proto.BOOL, + number=10, + ) + accelerators: MutableSequence['AcceleratorConfig'] = proto.RepeatedField( + proto.MESSAGE, + number=11, + message='AcceleratorConfig', + ) + sandbox_config: 'SandboxConfig' = proto.Field( + proto.MESSAGE, + number=17, + message='SandboxConfig', + ) + node_group: str = proto.Field( + proto.STRING, + number=18, + ) + reservation_affinity: 'ReservationAffinity' = proto.Field( + proto.MESSAGE, + number=19, + message='ReservationAffinity', + ) + disk_type: str = proto.Field( + proto.STRING, + number=12, + ) + min_cpu_platform: str = proto.Field( + proto.STRING, + number=13, + ) + workload_metadata_config: 'WorkloadMetadataConfig' = proto.Field( + proto.MESSAGE, + number=14, + message='WorkloadMetadataConfig', + ) + taints: MutableSequence['NodeTaint'] = proto.RepeatedField( + proto.MESSAGE, + number=15, + message='NodeTaint', + ) + boot_disk_kms_key: str = proto.Field( + proto.STRING, + number=23, + ) + shielded_instance_config: 'ShieldedInstanceConfig' = proto.Field( + proto.MESSAGE, + number=20, + message='ShieldedInstanceConfig', + ) + linux_node_config: 'LinuxNodeConfig' = proto.Field( + proto.MESSAGE, + number=21, + message='LinuxNodeConfig', + ) + kubelet_config: 'NodeKubeletConfig' = proto.Field( + proto.MESSAGE, + number=22, + message='NodeKubeletConfig', + ) + ephemeral_storage_config: 'EphemeralStorageConfig' = proto.Field( + proto.MESSAGE, + number=24, + message='EphemeralStorageConfig', + ) + gcfs_config: 'GcfsConfig' = proto.Field( + proto.MESSAGE, + number=25, + message='GcfsConfig', + ) + advanced_machine_features: 'AdvancedMachineFeatures' = proto.Field( + proto.MESSAGE, + number=26, + message='AdvancedMachineFeatures', + ) + gvnic: 'VirtualNIC' = proto.Field( + proto.MESSAGE, + number=29, + message='VirtualNIC', + ) + spot: bool = proto.Field( + proto.BOOL, + number=32, + ) + confidential_nodes: 'ConfidentialNodes' = proto.Field( + proto.MESSAGE, + number=35, + message='ConfidentialNodes', + ) + fast_socket: 'FastSocket' = proto.Field( + proto.MESSAGE, + number=36, + optional=True, + message='FastSocket', + ) + resource_labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=37, + ) + logging_config: 'NodePoolLoggingConfig' = proto.Field( + proto.MESSAGE, + number=38, + message='NodePoolLoggingConfig', + ) + windows_node_config: 'WindowsNodeConfig' = proto.Field( + proto.MESSAGE, + number=39, + message='WindowsNodeConfig', + ) + local_nvme_ssd_block_config: 'LocalNvmeSsdBlockConfig' = proto.Field( + proto.MESSAGE, + number=40, + message='LocalNvmeSsdBlockConfig', + ) + ephemeral_storage_local_ssd_config: 'EphemeralStorageLocalSsdConfig' = proto.Field( + proto.MESSAGE, + number=41, + message='EphemeralStorageLocalSsdConfig', + ) + sole_tenant_config: 'SoleTenantConfig' = proto.Field( + proto.MESSAGE, + number=42, + message='SoleTenantConfig', + ) + containerd_config: 'ContainerdConfig' = proto.Field( + proto.MESSAGE, + number=43, + message='ContainerdConfig', + ) + host_maintenance_policy: 'HostMaintenancePolicy' = proto.Field( + proto.MESSAGE, + number=44, + message='HostMaintenancePolicy', + ) + resource_manager_tags: 'ResourceManagerTags' = proto.Field( + proto.MESSAGE, + number=45, + message='ResourceManagerTags', + ) + enable_confidential_storage: bool = proto.Field( + proto.BOOL, + number=46, + ) + secondary_boot_disks: MutableSequence['SecondaryBootDisk'] = proto.RepeatedField( + proto.MESSAGE, + number=48, + message='SecondaryBootDisk', + ) + secondary_boot_disk_update_strategy: 'SecondaryBootDiskUpdateStrategy' = proto.Field( + proto.MESSAGE, + number=50, + optional=True, + message='SecondaryBootDiskUpdateStrategy', + ) + + +class AdvancedMachineFeatures(proto.Message): + r"""Specifies options for controlling advanced machine features. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + threads_per_core (int): + The number of threads per physical core. To + disable simultaneous multithreading (SMT) set + this to 1. If unset, the maximum number of + threads supported per core by the underlying + processor is assumed. + + This field is a member of `oneof`_ ``_threads_per_core``. + enable_nested_virtualization (bool): + Whether or not to enable nested + virtualization (defaults to false). + + This field is a member of `oneof`_ ``_enable_nested_virtualization``. + """ + + threads_per_core: int = proto.Field( + proto.INT64, + number=1, + optional=True, + ) + enable_nested_virtualization: bool = proto.Field( + proto.BOOL, + number=2, + optional=True, + ) + + +class NodeNetworkConfig(proto.Message): + r"""Parameters for node pool-level network config. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + create_pod_range (bool): + Input only. Whether to create a new range for pod IPs in + this node pool. Defaults are provided for ``pod_range`` and + ``pod_ipv4_cidr_block`` if they are not specified. + + If neither ``create_pod_range`` or ``pod_range`` are + specified, the cluster-level default + (``ip_allocation_policy.cluster_ipv4_cidr_block``) is used. + + Only applicable if ``ip_allocation_policy.use_ip_aliases`` + is true. + + This field cannot be changed after the node pool has been + created. + pod_range (str): + The ID of the secondary range for pod IPs. If + ``create_pod_range`` is true, this ID is used for the new + range. If ``create_pod_range`` is false, uses an existing + secondary range with this ID. + + Only applicable if ``ip_allocation_policy.use_ip_aliases`` + is true. + + This field cannot be changed after the node pool has been + created. + pod_ipv4_cidr_block (str): + The IP address range for pod IPs in this node pool. + + Only applicable if ``create_pod_range`` is true. + + Set to blank to have a range chosen with the default size. + + Set to /netmask (e.g. ``/14``) to have a range chosen with a + specific netmask. + + Set to a + `CIDR `__ + notation (e.g. ``10.96.0.0/14``) to pick a specific range to + use. + + Only applicable if ``ip_allocation_policy.use_ip_aliases`` + is true. + + This field cannot be changed after the node pool has been + created. + enable_private_nodes (bool): + Whether nodes have internal IP addresses only. If + enable_private_nodes is not specified, then the value is + derived from + [cluster.privateClusterConfig.enablePrivateNodes][google.container.v1beta1.PrivateClusterConfig.enablePrivateNodes] + + This field is a member of `oneof`_ ``_enable_private_nodes``. + network_performance_config (google.cloud.container_v1beta1.types.NodeNetworkConfig.NetworkPerformanceConfig): + Network bandwidth tier configuration. + + This field is a member of `oneof`_ ``_network_performance_config``. + pod_cidr_overprovision_config (google.cloud.container_v1beta1.types.PodCIDROverprovisionConfig): + [PRIVATE FIELD] Pod CIDR size overprovisioning config for + the nodepool. + + Pod CIDR size per node depends on max_pods_per_node. By + default, the value of max_pods_per_node is rounded off to + next power of 2 and we then double that to get the size of + pod CIDR block per node. Example: max_pods_per_node of 30 + would result in 64 IPs (/26). + + This config can disable the doubling of IPs (we still round + off to next power of 2) Example: max_pods_per_node of 30 + will result in 32 IPs (/27) when overprovisioning is + disabled. + additional_node_network_configs (MutableSequence[google.cloud.container_v1beta1.types.AdditionalNodeNetworkConfig]): + We specify the additional node networks for + this node pool using this list. Each node + network corresponds to an additional interface + additional_pod_network_configs (MutableSequence[google.cloud.container_v1beta1.types.AdditionalPodNetworkConfig]): + We specify the additional pod networks for + this node pool using this list. Each pod network + corresponds to an additional alias IP range for + the node + pod_ipv4_range_utilization (float): + Output only. The utilization of the IPv4 range for the pod. + The ratio is Usage/[Total number of IPs in the secondary + range], Usage=numNodes\ *numZones*\ podIPsPerNode. + """ + + class NetworkPerformanceConfig(proto.Message): + r"""Configuration of all network bandwidth tiers + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + total_egress_bandwidth_tier (google.cloud.container_v1beta1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier): + Specifies the total network bandwidth tier + for the NodePool. + + This field is a member of `oneof`_ ``_total_egress_bandwidth_tier``. + external_ip_egress_bandwidth_tier (google.cloud.container_v1beta1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier): + Specifies the network bandwidth tier for the + NodePool for traffic to external/public IP + addresses. + + This field is a member of `oneof`_ ``_external_ip_egress_bandwidth_tier``. + """ + class Tier(proto.Enum): + r"""Node network tier + + Values: + TIER_UNSPECIFIED (0): + Default value + TIER_1 (1): + Higher bandwidth, actual values based on VM + size. + """ + TIER_UNSPECIFIED = 0 + TIER_1 = 1 + + total_egress_bandwidth_tier: 'NodeNetworkConfig.NetworkPerformanceConfig.Tier' = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum='NodeNetworkConfig.NetworkPerformanceConfig.Tier', + ) + external_ip_egress_bandwidth_tier: 'NodeNetworkConfig.NetworkPerformanceConfig.Tier' = proto.Field( + proto.ENUM, + number=2, + optional=True, + enum='NodeNetworkConfig.NetworkPerformanceConfig.Tier', + ) + + create_pod_range: bool = proto.Field( + proto.BOOL, + number=4, + ) + pod_range: str = proto.Field( + proto.STRING, + number=5, + ) + pod_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=6, + ) + enable_private_nodes: bool = proto.Field( + proto.BOOL, + number=9, + optional=True, + ) + network_performance_config: NetworkPerformanceConfig = proto.Field( + proto.MESSAGE, + number=11, + optional=True, + message=NetworkPerformanceConfig, + ) + pod_cidr_overprovision_config: 'PodCIDROverprovisionConfig' = proto.Field( + proto.MESSAGE, + number=13, + message='PodCIDROverprovisionConfig', + ) + additional_node_network_configs: MutableSequence['AdditionalNodeNetworkConfig'] = proto.RepeatedField( + proto.MESSAGE, + number=14, + message='AdditionalNodeNetworkConfig', + ) + additional_pod_network_configs: MutableSequence['AdditionalPodNetworkConfig'] = proto.RepeatedField( + proto.MESSAGE, + number=15, + message='AdditionalPodNetworkConfig', + ) + pod_ipv4_range_utilization: float = proto.Field( + proto.DOUBLE, + number=16, + ) + + +class AdditionalNodeNetworkConfig(proto.Message): + r"""AdditionalNodeNetworkConfig is the configuration for + additional node networks within the NodeNetworkConfig message + + Attributes: + network (str): + Name of the VPC where the additional + interface belongs + subnetwork (str): + Name of the subnetwork where the additional + interface belongs + """ + + network: str = proto.Field( + proto.STRING, + number=1, + ) + subnetwork: str = proto.Field( + proto.STRING, + number=2, + ) + + +class AdditionalPodNetworkConfig(proto.Message): + r"""AdditionalPodNetworkConfig is the configuration for + additional pod networks within the NodeNetworkConfig message + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + subnetwork (str): + Name of the subnetwork where the additional + pod network belongs. + secondary_pod_range (str): + The name of the secondary range on the subnet + which provides IP address for this pod range. + max_pods_per_node (google.cloud.container_v1beta1.types.MaxPodsConstraint): + The maximum number of pods per node which use + this pod network. + + This field is a member of `oneof`_ ``_max_pods_per_node``. + """ + + subnetwork: str = proto.Field( + proto.STRING, + number=1, + ) + secondary_pod_range: str = proto.Field( + proto.STRING, + number=2, + ) + max_pods_per_node: 'MaxPodsConstraint' = proto.Field( + proto.MESSAGE, + number=3, + optional=True, + message='MaxPodsConstraint', + ) + + +class ShieldedInstanceConfig(proto.Message): + r"""A set of Shielded Instance options. + + Attributes: + enable_secure_boot (bool): + Defines whether the instance has Secure Boot + enabled. + Secure Boot helps ensure that the system only + runs authentic software by verifying the digital + signature of all boot components, and halting + the boot process if signature verification + fails. + enable_integrity_monitoring (bool): + Defines whether the instance has integrity + monitoring enabled. + Enables monitoring and attestation of the boot + integrity of the instance. The attestation is + performed against the integrity policy baseline. + This baseline is initially derived from the + implicitly trusted boot image when the instance + is created. + """ + + enable_secure_boot: bool = proto.Field( + proto.BOOL, + number=1, + ) + enable_integrity_monitoring: bool = proto.Field( + proto.BOOL, + number=2, + ) + + +class SandboxConfig(proto.Message): + r"""SandboxConfig contains configurations of the sandbox to use + for the node. + + Attributes: + sandbox_type (str): + Type of the sandbox to use for the node (e.g. + 'gvisor') + type_ (google.cloud.container_v1beta1.types.SandboxConfig.Type): + Type of the sandbox to use for the node. + """ + class Type(proto.Enum): + r"""Possible types of sandboxes. + + Values: + UNSPECIFIED (0): + Default value. This should not be used. + GVISOR (1): + Run sandbox using gvisor. + """ + UNSPECIFIED = 0 + GVISOR = 1 + + sandbox_type: str = proto.Field( + proto.STRING, + number=1, + ) + type_: Type = proto.Field( + proto.ENUM, + number=2, + enum=Type, + ) + + +class EphemeralStorageConfig(proto.Message): + r"""EphemeralStorageConfig contains configuration for the + ephemeral storage filesystem. + + Attributes: + local_ssd_count (int): + Number of local SSDs to use to back ephemeral storage. Uses + NVMe interfaces. The limit for this value is dependent upon + the maximum number of disk available on a machine per zone. + See: https://cloud.google.com/compute/docs/disks/local-ssd + for more information. + + A zero (or unset) value has different meanings depending on + machine type being used: + + 1. For pre-Gen3 machines, which support flexible numbers of + local ssds, zero (or unset) means to disable using local + SSDs as ephemeral storage. + 2. For Gen3 machines which dictate a specific number of + local ssds, zero (or unset) means to use the default + number of local ssds that goes with that machine type. + For example, for a c3-standard-8-lssd machine, 2 local + ssds would be provisioned. For c3-standard-8 (which + doesn't support local ssds), 0 will be provisioned. See + https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds + for more info. + """ + + local_ssd_count: int = proto.Field( + proto.INT32, + number=1, + ) + + +class LocalNvmeSsdBlockConfig(proto.Message): + r"""LocalNvmeSsdBlockConfig contains configuration for using + raw-block local NVMe SSDs + + Attributes: + local_ssd_count (int): + Number of local NVMe SSDs to use. The limit for this value + is dependent upon the maximum number of disk available on a + machine per zone. See: + https://cloud.google.com/compute/docs/disks/local-ssd for + more information. + + A zero (or unset) value has different meanings depending on + machine type being used: + + 1. For pre-Gen3 machines, which support flexible numbers of + local ssds, zero (or unset) means to disable using local + SSDs as ephemeral storage. + 2. For Gen3 machines which dictate a specific number of + local ssds, zero (or unset) means to use the default + number of local ssds that goes with that machine type. + For example, for a c3-standard-8-lssd machine, 2 local + ssds would be provisioned. For c3-standard-8 (which + doesn't support local ssds), 0 will be provisioned. See + https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds + for more info. + """ + + local_ssd_count: int = proto.Field( + proto.INT32, + number=1, + ) + + +class EphemeralStorageLocalSsdConfig(proto.Message): + r"""EphemeralStorageLocalSsdConfig contains configuration for the + node ephemeral storage using Local SSDs. + + Attributes: + local_ssd_count (int): + Number of local SSDs to use to back ephemeral storage. Uses + NVMe interfaces. + + A zero (or unset) value has different meanings depending on + machine type being used: + + 1. For pre-Gen3 machines, which support flexible numbers of + local ssds, zero (or unset) means to disable using local + SSDs as ephemeral storage. The limit for this value is + dependent upon the maximum number of disk available on a + machine per zone. See: + https://cloud.google.com/compute/docs/disks/local-ssd for + more information. + 2. For Gen3 machines which dictate a specific number of + local ssds, zero (or unset) means to use the default + number of local ssds that goes with that machine type. + For example, for a c3-standard-8-lssd machine, 2 local + ssds would be provisioned. For c3-standard-8 (which + doesn't support local ssds), 0 will be provisioned. See + https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds + for more info. + """ + + local_ssd_count: int = proto.Field( + proto.INT32, + number=1, + ) + + +class GcfsConfig(proto.Message): + r"""GcfsConfig contains configurations of Google Container File + System. + + Attributes: + enabled (bool): + Whether to use GCFS. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class ReservationAffinity(proto.Message): + r"""`ReservationAffinity `__ + is the configuration of desired reservation which instances could + take capacity from. + + Attributes: + consume_reservation_type (google.cloud.container_v1beta1.types.ReservationAffinity.Type): + Corresponds to the type of reservation + consumption. + key (str): + Corresponds to the label key of a reservation resource. To + target a SPECIFIC_RESERVATION by name, specify + "compute.googleapis.com/reservation-name" as the key and + specify the name of your reservation as its value. + values (MutableSequence[str]): + Corresponds to the label value(s) of + reservation resource(s). + """ + class Type(proto.Enum): + r"""Indicates whether to consume capacity from a reservation or + not. + + Values: + UNSPECIFIED (0): + Default value. This should not be used. + NO_RESERVATION (1): + Do not consume from any reserved capacity. + ANY_RESERVATION (2): + Consume any reservation available. + SPECIFIC_RESERVATION (3): + Must consume from a specific reservation. + Must specify key value fields for specifying the + reservations. + """ + UNSPECIFIED = 0 + NO_RESERVATION = 1 + ANY_RESERVATION = 2 + SPECIFIC_RESERVATION = 3 + + consume_reservation_type: Type = proto.Field( + proto.ENUM, + number=1, + enum=Type, + ) + key: str = proto.Field( + proto.STRING, + number=2, + ) + values: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class SoleTenantConfig(proto.Message): + r"""SoleTenantConfig contains the NodeAffinities to specify what + shared sole tenant node groups should back the node pool. + + Attributes: + node_affinities (MutableSequence[google.cloud.container_v1beta1.types.SoleTenantConfig.NodeAffinity]): + NodeAffinities used to match to a shared sole + tenant node group. + """ + + class NodeAffinity(proto.Message): + r"""Specifies the NodeAffinity key, values, and affinity operator + according to `shared sole tenant node group + affinities `__. + + Attributes: + key (str): + Key for NodeAffinity. + operator (google.cloud.container_v1beta1.types.SoleTenantConfig.NodeAffinity.Operator): + Operator for NodeAffinity. + values (MutableSequence[str]): + Values for NodeAffinity. + """ + class Operator(proto.Enum): + r"""Operator allows user to specify affinity or anti-affinity for + the given key values. + + Values: + OPERATOR_UNSPECIFIED (0): + Invalid or unspecified affinity operator. + IN (1): + Affinity operator. + NOT_IN (2): + Anti-affinity operator. + """ + OPERATOR_UNSPECIFIED = 0 + IN = 1 + NOT_IN = 2 + + key: str = proto.Field( + proto.STRING, + number=1, + ) + operator: 'SoleTenantConfig.NodeAffinity.Operator' = proto.Field( + proto.ENUM, + number=2, + enum='SoleTenantConfig.NodeAffinity.Operator', + ) + values: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + node_affinities: MutableSequence[NodeAffinity] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=NodeAffinity, + ) + + +class ContainerdConfig(proto.Message): + r"""ContainerdConfig contains configuration to customize + containerd. + + Attributes: + private_registry_access_config (google.cloud.container_v1beta1.types.ContainerdConfig.PrivateRegistryAccessConfig): + PrivateRegistryAccessConfig is used to + configure access configuration for private + container registries. + """ + + class PrivateRegistryAccessConfig(proto.Message): + r"""PrivateRegistryAccessConfig contains access configuration for + private container registries. + + Attributes: + enabled (bool): + Private registry access is enabled. + certificate_authority_domain_config (MutableSequence[google.cloud.container_v1beta1.types.ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig]): + Private registry access configuration. + """ + + class CertificateAuthorityDomainConfig(proto.Message): + r"""CertificateAuthorityDomainConfig configures one or more fully + qualified domain names (FQDN) to a specific certificate. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + fqdns (MutableSequence[str]): + List of fully qualified domain names (FQDN). + Specifying port is supported. + Wilcards are NOT supported. + Examples: + + - my.customdomain.com + - 10.0.1.2:5000 + gcp_secret_manager_certificate_config (google.cloud.container_v1beta1.types.ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig.GCPSecretManagerCertificateConfig): + Google Secret Manager (GCP) certificate + configuration. + + This field is a member of `oneof`_ ``certificate_config``. + """ + + class GCPSecretManagerCertificateConfig(proto.Message): + r"""GCPSecretManagerCertificateConfig configures a secret from `Google + Secret Manager `__. + + Attributes: + secret_uri (str): + Secret URI, in the form + "projects/$PROJECT_ID/secrets/$SECRET_NAME/versions/$VERSION". + Version can be fixed (e.g. "2") or "latest". + """ + + secret_uri: str = proto.Field( + proto.STRING, + number=1, + ) + + fqdns: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + gcp_secret_manager_certificate_config: 'ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig.GCPSecretManagerCertificateConfig' = proto.Field( + proto.MESSAGE, + number=2, + oneof='certificate_config', + message='ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig.GCPSecretManagerCertificateConfig', + ) + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + certificate_authority_domain_config: MutableSequence['ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig', + ) + + private_registry_access_config: PrivateRegistryAccessConfig = proto.Field( + proto.MESSAGE, + number=1, + message=PrivateRegistryAccessConfig, + ) + + +class HostMaintenancePolicy(proto.Message): + r"""HostMaintenancePolicy contains the maintenance policy for the + hosts on which the GKE VMs run on. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + maintenance_interval (google.cloud.container_v1beta1.types.HostMaintenancePolicy.MaintenanceInterval): + Specifies the frequency of planned + maintenance events. + + This field is a member of `oneof`_ ``_maintenance_interval``. + opportunistic_maintenance_strategy (google.cloud.container_v1beta1.types.HostMaintenancePolicy.OpportunisticMaintenanceStrategy): + Strategy that will trigger maintenance on + behalf of the customer. + + This field is a member of `oneof`_ ``maintenance_strategy``. + """ + class MaintenanceInterval(proto.Enum): + r"""Allows selecting how infrastructure upgrades should be + applied to the cluster or node pool. + + Values: + MAINTENANCE_INTERVAL_UNSPECIFIED (0): + The maintenance interval is not explicitly + specified. + AS_NEEDED (1): + Nodes are eligible to receive infrastructure + and hypervisor updates as they become available. + This may result in more maintenance operations + (live migrations or terminations) for the node + than the PERIODIC option. + PERIODIC (2): + Nodes receive infrastructure and hypervisor updates on a + periodic basis, minimizing the number of maintenance + operations (live migrations or terminations) on an + individual VM. This may mean underlying VMs will take longer + to receive an update than if it was configured for + AS_NEEDED. Security updates will still be applied as soon as + they are available. + """ + MAINTENANCE_INTERVAL_UNSPECIFIED = 0 + AS_NEEDED = 1 + PERIODIC = 2 + + class OpportunisticMaintenanceStrategy(proto.Message): + r"""Strategy that will trigger maintenance on behalf of the + customer. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + node_idle_time_window (google.protobuf.duration_pb2.Duration): + The amount of time that a node can remain + idle (no customer owned workloads running), + before triggering maintenance. + + This field is a member of `oneof`_ ``_node_idle_time_window``. + maintenance_availability_window (google.protobuf.duration_pb2.Duration): + The window of time that opportunistic maintenance can run. + Example: A setting of 14 days implies that opportunistic + maintenance can only be ran in the 2 weeks leading up to the + scheduled maintenance date. Setting 28 days allows + opportunistic maintenance to run at any time in the + scheduled maintenance window (all ``PERIODIC`` maintenance + is set 28 days in advance). + + This field is a member of `oneof`_ ``_maintenance_availability_window``. + min_nodes_per_pool (int): + The minimum nodes required to be available in + a pool. Blocks maintenance if it would cause the + number of running nodes to dip below this value. + + This field is a member of `oneof`_ ``_min_nodes_per_pool``. + """ + + node_idle_time_window: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=1, + optional=True, + message=duration_pb2.Duration, + ) + maintenance_availability_window: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=2, + optional=True, + message=duration_pb2.Duration, + ) + min_nodes_per_pool: int = proto.Field( + proto.INT64, + number=3, + optional=True, + ) + + maintenance_interval: MaintenanceInterval = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum=MaintenanceInterval, + ) + opportunistic_maintenance_strategy: OpportunisticMaintenanceStrategy = proto.Field( + proto.MESSAGE, + number=2, + oneof='maintenance_strategy', + message=OpportunisticMaintenanceStrategy, + ) + + +class NodeTaint(proto.Message): + r"""Kubernetes taint is composed of three fields: key, value, and + effect. Effect can only be one of three types: NoSchedule, + PreferNoSchedule or NoExecute. + + See + `here `__ + for more information, including usage and the valid values. + + Attributes: + key (str): + Key for taint. + value (str): + Value for taint. + effect (google.cloud.container_v1beta1.types.NodeTaint.Effect): + Effect for taint. + """ + class Effect(proto.Enum): + r"""Possible values for Effect in taint. + + Values: + EFFECT_UNSPECIFIED (0): + Not set + NO_SCHEDULE (1): + NoSchedule + PREFER_NO_SCHEDULE (2): + PreferNoSchedule + NO_EXECUTE (3): + NoExecute + """ + EFFECT_UNSPECIFIED = 0 + NO_SCHEDULE = 1 + PREFER_NO_SCHEDULE = 2 + NO_EXECUTE = 3 + + key: str = proto.Field( + proto.STRING, + number=1, + ) + value: str = proto.Field( + proto.STRING, + number=2, + ) + effect: Effect = proto.Field( + proto.ENUM, + number=3, + enum=Effect, + ) + + +class NodeTaints(proto.Message): + r"""Collection of Kubernetes `node + taints `__. + + Attributes: + taints (MutableSequence[google.cloud.container_v1beta1.types.NodeTaint]): + List of node taints. + """ + + taints: MutableSequence['NodeTaint'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='NodeTaint', + ) + + +class NodeLabels(proto.Message): + r"""Collection of node-level `Kubernetes + labels `__. + + Attributes: + labels (MutableMapping[str, str]): + Map of node label keys and node label values. + """ + + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=1, + ) + + +class ResourceLabels(proto.Message): + r"""Collection of `GCP + labels `__. + + Attributes: + labels (MutableMapping[str, str]): + Map of node label keys and node label values. + """ + + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=1, + ) + + +class NetworkTags(proto.Message): + r"""Collection of Compute Engine network tags that can be applied to a + node's underlying VM instance. (See ``tags`` field in + ```NodeConfig`` `__). + + Attributes: + tags (MutableSequence[str]): + List of network tags. + """ + + tags: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + + +class MasterAuth(proto.Message): + r"""The authentication information for accessing the master + endpoint. Authentication can be done using HTTP basic auth or + using client certificates. + + Attributes: + username (str): + The username to use for HTTP basic + authentication to the master endpoint. For + clusters v1.6.0 and later, basic authentication + can be disabled by leaving username unspecified + (or setting it to the empty string). + + Warning: basic authentication is deprecated, and + will be removed in GKE control plane versions + 1.19 and newer. For a list of recommended + authentication methods, see: + + https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication + password (str): + The password to use for HTTP basic + authentication to the master endpoint. Because + the master endpoint is open to the Internet, you + should create a strong password. If a password + is provided for cluster creation, username must + be non-empty. + + Warning: basic authentication is deprecated, and + will be removed in GKE control plane versions + 1.19 and newer. For a list of recommended + authentication methods, see: + + https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication + client_certificate_config (google.cloud.container_v1beta1.types.ClientCertificateConfig): + Configuration for client certificate + authentication on the cluster. For clusters + before v1.12, if no configuration is specified, + a client certificate is issued. + cluster_ca_certificate (str): + Output only. Base64-encoded public + certificate that is the root of trust for the + cluster. + client_certificate (str): + Output only. Base64-encoded public + certificate used by clients to authenticate to + the cluster endpoint. + client_key (str): + Output only. Base64-encoded private key used + by clients to authenticate to the cluster + endpoint. + """ + + username: str = proto.Field( + proto.STRING, + number=1, + ) + password: str = proto.Field( + proto.STRING, + number=2, + ) + client_certificate_config: 'ClientCertificateConfig' = proto.Field( + proto.MESSAGE, + number=3, + message='ClientCertificateConfig', + ) + cluster_ca_certificate: str = proto.Field( + proto.STRING, + number=100, + ) + client_certificate: str = proto.Field( + proto.STRING, + number=101, + ) + client_key: str = proto.Field( + proto.STRING, + number=102, + ) + + +class ClientCertificateConfig(proto.Message): + r"""Configuration for client certificates on the cluster. + + Attributes: + issue_client_certificate (bool): + Issue a client certificate. + """ + + issue_client_certificate: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class AddonsConfig(proto.Message): + r"""Configuration for the addons that can be automatically spun + up in the cluster, enabling additional functionality. + + Attributes: + http_load_balancing (google.cloud.container_v1beta1.types.HttpLoadBalancing): + Configuration for the HTTP (L7) load + balancing controller addon, which makes it easy + to set up HTTP load balancers for services in a + cluster. + horizontal_pod_autoscaling (google.cloud.container_v1beta1.types.HorizontalPodAutoscaling): + Configuration for the horizontal pod + autoscaling feature, which increases or + decreases the number of replica pods a + replication controller has based on the resource + usage of the existing pods. + kubernetes_dashboard (google.cloud.container_v1beta1.types.KubernetesDashboard): + Configuration for the Kubernetes Dashboard. + This addon is deprecated, and will be disabled + in 1.15. It is recommended to use the Cloud + Console to manage and monitor your Kubernetes + clusters, workloads and applications. For more + information, see: + + https://cloud.google.com/kubernetes-engine/docs/concepts/dashboards + network_policy_config (google.cloud.container_v1beta1.types.NetworkPolicyConfig): + Configuration for NetworkPolicy. This only + tracks whether the addon is enabled or not on + the Master, it does not track whether network + policy is enabled for the nodes. + istio_config (google.cloud.container_v1beta1.types.IstioConfig): + Configuration for Istio, an open platform to + connect, manage, and secure microservices. + cloud_run_config (google.cloud.container_v1beta1.types.CloudRunConfig): + Configuration for the Cloud Run addon. The ``IstioConfig`` + addon must be enabled in order to enable Cloud Run addon. + This option can only be enabled at cluster creation time. + dns_cache_config (google.cloud.container_v1beta1.types.DnsCacheConfig): + Configuration for NodeLocalDNS, a dns cache + running on cluster nodes + config_connector_config (google.cloud.container_v1beta1.types.ConfigConnectorConfig): + Configuration for the ConfigConnector add-on, + a Kubernetes extension to manage hosted GCP + services through the Kubernetes API + gce_persistent_disk_csi_driver_config (google.cloud.container_v1beta1.types.GcePersistentDiskCsiDriverConfig): + Configuration for the Compute Engine + Persistent Disk CSI driver. + kalm_config (google.cloud.container_v1beta1.types.KalmConfig): + Configuration for the KALM addon, which + manages the lifecycle of k8s applications. + gcp_filestore_csi_driver_config (google.cloud.container_v1beta1.types.GcpFilestoreCsiDriverConfig): + Configuration for the GCP Filestore CSI + driver. + gke_backup_agent_config (google.cloud.container_v1beta1.types.GkeBackupAgentConfig): + Configuration for the Backup for GKE agent + addon. + gcs_fuse_csi_driver_config (google.cloud.container_v1beta1.types.GcsFuseCsiDriverConfig): + Configuration for the Cloud Storage Fuse CSI + driver. + stateful_ha_config (google.cloud.container_v1beta1.types.StatefulHAConfig): + Optional. Configuration for the StatefulHA + add-on. + ray_operator_config (google.cloud.container_v1beta1.types.RayOperatorConfig): + Optional. Configuration for Ray Operator + addon. + """ + + http_load_balancing: 'HttpLoadBalancing' = proto.Field( + proto.MESSAGE, + number=1, + message='HttpLoadBalancing', + ) + horizontal_pod_autoscaling: 'HorizontalPodAutoscaling' = proto.Field( + proto.MESSAGE, + number=2, + message='HorizontalPodAutoscaling', + ) + kubernetes_dashboard: 'KubernetesDashboard' = proto.Field( + proto.MESSAGE, + number=3, + message='KubernetesDashboard', + ) + network_policy_config: 'NetworkPolicyConfig' = proto.Field( + proto.MESSAGE, + number=4, + message='NetworkPolicyConfig', + ) + istio_config: 'IstioConfig' = proto.Field( + proto.MESSAGE, + number=5, + message='IstioConfig', + ) + cloud_run_config: 'CloudRunConfig' = proto.Field( + proto.MESSAGE, + number=7, + message='CloudRunConfig', + ) + dns_cache_config: 'DnsCacheConfig' = proto.Field( + proto.MESSAGE, + number=8, + message='DnsCacheConfig', + ) + config_connector_config: 'ConfigConnectorConfig' = proto.Field( + proto.MESSAGE, + number=10, + message='ConfigConnectorConfig', + ) + gce_persistent_disk_csi_driver_config: 'GcePersistentDiskCsiDriverConfig' = proto.Field( + proto.MESSAGE, + number=11, + message='GcePersistentDiskCsiDriverConfig', + ) + kalm_config: 'KalmConfig' = proto.Field( + proto.MESSAGE, + number=12, + message='KalmConfig', + ) + gcp_filestore_csi_driver_config: 'GcpFilestoreCsiDriverConfig' = proto.Field( + proto.MESSAGE, + number=14, + message='GcpFilestoreCsiDriverConfig', + ) + gke_backup_agent_config: 'GkeBackupAgentConfig' = proto.Field( + proto.MESSAGE, + number=16, + message='GkeBackupAgentConfig', + ) + gcs_fuse_csi_driver_config: 'GcsFuseCsiDriverConfig' = proto.Field( + proto.MESSAGE, + number=17, + message='GcsFuseCsiDriverConfig', + ) + stateful_ha_config: 'StatefulHAConfig' = proto.Field( + proto.MESSAGE, + number=18, + message='StatefulHAConfig', + ) + ray_operator_config: 'RayOperatorConfig' = proto.Field( + proto.MESSAGE, + number=21, + message='RayOperatorConfig', + ) + + +class HttpLoadBalancing(proto.Message): + r"""Configuration options for the HTTP (L7) load balancing + controller addon, which makes it easy to set up HTTP load + balancers for services in a cluster. + + Attributes: + disabled (bool): + Whether the HTTP Load Balancing controller is + enabled in the cluster. When enabled, it runs a + small pod in the cluster that manages the load + balancers. + """ + + disabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class HorizontalPodAutoscaling(proto.Message): + r"""Configuration options for the horizontal pod autoscaling + feature, which increases or decreases the number of replica pods + a replication controller has based on the resource usage of the + existing pods. + + Attributes: + disabled (bool): + Whether the Horizontal Pod Autoscaling + feature is enabled in the cluster. When enabled, + it ensures that metrics are collected into + Stackdriver Monitoring. + """ + + disabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class KubernetesDashboard(proto.Message): + r"""Configuration for the Kubernetes Dashboard. + + Attributes: + disabled (bool): + Whether the Kubernetes Dashboard is enabled + for this cluster. + """ + + disabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class NetworkPolicyConfig(proto.Message): + r"""Configuration for NetworkPolicy. This only tracks whether the + addon is enabled or not on the Master, it does not track whether + network policy is enabled for the nodes. + + Attributes: + disabled (bool): + Whether NetworkPolicy is enabled for this + cluster. + """ + + disabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class DnsCacheConfig(proto.Message): + r"""Configuration for NodeLocal DNSCache + + Attributes: + enabled (bool): + Whether NodeLocal DNSCache is enabled for + this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class KalmConfig(proto.Message): + r"""Configuration options for the KALM addon. + + Attributes: + enabled (bool): + Whether KALM is enabled for this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class GkeBackupAgentConfig(proto.Message): + r"""Configuration for the Backup for GKE Agent. + + Attributes: + enabled (bool): + Whether the Backup for GKE agent is enabled + for this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class StatefulHAConfig(proto.Message): + r"""Configuration for the Stateful HA add-on. + + Attributes: + enabled (bool): + Whether the Stateful HA add-on is enabled for + this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class ConfigConnectorConfig(proto.Message): + r"""Configuration options for the Config Connector add-on. + + Attributes: + enabled (bool): + Whether Cloud Connector is enabled for this + cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class GcePersistentDiskCsiDriverConfig(proto.Message): + r"""Configuration for the Compute Engine PD CSI driver. + + Attributes: + enabled (bool): + Whether the Compute Engine PD CSI driver is + enabled for this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class GcpFilestoreCsiDriverConfig(proto.Message): + r"""Configuration for the GCP Filestore CSI driver. + + Attributes: + enabled (bool): + Whether the GCP Filestore CSI driver is + enabled for this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class GcsFuseCsiDriverConfig(proto.Message): + r"""Configuration for the Cloud Storage Fuse CSI driver. + + Attributes: + enabled (bool): + Whether the Cloud Storage Fuse CSI driver is + enabled for this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class RayOperatorConfig(proto.Message): + r"""Configuration options for the Ray Operator add-on. + + Attributes: + enabled (bool): + Whether the Ray addon is enabled for this + cluster. + ray_cluster_logging_config (google.cloud.container_v1beta1.types.RayClusterLoggingConfig): + Optional. Logging configuration for Ray + clusters. + ray_cluster_monitoring_config (google.cloud.container_v1beta1.types.RayClusterMonitoringConfig): + Optional. Monitoring configuration for Ray + clusters. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + ray_cluster_logging_config: 'RayClusterLoggingConfig' = proto.Field( + proto.MESSAGE, + number=2, + message='RayClusterLoggingConfig', + ) + ray_cluster_monitoring_config: 'RayClusterMonitoringConfig' = proto.Field( + proto.MESSAGE, + number=3, + message='RayClusterMonitoringConfig', + ) + + +class PrivateClusterMasterGlobalAccessConfig(proto.Message): + r"""Configuration for controlling master global access settings. + + Attributes: + enabled (bool): + Whenever master is accessible globally or + not. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class PrivateClusterConfig(proto.Message): + r"""Configuration options for private clusters. + + Attributes: + enable_private_nodes (bool): + Whether nodes have internal IP addresses + only. If enabled, all nodes are given only RFC + 1918 private addresses and communicate with the + master via private networking. + enable_private_endpoint (bool): + Whether the master's internal IP address is + used as the cluster endpoint. + master_ipv4_cidr_block (str): + The IP range in CIDR notation to use for the + hosted master network. This range will be used + for assigning internal IP addresses to the + master or set of masters, as well as the ILB + VIP. This range must not overlap with any other + ranges in use within the cluster's network. + private_endpoint (str): + Output only. The internal IP address of this + cluster's master endpoint. + public_endpoint (str): + Output only. The external IP address of this + cluster's master endpoint. + peering_name (str): + Output only. The peering name in the customer + VPC used by this cluster. + master_global_access_config (google.cloud.container_v1beta1.types.PrivateClusterMasterGlobalAccessConfig): + Controls master global access settings. + private_endpoint_subnetwork (str): + Subnet to provision the master's private endpoint during + cluster creation. Specified in + projects/\ */regions/*/subnetworks/\* format. + """ + + enable_private_nodes: bool = proto.Field( + proto.BOOL, + number=1, + ) + enable_private_endpoint: bool = proto.Field( + proto.BOOL, + number=2, + ) + master_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=3, + ) + private_endpoint: str = proto.Field( + proto.STRING, + number=4, + ) + public_endpoint: str = proto.Field( + proto.STRING, + number=5, + ) + peering_name: str = proto.Field( + proto.STRING, + number=7, + ) + master_global_access_config: 'PrivateClusterMasterGlobalAccessConfig' = proto.Field( + proto.MESSAGE, + number=8, + message='PrivateClusterMasterGlobalAccessConfig', + ) + private_endpoint_subnetwork: str = proto.Field( + proto.STRING, + number=10, + ) + + +class IstioConfig(proto.Message): + r"""Configuration options for Istio addon. + + Attributes: + disabled (bool): + Whether Istio is enabled for this cluster. + auth (google.cloud.container_v1beta1.types.IstioConfig.IstioAuthMode): + The specified Istio auth mode, either none, + or mutual TLS. + """ + class IstioAuthMode(proto.Enum): + r"""Istio auth mode, + https://istio.io/docs/concepts/security/mutual-tls.html + + Values: + AUTH_NONE (0): + auth not enabled + AUTH_MUTUAL_TLS (1): + auth mutual TLS enabled + """ + AUTH_NONE = 0 + AUTH_MUTUAL_TLS = 1 + + disabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + auth: IstioAuthMode = proto.Field( + proto.ENUM, + number=2, + enum=IstioAuthMode, + ) + + +class CloudRunConfig(proto.Message): + r"""Configuration options for the Cloud Run feature. + + Attributes: + disabled (bool): + Whether Cloud Run addon is enabled for this + cluster. + load_balancer_type (google.cloud.container_v1beta1.types.CloudRunConfig.LoadBalancerType): + Which load balancer type is installed for + Cloud Run. + """ + class LoadBalancerType(proto.Enum): + r"""Load balancer type of ingress service of Cloud Run. + + Values: + LOAD_BALANCER_TYPE_UNSPECIFIED (0): + Load balancer type for Cloud Run is + unspecified. + LOAD_BALANCER_TYPE_EXTERNAL (1): + Install external load balancer for Cloud Run. + LOAD_BALANCER_TYPE_INTERNAL (2): + Install internal load balancer for Cloud Run. + """ + LOAD_BALANCER_TYPE_UNSPECIFIED = 0 + LOAD_BALANCER_TYPE_EXTERNAL = 1 + LOAD_BALANCER_TYPE_INTERNAL = 2 + + disabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + load_balancer_type: LoadBalancerType = proto.Field( + proto.ENUM, + number=3, + enum=LoadBalancerType, + ) + + +class MasterAuthorizedNetworksConfig(proto.Message): + r"""Configuration options for the master authorized networks + feature. Enabled master authorized networks will disallow all + external traffic to access Kubernetes master through HTTPS + except traffic from the given CIDR blocks, Google Compute Engine + Public IPs and Google Prod IPs. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + enabled (bool): + Whether or not master authorized networks is + enabled. + cidr_blocks (MutableSequence[google.cloud.container_v1beta1.types.MasterAuthorizedNetworksConfig.CidrBlock]): + cidr_blocks define up to 10 external networks that could + access Kubernetes master through HTTPS. + gcp_public_cidrs_access_enabled (bool): + Whether master is accessbile via Google + Compute Engine Public IP addresses. + + This field is a member of `oneof`_ ``_gcp_public_cidrs_access_enabled``. + """ + + class CidrBlock(proto.Message): + r"""CidrBlock contains an optional name and one CIDR block. + + Attributes: + display_name (str): + display_name is an optional field for users to identify CIDR + blocks. + cidr_block (str): + cidr_block must be specified in CIDR notation. + """ + + display_name: str = proto.Field( + proto.STRING, + number=1, + ) + cidr_block: str = proto.Field( + proto.STRING, + number=2, + ) + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + cidr_blocks: MutableSequence[CidrBlock] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=CidrBlock, + ) + gcp_public_cidrs_access_enabled: bool = proto.Field( + proto.BOOL, + number=3, + optional=True, + ) + + +class LegacyAbac(proto.Message): + r"""Configuration for the legacy Attribute Based Access Control + authorization mode. + + Attributes: + enabled (bool): + Whether the ABAC authorizer is enabled for + this cluster. When enabled, identities in the + system, including service accounts, nodes, and + controllers, will have statically granted + permissions beyond those provided by the RBAC + configuration or IAM. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class NetworkPolicy(proto.Message): + r"""Configuration options for the NetworkPolicy feature. + https://kubernetes.io/docs/concepts/services-networking/networkpolicies/ + + Attributes: + provider (google.cloud.container_v1beta1.types.NetworkPolicy.Provider): + The selected network policy provider. + enabled (bool): + Whether network policy is enabled on the + cluster. + """ + class Provider(proto.Enum): + r"""Allowed Network Policy providers. + + Values: + PROVIDER_UNSPECIFIED (0): + Not set + CALICO (1): + Tigera (Calico Felix). + """ + PROVIDER_UNSPECIFIED = 0 + CALICO = 1 + + provider: Provider = proto.Field( + proto.ENUM, + number=1, + enum=Provider, + ) + enabled: bool = proto.Field( + proto.BOOL, + number=2, + ) + + +class PodCIDROverprovisionConfig(proto.Message): + r"""[PRIVATE FIELD] Config for pod CIDR size overprovisioning. + + Attributes: + disable (bool): + Whether Pod CIDR overprovisioning is + disabled. Note: Pod CIDR overprovisioning is + enabled by default. + """ + + disable: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class IPAllocationPolicy(proto.Message): + r"""Configuration for controlling how IPs are allocated in the + cluster. + + Attributes: + use_ip_aliases (bool): + Whether alias IPs will be used for pod IPs in the cluster. + This is used in conjunction with use_routes. It cannot be + true if use_routes is true. If both use_ip_aliases and + use_routes are false, then the server picks the default IP + allocation mode + create_subnetwork (bool): + Whether a new subnetwork will be created automatically for + the cluster. + + This field is only applicable when ``use_ip_aliases`` is + true. + subnetwork_name (str): + A custom subnetwork name to be used if ``create_subnetwork`` + is true. If this field is empty, then an automatic name will + be chosen for the new subnetwork. + cluster_ipv4_cidr (str): + This field is deprecated, use cluster_ipv4_cidr_block. + node_ipv4_cidr (str): + This field is deprecated, use node_ipv4_cidr_block. + services_ipv4_cidr (str): + This field is deprecated, use services_ipv4_cidr_block. + cluster_secondary_range_name (str): + The name of the secondary range to be used for the cluster + CIDR block. The secondary range will be used for pod IP + addresses. This must be an existing secondary range + associated with the cluster subnetwork. + + This field is only applicable with use_ip_aliases and + create_subnetwork is false. + services_secondary_range_name (str): + The name of the secondary range to be used as for the + services CIDR block. The secondary range will be used for + service ClusterIPs. This must be an existing secondary range + associated with the cluster subnetwork. + + This field is only applicable with use_ip_aliases and + create_subnetwork is false. + cluster_ipv4_cidr_block (str): + The IP address range for the cluster pod IPs. If this field + is set, then ``cluster.cluster_ipv4_cidr`` must be left + blank. + + This field is only applicable when ``use_ip_aliases`` is + true. + + Set to blank to have a range chosen with the default size. + + Set to /netmask (e.g. ``/14``) to have a range chosen with a + specific netmask. + + Set to a + `CIDR `__ + notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private + networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, + ``192.168.0.0/16``) to pick a specific range to use. + node_ipv4_cidr_block (str): + The IP address range of the instance IPs in this cluster. + + This is applicable only if ``create_subnetwork`` is true. + + Set to blank to have a range chosen with the default size. + + Set to /netmask (e.g. ``/14``) to have a range chosen with a + specific netmask. + + Set to a + `CIDR `__ + notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private + networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, + ``192.168.0.0/16``) to pick a specific range to use. + services_ipv4_cidr_block (str): + The IP address range of the services IPs in this cluster. If + blank, a range will be automatically chosen with the default + size. + + This field is only applicable when ``use_ip_aliases`` is + true. + + Set to blank to have a range chosen with the default size. + + Set to /netmask (e.g. ``/14``) to have a range chosen with a + specific netmask. + + Set to a + `CIDR `__ + notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private + networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, + ``192.168.0.0/16``) to pick a specific range to use. + allow_route_overlap (bool): + If true, allow allocation of cluster CIDR ranges that + overlap with certain kinds of network routes. By default we + do not allow cluster CIDR ranges to intersect with any user + declared routes. With allow_route_overlap == true, we allow + overlapping with CIDR ranges that are larger than the + cluster CIDR range. + + If this field is set to true, then cluster and services + CIDRs must be fully-specified (e.g. ``10.96.0.0/14``, but + not ``/14``), which means: + + 1) When ``use_ip_aliases`` is true, + ``cluster_ipv4_cidr_block`` and + ``services_ipv4_cidr_block`` must be fully-specified. + 2) When ``use_ip_aliases`` is false, + ``cluster.cluster_ipv4_cidr`` muse be fully-specified. + tpu_ipv4_cidr_block (str): + The IP address range of the Cloud TPUs in this cluster. If + unspecified, a range will be automatically chosen with the + default size. + + This field is only applicable when ``use_ip_aliases`` is + true. + + If unspecified, the range will use the default size. + + Set to /netmask (e.g. ``/14``) to have a range chosen with a + specific netmask. + + Set to a + `CIDR `__ + notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private + networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, + ``192.168.0.0/16``) to pick a specific range to use. This + field is deprecated, use cluster.tpu_config.ipv4_cidr_block + instead. + use_routes (bool): + Whether routes will be used for pod IPs in the cluster. This + is used in conjunction with use_ip_aliases. It cannot be + true if use_ip_aliases is true. If both use_ip_aliases and + use_routes are false, then the server picks the default IP + allocation mode + stack_type (google.cloud.container_v1beta1.types.IPAllocationPolicy.StackType): + IP stack type + ipv6_access_type (google.cloud.container_v1beta1.types.IPAllocationPolicy.IPv6AccessType): + The ipv6 access type (internal or external) when + create_subnetwork is true + pod_cidr_overprovision_config (google.cloud.container_v1beta1.types.PodCIDROverprovisionConfig): + [PRIVATE FIELD] Pod CIDR size overprovisioning config for + the cluster. + + Pod CIDR size per node depends on max_pods_per_node. By + default, the value of max_pods_per_node is doubled and then + rounded off to next power of 2 to get the size of pod CIDR + block per node. Example: max_pods_per_node of 30 would + result in 64 IPs (/26). + + This config can disable the doubling of IPs (we still round + off to next power of 2) Example: max_pods_per_node of 30 + will result in 32 IPs (/27) when overprovisioning is + disabled. + subnet_ipv6_cidr_block (str): + Output only. The subnet's IPv6 CIDR block + used by nodes and pods. + services_ipv6_cidr_block (str): + Output only. The services IPv6 CIDR block for + the cluster. + additional_pod_ranges_config (google.cloud.container_v1beta1.types.AdditionalPodRangesConfig): + Output only. The additional pod ranges that + are added to the cluster. These pod ranges can + be used by new node pools to allocate pod IPs + automatically. Once the range is removed it will + not show up in IPAllocationPolicy. + default_pod_ipv4_range_utilization (float): + Output only. The utilization of the cluster default IPv4 + range for the pod. The ratio is Usage/[Total number of IPs + in the secondary range], + Usage=numNodes\ *numZones*\ podIPsPerNode. + """ + class StackType(proto.Enum): + r"""Possible values for IP stack type + + Values: + STACK_TYPE_UNSPECIFIED (0): + By default, the clusters will be IPV4 only + IPV4 (1): + The value used if the cluster is a IPV4 only + IPV4_IPV6 (2): + The value used if the cluster is a dual stack + cluster + """ + STACK_TYPE_UNSPECIFIED = 0 + IPV4 = 1 + IPV4_IPV6 = 2 + + class IPv6AccessType(proto.Enum): + r"""IPv6 access type + + Values: + IPV6_ACCESS_TYPE_UNSPECIFIED (0): + Default value, will be defaulted as type + external. + INTERNAL (1): + Access type internal (all v6 addresses are + internal IPs) + EXTERNAL (2): + Access type external (all v6 addresses are + external IPs) + """ + IPV6_ACCESS_TYPE_UNSPECIFIED = 0 + INTERNAL = 1 + EXTERNAL = 2 + + use_ip_aliases: bool = proto.Field( + proto.BOOL, + number=1, + ) + create_subnetwork: bool = proto.Field( + proto.BOOL, + number=2, + ) + subnetwork_name: str = proto.Field( + proto.STRING, + number=3, + ) + cluster_ipv4_cidr: str = proto.Field( + proto.STRING, + number=4, + ) + node_ipv4_cidr: str = proto.Field( + proto.STRING, + number=5, + ) + services_ipv4_cidr: str = proto.Field( + proto.STRING, + number=6, + ) + cluster_secondary_range_name: str = proto.Field( + proto.STRING, + number=7, + ) + services_secondary_range_name: str = proto.Field( + proto.STRING, + number=8, + ) + cluster_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=9, + ) + node_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=10, + ) + services_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=11, + ) + allow_route_overlap: bool = proto.Field( + proto.BOOL, + number=12, + ) + tpu_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=13, + ) + use_routes: bool = proto.Field( + proto.BOOL, + number=15, + ) + stack_type: StackType = proto.Field( + proto.ENUM, + number=16, + enum=StackType, + ) + ipv6_access_type: IPv6AccessType = proto.Field( + proto.ENUM, + number=17, + enum=IPv6AccessType, + ) + pod_cidr_overprovision_config: 'PodCIDROverprovisionConfig' = proto.Field( + proto.MESSAGE, + number=21, + message='PodCIDROverprovisionConfig', + ) + subnet_ipv6_cidr_block: str = proto.Field( + proto.STRING, + number=22, + ) + services_ipv6_cidr_block: str = proto.Field( + proto.STRING, + number=23, + ) + additional_pod_ranges_config: 'AdditionalPodRangesConfig' = proto.Field( + proto.MESSAGE, + number=24, + message='AdditionalPodRangesConfig', + ) + default_pod_ipv4_range_utilization: float = proto.Field( + proto.DOUBLE, + number=25, + ) + + +class BinaryAuthorization(proto.Message): + r"""Configuration for Binary Authorization. + + Attributes: + enabled (bool): + This field is deprecated. Leave this unset and instead + configure BinaryAuthorization using evaluation_mode. If + evaluation_mode is set to anything other than + EVALUATION_MODE_UNSPECIFIED, this field is ignored. + evaluation_mode (google.cloud.container_v1beta1.types.BinaryAuthorization.EvaluationMode): + Mode of operation for binauthz policy + evaluation. If unspecified, defaults to + DISABLED. + policy_bindings (MutableSequence[google.cloud.container_v1beta1.types.BinaryAuthorization.PolicyBinding]): + Optional. Binauthz policies that apply to + this cluster. + """ + class EvaluationMode(proto.Enum): + r"""Binary Authorization mode of operation. + + Values: + EVALUATION_MODE_UNSPECIFIED (0): + Default value + DISABLED (1): + Disable BinaryAuthorization + PROJECT_SINGLETON_POLICY_ENFORCE (2): + Enforce Kubernetes admission requests with + BinaryAuthorization using the project's + singleton policy. This is equivalent to setting + the enabled boolean to true. + POLICY_BINDINGS (5): + Use Binary Authorization Continuous Validation with the + policies specified in policy_bindings. + POLICY_BINDINGS_AND_PROJECT_SINGLETON_POLICY_ENFORCE (6): + Use Binary Authorization Continuous Validation with the + policies specified in policy_bindings and enforce Kubernetes + admission requests with Binary Authorization using the + project's singleton policy. + """ + EVALUATION_MODE_UNSPECIFIED = 0 + DISABLED = 1 + PROJECT_SINGLETON_POLICY_ENFORCE = 2 + POLICY_BINDINGS = 5 + POLICY_BINDINGS_AND_PROJECT_SINGLETON_POLICY_ENFORCE = 6 + + class PolicyBinding(proto.Message): + r"""Binauthz policy that applies to this cluster. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + name (str): + The relative resource name of the binauthz platform policy + to evaluate. GKE platform policies have the following + format: + ``projects/{project_number}/platforms/gke/policies/{policy_id}``. + + This field is a member of `oneof`_ ``_name``. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + optional=True, + ) + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + evaluation_mode: EvaluationMode = proto.Field( + proto.ENUM, + number=2, + enum=EvaluationMode, + ) + policy_bindings: MutableSequence[PolicyBinding] = proto.RepeatedField( + proto.MESSAGE, + number=5, + message=PolicyBinding, + ) + + +class PodSecurityPolicyConfig(proto.Message): + r"""Configuration for the PodSecurityPolicy feature. + + Attributes: + enabled (bool): + Enable the PodSecurityPolicy controller for + this cluster. If enabled, pods must be valid + under a PodSecurityPolicy to be created. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class AuthenticatorGroupsConfig(proto.Message): + r"""Configuration for returning group information from + authenticators. + + Attributes: + enabled (bool): + Whether this cluster should return group + membership lookups during authentication using a + group of security groups. + security_group (str): + The name of the security group-of-groups to + be used. Only relevant if enabled = true. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + security_group: str = proto.Field( + proto.STRING, + number=2, + ) + + +class ClusterTelemetry(proto.Message): + r"""Telemetry integration for the cluster. + + Attributes: + type_ (google.cloud.container_v1beta1.types.ClusterTelemetry.Type): + Type of the integration. + """ + class Type(proto.Enum): + r"""Type of the integration. + + Values: + UNSPECIFIED (0): + Not set. + DISABLED (1): + Monitoring integration is disabled. + ENABLED (2): + Monitoring integration is enabled. + SYSTEM_ONLY (3): + Only system components are monitored and + logged. + """ + UNSPECIFIED = 0 + DISABLED = 1 + ENABLED = 2 + SYSTEM_ONLY = 3 + + type_: Type = proto.Field( + proto.ENUM, + number=1, + enum=Type, + ) + + +class Cluster(proto.Message): + r"""A Google Kubernetes Engine cluster. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + name (str): + The name of this cluster. The name must be unique within + this project and location (e.g. zone or region), and can be + up to 40 characters with the following restrictions: + + - Lowercase letters, numbers, and hyphens only. + - Must start with a letter. + - Must end with a number or a letter. + description (str): + An optional description of this cluster. + initial_node_count (int): + The number of nodes to create in this cluster. You must + ensure that your Compute Engine `resource + quota `__ is + sufficient for this number of instances. You must also have + available firewall and routes quota. For requests, this + field should only be used in lieu of a "node_pool" object, + since this configuration (along with the "node_config") will + be used to create a "NodePool" object with an auto-generated + name. Do not use this and a node_pool at the same time. + + This field is deprecated, use node_pool.initial_node_count + instead. + node_config (google.cloud.container_v1beta1.types.NodeConfig): + Parameters used in creating the cluster's nodes. For + requests, this field should only be used in lieu of a + "node_pool" object, since this configuration (along with the + "initial_node_count") will be used to create a "NodePool" + object with an auto-generated name. Do not use this and a + node_pool at the same time. For responses, this field will + be populated with the node configuration of the first node + pool. (For configuration of each node pool, see + ``node_pool.config``) + + If unspecified, the defaults are used. This field is + deprecated, use node_pool.config instead. + master_auth (google.cloud.container_v1beta1.types.MasterAuth): + The authentication information for accessing the master + endpoint. If unspecified, the defaults are used: For + clusters before v1.12, if master_auth is unspecified, + ``username`` will be set to "admin", a random password will + be generated, and a client certificate will be issued. + logging_service (str): + The logging service the cluster should use to write logs. + Currently available options: + + - ``logging.googleapis.com/kubernetes`` - The Cloud Logging + service with a Kubernetes-native resource model + - ``logging.googleapis.com`` - The legacy Cloud Logging + service (no longer available as of GKE 1.15). + - ``none`` - no logs will be exported from the cluster. + + If left as an empty + string,\ ``logging.googleapis.com/kubernetes`` will be used + for GKE 1.14+ or ``logging.googleapis.com`` for earlier + versions. + monitoring_service (str): + The monitoring service the cluster should use to write + metrics. Currently available options: + + - "monitoring.googleapis.com/kubernetes" - The Cloud + Monitoring service with a Kubernetes-native resource + model + - ``monitoring.googleapis.com`` - The legacy Cloud + Monitoring service (no longer available as of GKE 1.15). + - ``none`` - No metrics will be exported from the cluster. + + If left as an empty + string,\ ``monitoring.googleapis.com/kubernetes`` will be + used for GKE 1.14+ or ``monitoring.googleapis.com`` for + earlier versions. + network (str): + The name of the Google Compute Engine + `network `__ + to which the cluster is connected. If left unspecified, the + ``default`` network will be used. On output this shows the + network ID instead of the name. + cluster_ipv4_cidr (str): + The IP address range of the container pods in this cluster, + in + `CIDR `__ + notation (e.g. ``10.96.0.0/14``). Leave blank to have one + automatically chosen or specify a ``/14`` block in + ``10.0.0.0/8``. + addons_config (google.cloud.container_v1beta1.types.AddonsConfig): + Configurations for the various addons + available to run in the cluster. + subnetwork (str): + The name of the Google Compute Engine + `subnetwork `__ + to which the cluster is connected. On output this shows the + subnetwork ID instead of the name. + node_pools (MutableSequence[google.cloud.container_v1beta1.types.NodePool]): + The node pools associated with this cluster. This field + should not be set if "node_config" or "initial_node_count" + are specified. + locations (MutableSequence[str]): + The list of Google Compute Engine + `zones `__ + in which the cluster's nodes should be located. + + This field provides a default value if + `NodePool.Locations `__ + are not specified during node pool creation. + + Warning: changing cluster locations will update the + `NodePool.Locations `__ + of all node pools and will result in nodes being added + and/or removed. + enable_kubernetes_alpha (bool): + Kubernetes alpha features are enabled on this + cluster. This includes alpha API groups (e.g. + v1beta1) and features that may not be production + ready in the kubernetes version of the master + and nodes. The cluster has no SLA for uptime and + master/node upgrades are disabled. Alpha enabled + clusters are automatically deleted thirty days + after creation. + enable_k8s_beta_apis (google.cloud.container_v1beta1.types.K8sBetaAPIConfig): + Kubernetes open source beta apis enabled on + the cluster. Only beta apis. + resource_labels (MutableMapping[str, str]): + The resource labels for the cluster to use to + annotate any related Google Compute Engine + resources. + label_fingerprint (str): + The fingerprint of the set of labels for this + cluster. + legacy_abac (google.cloud.container_v1beta1.types.LegacyAbac): + Configuration for the legacy ABAC + authorization mode. + network_policy (google.cloud.container_v1beta1.types.NetworkPolicy): + Configuration options for the NetworkPolicy + feature. + ip_allocation_policy (google.cloud.container_v1beta1.types.IPAllocationPolicy): + Configuration for cluster IP allocation. + master_authorized_networks_config (google.cloud.container_v1beta1.types.MasterAuthorizedNetworksConfig): + The configuration options for master + authorized networks feature. + maintenance_policy (google.cloud.container_v1beta1.types.MaintenancePolicy): + Configure the maintenance policy for this + cluster. + binary_authorization (google.cloud.container_v1beta1.types.BinaryAuthorization): + Configuration for Binary Authorization. + pod_security_policy_config (google.cloud.container_v1beta1.types.PodSecurityPolicyConfig): + Configuration for the PodSecurityPolicy + feature. + autoscaling (google.cloud.container_v1beta1.types.ClusterAutoscaling): + Cluster-level autoscaling configuration. + network_config (google.cloud.container_v1beta1.types.NetworkConfig): + Configuration for cluster networking. + private_cluster (bool): + If this is a private cluster setup. Private clusters are + clusters that, by default have no external IP addresses on + the nodes and where nodes and the master communicate over + private IP addresses. This field is deprecated, use + private_cluster_config.enable_private_nodes instead. + master_ipv4_cidr_block (str): + The IP prefix in CIDR notation to use for the hosted master + network. This prefix will be used for assigning private IP + addresses to the master or set of masters, as well as the + ILB VIP. This field is deprecated, use + private_cluster_config.master_ipv4_cidr_block instead. + default_max_pods_constraint (google.cloud.container_v1beta1.types.MaxPodsConstraint): + The default constraint on the maximum number + of pods that can be run simultaneously on a node + in the node pool of this cluster. Only honored + if cluster created with IP Alias support. + resource_usage_export_config (google.cloud.container_v1beta1.types.ResourceUsageExportConfig): + Configuration for exporting resource usages. + Resource usage export is disabled when this + config unspecified. + authenticator_groups_config (google.cloud.container_v1beta1.types.AuthenticatorGroupsConfig): + Configuration controlling RBAC group + membership information. + private_cluster_config (google.cloud.container_v1beta1.types.PrivateClusterConfig): + Configuration for private cluster. + vertical_pod_autoscaling (google.cloud.container_v1beta1.types.VerticalPodAutoscaling): + Cluster-level Vertical Pod Autoscaling + configuration. + shielded_nodes (google.cloud.container_v1beta1.types.ShieldedNodes): + Shielded Nodes configuration. + release_channel (google.cloud.container_v1beta1.types.ReleaseChannel): + Release channel configuration. If left + unspecified on cluster creation and a version is + specified, the cluster is enrolled in the most + mature release channel where the version is + available (first checking STABLE, then REGULAR, + and finally RAPID). Otherwise, if no release + channel configuration and no version is + specified, the cluster is enrolled in the + REGULAR channel with its default version. + workload_identity_config (google.cloud.container_v1beta1.types.WorkloadIdentityConfig): + Configuration for the use of Kubernetes + Service Accounts in GCP IAM policies. + workload_certificates (google.cloud.container_v1beta1.types.WorkloadCertificates): + Configuration for issuance of mTLS keys and + certificates to Kubernetes pods. + mesh_certificates (google.cloud.container_v1beta1.types.MeshCertificates): + Configuration for issuance of mTLS keys and + certificates to Kubernetes pods. + workload_alts_config (google.cloud.container_v1beta1.types.WorkloadALTSConfig): + Configuration for direct-path (via ALTS) with + workload identity. + cost_management_config (google.cloud.container_v1beta1.types.CostManagementConfig): + Configuration for the fine-grained cost + management feature. + cluster_telemetry (google.cloud.container_v1beta1.types.ClusterTelemetry): + Telemetry integration for the cluster. + tpu_config (google.cloud.container_v1beta1.types.TpuConfig): + Configuration for Cloud TPU support; + notification_config (google.cloud.container_v1beta1.types.NotificationConfig): + Notification configuration of the cluster. + confidential_nodes (google.cloud.container_v1beta1.types.ConfidentialNodes): + Configuration of Confidential Nodes. + All the nodes in the cluster will be + Confidential VM once enabled. + identity_service_config (google.cloud.container_v1beta1.types.IdentityServiceConfig): + Configuration for Identity Service component. + self_link (str): + Output only. Server-defined URL for the + resource. + zone (str): + Output only. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field is deprecated, use + location instead. + endpoint (str): + Output only. The IP address of this cluster's master + endpoint. The endpoint can be accessed from the internet at + ``https://username:password@endpoint/``. + + See the ``masterAuth`` property of this resource for + username and password information. + initial_cluster_version (str): + The initial Kubernetes version for this + cluster. Valid versions are those found in + validMasterVersions returned by getServerConfig. + The version can be upgraded over time; such + upgrades are reflected in currentMasterVersion + and currentNodeVersion. + + Users may specify either explicit versions + offered by Kubernetes Engine or version aliases, + which have the following behavior: + + - "latest": picks the highest valid Kubernetes + version + - "1.X": picks the highest valid patch+gke.N + patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N patch + in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit Kubernetes + version + - "","-": picks the default Kubernetes version + current_master_version (str): + Output only. The current software version of + the master endpoint. + current_node_version (str): + Output only. Deprecated, use + `NodePool.version `__ + instead. The current version of the node software + components. If they are currently at multiple versions + because they're in the process of being upgraded, this + reflects the minimum version of all nodes. + create_time (str): + Output only. The time the cluster was created, in + `RFC3339 `__ text + format. + status (google.cloud.container_v1beta1.types.Cluster.Status): + Output only. The current status of this + cluster. + status_message (str): + Output only. Deprecated. Use conditions + instead. Additional information about the + current status of this cluster, if available. + node_ipv4_cidr_size (int): + Output only. The size of the address space on each node for + hosting containers. This is provisioned from within the + ``container_ipv4_cidr`` range. This field will only be set + when cluster is in route-based network mode. + services_ipv4_cidr (str): + Output only. The IP address range of the Kubernetes services + in this cluster, in + `CIDR `__ + notation (e.g. ``1.2.3.4/29``). Service addresses are + typically put in the last ``/16`` from the container CIDR. + instance_group_urls (MutableSequence[str]): + Output only. Deprecated. Use node_pools.instance_group_urls. + current_node_count (int): + Output only. The number of nodes currently in + the cluster. Deprecated. Call Kubernetes API + directly to retrieve node information. + expire_time (str): + Output only. The time the cluster will be automatically + deleted in + `RFC3339 `__ text + format. + location (str): + Output only. The name of the Google Compute Engine + `zone `__ + or + `region `__ + in which the cluster resides. + enable_tpu (bool): + Enable the ability to use Cloud TPUs in this cluster. This + field is deprecated, use tpu_config.enabled instead. + tpu_ipv4_cidr_block (str): + Output only. The IP address range of the Cloud TPUs in this + cluster, in + `CIDR `__ + notation (e.g. ``1.2.3.4/29``). + database_encryption (google.cloud.container_v1beta1.types.DatabaseEncryption): + Configuration of etcd encryption. + conditions (MutableSequence[google.cloud.container_v1beta1.types.StatusCondition]): + Which conditions caused the current cluster + state. + master (google.cloud.container_v1beta1.types.Master): + Configuration for master components. + autopilot (google.cloud.container_v1beta1.types.Autopilot): + Autopilot configuration for the cluster. + id (str): + Output only. Unique id for the cluster. + node_pool_defaults (google.cloud.container_v1beta1.types.NodePoolDefaults): + Default NodePool settings for the entire + cluster. These settings are overridden if + specified on the specific NodePool object. + + This field is a member of `oneof`_ ``_node_pool_defaults``. + logging_config (google.cloud.container_v1beta1.types.LoggingConfig): + Logging configuration for the cluster. + monitoring_config (google.cloud.container_v1beta1.types.MonitoringConfig): + Monitoring configuration for the cluster. + node_pool_auto_config (google.cloud.container_v1beta1.types.NodePoolAutoConfig): + Node pool configs that apply to all + auto-provisioned node pools in autopilot + clusters and node auto-provisioning enabled + clusters. + protect_config (google.cloud.container_v1beta1.types.ProtectConfig): + Deprecated: Use SecurityPostureConfig + instead. Enable/Disable Protect API features for + the cluster. + + This field is a member of `oneof`_ ``_protect_config``. + etag (str): + This checksum is computed by the server based + on the value of cluster fields, and may be sent + on update requests to ensure the client has an + up-to-date value before proceeding. + fleet (google.cloud.container_v1beta1.types.Fleet): + Fleet information for the cluster. + security_posture_config (google.cloud.container_v1beta1.types.SecurityPostureConfig): + Enable/Disable Security Posture API features + for the cluster. + enterprise_config (google.cloud.container_v1beta1.types.EnterpriseConfig): + GKE Enterprise Configuration. + secret_manager_config (google.cloud.container_v1beta1.types.SecretManagerConfig): + Secret CSI driver configuration. + compliance_posture_config (google.cloud.container_v1beta1.types.CompliancePostureConfig): + Enable/Disable Compliance Posture features + for the cluster. + satisfies_pzs (bool): + Output only. Reserved for future use. + + This field is a member of `oneof`_ ``_satisfies_pzs``. + satisfies_pzi (bool): + Output only. Reserved for future use. + + This field is a member of `oneof`_ ``_satisfies_pzi``. + """ + class Status(proto.Enum): + r"""The current status of the cluster. + + Values: + STATUS_UNSPECIFIED (0): + Not set. + PROVISIONING (1): + The PROVISIONING state indicates the cluster + is being created. + RUNNING (2): + The RUNNING state indicates the cluster has + been created and is fully usable. + RECONCILING (3): + The RECONCILING state indicates that some work is actively + being done on the cluster, such as upgrading the master or + node software. Details can be found in the ``statusMessage`` + field. + STOPPING (4): + The STOPPING state indicates the cluster is + being deleted. + ERROR (5): + The ERROR state indicates the cluster may be unusable. + Details can be found in the ``statusMessage`` field. + DEGRADED (6): + The DEGRADED state indicates the cluster requires user + action to restore full functionality. Details can be found + in the ``statusMessage`` field. + """ + STATUS_UNSPECIFIED = 0 + PROVISIONING = 1 + RUNNING = 2 + RECONCILING = 3 + STOPPING = 4 + ERROR = 5 + DEGRADED = 6 + + name: str = proto.Field( + proto.STRING, + number=1, + ) + description: str = proto.Field( + proto.STRING, + number=2, + ) + initial_node_count: int = proto.Field( + proto.INT32, + number=3, + ) + node_config: 'NodeConfig' = proto.Field( + proto.MESSAGE, + number=4, + message='NodeConfig', + ) + master_auth: 'MasterAuth' = proto.Field( + proto.MESSAGE, + number=5, + message='MasterAuth', + ) + logging_service: str = proto.Field( + proto.STRING, + number=6, + ) + monitoring_service: str = proto.Field( + proto.STRING, + number=7, + ) + network: str = proto.Field( + proto.STRING, + number=8, + ) + cluster_ipv4_cidr: str = proto.Field( + proto.STRING, + number=9, + ) + addons_config: 'AddonsConfig' = proto.Field( + proto.MESSAGE, + number=10, + message='AddonsConfig', + ) + subnetwork: str = proto.Field( + proto.STRING, + number=11, + ) + node_pools: MutableSequence['NodePool'] = proto.RepeatedField( + proto.MESSAGE, + number=12, + message='NodePool', + ) + locations: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=13, + ) + enable_kubernetes_alpha: bool = proto.Field( + proto.BOOL, + number=14, + ) + enable_k8s_beta_apis: 'K8sBetaAPIConfig' = proto.Field( + proto.MESSAGE, + number=143, + message='K8sBetaAPIConfig', + ) + resource_labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=15, + ) + label_fingerprint: str = proto.Field( + proto.STRING, + number=16, + ) + legacy_abac: 'LegacyAbac' = proto.Field( + proto.MESSAGE, + number=18, + message='LegacyAbac', + ) + network_policy: 'NetworkPolicy' = proto.Field( + proto.MESSAGE, + number=19, + message='NetworkPolicy', + ) + ip_allocation_policy: 'IPAllocationPolicy' = proto.Field( + proto.MESSAGE, + number=20, + message='IPAllocationPolicy', + ) + master_authorized_networks_config: 'MasterAuthorizedNetworksConfig' = proto.Field( + proto.MESSAGE, + number=22, + message='MasterAuthorizedNetworksConfig', + ) + maintenance_policy: 'MaintenancePolicy' = proto.Field( + proto.MESSAGE, + number=23, + message='MaintenancePolicy', + ) + binary_authorization: 'BinaryAuthorization' = proto.Field( + proto.MESSAGE, + number=24, + message='BinaryAuthorization', + ) + pod_security_policy_config: 'PodSecurityPolicyConfig' = proto.Field( + proto.MESSAGE, + number=25, + message='PodSecurityPolicyConfig', + ) + autoscaling: 'ClusterAutoscaling' = proto.Field( + proto.MESSAGE, + number=26, + message='ClusterAutoscaling', + ) + network_config: 'NetworkConfig' = proto.Field( + proto.MESSAGE, + number=27, + message='NetworkConfig', + ) + private_cluster: bool = proto.Field( + proto.BOOL, + number=28, + ) + master_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=29, + ) + default_max_pods_constraint: 'MaxPodsConstraint' = proto.Field( + proto.MESSAGE, + number=30, + message='MaxPodsConstraint', + ) + resource_usage_export_config: 'ResourceUsageExportConfig' = proto.Field( + proto.MESSAGE, + number=33, + message='ResourceUsageExportConfig', + ) + authenticator_groups_config: 'AuthenticatorGroupsConfig' = proto.Field( + proto.MESSAGE, + number=34, + message='AuthenticatorGroupsConfig', + ) + private_cluster_config: 'PrivateClusterConfig' = proto.Field( + proto.MESSAGE, + number=37, + message='PrivateClusterConfig', + ) + vertical_pod_autoscaling: 'VerticalPodAutoscaling' = proto.Field( + proto.MESSAGE, + number=39, + message='VerticalPodAutoscaling', + ) + shielded_nodes: 'ShieldedNodes' = proto.Field( + proto.MESSAGE, + number=40, + message='ShieldedNodes', + ) + release_channel: 'ReleaseChannel' = proto.Field( + proto.MESSAGE, + number=41, + message='ReleaseChannel', + ) + workload_identity_config: 'WorkloadIdentityConfig' = proto.Field( + proto.MESSAGE, + number=43, + message='WorkloadIdentityConfig', + ) + workload_certificates: 'WorkloadCertificates' = proto.Field( + proto.MESSAGE, + number=52, + message='WorkloadCertificates', + ) + mesh_certificates: 'MeshCertificates' = proto.Field( + proto.MESSAGE, + number=67, + message='MeshCertificates', + ) + workload_alts_config: 'WorkloadALTSConfig' = proto.Field( + proto.MESSAGE, + number=53, + message='WorkloadALTSConfig', + ) + cost_management_config: 'CostManagementConfig' = proto.Field( + proto.MESSAGE, + number=45, + message='CostManagementConfig', + ) + cluster_telemetry: 'ClusterTelemetry' = proto.Field( + proto.MESSAGE, + number=46, + message='ClusterTelemetry', + ) + tpu_config: 'TpuConfig' = proto.Field( + proto.MESSAGE, + number=47, + message='TpuConfig', + ) + notification_config: 'NotificationConfig' = proto.Field( + proto.MESSAGE, + number=49, + message='NotificationConfig', + ) + confidential_nodes: 'ConfidentialNodes' = proto.Field( + proto.MESSAGE, + number=50, + message='ConfidentialNodes', + ) + identity_service_config: 'IdentityServiceConfig' = proto.Field( + proto.MESSAGE, + number=54, + message='IdentityServiceConfig', + ) + self_link: str = proto.Field( + proto.STRING, + number=100, + ) + zone: str = proto.Field( + proto.STRING, + number=101, + ) + endpoint: str = proto.Field( + proto.STRING, + number=102, + ) + initial_cluster_version: str = proto.Field( + proto.STRING, + number=103, + ) + current_master_version: str = proto.Field( + proto.STRING, + number=104, + ) + current_node_version: str = proto.Field( + proto.STRING, + number=105, + ) + create_time: str = proto.Field( + proto.STRING, + number=106, + ) + status: Status = proto.Field( + proto.ENUM, + number=107, + enum=Status, + ) + status_message: str = proto.Field( + proto.STRING, + number=108, + ) + node_ipv4_cidr_size: int = proto.Field( + proto.INT32, + number=109, + ) + services_ipv4_cidr: str = proto.Field( + proto.STRING, + number=110, + ) + instance_group_urls: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=111, + ) + current_node_count: int = proto.Field( + proto.INT32, + number=112, + ) + expire_time: str = proto.Field( + proto.STRING, + number=113, + ) + location: str = proto.Field( + proto.STRING, + number=114, + ) + enable_tpu: bool = proto.Field( + proto.BOOL, + number=115, + ) + tpu_ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=116, + ) + database_encryption: 'DatabaseEncryption' = proto.Field( + proto.MESSAGE, + number=38, + message='DatabaseEncryption', + ) + conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( + proto.MESSAGE, + number=118, + message='StatusCondition', + ) + master: 'Master' = proto.Field( + proto.MESSAGE, + number=124, + message='Master', + ) + autopilot: 'Autopilot' = proto.Field( + proto.MESSAGE, + number=128, + message='Autopilot', + ) + id: str = proto.Field( + proto.STRING, + number=129, + ) + node_pool_defaults: 'NodePoolDefaults' = proto.Field( + proto.MESSAGE, + number=131, + optional=True, + message='NodePoolDefaults', + ) + logging_config: 'LoggingConfig' = proto.Field( + proto.MESSAGE, + number=132, + message='LoggingConfig', + ) + monitoring_config: 'MonitoringConfig' = proto.Field( + proto.MESSAGE, + number=133, + message='MonitoringConfig', + ) + node_pool_auto_config: 'NodePoolAutoConfig' = proto.Field( + proto.MESSAGE, + number=136, + message='NodePoolAutoConfig', + ) + protect_config: 'ProtectConfig' = proto.Field( + proto.MESSAGE, + number=137, + optional=True, + message='ProtectConfig', + ) + etag: str = proto.Field( + proto.STRING, + number=139, + ) + fleet: 'Fleet' = proto.Field( + proto.MESSAGE, + number=140, + message='Fleet', + ) + security_posture_config: 'SecurityPostureConfig' = proto.Field( + proto.MESSAGE, + number=145, + message='SecurityPostureConfig', + ) + enterprise_config: 'EnterpriseConfig' = proto.Field( + proto.MESSAGE, + number=149, + message='EnterpriseConfig', + ) + secret_manager_config: 'SecretManagerConfig' = proto.Field( + proto.MESSAGE, + number=150, + message='SecretManagerConfig', + ) + compliance_posture_config: 'CompliancePostureConfig' = proto.Field( + proto.MESSAGE, + number=151, + message='CompliancePostureConfig', + ) + satisfies_pzs: bool = proto.Field( + proto.BOOL, + number=152, + optional=True, + ) + satisfies_pzi: bool = proto.Field( + proto.BOOL, + number=153, + optional=True, + ) + + +class CompliancePostureConfig(proto.Message): + r"""CompliancePostureConfig defines the settings needed to + enable/disable features for the Compliance Posture. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + mode (google.cloud.container_v1beta1.types.CompliancePostureConfig.Mode): + Defines the enablement mode for Compliance + Posture. + + This field is a member of `oneof`_ ``_mode``. + compliance_standards (MutableSequence[google.cloud.container_v1beta1.types.CompliancePostureConfig.ComplianceStandard]): + List of enabled compliance standards. + """ + class Mode(proto.Enum): + r"""Mode defines enablement mode for Compliance Posture. + + Values: + MODE_UNSPECIFIED (0): + Default value not specified. + DISABLED (1): + Disables Compliance Posture features on the + cluster. + ENABLED (2): + Enables Compliance Posture features on the + cluster. + """ + MODE_UNSPECIFIED = 0 + DISABLED = 1 + ENABLED = 2 + + class ComplianceStandard(proto.Message): + r"""Defines the details of a compliance standard. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + standard (str): + Name of the compliance standard. + + This field is a member of `oneof`_ ``_standard``. + """ + + standard: str = proto.Field( + proto.STRING, + number=1, + optional=True, + ) + + mode: Mode = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum=Mode, + ) + compliance_standards: MutableSequence[ComplianceStandard] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=ComplianceStandard, + ) + + +class K8sBetaAPIConfig(proto.Message): + r"""Kubernetes open source beta apis enabled on the cluster. + + Attributes: + enabled_apis (MutableSequence[str]): + api name, e.g. + storage.k8s.io/v1beta1/csistoragecapacities. + """ + + enabled_apis: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + + +class WorkloadConfig(proto.Message): + r"""WorkloadConfig defines the flags to enable or disable the + workload configurations for the cluster. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + audit_mode (google.cloud.container_v1beta1.types.WorkloadConfig.Mode): + Sets which mode of auditing should be used + for the cluster's workloads. + + This field is a member of `oneof`_ ``_audit_mode``. + """ + class Mode(proto.Enum): + r"""Mode defines how to audit the workload configs. + + Values: + MODE_UNSPECIFIED (0): + Default value meaning that no mode has been + specified. + DISABLED (1): + This disables Workload Configuration auditing + on the cluster, meaning that nothing is + surfaced. + BASIC (4): + Applies the default set of policy auditing to + a cluster's workloads. + BASELINE (2): + Surfaces configurations that are not in line + with the Pod Security Standard Baseline policy. + RESTRICTED (3): + Surfaces configurations that are not in line + with the Pod Security Standard Restricted + policy. + """ + MODE_UNSPECIFIED = 0 + DISABLED = 1 + BASIC = 4 + BASELINE = 2 + RESTRICTED = 3 + + audit_mode: Mode = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum=Mode, + ) + + +class ProtectConfig(proto.Message): + r"""ProtectConfig defines the flags needed to enable/disable + features for the Protect API. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + workload_config (google.cloud.container_v1beta1.types.WorkloadConfig): + WorkloadConfig defines which actions are + enabled for a cluster's workload configurations. + + This field is a member of `oneof`_ ``_workload_config``. + workload_vulnerability_mode (google.cloud.container_v1beta1.types.ProtectConfig.WorkloadVulnerabilityMode): + Sets which mode to use for Protect workload + vulnerability scanning feature. + + This field is a member of `oneof`_ ``_workload_vulnerability_mode``. + """ + class WorkloadVulnerabilityMode(proto.Enum): + r"""WorkloadVulnerabilityMode defines mode to perform + vulnerability scanning. + + Values: + WORKLOAD_VULNERABILITY_MODE_UNSPECIFIED (0): + Default value not specified. + DISABLED (1): + Disables Workload Vulnerability Scanning + feature on the cluster. + BASIC (2): + Applies basic vulnerability scanning settings + for cluster workloads. + """ + WORKLOAD_VULNERABILITY_MODE_UNSPECIFIED = 0 + DISABLED = 1 + BASIC = 2 + + workload_config: 'WorkloadConfig' = proto.Field( + proto.MESSAGE, + number=1, + optional=True, + message='WorkloadConfig', + ) + workload_vulnerability_mode: WorkloadVulnerabilityMode = proto.Field( + proto.ENUM, + number=2, + optional=True, + enum=WorkloadVulnerabilityMode, + ) + + +class SecurityPostureConfig(proto.Message): + r"""SecurityPostureConfig defines the flags needed to + enable/disable features for the Security Posture API. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + mode (google.cloud.container_v1beta1.types.SecurityPostureConfig.Mode): + Sets which mode to use for Security Posture + features. + + This field is a member of `oneof`_ ``_mode``. + vulnerability_mode (google.cloud.container_v1beta1.types.SecurityPostureConfig.VulnerabilityMode): + Sets which mode to use for vulnerability + scanning. + + This field is a member of `oneof`_ ``_vulnerability_mode``. + """ + class Mode(proto.Enum): + r"""Mode defines enablement mode for GKE Security posture + features. + + Values: + MODE_UNSPECIFIED (0): + Default value not specified. + DISABLED (1): + Disables Security Posture features on the + cluster. + BASIC (2): + Applies Security Posture features on the + cluster. + ENTERPRISE (3): + Applies the Security Posture off cluster + Enterprise level features. + """ + MODE_UNSPECIFIED = 0 + DISABLED = 1 + BASIC = 2 + ENTERPRISE = 3 + + class VulnerabilityMode(proto.Enum): + r"""VulnerabilityMode defines enablement mode for vulnerability + scanning. + + Values: + VULNERABILITY_MODE_UNSPECIFIED (0): + Default value not specified. + VULNERABILITY_DISABLED (1): + Disables vulnerability scanning on the + cluster. + VULNERABILITY_BASIC (2): + Applies basic vulnerability scanning on the + cluster. + VULNERABILITY_ENTERPRISE (3): + Applies the Security Posture's vulnerability + on cluster Enterprise level features. + """ + VULNERABILITY_MODE_UNSPECIFIED = 0 + VULNERABILITY_DISABLED = 1 + VULNERABILITY_BASIC = 2 + VULNERABILITY_ENTERPRISE = 3 + + mode: Mode = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum=Mode, + ) + vulnerability_mode: VulnerabilityMode = proto.Field( + proto.ENUM, + number=2, + optional=True, + enum=VulnerabilityMode, + ) + + +class NodePoolDefaults(proto.Message): + r"""Subset of Nodepool message that has defaults. + + Attributes: + node_config_defaults (google.cloud.container_v1beta1.types.NodeConfigDefaults): + Subset of NodeConfig message that has + defaults. + """ + + node_config_defaults: 'NodeConfigDefaults' = proto.Field( + proto.MESSAGE, + number=1, + message='NodeConfigDefaults', + ) + + +class NodeConfigDefaults(proto.Message): + r"""Subset of NodeConfig message that has defaults. + + Attributes: + gcfs_config (google.cloud.container_v1beta1.types.GcfsConfig): + GCFS (Google Container File System, also + known as Riptide) options. + logging_config (google.cloud.container_v1beta1.types.NodePoolLoggingConfig): + Logging configuration for node pools. + containerd_config (google.cloud.container_v1beta1.types.ContainerdConfig): + Parameters for containerd customization. + host_maintenance_policy (google.cloud.container_v1beta1.types.HostMaintenancePolicy): + HostMaintenancePolicy contains the desired + maintenance policy for the Google Compute Engine + hosts. + node_kubelet_config (google.cloud.container_v1beta1.types.NodeKubeletConfig): + NodeKubeletConfig controls the defaults for new node-pools. + + Currently only ``insecure_kubelet_readonly_port_enabled`` + can be set here. + """ + + gcfs_config: 'GcfsConfig' = proto.Field( + proto.MESSAGE, + number=1, + message='GcfsConfig', + ) + logging_config: 'NodePoolLoggingConfig' = proto.Field( + proto.MESSAGE, + number=3, + message='NodePoolLoggingConfig', + ) + containerd_config: 'ContainerdConfig' = proto.Field( + proto.MESSAGE, + number=4, + message='ContainerdConfig', + ) + host_maintenance_policy: 'HostMaintenancePolicy' = proto.Field( + proto.MESSAGE, + number=5, + message='HostMaintenancePolicy', + ) + node_kubelet_config: 'NodeKubeletConfig' = proto.Field( + proto.MESSAGE, + number=6, + message='NodeKubeletConfig', + ) + + +class NodePoolAutoConfig(proto.Message): + r"""node pool configs that apply to all auto-provisioned node + pools in autopilot clusters and node auto-provisioning enabled + clusters + + Attributes: + network_tags (google.cloud.container_v1beta1.types.NetworkTags): + The list of instance tags applied to all + nodes. Tags are used to identify valid sources + or targets for network firewalls and are + specified by the client during cluster creation. + Each tag within the list must comply with + RFC1035. + resource_manager_tags (google.cloud.container_v1beta1.types.ResourceManagerTags): + Resource manager tag keys and values to be + attached to the nodes for managing Compute + Engine firewalls using Network Firewall + Policies. + node_kubelet_config (google.cloud.container_v1beta1.types.NodeKubeletConfig): + NodeKubeletConfig controls the defaults for autoprovisioned + node-pools. + + Currently only ``insecure_kubelet_readonly_port_enabled`` + can be set here. + """ + + network_tags: 'NetworkTags' = proto.Field( + proto.MESSAGE, + number=1, + message='NetworkTags', + ) + resource_manager_tags: 'ResourceManagerTags' = proto.Field( + proto.MESSAGE, + number=2, + message='ResourceManagerTags', + ) + node_kubelet_config: 'NodeKubeletConfig' = proto.Field( + proto.MESSAGE, + number=3, + message='NodeKubeletConfig', + ) + + +class ClusterUpdate(proto.Message): + r"""ClusterUpdate describes an update to the cluster. Exactly one + update can be applied to a cluster with each request, so at most + one field can be provided. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + desired_node_version (str): + The Kubernetes version to change the nodes to + (typically an upgrade). + + Users may specify either explicit versions + offered by Kubernetes Engine or version aliases, + which have the following behavior: + + - "latest": picks the highest valid Kubernetes + version + - "1.X": picks the highest valid patch+gke.N + patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N patch + in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit Kubernetes + version + - "-": picks the Kubernetes master version + desired_monitoring_service (str): + The monitoring service the cluster should use to write + metrics. Currently available options: + + - "monitoring.googleapis.com/kubernetes" - The Cloud + Monitoring service with a Kubernetes-native resource + model + - ``monitoring.googleapis.com`` - The legacy Cloud + Monitoring service (no longer available as of GKE 1.15). + - ``none`` - No metrics will be exported from the cluster. + + If left as an empty + string,\ ``monitoring.googleapis.com/kubernetes`` will be + used for GKE 1.14+ or ``monitoring.googleapis.com`` for + earlier versions. + desired_addons_config (google.cloud.container_v1beta1.types.AddonsConfig): + Configurations for the various addons + available to run in the cluster. + desired_node_pool_id (str): + The node pool to be upgraded. This field is mandatory if + "desired_node_version", "desired_image_family", + "desired_node_pool_autoscaling", or + "desired_workload_metadata_config" is specified and there is + more than one node pool on the cluster. + desired_image_type (str): + The desired image type for the node pool. NOTE: Set the + "desired_node_pool" field as well. + desired_node_pool_autoscaling (google.cloud.container_v1beta1.types.NodePoolAutoscaling): + Autoscaler configuration for the node pool specified in + desired_node_pool_id. If there is only one pool in the + cluster and desired_node_pool_id is not provided then the + change applies to that single node pool. + desired_locations (MutableSequence[str]): + The desired list of Google Compute Engine + `zones `__ + in which the cluster's nodes should be located. + + This list must always include the cluster's primary zone. + + Warning: changing cluster locations will update the + locations of all node pools and will result in nodes being + added and/or removed. + desired_master_authorized_networks_config (google.cloud.container_v1beta1.types.MasterAuthorizedNetworksConfig): + The desired configuration options for master + authorized networks feature. + desired_pod_security_policy_config (google.cloud.container_v1beta1.types.PodSecurityPolicyConfig): + The desired configuration options for the + PodSecurityPolicy feature. + desired_cluster_autoscaling (google.cloud.container_v1beta1.types.ClusterAutoscaling): + Cluster-level autoscaling configuration. + desired_binary_authorization (google.cloud.container_v1beta1.types.BinaryAuthorization): + The desired configuration options for the + Binary Authorization feature. + desired_logging_service (str): + The logging service the cluster should use to write logs. + Currently available options: + + - ``logging.googleapis.com/kubernetes`` - The Cloud Logging + service with a Kubernetes-native resource model + - ``logging.googleapis.com`` - The legacy Cloud Logging + service (no longer available as of GKE 1.15). + - ``none`` - no logs will be exported from the cluster. + + If left as an empty + string,\ ``logging.googleapis.com/kubernetes`` will be used + for GKE 1.14+ or ``logging.googleapis.com`` for earlier + versions. + desired_resource_usage_export_config (google.cloud.container_v1beta1.types.ResourceUsageExportConfig): + The desired configuration for exporting + resource usage. + desired_vertical_pod_autoscaling (google.cloud.container_v1beta1.types.VerticalPodAutoscaling): + Cluster-level Vertical Pod Autoscaling + configuration. + desired_private_cluster_config (google.cloud.container_v1beta1.types.PrivateClusterConfig): + The desired private cluster configuration. + master_global_access_config is the only field that can be + changed via this field. See also + [ClusterUpdate.desired_enable_private_endpoint][google.container.v1beta1.ClusterUpdate.desired_enable_private_endpoint] + for modifying other fields within + [PrivateClusterConfig][google.container.v1beta1.PrivateClusterConfig]. + desired_intra_node_visibility_config (google.cloud.container_v1beta1.types.IntraNodeVisibilityConfig): + The desired config of Intra-node visibility. + desired_default_snat_status (google.cloud.container_v1beta1.types.DefaultSnatStatus): + The desired status of whether to disable + default sNAT for this cluster. + desired_cluster_telemetry (google.cloud.container_v1beta1.types.ClusterTelemetry): + The desired telemetry integration for the + cluster. + desired_release_channel (google.cloud.container_v1beta1.types.ReleaseChannel): + The desired release channel configuration. + private_cluster_config (google.cloud.container_v1beta1.types.PrivateClusterConfig): + The desired private cluster configuration. Has no effect. + Use + [desired_private_cluster_config][google.container.v1beta1.ClusterUpdate.desired_private_cluster_config] + instead. + desired_tpu_config (google.cloud.container_v1beta1.types.TpuConfig): + The desired Cloud TPU configuration. + desired_l4ilb_subsetting_config (google.cloud.container_v1beta1.types.ILBSubsettingConfig): + The desired L4 Internal Load Balancer + Subsetting configuration. + desired_datapath_provider (google.cloud.container_v1beta1.types.DatapathProvider): + The desired datapath provider for the + cluster. + desired_private_ipv6_google_access (google.cloud.container_v1beta1.types.PrivateIPv6GoogleAccess): + The desired state of IPv6 connectivity to + Google Services. + desired_notification_config (google.cloud.container_v1beta1.types.NotificationConfig): + The desired notification configuration. + desired_master_version (str): + The Kubernetes version to change the master + to. The only valid value is the latest supported + version. + + Users may specify either explicit versions + offered by Kubernetes Engine or version aliases, + which have the following behavior: + + - "latest": picks the highest valid Kubernetes + version + - "1.X": picks the highest valid patch+gke.N + patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N patch + in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit Kubernetes + version + - "-": picks the default Kubernetes version + desired_gcfs_config (google.cloud.container_v1beta1.types.GcfsConfig): + The desired GCFS config for the cluster. + desired_database_encryption (google.cloud.container_v1beta1.types.DatabaseEncryption): + Configuration of etcd encryption. + desired_workload_identity_config (google.cloud.container_v1beta1.types.WorkloadIdentityConfig): + Configuration for Workload Identity. + desired_workload_certificates (google.cloud.container_v1beta1.types.WorkloadCertificates): + Configuration for issuance of mTLS keys and + certificates to Kubernetes pods. + desired_mesh_certificates (google.cloud.container_v1beta1.types.MeshCertificates): + Configuration for issuance of mTLS keys and + certificates to Kubernetes pods. + desired_workload_alts_config (google.cloud.container_v1beta1.types.WorkloadALTSConfig): + Configuration for direct-path (via ALTS) with + workload identity. + desired_shielded_nodes (google.cloud.container_v1beta1.types.ShieldedNodes): + Configuration for Shielded Nodes. + desired_cost_management_config (google.cloud.container_v1beta1.types.CostManagementConfig): + The desired configuration for the + fine-grained cost management feature. + desired_master (google.cloud.container_v1beta1.types.Master): + Configuration for master components. + desired_dns_config (google.cloud.container_v1beta1.types.DNSConfig): + DNSConfig contains clusterDNS config for this + cluster. + desired_service_external_ips_config (google.cloud.container_v1beta1.types.ServiceExternalIPsConfig): + ServiceExternalIPsConfig specifies the config + for the use of Services with ExternalIPs field. + desired_authenticator_groups_config (google.cloud.container_v1beta1.types.AuthenticatorGroupsConfig): + AuthenticatorGroupsConfig specifies the + config for the cluster security groups settings. + desired_logging_config (google.cloud.container_v1beta1.types.LoggingConfig): + The desired logging configuration. + desired_monitoring_config (google.cloud.container_v1beta1.types.MonitoringConfig): + The desired monitoring configuration. + desired_identity_service_config (google.cloud.container_v1beta1.types.IdentityServiceConfig): + The desired Identity Service component + configuration. + desired_enable_private_endpoint (bool): + Enable/Disable private endpoint for the + cluster's master. + + This field is a member of `oneof`_ ``_desired_enable_private_endpoint``. + desired_node_pool_auto_config_network_tags (google.cloud.container_v1beta1.types.NetworkTags): + The desired network tags that apply to all + auto-provisioned node pools in autopilot + clusters and node auto-provisioning enabled + clusters. + desired_protect_config (google.cloud.container_v1beta1.types.ProtectConfig): + Deprecated: Use DesiredSecurityPostureConfig + instead. Enable/Disable Protect API features for + the cluster. + + This field is a member of `oneof`_ ``_desired_protect_config``. + desired_gateway_api_config (google.cloud.container_v1beta1.types.GatewayAPIConfig): + The desired config of Gateway API on this + cluster. + etag (str): + The current etag of the cluster. + If an etag is provided and does not match the + current etag of the cluster, update will be + blocked and an ABORTED error will be returned. + desired_node_pool_logging_config (google.cloud.container_v1beta1.types.NodePoolLoggingConfig): + The desired node pool logging configuration + defaults for the cluster. + desired_fleet (google.cloud.container_v1beta1.types.Fleet): + The desired fleet configuration for the + cluster. + desired_stack_type (google.cloud.container_v1beta1.types.StackType): + The desired stack type of the cluster. + If a stack type is provided and does not match + the current stack type of the cluster, update + will attempt to change the stack type to the new + type. + additional_pod_ranges_config (google.cloud.container_v1beta1.types.AdditionalPodRangesConfig): + The additional pod ranges to be added to the + cluster. These pod ranges can be used by node + pools to allocate pod IPs. + removed_additional_pod_ranges_config (google.cloud.container_v1beta1.types.AdditionalPodRangesConfig): + The additional pod ranges that are to be removed from the + cluster. The pod ranges specified here must have been + specified earlier in the 'additional_pod_ranges_config' + argument. + enable_k8s_beta_apis (google.cloud.container_v1beta1.types.K8sBetaAPIConfig): + Kubernetes open source beta apis enabled on + the cluster. Only beta apis + desired_security_posture_config (google.cloud.container_v1beta1.types.SecurityPostureConfig): + Enable/Disable Security Posture API features + for the cluster. + desired_network_performance_config (google.cloud.container_v1beta1.types.NetworkConfig.ClusterNetworkPerformanceConfig): + The desired network performance config. + desired_enable_fqdn_network_policy (bool): + Enable/Disable FQDN Network Policy for the + cluster. + + This field is a member of `oneof`_ ``_desired_enable_fqdn_network_policy``. + desired_autopilot_workload_policy_config (google.cloud.container_v1beta1.types.WorkloadPolicyConfig): + The desired workload policy configuration for + the autopilot cluster. + desired_k8s_beta_apis (google.cloud.container_v1beta1.types.K8sBetaAPIConfig): + Beta APIs enabled for cluster. + desired_host_maintenance_policy (google.cloud.container_v1beta1.types.HostMaintenancePolicy): + HostMaintenancePolicy contains the desired + maintenance policy for the Google Compute Engine + hosts. + desired_containerd_config (google.cloud.container_v1beta1.types.ContainerdConfig): + The desired containerd config for the + cluster. + desired_enable_multi_networking (bool): + Enable/Disable Multi-Networking for the + cluster + + This field is a member of `oneof`_ ``_desired_enable_multi_networking``. + desired_node_pool_auto_config_resource_manager_tags (google.cloud.container_v1beta1.types.ResourceManagerTags): + The desired resource manager tags that apply + to all auto-provisioned node pools in autopilot + clusters and node auto-provisioning enabled + clusters. + desired_in_transit_encryption_config (google.cloud.container_v1beta1.types.InTransitEncryptionConfig): + Specify the details of in-transit encryption. + Now named inter-node transparent encryption. + + This field is a member of `oneof`_ ``_desired_in_transit_encryption_config``. + desired_enable_cilium_clusterwide_network_policy (bool): + Enable/Disable Cilium Clusterwide Network + Policy for the cluster. + + This field is a member of `oneof`_ ``_desired_enable_cilium_clusterwide_network_policy``. + desired_secret_manager_config (google.cloud.container_v1beta1.types.SecretManagerConfig): + Enable/Disable Secret Manager Config. + + This field is a member of `oneof`_ ``_desired_secret_manager_config``. + desired_node_kubelet_config (google.cloud.container_v1beta1.types.NodeKubeletConfig): + The desired node kubelet config for the + cluster. + desired_node_pool_auto_config_kubelet_config (google.cloud.container_v1beta1.types.NodeKubeletConfig): + The desired node kubelet config for all + auto-provisioned node pools in autopilot + clusters and node auto-provisioning enabled + clusters. + """ + + desired_node_version: str = proto.Field( + proto.STRING, + number=4, + ) + desired_monitoring_service: str = proto.Field( + proto.STRING, + number=5, + ) + desired_addons_config: 'AddonsConfig' = proto.Field( + proto.MESSAGE, + number=6, + message='AddonsConfig', + ) + desired_node_pool_id: str = proto.Field( + proto.STRING, + number=7, + ) + desired_image_type: str = proto.Field( + proto.STRING, + number=8, + ) + desired_node_pool_autoscaling: 'NodePoolAutoscaling' = proto.Field( + proto.MESSAGE, + number=9, + message='NodePoolAutoscaling', + ) + desired_locations: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=10, + ) + desired_master_authorized_networks_config: 'MasterAuthorizedNetworksConfig' = proto.Field( + proto.MESSAGE, + number=12, + message='MasterAuthorizedNetworksConfig', + ) + desired_pod_security_policy_config: 'PodSecurityPolicyConfig' = proto.Field( + proto.MESSAGE, + number=14, + message='PodSecurityPolicyConfig', + ) + desired_cluster_autoscaling: 'ClusterAutoscaling' = proto.Field( + proto.MESSAGE, + number=15, + message='ClusterAutoscaling', + ) + desired_binary_authorization: 'BinaryAuthorization' = proto.Field( + proto.MESSAGE, + number=16, + message='BinaryAuthorization', + ) + desired_logging_service: str = proto.Field( + proto.STRING, + number=19, + ) + desired_resource_usage_export_config: 'ResourceUsageExportConfig' = proto.Field( + proto.MESSAGE, + number=21, + message='ResourceUsageExportConfig', + ) + desired_vertical_pod_autoscaling: 'VerticalPodAutoscaling' = proto.Field( + proto.MESSAGE, + number=22, + message='VerticalPodAutoscaling', + ) + desired_private_cluster_config: 'PrivateClusterConfig' = proto.Field( + proto.MESSAGE, + number=25, + message='PrivateClusterConfig', + ) + desired_intra_node_visibility_config: 'IntraNodeVisibilityConfig' = proto.Field( + proto.MESSAGE, + number=26, + message='IntraNodeVisibilityConfig', + ) + desired_default_snat_status: 'DefaultSnatStatus' = proto.Field( + proto.MESSAGE, + number=28, + message='DefaultSnatStatus', + ) + desired_cluster_telemetry: 'ClusterTelemetry' = proto.Field( + proto.MESSAGE, + number=30, + message='ClusterTelemetry', + ) + desired_release_channel: 'ReleaseChannel' = proto.Field( + proto.MESSAGE, + number=31, + message='ReleaseChannel', + ) + private_cluster_config: 'PrivateClusterConfig' = proto.Field( + proto.MESSAGE, + number=37, + message='PrivateClusterConfig', + ) + desired_tpu_config: 'TpuConfig' = proto.Field( + proto.MESSAGE, + number=38, + message='TpuConfig', + ) + desired_l4ilb_subsetting_config: 'ILBSubsettingConfig' = proto.Field( + proto.MESSAGE, + number=39, + message='ILBSubsettingConfig', + ) + desired_datapath_provider: 'DatapathProvider' = proto.Field( + proto.ENUM, + number=50, + enum='DatapathProvider', + ) + desired_private_ipv6_google_access: 'PrivateIPv6GoogleAccess' = proto.Field( + proto.ENUM, + number=51, + enum='PrivateIPv6GoogleAccess', + ) + desired_notification_config: 'NotificationConfig' = proto.Field( + proto.MESSAGE, + number=55, + message='NotificationConfig', + ) + desired_master_version: str = proto.Field( + proto.STRING, + number=100, + ) + desired_gcfs_config: 'GcfsConfig' = proto.Field( + proto.MESSAGE, + number=109, + message='GcfsConfig', + ) + desired_database_encryption: 'DatabaseEncryption' = proto.Field( + proto.MESSAGE, + number=46, + message='DatabaseEncryption', + ) + desired_workload_identity_config: 'WorkloadIdentityConfig' = proto.Field( + proto.MESSAGE, + number=47, + message='WorkloadIdentityConfig', + ) + desired_workload_certificates: 'WorkloadCertificates' = proto.Field( + proto.MESSAGE, + number=61, + message='WorkloadCertificates', + ) + desired_mesh_certificates: 'MeshCertificates' = proto.Field( + proto.MESSAGE, + number=67, + message='MeshCertificates', + ) + desired_workload_alts_config: 'WorkloadALTSConfig' = proto.Field( + proto.MESSAGE, + number=62, + message='WorkloadALTSConfig', + ) + desired_shielded_nodes: 'ShieldedNodes' = proto.Field( + proto.MESSAGE, + number=48, + message='ShieldedNodes', + ) + desired_cost_management_config: 'CostManagementConfig' = proto.Field( + proto.MESSAGE, + number=49, + message='CostManagementConfig', + ) + desired_master: 'Master' = proto.Field( + proto.MESSAGE, + number=52, + message='Master', + ) + desired_dns_config: 'DNSConfig' = proto.Field( + proto.MESSAGE, + number=53, + message='DNSConfig', + ) + desired_service_external_ips_config: 'ServiceExternalIPsConfig' = proto.Field( + proto.MESSAGE, + number=60, + message='ServiceExternalIPsConfig', + ) + desired_authenticator_groups_config: 'AuthenticatorGroupsConfig' = proto.Field( + proto.MESSAGE, + number=63, + message='AuthenticatorGroupsConfig', + ) + desired_logging_config: 'LoggingConfig' = proto.Field( + proto.MESSAGE, + number=64, + message='LoggingConfig', + ) + desired_monitoring_config: 'MonitoringConfig' = proto.Field( + proto.MESSAGE, + number=65, + message='MonitoringConfig', + ) + desired_identity_service_config: 'IdentityServiceConfig' = proto.Field( + proto.MESSAGE, + number=66, + message='IdentityServiceConfig', + ) + desired_enable_private_endpoint: bool = proto.Field( + proto.BOOL, + number=71, + optional=True, + ) + desired_node_pool_auto_config_network_tags: 'NetworkTags' = proto.Field( + proto.MESSAGE, + number=110, + message='NetworkTags', + ) + desired_protect_config: 'ProtectConfig' = proto.Field( + proto.MESSAGE, + number=112, + optional=True, + message='ProtectConfig', + ) + desired_gateway_api_config: 'GatewayAPIConfig' = proto.Field( + proto.MESSAGE, + number=114, + message='GatewayAPIConfig', + ) + etag: str = proto.Field( + proto.STRING, + number=115, + ) + desired_node_pool_logging_config: 'NodePoolLoggingConfig' = proto.Field( + proto.MESSAGE, + number=116, + message='NodePoolLoggingConfig', + ) + desired_fleet: 'Fleet' = proto.Field( + proto.MESSAGE, + number=117, + message='Fleet', + ) + desired_stack_type: 'StackType' = proto.Field( + proto.ENUM, + number=119, + enum='StackType', + ) + additional_pod_ranges_config: 'AdditionalPodRangesConfig' = proto.Field( + proto.MESSAGE, + number=120, + message='AdditionalPodRangesConfig', + ) + removed_additional_pod_ranges_config: 'AdditionalPodRangesConfig' = proto.Field( + proto.MESSAGE, + number=121, + message='AdditionalPodRangesConfig', + ) + enable_k8s_beta_apis: 'K8sBetaAPIConfig' = proto.Field( + proto.MESSAGE, + number=122, + message='K8sBetaAPIConfig', + ) + desired_security_posture_config: 'SecurityPostureConfig' = proto.Field( + proto.MESSAGE, + number=124, + message='SecurityPostureConfig', + ) + desired_network_performance_config: 'NetworkConfig.ClusterNetworkPerformanceConfig' = proto.Field( + proto.MESSAGE, + number=125, + message='NetworkConfig.ClusterNetworkPerformanceConfig', + ) + desired_enable_fqdn_network_policy: bool = proto.Field( + proto.BOOL, + number=126, + optional=True, + ) + desired_autopilot_workload_policy_config: 'WorkloadPolicyConfig' = proto.Field( + proto.MESSAGE, + number=128, + message='WorkloadPolicyConfig', + ) + desired_k8s_beta_apis: 'K8sBetaAPIConfig' = proto.Field( + proto.MESSAGE, + number=131, + message='K8sBetaAPIConfig', + ) + desired_host_maintenance_policy: 'HostMaintenancePolicy' = proto.Field( + proto.MESSAGE, + number=132, + message='HostMaintenancePolicy', + ) + desired_containerd_config: 'ContainerdConfig' = proto.Field( + proto.MESSAGE, + number=134, + message='ContainerdConfig', + ) + desired_enable_multi_networking: bool = proto.Field( + proto.BOOL, + number=135, + optional=True, + ) + desired_node_pool_auto_config_resource_manager_tags: 'ResourceManagerTags' = proto.Field( + proto.MESSAGE, + number=136, + message='ResourceManagerTags', + ) + desired_in_transit_encryption_config: 'InTransitEncryptionConfig' = proto.Field( + proto.ENUM, + number=137, + optional=True, + enum='InTransitEncryptionConfig', + ) + desired_enable_cilium_clusterwide_network_policy: bool = proto.Field( + proto.BOOL, + number=138, + optional=True, + ) + desired_secret_manager_config: 'SecretManagerConfig' = proto.Field( + proto.MESSAGE, + number=139, + optional=True, + message='SecretManagerConfig', + ) + desired_node_kubelet_config: 'NodeKubeletConfig' = proto.Field( + proto.MESSAGE, + number=141, + message='NodeKubeletConfig', + ) + desired_node_pool_auto_config_kubelet_config: 'NodeKubeletConfig' = proto.Field( + proto.MESSAGE, + number=142, + message='NodeKubeletConfig', + ) + + +class AdditionalPodRangesConfig(proto.Message): + r"""AdditionalPodRangesConfig is the configuration for additional + pod secondary ranges supporting the ClusterUpdate message. + + Attributes: + pod_range_names (MutableSequence[str]): + Name for pod secondary ipv4 range which has + the actual range defined ahead. + pod_range_info (MutableSequence[google.cloud.container_v1beta1.types.RangeInfo]): + Output only. Information for additional pod + range. + """ + + pod_range_names: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + pod_range_info: MutableSequence['RangeInfo'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='RangeInfo', + ) + + +class RangeInfo(proto.Message): + r"""RangeInfo contains the range name and the range utilization + by this cluster. + + Attributes: + range_name (str): + Output only. Name of a range. + utilization (float): + Output only. The utilization of the range. + """ + + range_name: str = proto.Field( + proto.STRING, + number=1, + ) + utilization: float = proto.Field( + proto.DOUBLE, + number=2, + ) + + +class Operation(proto.Message): + r"""This operation resource represents operations that may have + happened or are happening on the cluster. All fields are output + only. + + Attributes: + name (str): + Output only. The server-assigned ID for the + operation. + zone (str): + Output only. The name of the Google Compute Engine + `zone `__ + in which the operation is taking place. This field is + deprecated, use location instead. + operation_type (google.cloud.container_v1beta1.types.Operation.Type): + Output only. The operation type. + status (google.cloud.container_v1beta1.types.Operation.Status): + Output only. The current status of the + operation. + detail (str): + Output only. Detailed operation progress, if + available. + status_message (str): + Output only. If an error has occurred, a + textual description of the error. Deprecated. + Use field error instead. + self_link (str): + Output only. Server-defined URI for the operation. Example: + ``https://container.googleapis.com/v1alpha1/projects/123/locations/us-central1/operations/operation-123``. + target_link (str): + Output only. Server-defined URI for the target of the + operation. The format of this is a URI to the resource being + modified (such as a cluster, node pool, or node). For node + pool repairs, there may be multiple nodes being repaired, + but only one will be the target. + + Examples: + + - + + ``https://container.googleapis.com/v1/projects/123/locations/us-central1/clusters/my-cluster`` + + ``https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np`` + + ``https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np/node/my-node`` + location (str): + Output only. The name of the Google Compute Engine + `zone `__ + or + `region `__ + in which the cluster resides. + start_time (str): + Output only. The time the operation started, in + `RFC3339 `__ text + format. + end_time (str): + Output only. The time the operation completed, in + `RFC3339 `__ text + format. + progress (google.cloud.container_v1beta1.types.OperationProgress): + Output only. Progress information for an + operation. + cluster_conditions (MutableSequence[google.cloud.container_v1beta1.types.StatusCondition]): + Which conditions caused the current cluster + state. Deprecated. Use field error instead. + nodepool_conditions (MutableSequence[google.cloud.container_v1beta1.types.StatusCondition]): + Which conditions caused the current node pool + state. Deprecated. Use field error instead. + error (google.rpc.status_pb2.Status): + The error result of the operation in case of + failure. + """ + class Status(proto.Enum): + r"""Current status of the operation. + + Values: + STATUS_UNSPECIFIED (0): + Not set. + PENDING (1): + The operation has been created. + RUNNING (2): + The operation is currently running. + DONE (3): + The operation is done, either cancelled or + completed. + ABORTING (4): + The operation is aborting. + """ + STATUS_UNSPECIFIED = 0 + PENDING = 1 + RUNNING = 2 + DONE = 3 + ABORTING = 4 + + class Type(proto.Enum): + r"""Operation type categorizes the operation. + + Values: + TYPE_UNSPECIFIED (0): + Not set. + CREATE_CLUSTER (1): + The cluster is being created. The cluster should be assumed + to be unusable until the operation finishes. + + In the event of the operation failing, the cluster will + enter the [ERROR state][Cluster.Status.ERROR] and eventually + be deleted. + DELETE_CLUSTER (2): + The cluster is being deleted. The cluster should be assumed + to be unusable as soon as this operation starts. + + In the event of the operation failing, the cluster will + enter the [ERROR state][Cluster.Status.ERROR] and the + deletion will be automatically retried until completed. + UPGRADE_MASTER (3): + The [cluster + version][google.container.v1beta1.ClusterUpdate.desired_master_version] + is being updated. Note that this includes "upgrades" to the + same version, which are simply a recreation. This also + includes + `auto-upgrades `__. + For more details, see `documentation on cluster + upgrades `__. + UPGRADE_NODES (4): + A node pool is being updated. Despite calling this an + "upgrade", this includes most forms of updates to node + pools. This also includes + `auto-upgrades `__. + + This operation sets the + [progress][google.container.v1beta1.Operation.progress] + field and may be + [canceled][google.container.v1beta1.ClusterManager.CancelOperation]. + + The upgrade strategy depends on `node pool + configuration `__. + The nodes are generally still usable during this operation. + REPAIR_CLUSTER (5): + A problem has been detected with the control plane and is + being repaired. This operation type is initiated by GKE. For + more details, see `documentation on + repairs `__. + UPDATE_CLUSTER (6): + The cluster is being updated. This is a broad category of + operations and includes operations that only change metadata + as well as those that must recreate the entire cluster. If + the control plane must be recreated, this will cause + temporary downtime for zonal clusters. + + Some features require recreating the nodes as well. Those + will be recreated as separate operations and the update may + not be completely functional until the node pools + recreations finish. Node recreations will generally follow + `maintenance + policies `__. + + Some GKE-initiated operations use this type. This includes + certain types of auto-upgrades and incident mitigations. + CREATE_NODE_POOL (7): + A node pool is being created. The node pool should be + assumed to be unusable until this operation finishes. In the + event of an error, the node pool may be partially created. + + If enabled, `node + autoprovisioning `__ + may have automatically initiated such operations. + DELETE_NODE_POOL (8): + The node pool is being deleted. The node pool + should be assumed to be unusable as soon as this + operation starts. + SET_NODE_POOL_MANAGEMENT (9): + The node pool's + [manamagent][google.container.v1beta1.NodePool.management] + field is being updated. These operations only update + metadata and may be concurrent with most other operations. + AUTO_REPAIR_NODES (10): + A problem has been detected with nodes and `they are being + repaired `__. + This operation type is initiated by GKE, typically + automatically. This operation may be concurrent with other + operations and there may be multiple repairs occurring on + the same node pool. + AUTO_UPGRADE_NODES (11): + Unused. Automatic node upgrade uses + [UPGRADE_NODES][google.container.v1beta1.Operation.Type.UPGRADE_NODES]. + SET_LABELS (12): + Unused. Updating labels uses + [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. + SET_MASTER_AUTH (13): + Unused. Updating master auth uses + [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. + SET_NODE_POOL_SIZE (14): + The node pool is being resized. With the + exception of resizing to or from size zero, the + node pool is generally usable during this + operation. + SET_NETWORK_POLICY (15): + Unused. Updating network policy uses + [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. + SET_MAINTENANCE_POLICY (16): + Unused. Updating maintenance policy uses + [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. + RESIZE_CLUSTER (18): + The control plane is being resized. This operation type is + initiated by GKE. These operations are often performed + preemptively to ensure that the control plane has sufficient + resources and is not typically an indication of issues. For + more details, see `documentation on + resizes `__. + FLEET_FEATURE_UPGRADE (19): + Fleet features of GKE Enterprise are being + upgraded. The cluster should be assumed to be + blocked for other upgrades until the operation + finishes. + """ + TYPE_UNSPECIFIED = 0 + CREATE_CLUSTER = 1 + DELETE_CLUSTER = 2 + UPGRADE_MASTER = 3 + UPGRADE_NODES = 4 + REPAIR_CLUSTER = 5 + UPDATE_CLUSTER = 6 + CREATE_NODE_POOL = 7 + DELETE_NODE_POOL = 8 + SET_NODE_POOL_MANAGEMENT = 9 + AUTO_REPAIR_NODES = 10 + AUTO_UPGRADE_NODES = 11 + SET_LABELS = 12 + SET_MASTER_AUTH = 13 + SET_NODE_POOL_SIZE = 14 + SET_NETWORK_POLICY = 15 + SET_MAINTENANCE_POLICY = 16 + RESIZE_CLUSTER = 18 + FLEET_FEATURE_UPGRADE = 19 + + name: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + operation_type: Type = proto.Field( + proto.ENUM, + number=3, + enum=Type, + ) + status: Status = proto.Field( + proto.ENUM, + number=4, + enum=Status, + ) + detail: str = proto.Field( + proto.STRING, + number=8, + ) + status_message: str = proto.Field( + proto.STRING, + number=5, + ) + self_link: str = proto.Field( + proto.STRING, + number=6, + ) + target_link: str = proto.Field( + proto.STRING, + number=7, + ) + location: str = proto.Field( + proto.STRING, + number=9, + ) + start_time: str = proto.Field( + proto.STRING, + number=10, + ) + end_time: str = proto.Field( + proto.STRING, + number=11, + ) + progress: 'OperationProgress' = proto.Field( + proto.MESSAGE, + number=12, + message='OperationProgress', + ) + cluster_conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( + proto.MESSAGE, + number=13, + message='StatusCondition', + ) + nodepool_conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( + proto.MESSAGE, + number=14, + message='StatusCondition', + ) + error: status_pb2.Status = proto.Field( + proto.MESSAGE, + number=15, + message=status_pb2.Status, + ) + + +class OperationProgress(proto.Message): + r"""Information about operation (or operation stage) progress. + + Attributes: + name (str): + A non-parameterized string describing an + operation stage. Unset for single-stage + operations. + status (google.cloud.container_v1beta1.types.Operation.Status): + Status of an operation stage. + Unset for single-stage operations. + metrics (MutableSequence[google.cloud.container_v1beta1.types.OperationProgress.Metric]): + Progress metric bundle, for example: metrics: [{name: "nodes + done", int_value: 15}, {name: "nodes total", int_value: 32}] + or metrics: [{name: "progress", double_value: 0.56}, {name: + "progress scale", double_value: 1.0}] + stages (MutableSequence[google.cloud.container_v1beta1.types.OperationProgress]): + Substages of an operation or a stage. + """ + + class Metric(proto.Message): + r"""Progress metric is (string, int|float|string) pair. + + 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): + Required. Metric name, e.g., "nodes total", + "percent done". + int_value (int): + For metrics with integer value. + + This field is a member of `oneof`_ ``value``. + double_value (float): + For metrics with floating point value. + + This field is a member of `oneof`_ ``value``. + string_value (str): + For metrics with custom values (ratios, + visual progress, etc.). + + This field is a member of `oneof`_ ``value``. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + int_value: int = proto.Field( + proto.INT64, + number=2, + oneof='value', + ) + double_value: float = proto.Field( + proto.DOUBLE, + number=3, + oneof='value', + ) + string_value: str = proto.Field( + proto.STRING, + number=4, + oneof='value', + ) + + name: str = proto.Field( + proto.STRING, + number=1, + ) + status: 'Operation.Status' = proto.Field( + proto.ENUM, + number=2, + enum='Operation.Status', + ) + metrics: MutableSequence[Metric] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=Metric, + ) + stages: MutableSequence['OperationProgress'] = proto.RepeatedField( + proto.MESSAGE, + number=4, + message='OperationProgress', + ) + + +class CreateClusterRequest(proto.Message): + r"""CreateClusterRequest creates a cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the parent + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the parent field. + cluster (google.cloud.container_v1beta1.types.Cluster): + Required. A `cluster + resource `__ + parent (str): + The parent (project and location) where the cluster will be + created. Specified in the format ``projects/*/locations/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster: 'Cluster' = proto.Field( + proto.MESSAGE, + number=3, + message='Cluster', + ) + parent: str = proto.Field( + proto.STRING, + number=5, + ) + + +class GetClusterRequest(proto.Message): + r"""GetClusterRequest gets the settings of a cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to retrieve. This field has been deprecated and + replaced by the name field. + name (str): + The name (project, location, cluster) of the cluster to + retrieve. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + name: str = proto.Field( + proto.STRING, + number=5, + ) + + +class UpdateClusterRequest(proto.Message): + r"""UpdateClusterRequest updates the settings of a cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to upgrade. This field has been deprecated and + replaced by the name field. + update (google.cloud.container_v1beta1.types.ClusterUpdate): + Required. A description of the update. + name (str): + The name (project, location, cluster) of the cluster to + update. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + update: 'ClusterUpdate' = proto.Field( + proto.MESSAGE, + number=4, + message='ClusterUpdate', + ) + name: str = proto.Field( + proto.STRING, + number=5, + ) + + +class UpdateNodePoolRequest(proto.Message): + r"""SetNodePoolVersionRequest updates the version of a node pool. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to upgrade. This field has been deprecated and + replaced by the name field. + node_pool_id (str): + Required. Deprecated. The name of the node + pool to upgrade. This field has been deprecated + and replaced by the name field. + node_version (str): + Required. The Kubernetes version to change + the nodes to (typically an upgrade). + + Users may specify either explicit versions + offered by Kubernetes Engine or version aliases, + which have the following behavior: + + - "latest": picks the highest valid Kubernetes + version + - "1.X": picks the highest valid patch+gke.N + patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N patch + in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit Kubernetes + version + - "-": picks the Kubernetes master version + image_type (str): + Required. The desired image type for the node + pool. Please see + https://cloud.google.com/kubernetes-engine/docs/concepts/node-images + for available image types. + locations (MutableSequence[str]): + The desired list of Google Compute Engine + `zones `__ + in which the node pool's nodes should be located. Changing + the locations for a node pool will result in nodes being + either created or removed from the node pool, depending on + whether locations are being added or removed. + workload_metadata_config (google.cloud.container_v1beta1.types.WorkloadMetadataConfig): + The desired workload metadata config for the + node pool. + name (str): + The name (project, location, cluster, node pool) of the node + pool to update. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + upgrade_settings (google.cloud.container_v1beta1.types.NodePool.UpgradeSettings): + Upgrade settings control disruption and speed + of the upgrade. + tags (google.cloud.container_v1beta1.types.NetworkTags): + The desired network tags to be applied to all nodes in the + node pool. If this field is not present, the tags will not + be changed. Otherwise, the existing network tags will be + *replaced* with the provided tags. + taints (google.cloud.container_v1beta1.types.NodeTaints): + The desired node taints to be applied to all nodes in the + node pool. If this field is not present, the taints will not + be changed. Otherwise, the existing node taints will be + *replaced* with the provided taints. + labels (google.cloud.container_v1beta1.types.NodeLabels): + The desired node labels to be applied to all nodes in the + node pool. If this field is not present, the labels will not + be changed. Otherwise, the existing node labels will be + *replaced* with the provided labels. + linux_node_config (google.cloud.container_v1beta1.types.LinuxNodeConfig): + Parameters that can be configured on Linux + nodes. + kubelet_config (google.cloud.container_v1beta1.types.NodeKubeletConfig): + Node kubelet configs. + node_network_config (google.cloud.container_v1beta1.types.NodeNetworkConfig): + Node network config. + gcfs_config (google.cloud.container_v1beta1.types.GcfsConfig): + GCFS config. + confidential_nodes (google.cloud.container_v1beta1.types.ConfidentialNodes): + Confidential nodes config. + All the nodes in the node pool will be + Confidential VM once enabled. + gvnic (google.cloud.container_v1beta1.types.VirtualNIC): + Enable or disable gvnic on the node pool. + etag (str): + The current etag of the node pool. + If an etag is provided and does not match the + current etag of the node pool, update will be + blocked and an ABORTED error will be returned. + fast_socket (google.cloud.container_v1beta1.types.FastSocket): + Enable or disable NCCL fast socket for the + node pool. + logging_config (google.cloud.container_v1beta1.types.NodePoolLoggingConfig): + Logging configuration. + resource_labels (google.cloud.container_v1beta1.types.ResourceLabels): + The resource labels for the node pool to use + to annotate any related Google Compute Engine + resources. + windows_node_config (google.cloud.container_v1beta1.types.WindowsNodeConfig): + Parameters that can be configured on Windows + nodes. + accelerators (MutableSequence[google.cloud.container_v1beta1.types.AcceleratorConfig]): + A list of hardware accelerators to be + attached to each node. See + https://cloud.google.com/compute/docs/gpus for + more information about support for GPUs. + machine_type (str): + Optional. The desired machine type for nodes + in the node pool. Initiates an upgrade operation + that migrates the nodes in the node pool to the + specified machine type. + disk_type (str): + Optional. The desired disk type for nodes in + the node pool. Initiates an upgrade operation + that migrates the nodes in the node pool to the + specified disk type. + disk_size_gb (int): + Optional. The desired disk size for nodes in + the node pool. Initiates an upgrade operation + that migrates the nodes in the node pool to the + specified disk size. + resource_manager_tags (google.cloud.container_v1beta1.types.ResourceManagerTags): + Desired resource manager tag keys and values + to be attached to the nodes for managing Compute + Engine firewalls using Network Firewall + Policies. Existing tags will be replaced with + new values. + containerd_config (google.cloud.container_v1beta1.types.ContainerdConfig): + The desired containerd config for nodes in + the node pool. Initiates an upgrade operation + that recreates the nodes with the new config. + queued_provisioning (google.cloud.container_v1beta1.types.NodePool.QueuedProvisioning): + Specifies the configuration of queued + provisioning. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + node_version: str = proto.Field( + proto.STRING, + number=5, + ) + image_type: str = proto.Field( + proto.STRING, + number=6, + ) + locations: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=13, + ) + workload_metadata_config: 'WorkloadMetadataConfig' = proto.Field( + proto.MESSAGE, + number=14, + message='WorkloadMetadataConfig', + ) + name: str = proto.Field( + proto.STRING, + number=8, + ) + upgrade_settings: 'NodePool.UpgradeSettings' = proto.Field( + proto.MESSAGE, + number=15, + message='NodePool.UpgradeSettings', + ) + tags: 'NetworkTags' = proto.Field( + proto.MESSAGE, + number=16, + message='NetworkTags', + ) + taints: 'NodeTaints' = proto.Field( + proto.MESSAGE, + number=17, + message='NodeTaints', + ) + labels: 'NodeLabels' = proto.Field( + proto.MESSAGE, + number=18, + message='NodeLabels', + ) + linux_node_config: 'LinuxNodeConfig' = proto.Field( + proto.MESSAGE, + number=19, + message='LinuxNodeConfig', + ) + kubelet_config: 'NodeKubeletConfig' = proto.Field( + proto.MESSAGE, + number=20, + message='NodeKubeletConfig', + ) + node_network_config: 'NodeNetworkConfig' = proto.Field( + proto.MESSAGE, + number=21, + message='NodeNetworkConfig', + ) + gcfs_config: 'GcfsConfig' = proto.Field( + proto.MESSAGE, + number=22, + message='GcfsConfig', + ) + confidential_nodes: 'ConfidentialNodes' = proto.Field( + proto.MESSAGE, + number=23, + message='ConfidentialNodes', + ) + gvnic: 'VirtualNIC' = proto.Field( + proto.MESSAGE, + number=29, + message='VirtualNIC', + ) + etag: str = proto.Field( + proto.STRING, + number=30, + ) + fast_socket: 'FastSocket' = proto.Field( + proto.MESSAGE, + number=31, + message='FastSocket', + ) + logging_config: 'NodePoolLoggingConfig' = proto.Field( + proto.MESSAGE, + number=32, + message='NodePoolLoggingConfig', + ) + resource_labels: 'ResourceLabels' = proto.Field( + proto.MESSAGE, + number=33, + message='ResourceLabels', + ) + windows_node_config: 'WindowsNodeConfig' = proto.Field( + proto.MESSAGE, + number=34, + message='WindowsNodeConfig', + ) + accelerators: MutableSequence['AcceleratorConfig'] = proto.RepeatedField( + proto.MESSAGE, + number=35, + message='AcceleratorConfig', + ) + machine_type: str = proto.Field( + proto.STRING, + number=36, + ) + disk_type: str = proto.Field( + proto.STRING, + number=37, + ) + disk_size_gb: int = proto.Field( + proto.INT64, + number=38, + ) + resource_manager_tags: 'ResourceManagerTags' = proto.Field( + proto.MESSAGE, + number=39, + message='ResourceManagerTags', + ) + containerd_config: 'ContainerdConfig' = proto.Field( + proto.MESSAGE, + number=40, + message='ContainerdConfig', + ) + queued_provisioning: 'NodePool.QueuedProvisioning' = proto.Field( + proto.MESSAGE, + number=42, + message='NodePool.QueuedProvisioning', + ) + + +class SetNodePoolAutoscalingRequest(proto.Message): + r"""SetNodePoolAutoscalingRequest sets the autoscaler settings of + a node pool. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to upgrade. This field has been deprecated and + replaced by the name field. + node_pool_id (str): + Required. Deprecated. The name of the node + pool to upgrade. This field has been deprecated + and replaced by the name field. + autoscaling (google.cloud.container_v1beta1.types.NodePoolAutoscaling): + Required. Autoscaling configuration for the + node pool. + name (str): + The name (project, location, cluster, node pool) of the node + pool to set autoscaler settings. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + autoscaling: 'NodePoolAutoscaling' = proto.Field( + proto.MESSAGE, + number=5, + message='NodePoolAutoscaling', + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class SetLoggingServiceRequest(proto.Message): + r"""SetLoggingServiceRequest sets the logging service of a + cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to upgrade. This field has been deprecated and + replaced by the name field. + logging_service (str): + Required. The logging service the cluster should use to + write logs. Currently available options: + + - ``logging.googleapis.com/kubernetes`` - The Cloud Logging + service with a Kubernetes-native resource model + - ``logging.googleapis.com`` - The legacy Cloud Logging + service (no longer available as of GKE 1.15). + - ``none`` - no logs will be exported from the cluster. + + If left as an empty + string,\ ``logging.googleapis.com/kubernetes`` will be used + for GKE 1.14+ or ``logging.googleapis.com`` for earlier + versions. + name (str): + The name (project, location, cluster) of the cluster to set + logging. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + logging_service: str = proto.Field( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=5, + ) + + +class SetMonitoringServiceRequest(proto.Message): + r"""SetMonitoringServiceRequest sets the monitoring service of a + cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to upgrade. This field has been deprecated and + replaced by the name field. + monitoring_service (str): + Required. The monitoring service the cluster should use to + write metrics. Currently available options: + + - "monitoring.googleapis.com/kubernetes" - The Cloud + Monitoring service with a Kubernetes-native resource + model + - ``monitoring.googleapis.com`` - The legacy Cloud + Monitoring service (no longer available as of GKE 1.15). + - ``none`` - No metrics will be exported from the cluster. + + If left as an empty + string,\ ``monitoring.googleapis.com/kubernetes`` will be + used for GKE 1.14+ or ``monitoring.googleapis.com`` for + earlier versions. + name (str): + The name (project, location, cluster) of the cluster to set + monitoring. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + monitoring_service: str = proto.Field( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class SetAddonsConfigRequest(proto.Message): + r"""SetAddonsRequest sets the addons associated with the cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to upgrade. This field has been deprecated and + replaced by the name field. + addons_config (google.cloud.container_v1beta1.types.AddonsConfig): + Required. The desired configurations for the + various addons available to run in the cluster. + name (str): + The name (project, location, cluster) of the cluster to set + addons. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + addons_config: 'AddonsConfig' = proto.Field( + proto.MESSAGE, + number=4, + message='AddonsConfig', + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class SetLocationsRequest(proto.Message): + r"""SetLocationsRequest sets the locations of the cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to upgrade. This field has been deprecated and + replaced by the name field. + locations (MutableSequence[str]): + Required. The desired list of Google Compute Engine + `zones `__ + in which the cluster's nodes should be located. Changing the + locations a cluster is in will result in nodes being either + created or removed from the cluster, depending on whether + locations are being added or removed. + + This list must always include the cluster's primary zone. + name (str): + The name (project, location, cluster) of the cluster to set + locations. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + locations: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class UpdateMasterRequest(proto.Message): + r"""UpdateMasterRequest updates the master of the cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to upgrade. This field has been deprecated and + replaced by the name field. + master_version (str): + Required. The Kubernetes version to change + the master to. + Users may specify either explicit versions + offered by Kubernetes Engine or version aliases, + which have the following behavior: + + - "latest": picks the highest valid Kubernetes + version + - "1.X": picks the highest valid patch+gke.N + patch in the 1.X version + - "1.X.Y": picks the highest valid gke.N patch + in the 1.X.Y version + - "1.X.Y-gke.N": picks an explicit Kubernetes + version + - "-": picks the default Kubernetes version + name (str): + The name (project, location, cluster) of the cluster to + update. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + master_version: str = proto.Field( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=7, + ) + + +class SetMasterAuthRequest(proto.Message): + r"""SetMasterAuthRequest updates the admin password of a cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to upgrade. This field has been deprecated and + replaced by the name field. + action (google.cloud.container_v1beta1.types.SetMasterAuthRequest.Action): + Required. The exact form of action to be + taken on the master auth. + update (google.cloud.container_v1beta1.types.MasterAuth): + Required. A description of the update. + name (str): + The name (project, location, cluster) of the cluster to set + auth. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + class Action(proto.Enum): + r"""Operation type: what type update to perform. + + Values: + UNKNOWN (0): + Operation is unknown and will error out. + SET_PASSWORD (1): + Set the password to a user generated value. + GENERATE_PASSWORD (2): + Generate a new password and set it to that. + SET_USERNAME (3): + Set the username. If an empty username is + provided, basic authentication is disabled for + the cluster. If a non-empty username is + provided, basic authentication is enabled, with + either a provided password or a generated one. + """ + UNKNOWN = 0 + SET_PASSWORD = 1 + GENERATE_PASSWORD = 2 + SET_USERNAME = 3 + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + action: Action = proto.Field( + proto.ENUM, + number=4, + enum=Action, + ) + update: 'MasterAuth' = proto.Field( + proto.MESSAGE, + number=5, + message='MasterAuth', + ) + name: str = proto.Field( + proto.STRING, + number=7, + ) + + +class DeleteClusterRequest(proto.Message): + r"""DeleteClusterRequest deletes a cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to delete. This field has been deprecated and + replaced by the name field. + name (str): + The name (project, location, cluster) of the cluster to + delete. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + name: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListClustersRequest(proto.Message): + r"""ListClustersRequest lists clusters. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the parent + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides, or "-" for all zones. This + field has been deprecated and replaced by the parent field. + parent (str): + The parent (project and location) where the clusters will be + listed. Specified in the format ``projects/*/locations/*``. + Location "-" matches all zones and all regions. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + parent: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListClustersResponse(proto.Message): + r"""ListClustersResponse is the result of ListClustersRequest. + + Attributes: + clusters (MutableSequence[google.cloud.container_v1beta1.types.Cluster]): + A list of clusters in the project in the + specified zone, or across all ones. + missing_zones (MutableSequence[str]): + If any zones are listed here, the list of + clusters returned may be missing those zones. + """ + + clusters: MutableSequence['Cluster'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Cluster', + ) + missing_zones: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=2, + ) + + +class GetOperationRequest(proto.Message): + r"""GetOperationRequest gets a single operation. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + operation_id (str): + Required. Deprecated. The server-assigned ``name`` of the + operation. This field has been deprecated and replaced by + the name field. + name (str): + The name (project, location, operation id) of the operation + to get. Specified in the format + ``projects/*/locations/*/operations/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + operation_id: str = proto.Field( + proto.STRING, + number=3, + ) + name: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListOperationsRequest(proto.Message): + r"""ListOperationsRequest lists operations. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the parent + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + to return operations for, or ``-`` for all zones. This field + has been deprecated and replaced by the parent field. + parent (str): + The parent (project and location) where the operations will + be listed. Specified in the format + ``projects/*/locations/*``. Location "-" matches all zones + and all regions. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + parent: str = proto.Field( + proto.STRING, + number=4, + ) + + +class CancelOperationRequest(proto.Message): + r"""CancelOperationRequest cancels a single operation. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the operation resides. This field has been + deprecated and replaced by the name field. + operation_id (str): + Required. Deprecated. The server-assigned ``name`` of the + operation. This field has been deprecated and replaced by + the name field. + name (str): + The name (project, location, operation id) of the operation + to cancel. Specified in the format + ``projects/*/locations/*/operations/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + operation_id: str = proto.Field( + proto.STRING, + number=3, + ) + name: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListOperationsResponse(proto.Message): + r"""ListOperationsResponse is the result of + ListOperationsRequest. + + Attributes: + operations (MutableSequence[google.cloud.container_v1beta1.types.Operation]): + A list of operations in the project in the + specified zone. + missing_zones (MutableSequence[str]): + If any zones are listed here, the list of + operations returned may be missing the + operations from those zones. + """ + + operations: MutableSequence['Operation'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Operation', + ) + missing_zones: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=2, + ) + + +class GetServerConfigRequest(proto.Message): + r"""Gets the current Kubernetes Engine service configuration. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + to return operations for. This field has been deprecated and + replaced by the name field. + name (str): + The name (project and location) of the server config to get, + specified in the format ``projects/*/locations/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + name: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ServerConfig(proto.Message): + r"""Kubernetes Engine service configuration. + + Attributes: + default_cluster_version (str): + Version of Kubernetes the service deploys by + default. + valid_node_versions (MutableSequence[str]): + List of valid node upgrade target versions, + in descending order. + default_image_type (str): + Default image type. + valid_image_types (MutableSequence[str]): + List of valid image types. + valid_master_versions (MutableSequence[str]): + List of valid master versions, in descending + order. + channels (MutableSequence[google.cloud.container_v1beta1.types.ServerConfig.ReleaseChannelConfig]): + List of release channel configurations. + windows_version_maps (MutableMapping[str, google.cloud.container_v1beta1.types.WindowsVersions]): + Maps of Kubernetes version and supported + Windows server versions. + """ + + class ReleaseChannelConfig(proto.Message): + r"""ReleaseChannelConfig exposes configuration for a release + channel. + + Attributes: + channel (google.cloud.container_v1beta1.types.ReleaseChannel.Channel): + The release channel this configuration + applies to. + default_version (str): + The default version for newly created + clusters on the channel. + available_versions (MutableSequence[google.cloud.container_v1beta1.types.ServerConfig.ReleaseChannelConfig.AvailableVersion]): + Deprecated. This field has been deprecated and replaced with + the valid_versions field. + valid_versions (MutableSequence[str]): + List of valid versions for the channel. + """ + + class AvailableVersion(proto.Message): + r"""Deprecated. + + Attributes: + version (str): + Kubernetes version. + reason (str): + Reason for availability. + """ + + version: str = proto.Field( + proto.STRING, + number=1, + ) + reason: str = proto.Field( + proto.STRING, + number=2, + ) + + channel: 'ReleaseChannel.Channel' = proto.Field( + proto.ENUM, + number=1, + enum='ReleaseChannel.Channel', + ) + default_version: str = proto.Field( + proto.STRING, + number=2, + ) + available_versions: MutableSequence['ServerConfig.ReleaseChannelConfig.AvailableVersion'] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message='ServerConfig.ReleaseChannelConfig.AvailableVersion', + ) + valid_versions: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + + default_cluster_version: str = proto.Field( + proto.STRING, + number=1, + ) + valid_node_versions: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + default_image_type: str = proto.Field( + proto.STRING, + number=4, + ) + valid_image_types: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=5, + ) + valid_master_versions: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=6, + ) + channels: MutableSequence[ReleaseChannelConfig] = proto.RepeatedField( + proto.MESSAGE, + number=9, + message=ReleaseChannelConfig, + ) + windows_version_maps: MutableMapping[str, 'WindowsVersions'] = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=10, + message='WindowsVersions', + ) + + +class BestEffortProvisioning(proto.Message): + r"""Best effort provisioning. + + Attributes: + enabled (bool): + When this is enabled, cluster/node pool + creations will ignore non-fatal errors like + stockout to best provision as many nodes as + possible right now and eventually bring up all + target number of nodes + min_provision_nodes (int): + Minimum number of nodes to be provisioned to + be considered as succeeded, and the rest of + nodes will be provisioned gradually and + eventually when stockout issue has been + resolved. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + min_provision_nodes: int = proto.Field( + proto.INT32, + number=2, + ) + + +class WindowsVersions(proto.Message): + r"""Windows server versions. + + Attributes: + windows_versions (MutableSequence[google.cloud.container_v1beta1.types.WindowsVersions.WindowsVersion]): + List of Windows server versions. + """ + + class WindowsVersion(proto.Message): + r"""Windows server version. + + Attributes: + image_type (str): + Windows server image type + os_version (str): + Windows server build number + support_end_date (google.type.date_pb2.Date): + Mainstream support end date + """ + + image_type: str = proto.Field( + proto.STRING, + number=1, + ) + os_version: str = proto.Field( + proto.STRING, + number=2, + ) + support_end_date: date_pb2.Date = proto.Field( + proto.MESSAGE, + number=3, + message=date_pb2.Date, + ) + + windows_versions: MutableSequence[WindowsVersion] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=WindowsVersion, + ) + + +class CreateNodePoolRequest(proto.Message): + r"""CreateNodePoolRequest creates a node pool for a cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the parent + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the parent field. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated and + replaced by the parent field. + node_pool (google.cloud.container_v1beta1.types.NodePool): + Required. The node pool to create. + parent (str): + The parent (project, location, cluster name) where the node + pool will be created. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool: 'NodePool' = proto.Field( + proto.MESSAGE, + number=4, + message='NodePool', + ) + parent: str = proto.Field( + proto.STRING, + number=6, + ) + + +class DeleteNodePoolRequest(proto.Message): + r"""DeleteNodePoolRequest deletes a node pool for a cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated and + replaced by the name field. + node_pool_id (str): + Required. Deprecated. The name of the node + pool to delete. This field has been deprecated + and replaced by the name field. + name (str): + The name (project, location, cluster, node pool id) of the + node pool to delete. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class ListNodePoolsRequest(proto.Message): + r"""ListNodePoolsRequest lists the node pool(s) for a cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the parent + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the parent field. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated and + replaced by the parent field. + parent (str): + The parent (project, location, cluster name) where the node + pools will be listed. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + parent: str = proto.Field( + proto.STRING, + number=5, + ) + + +class GetNodePoolRequest(proto.Message): + r"""GetNodePoolRequest retrieves a node pool for a cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated and + replaced by the name field. + node_pool_id (str): + Required. Deprecated. The name of the node + pool. This field has been deprecated and + replaced by the name field. + name (str): + The name (project, location, cluster, node pool id) of the + node pool to get. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class BlueGreenSettings(proto.Message): + r"""Settings for blue-green upgrade. + + 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: + standard_rollout_policy (google.cloud.container_v1beta1.types.BlueGreenSettings.StandardRolloutPolicy): + Standard policy for the blue-green upgrade. + + This field is a member of `oneof`_ ``rollout_policy``. + autoscaled_rollout_policy (google.cloud.container_v1beta1.types.BlueGreenSettings.AutoscaledRolloutPolicy): + Autoscaled policy for cluster autoscaler + enabled blue-green upgrade. + + This field is a member of `oneof`_ ``rollout_policy``. + node_pool_soak_duration (google.protobuf.duration_pb2.Duration): + Time needed after draining entire blue pool. + After this period, blue pool will be cleaned up. + + This field is a member of `oneof`_ ``_node_pool_soak_duration``. + """ + + class StandardRolloutPolicy(proto.Message): + r"""Standard rollout policy is the default policy for blue-green. + + 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: + batch_percentage (float): + Percentage of the blue pool nodes to drain in a batch. The + range of this field should be (0.0, 1.0]. + + This field is a member of `oneof`_ ``update_batch_size``. + batch_node_count (int): + Number of blue nodes to drain in a batch. + + This field is a member of `oneof`_ ``update_batch_size``. + batch_soak_duration (google.protobuf.duration_pb2.Duration): + Soak time after each batch gets drained. + Default to zero. + + This field is a member of `oneof`_ ``_batch_soak_duration``. + """ + + batch_percentage: float = proto.Field( + proto.FLOAT, + number=1, + oneof='update_batch_size', + ) + batch_node_count: int = proto.Field( + proto.INT32, + number=2, + oneof='update_batch_size', + ) + batch_soak_duration: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=3, + optional=True, + message=duration_pb2.Duration, + ) + + class AutoscaledRolloutPolicy(proto.Message): + r"""Autoscaled rollout policy uses cluster autoscaler during + blue-green upgrades to scale both the green and blue pools. + + """ + + standard_rollout_policy: StandardRolloutPolicy = proto.Field( + proto.MESSAGE, + number=1, + oneof='rollout_policy', + message=StandardRolloutPolicy, + ) + autoscaled_rollout_policy: AutoscaledRolloutPolicy = proto.Field( + proto.MESSAGE, + number=3, + oneof='rollout_policy', + message=AutoscaledRolloutPolicy, + ) + node_pool_soak_duration: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=2, + optional=True, + message=duration_pb2.Duration, + ) + + +class NodePool(proto.Message): + r"""NodePool contains the name and configuration for a cluster's + node pool. Node pools are a set of nodes (i.e. VM's), with a + common configuration and specification, under the control of the + cluster master. They may have a set of Kubernetes labels applied + to them, which may be used to reference them during pod + scheduling. They may also be resized up or down, to accommodate + the workload. + + Attributes: + name (str): + The name of the node pool. + config (google.cloud.container_v1beta1.types.NodeConfig): + The node configuration of the pool. + initial_node_count (int): + The initial node count for the pool. You must ensure that + your Compute Engine `resource + quota `__ is + sufficient for this number of instances. You must also have + available firewall and routes quota. + locations (MutableSequence[str]): + The list of Google Compute Engine + `zones `__ + in which the NodePool's nodes should be located. + + If this value is unspecified during node pool creation, the + `Cluster.Locations `__ + value will be used, instead. + + Warning: changing node pool locations will result in nodes + being added and/or removed. + network_config (google.cloud.container_v1beta1.types.NodeNetworkConfig): + Networking configuration for this NodePool. + If specified, it overrides the cluster-level + defaults. + self_link (str): + Output only. Server-defined URL for the + resource. + version (str): + The version of Kubernetes running on this NodePool's nodes. + If unspecified, it defaults as described + `here `__. + instance_group_urls (MutableSequence[str]): + Output only. The resource URLs of the `managed instance + groups `__ + associated with this node pool. During the node pool + blue-green upgrade operation, the URLs contain both blue and + green resources. + status (google.cloud.container_v1beta1.types.NodePool.Status): + Output only. The status of the nodes in this + pool instance. + status_message (str): + Output only. Deprecated. Use conditions + instead. Additional information about the + current status of this node pool instance, if + available. + autoscaling (google.cloud.container_v1beta1.types.NodePoolAutoscaling): + Autoscaler configuration for this NodePool. + Autoscaler is enabled only if a valid + configuration is present. + management (google.cloud.container_v1beta1.types.NodeManagement): + NodeManagement configuration for this + NodePool. + max_pods_constraint (google.cloud.container_v1beta1.types.MaxPodsConstraint): + The constraint on the maximum number of pods + that can be run simultaneously on a node in the + node pool. + conditions (MutableSequence[google.cloud.container_v1beta1.types.StatusCondition]): + Which conditions caused the current node pool + state. + pod_ipv4_cidr_size (int): + Output only. The pod CIDR block size per node + in this node pool. + upgrade_settings (google.cloud.container_v1beta1.types.NodePool.UpgradeSettings): + Upgrade settings control disruption and speed + of the upgrade. + placement_policy (google.cloud.container_v1beta1.types.NodePool.PlacementPolicy): + Specifies the node placement policy. + update_info (google.cloud.container_v1beta1.types.NodePool.UpdateInfo): + Output only. Update info contains relevant + information during a node pool update. + etag (str): + This checksum is computed by the server based + on the value of node pool fields, and may be + sent on update requests to ensure the client has + an up-to-date value before proceeding. + queued_provisioning (google.cloud.container_v1beta1.types.NodePool.QueuedProvisioning): + Specifies the configuration of queued + provisioning. + best_effort_provisioning (google.cloud.container_v1beta1.types.BestEffortProvisioning): + Enable best effort provisioning for nodes + """ + class Status(proto.Enum): + r"""The current status of the node pool instance. + + Values: + STATUS_UNSPECIFIED (0): + Not set. + PROVISIONING (1): + The PROVISIONING state indicates the node + pool is being created. + RUNNING (2): + The RUNNING state indicates the node pool has + been created and is fully usable. + RUNNING_WITH_ERROR (3): + The RUNNING_WITH_ERROR state indicates the node pool has + been created and is partially usable. Some error state has + occurred and some functionality may be impaired. Customer + may need to reissue a request or trigger a new update. + RECONCILING (4): + The RECONCILING state indicates that some work is actively + being done on the node pool, such as upgrading node + software. Details can be found in the ``statusMessage`` + field. + STOPPING (5): + The STOPPING state indicates the node pool is + being deleted. + ERROR (6): + The ERROR state indicates the node pool may be unusable. + Details can be found in the ``statusMessage`` field. + """ + STATUS_UNSPECIFIED = 0 + PROVISIONING = 1 + RUNNING = 2 + RUNNING_WITH_ERROR = 3 + RECONCILING = 4 + STOPPING = 5 + ERROR = 6 + + class UpgradeSettings(proto.Message): + r"""These upgrade settings control the level of parallelism and the + level of disruption caused by an upgrade. + + maxUnavailable controls the number of nodes that can be + simultaneously unavailable. + + maxSurge controls the number of additional nodes that can be added + to the node pool temporarily for the time of the upgrade to increase + the number of available nodes. + + (maxUnavailable + maxSurge) determines the level of parallelism (how + many nodes are being upgraded at the same time). + + Note: upgrades inevitably introduce some disruption since workloads + need to be moved from old nodes to new, upgraded ones. Even if + maxUnavailable=0, this holds true. (Disruption stays within the + limits of PodDisruptionBudget, if it is configured.) + + Consider a hypothetical node pool with 5 nodes having maxSurge=2, + maxUnavailable=1. This means the upgrade process upgrades 3 nodes + simultaneously. It creates 2 additional (upgraded) nodes, then it + brings down 3 old (not yet upgraded) nodes at the same time. This + ensures that there are always at least 4 nodes available. + + These upgrade settings configure the upgrade strategy for the node + pool. Use strategy to switch between the strategies applied to the + node pool. + + If the strategy is SURGE, use max_surge and max_unavailable to + control the level of parallelism and the level of disruption caused + by upgrade. + + 1. maxSurge controls the number of additional nodes that can be + added to the node pool temporarily for the time of the upgrade to + increase the number of available nodes. + 2. maxUnavailable controls the number of nodes that can be + simultaneously unavailable. + 3. (maxUnavailable + maxSurge) determines the level of parallelism + (how many nodes are being upgraded at the same time). + + If the strategy is BLUE_GREEN, use blue_green_settings to configure + the blue-green upgrade related settings. + + 1. standard_rollout_policy is the default policy. The policy is used + to control the way blue pool gets drained. The draining is + executed in the batch mode. The batch size could be specified as + either percentage of the node pool size or the number of nodes. + batch_soak_duration is the soak time after each batch gets + drained. + 2. node_pool_soak_duration is the soak time after all blue nodes are + drained. After this period, the blue pool nodes will be deleted. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + max_surge (int): + The maximum number of nodes that can be + created beyond the current size of the node pool + during the upgrade process. + max_unavailable (int): + The maximum number of nodes that can be + simultaneously unavailable during the upgrade + process. A node is considered available if its + status is Ready. + strategy (google.cloud.container_v1beta1.types.NodePoolUpdateStrategy): + Update strategy of the node pool. + + This field is a member of `oneof`_ ``_strategy``. + blue_green_settings (google.cloud.container_v1beta1.types.BlueGreenSettings): + Settings for blue-green upgrade strategy. + + This field is a member of `oneof`_ ``_blue_green_settings``. + """ + + max_surge: int = proto.Field( + proto.INT32, + number=1, + ) + max_unavailable: int = proto.Field( + proto.INT32, + number=2, + ) + strategy: 'NodePoolUpdateStrategy' = proto.Field( + proto.ENUM, + number=3, + optional=True, + enum='NodePoolUpdateStrategy', + ) + blue_green_settings: 'BlueGreenSettings' = proto.Field( + proto.MESSAGE, + number=4, + optional=True, + message='BlueGreenSettings', + ) + + class UpdateInfo(proto.Message): + r"""UpdateInfo contains resource (instance groups, etc), status + and other intermediate information relevant to a node pool + upgrade. + + Attributes: + blue_green_info (google.cloud.container_v1beta1.types.NodePool.UpdateInfo.BlueGreenInfo): + Information of a blue-green upgrade. + """ + + class BlueGreenInfo(proto.Message): + r"""Information relevant to blue-green upgrade. + + Attributes: + phase (google.cloud.container_v1beta1.types.NodePool.UpdateInfo.BlueGreenInfo.Phase): + Current blue-green upgrade phase. + blue_instance_group_urls (MutableSequence[str]): + The resource URLs of the [managed instance groups] + (/compute/docs/instance-groups/creating-groups-of-managed-instances) + associated with blue pool. + green_instance_group_urls (MutableSequence[str]): + The resource URLs of the [managed instance groups] + (/compute/docs/instance-groups/creating-groups-of-managed-instances) + associated with green pool. + blue_pool_deletion_start_time (str): + Time to start deleting blue pool to complete blue-green + upgrade, in + `RFC3339 `__ text + format. + green_pool_version (str): + Version of green pool. + """ + class Phase(proto.Enum): + r"""Phase represents the different stages blue-green upgrade is + running in. + + Values: + PHASE_UNSPECIFIED (0): + Unspecified phase. + UPDATE_STARTED (1): + blue-green upgrade has been initiated. + CREATING_GREEN_POOL (2): + Start creating green pool nodes. + CORDONING_BLUE_POOL (3): + Start cordoning blue pool nodes. + WAITING_TO_DRAIN_BLUE_POOL (8): + Start waiting after cordoning the blue pool + and before draining it. + DRAINING_BLUE_POOL (4): + Start draining blue pool nodes. + NODE_POOL_SOAKING (5): + Start soaking time after draining entire blue + pool. + DELETING_BLUE_POOL (6): + Start deleting blue nodes. + ROLLBACK_STARTED (7): + Rollback has been initiated. + """ + PHASE_UNSPECIFIED = 0 + UPDATE_STARTED = 1 + CREATING_GREEN_POOL = 2 + CORDONING_BLUE_POOL = 3 + WAITING_TO_DRAIN_BLUE_POOL = 8 + DRAINING_BLUE_POOL = 4 + NODE_POOL_SOAKING = 5 + DELETING_BLUE_POOL = 6 + ROLLBACK_STARTED = 7 + + phase: 'NodePool.UpdateInfo.BlueGreenInfo.Phase' = proto.Field( + proto.ENUM, + number=1, + enum='NodePool.UpdateInfo.BlueGreenInfo.Phase', + ) + blue_instance_group_urls: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=2, + ) + green_instance_group_urls: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + blue_pool_deletion_start_time: str = proto.Field( + proto.STRING, + number=4, + ) + green_pool_version: str = proto.Field( + proto.STRING, + number=5, + ) + + blue_green_info: 'NodePool.UpdateInfo.BlueGreenInfo' = proto.Field( + proto.MESSAGE, + number=1, + message='NodePool.UpdateInfo.BlueGreenInfo', + ) + + class PlacementPolicy(proto.Message): + r"""PlacementPolicy defines the placement policy used by the node + pool. + + Attributes: + type_ (google.cloud.container_v1beta1.types.NodePool.PlacementPolicy.Type): + The type of placement. + tpu_topology (str): + TPU placement topology for pod slice node pool. + https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies + policy_name (str): + If set, refers to the name of a custom + resource policy supplied by the user. The + resource policy must be in the same project and + region as the node pool. If not found, + InvalidArgument error is returned. + """ + class Type(proto.Enum): + r"""Type defines the type of placement policy. + + Values: + TYPE_UNSPECIFIED (0): + TYPE_UNSPECIFIED specifies no requirements on nodes + placement. + COMPACT (1): + COMPACT specifies node placement in the same + availability domain to ensure low communication + latency. + """ + TYPE_UNSPECIFIED = 0 + COMPACT = 1 + + type_: 'NodePool.PlacementPolicy.Type' = proto.Field( + proto.ENUM, + number=1, + enum='NodePool.PlacementPolicy.Type', + ) + tpu_topology: str = proto.Field( + proto.STRING, + number=2, + ) + policy_name: str = proto.Field( + proto.STRING, + number=3, + ) + + class QueuedProvisioning(proto.Message): + r"""QueuedProvisioning defines the queued provisioning used by + the node pool. + + Attributes: + enabled (bool): + Denotes that this nodepool is QRM specific, + meaning nodes can be only obtained through + queuing via the Cluster Autoscaler + ProvisioningRequest API. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + name: str = proto.Field( + proto.STRING, + number=1, + ) + config: 'NodeConfig' = proto.Field( + proto.MESSAGE, + number=2, + message='NodeConfig', + ) + initial_node_count: int = proto.Field( + proto.INT32, + number=3, + ) + locations: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=13, + ) + network_config: 'NodeNetworkConfig' = proto.Field( + proto.MESSAGE, + number=14, + message='NodeNetworkConfig', + ) + self_link: str = proto.Field( + proto.STRING, + number=100, + ) + version: str = proto.Field( + proto.STRING, + number=101, + ) + instance_group_urls: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=102, + ) + status: Status = proto.Field( + proto.ENUM, + number=103, + enum=Status, + ) + status_message: str = proto.Field( + proto.STRING, + number=104, + ) + autoscaling: 'NodePoolAutoscaling' = proto.Field( + proto.MESSAGE, + number=4, + message='NodePoolAutoscaling', + ) + management: 'NodeManagement' = proto.Field( + proto.MESSAGE, + number=5, + message='NodeManagement', + ) + max_pods_constraint: 'MaxPodsConstraint' = proto.Field( + proto.MESSAGE, + number=6, + message='MaxPodsConstraint', + ) + conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( + proto.MESSAGE, + number=105, + message='StatusCondition', + ) + pod_ipv4_cidr_size: int = proto.Field( + proto.INT32, + number=7, + ) + upgrade_settings: UpgradeSettings = proto.Field( + proto.MESSAGE, + number=107, + message=UpgradeSettings, + ) + placement_policy: PlacementPolicy = proto.Field( + proto.MESSAGE, + number=108, + message=PlacementPolicy, + ) + update_info: UpdateInfo = proto.Field( + proto.MESSAGE, + number=109, + message=UpdateInfo, + ) + etag: str = proto.Field( + proto.STRING, + number=110, + ) + queued_provisioning: QueuedProvisioning = proto.Field( + proto.MESSAGE, + number=112, + message=QueuedProvisioning, + ) + best_effort_provisioning: 'BestEffortProvisioning' = proto.Field( + proto.MESSAGE, + number=113, + message='BestEffortProvisioning', + ) + + +class NodeManagement(proto.Message): + r"""NodeManagement defines the set of node management services + turned on for the node pool. + + Attributes: + auto_upgrade (bool): + Whether the nodes will be automatically + upgraded. + auto_repair (bool): + Whether the nodes will be automatically + repaired. + upgrade_options (google.cloud.container_v1beta1.types.AutoUpgradeOptions): + Specifies the Auto Upgrade knobs for the node + pool. + """ + + auto_upgrade: bool = proto.Field( + proto.BOOL, + number=1, + ) + auto_repair: bool = proto.Field( + proto.BOOL, + number=2, + ) + upgrade_options: 'AutoUpgradeOptions' = proto.Field( + proto.MESSAGE, + number=10, + message='AutoUpgradeOptions', + ) + + +class AutoUpgradeOptions(proto.Message): + r"""AutoUpgradeOptions defines the set of options for the user to + control how the Auto Upgrades will proceed. + + Attributes: + auto_upgrade_start_time (str): + Output only. This field is set when upgrades are about to + commence with the approximate start time for the upgrades, + in `RFC3339 `__ text + format. + description (str): + Output only. This field is set when upgrades + are about to commence with the description of + the upgrade. + """ + + auto_upgrade_start_time: str = proto.Field( + proto.STRING, + number=1, + ) + description: str = proto.Field( + proto.STRING, + number=2, + ) + + +class MaintenancePolicy(proto.Message): + r"""MaintenancePolicy defines the maintenance policy to be used + for the cluster. + + Attributes: + window (google.cloud.container_v1beta1.types.MaintenanceWindow): + Specifies the maintenance window in which + maintenance may be performed. + resource_version (str): + A hash identifying the version of this policy, so that + updates to fields of the policy won't accidentally undo + intermediate changes (and so that users of the API unaware + of some fields won't accidentally remove other fields). Make + a ``get()`` request to the cluster to get the current + resource version and include it with requests to set the + policy. + """ + + window: 'MaintenanceWindow' = proto.Field( + proto.MESSAGE, + number=1, + message='MaintenanceWindow', + ) + resource_version: str = proto.Field( + proto.STRING, + number=3, + ) + + +class MaintenanceWindow(proto.Message): + r"""MaintenanceWindow defines the maintenance window to be used + for the cluster. + + 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: + daily_maintenance_window (google.cloud.container_v1beta1.types.DailyMaintenanceWindow): + DailyMaintenanceWindow specifies a daily + maintenance operation window. + + This field is a member of `oneof`_ ``policy``. + recurring_window (google.cloud.container_v1beta1.types.RecurringTimeWindow): + RecurringWindow specifies some number of + recurring time periods for maintenance to occur. + The time windows may be overlapping. If no + maintenance windows are set, maintenance can + occur at any time. + + This field is a member of `oneof`_ ``policy``. + maintenance_exclusions (MutableMapping[str, google.cloud.container_v1beta1.types.TimeWindow]): + Exceptions to maintenance window. + Non-emergency maintenance should not occur in + these windows. + """ + + daily_maintenance_window: 'DailyMaintenanceWindow' = proto.Field( + proto.MESSAGE, + number=2, + oneof='policy', + message='DailyMaintenanceWindow', + ) + recurring_window: 'RecurringTimeWindow' = proto.Field( + proto.MESSAGE, + number=3, + oneof='policy', + message='RecurringTimeWindow', + ) + maintenance_exclusions: MutableMapping[str, 'TimeWindow'] = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=4, + message='TimeWindow', + ) + + +class TimeWindow(proto.Message): + r"""Represents an arbitrary window of time. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + maintenance_exclusion_options (google.cloud.container_v1beta1.types.MaintenanceExclusionOptions): + MaintenanceExclusionOptions provides + maintenance exclusion related options. + + This field is a member of `oneof`_ ``options``. + start_time (google.protobuf.timestamp_pb2.Timestamp): + The time that the window first starts. + end_time (google.protobuf.timestamp_pb2.Timestamp): + The time that the window ends. The end time + should take place after the start time. + """ + + maintenance_exclusion_options: 'MaintenanceExclusionOptions' = proto.Field( + proto.MESSAGE, + number=3, + oneof='options', + message='MaintenanceExclusionOptions', + ) + start_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, + ) + + +class MaintenanceExclusionOptions(proto.Message): + r"""Represents the Maintenance exclusion option. + + Attributes: + scope (google.cloud.container_v1beta1.types.MaintenanceExclusionOptions.Scope): + Scope specifies the upgrade scope which + upgrades are blocked by the exclusion. + """ + class Scope(proto.Enum): + r"""Scope of exclusion. + + Values: + NO_UPGRADES (0): + NO_UPGRADES excludes all upgrades, including patch upgrades + and minor upgrades across control planes and nodes. This is + the default exclusion behavior. + NO_MINOR_UPGRADES (1): + NO_MINOR_UPGRADES excludes all minor upgrades for the + cluster, only patches are allowed. + NO_MINOR_OR_NODE_UPGRADES (2): + NO_MINOR_OR_NODE_UPGRADES excludes all minor upgrades for + the cluster, and also exclude all node pool upgrades. Only + control plane patches are allowed. + """ + NO_UPGRADES = 0 + NO_MINOR_UPGRADES = 1 + NO_MINOR_OR_NODE_UPGRADES = 2 + + scope: Scope = proto.Field( + proto.ENUM, + number=1, + enum=Scope, + ) + + +class RecurringTimeWindow(proto.Message): + r"""Represents an arbitrary window of time that recurs. + + Attributes: + window (google.cloud.container_v1beta1.types.TimeWindow): + The window of the first recurrence. + recurrence (str): + An RRULE + (https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for + how this window reccurs. They go on for the span of time + between the start and end time. + + For example, to have something repeat every weekday, you'd + use: ``FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR`` + + To repeat some window daily (equivalent to the + DailyMaintenanceWindow): ``FREQ=DAILY`` + + For the first weekend of every month: + ``FREQ=MONTHLY;BYSETPOS=1;BYDAY=SA,SU`` + + This specifies how frequently the window starts. Eg, if you + wanted to have a 9-5 UTC-4 window every weekday, you'd use + something like: + + :: + + start time = 2019-01-01T09:00:00-0400 + end time = 2019-01-01T17:00:00-0400 + recurrence = FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR + + Windows can span multiple days. Eg, to make the window + encompass every weekend from midnight Saturday till the last + minute of Sunday UTC: + + :: + + start time = 2019-01-05T00:00:00Z + end time = 2019-01-07T23:59:00Z + recurrence = FREQ=WEEKLY;BYDAY=SA + + Note the start and end time's specific dates are largely + arbitrary except to specify duration of the window and when + it first starts. The FREQ values of HOURLY, MINUTELY, and + SECONDLY are not supported. + """ + + window: 'TimeWindow' = proto.Field( + proto.MESSAGE, + number=1, + message='TimeWindow', + ) + recurrence: str = proto.Field( + proto.STRING, + number=2, + ) + + +class DailyMaintenanceWindow(proto.Message): + r"""Time window specified for daily maintenance operations. + + Attributes: + start_time (str): + Time within the maintenance window to start the maintenance + operations. It must be in format "HH:MM", where HH : [00-23] + and MM : [00-59] GMT. + duration (str): + Output only. Duration of the time window, + automatically chosen to be smallest possible in + the given scenario. + """ + + start_time: str = proto.Field( + proto.STRING, + number=2, + ) + duration: str = proto.Field( + proto.STRING, + number=3, + ) + + +class SetNodePoolManagementRequest(proto.Message): + r"""SetNodePoolManagementRequest sets the node management + properties of a node pool. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to update. This field has been deprecated and + replaced by the name field. + node_pool_id (str): + Required. Deprecated. The name of the node + pool to update. This field has been deprecated + and replaced by the name field. + management (google.cloud.container_v1beta1.types.NodeManagement): + Required. NodeManagement configuration for + the node pool. + name (str): + The name (project, location, cluster, node pool id) of the + node pool to set management properties. Specified in the + format ``projects/*/locations/*/clusters/*/nodePools/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + management: 'NodeManagement' = proto.Field( + proto.MESSAGE, + number=5, + message='NodeManagement', + ) + name: str = proto.Field( + proto.STRING, + number=7, + ) + + +class SetNodePoolSizeRequest(proto.Message): + r"""SetNodePoolSizeRequest sets the size of a node pool. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to update. This field has been deprecated and + replaced by the name field. + node_pool_id (str): + Required. Deprecated. The name of the node + pool to update. This field has been deprecated + and replaced by the name field. + node_count (int): + Required. The desired node count for the + pool. + name (str): + The name (project, location, cluster, node pool id) of the + node pool to set size. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + node_count: int = proto.Field( + proto.INT32, + number=5, + ) + name: str = proto.Field( + proto.STRING, + number=7, + ) + + +class CompleteNodePoolUpgradeRequest(proto.Message): + r"""CompleteNodePoolUpgradeRequest sets the name of target node + pool to complete upgrade. + + Attributes: + name (str): + The name (project, location, cluster, node pool id) of the + node pool to complete upgrade. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class RollbackNodePoolUpgradeRequest(proto.Message): + r"""RollbackNodePoolUpgradeRequest rollbacks the previously + Aborted or Failed NodePool upgrade. This will be an no-op if the + last upgrade successfully completed. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to rollback. This field has been deprecated and + replaced by the name field. + node_pool_id (str): + Required. Deprecated. The name of the node + pool to rollback. This field has been deprecated + and replaced by the name field. + name (str): + The name (project, location, cluster, node pool id) of the + node poll to rollback upgrade. Specified in the format + ``projects/*/locations/*/clusters/*/nodePools/*``. + respect_pdb (bool): + Option for rollback to ignore the + PodDisruptionBudget. Default value is false. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + node_pool_id: str = proto.Field( + proto.STRING, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + respect_pdb: bool = proto.Field( + proto.BOOL, + number=7, + ) + + +class ListNodePoolsResponse(proto.Message): + r"""ListNodePoolsResponse is the result of ListNodePoolsRequest. + + Attributes: + node_pools (MutableSequence[google.cloud.container_v1beta1.types.NodePool]): + A list of node pools for a cluster. + """ + + node_pools: MutableSequence['NodePool'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='NodePool', + ) + + +class ClusterAutoscaling(proto.Message): + r"""ClusterAutoscaling contains global, per-cluster information + required by Cluster Autoscaler to automatically adjust the size + of the cluster and create/delete + node pools based on the current needs. + + Attributes: + enable_node_autoprovisioning (bool): + Enables automatic node pool creation and + deletion. + resource_limits (MutableSequence[google.cloud.container_v1beta1.types.ResourceLimit]): + Contains global constraints regarding minimum + and maximum amount of resources in the cluster. + autoscaling_profile (google.cloud.container_v1beta1.types.ClusterAutoscaling.AutoscalingProfile): + Defines autoscaling behaviour. + autoprovisioning_node_pool_defaults (google.cloud.container_v1beta1.types.AutoprovisioningNodePoolDefaults): + AutoprovisioningNodePoolDefaults contains + defaults for a node pool created by NAP. + autoprovisioning_locations (MutableSequence[str]): + The list of Google Compute Engine + `zones `__ + in which the NodePool's nodes can be created by NAP. + """ + class AutoscalingProfile(proto.Enum): + r"""Defines possible options for autoscaling_profile field. + + Values: + PROFILE_UNSPECIFIED (0): + No change to autoscaling configuration. + OPTIMIZE_UTILIZATION (1): + Prioritize optimizing utilization of + resources. + BALANCED (2): + Use default (balanced) autoscaling + configuration. + """ + PROFILE_UNSPECIFIED = 0 + OPTIMIZE_UTILIZATION = 1 + BALANCED = 2 + + enable_node_autoprovisioning: bool = proto.Field( + proto.BOOL, + number=1, + ) + resource_limits: MutableSequence['ResourceLimit'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='ResourceLimit', + ) + autoscaling_profile: AutoscalingProfile = proto.Field( + proto.ENUM, + number=3, + enum=AutoscalingProfile, + ) + autoprovisioning_node_pool_defaults: 'AutoprovisioningNodePoolDefaults' = proto.Field( + proto.MESSAGE, + number=4, + message='AutoprovisioningNodePoolDefaults', + ) + autoprovisioning_locations: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=5, + ) + + +class AutoprovisioningNodePoolDefaults(proto.Message): + r"""AutoprovisioningNodePoolDefaults contains defaults for a node + pool created by NAP. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + oauth_scopes (MutableSequence[str]): + The set of Google API scopes to be made available on all of + the node VMs under the "default" service account. + + The following scopes are recommended, but not required, and + by default are not included: + + - ``https://www.googleapis.com/auth/compute`` is required + for mounting persistent storage on your nodes. + - ``https://www.googleapis.com/auth/devstorage.read_only`` + is required for communicating with **gcr.io** (the + `Google Container + Registry `__). + + If unspecified, no scopes are added, unless Cloud Logging or + Cloud Monitoring are enabled, in which case their required + scopes will be added. + service_account (str): + The Google Cloud Platform Service Account to + be used by the node VMs. Specify the email + address of the Service Account; otherwise, if no + Service Account is specified, the "default" + service account is used. + upgrade_settings (google.cloud.container_v1beta1.types.NodePool.UpgradeSettings): + Upgrade settings control disruption and speed + of the upgrade. + management (google.cloud.container_v1beta1.types.NodeManagement): + NodeManagement configuration for this + NodePool. + min_cpu_platform (str): + Deprecated. Minimum CPU platform to be used for NAP created + node pools. The instance may be scheduled on the specified + or newer CPU platform. Applicable values are the friendly + names of CPU platforms, such as minCpuPlatform: Intel + Haswell or minCpuPlatform: Intel Sandy Bridge. For more + information, read `how to specify min CPU + platform `__. + This field is deprecated, min_cpu_platform should be + specified using + ``cloud.google.com/requested-min-cpu-platform`` label + selector on the pod. To unset the min cpu platform field + pass "automatic" as field value. + disk_size_gb (int): + Size of the disk attached to each node, + specified in GB. The smallest allowed disk size + is 10GB. + + If unspecified, the default disk size is 100GB. + disk_type (str): + Type of the disk attached to each node (e.g. + 'pd-standard', 'pd-ssd' or 'pd-balanced') + + If unspecified, the default disk type is + 'pd-standard' + shielded_instance_config (google.cloud.container_v1beta1.types.ShieldedInstanceConfig): + Shielded Instance options. + boot_disk_kms_key (str): + The Customer Managed Encryption Key used to encrypt the boot + disk attached to each node in the node pool. This should be + of the form + projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. + For more information about protecting resources with Cloud + KMS Keys please see: + https://cloud.google.com/compute/docs/disks/customer-managed-encryption + image_type (str): + The image type to use for NAP created node. + Please see + https://cloud.google.com/kubernetes-engine/docs/concepts/node-images + for available image types. + insecure_kubelet_readonly_port_enabled (bool): + Enable or disable Kubelet read only port. + + This field is a member of `oneof`_ ``_insecure_kubelet_readonly_port_enabled``. + """ + + oauth_scopes: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + service_account: str = proto.Field( + proto.STRING, + number=2, + ) + upgrade_settings: 'NodePool.UpgradeSettings' = proto.Field( + proto.MESSAGE, + number=3, + message='NodePool.UpgradeSettings', + ) + management: 'NodeManagement' = proto.Field( + proto.MESSAGE, + number=4, + message='NodeManagement', + ) + min_cpu_platform: str = proto.Field( + proto.STRING, + number=5, + ) + disk_size_gb: int = proto.Field( + proto.INT32, + number=6, + ) + disk_type: str = proto.Field( + proto.STRING, + number=7, + ) + shielded_instance_config: 'ShieldedInstanceConfig' = proto.Field( + proto.MESSAGE, + number=8, + message='ShieldedInstanceConfig', + ) + boot_disk_kms_key: str = proto.Field( + proto.STRING, + number=9, + ) + image_type: str = proto.Field( + proto.STRING, + number=10, + ) + insecure_kubelet_readonly_port_enabled: bool = proto.Field( + proto.BOOL, + number=13, + optional=True, + ) + + +class ResourceLimit(proto.Message): + r"""Contains information about amount of some resource in the + cluster. For memory, value should be in GB. + + Attributes: + resource_type (str): + Resource name "cpu", "memory" or gpu-specific + string. + minimum (int): + Minimum amount of the resource in the + cluster. + maximum (int): + Maximum amount of the resource in the + cluster. + """ + + resource_type: str = proto.Field( + proto.STRING, + number=1, + ) + minimum: int = proto.Field( + proto.INT64, + number=2, + ) + maximum: int = proto.Field( + proto.INT64, + number=3, + ) + + +class NodePoolAutoscaling(proto.Message): + r"""NodePoolAutoscaling contains information required by cluster + autoscaler to adjust the size of the node pool to the current + cluster usage. + + Attributes: + enabled (bool): + Is autoscaling enabled for this node pool. + min_node_count (int): + Minimum number of nodes for one location in the NodePool. + Must be >= 1 and <= max_node_count. + max_node_count (int): + Maximum number of nodes for one location in the NodePool. + Must be >= min_node_count. There has to be enough quota to + scale up the cluster. + autoprovisioned (bool): + Can this node pool be deleted automatically. + location_policy (google.cloud.container_v1beta1.types.NodePoolAutoscaling.LocationPolicy): + Location policy used when scaling up a + nodepool. + total_min_node_count (int): + Minimum number of nodes in the node pool. Must be greater + than 1 less than total_max_node_count. The + total_*_node_count fields are mutually exclusive with the + \*_node_count fields. + total_max_node_count (int): + Maximum number of nodes in the node pool. Must be greater + than total_min_node_count. There has to be enough quota to + scale up the cluster. The total_*_node_count fields are + mutually exclusive with the \*_node_count fields. + """ + class LocationPolicy(proto.Enum): + r"""Location policy specifies how zones are picked when scaling + up the nodepool. + + Values: + LOCATION_POLICY_UNSPECIFIED (0): + Not set. + BALANCED (1): + BALANCED is a best effort policy that aims to + balance the sizes of different zones. + ANY (2): + ANY policy picks zones that have the highest + capacity available. + """ + LOCATION_POLICY_UNSPECIFIED = 0 + BALANCED = 1 + ANY = 2 + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + min_node_count: int = proto.Field( + proto.INT32, + number=2, + ) + max_node_count: int = proto.Field( + proto.INT32, + number=3, + ) + autoprovisioned: bool = proto.Field( + proto.BOOL, + number=4, + ) + location_policy: LocationPolicy = proto.Field( + proto.ENUM, + number=5, + enum=LocationPolicy, + ) + total_min_node_count: int = proto.Field( + proto.INT32, + number=6, + ) + total_max_node_count: int = proto.Field( + proto.INT32, + number=7, + ) + + +class SetLabelsRequest(proto.Message): + r"""SetLabelsRequest sets the Google Cloud Platform labels on a + Google Container Engine cluster, which will in turn set them for + Google Compute Engine resources used by that cluster + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated and + replaced by the name field. + resource_labels (MutableMapping[str, str]): + Required. The labels to set for that cluster. + label_fingerprint (str): + Required. The fingerprint of the previous set of labels for + this resource, used to detect conflicts. The fingerprint is + initially generated by Kubernetes Engine and changes after + every request to modify or update labels. You must always + provide an up-to-date fingerprint hash when updating or + changing labels. Make a ``get()`` request to the resource to + get the latest fingerprint. + name (str): + The name (project, location, cluster name) of the cluster to + set labels. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + resource_labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + label_fingerprint: str = proto.Field( + proto.STRING, + number=5, + ) + name: str = proto.Field( + proto.STRING, + number=7, + ) + + +class SetLegacyAbacRequest(proto.Message): + r"""SetLegacyAbacRequest enables or disables the ABAC + authorization mechanism for a cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the cluster + to update. This field has been deprecated and + replaced by the name field. + enabled (bool): + Required. Whether ABAC authorization will be + enabled in the cluster. + name (str): + The name (project, location, cluster name) of the cluster to + set legacy abac. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + enabled: bool = proto.Field( + proto.BOOL, + number=4, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class StartIPRotationRequest(proto.Message): + r"""StartIPRotationRequest creates a new IP for the cluster and + then performs a node upgrade on each node pool to point to the + new IP. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated and + replaced by the name field. + name (str): + The name (project, location, cluster name) of the cluster to + start IP rotation. Specified in the format + ``projects/*/locations/*/clusters/*``. + rotate_credentials (bool): + Whether to rotate credentials during IP + rotation. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + rotate_credentials: bool = proto.Field( + proto.BOOL, + number=7, + ) + + +class CompleteIPRotationRequest(proto.Message): + r"""CompleteIPRotationRequest moves the cluster master back into + single-IP mode. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated and + replaced by the name field. + name (str): + The name (project, location, cluster name) of the cluster to + complete IP rotation. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + name: str = proto.Field( + proto.STRING, + number=7, + ) + + +class AcceleratorConfig(proto.Message): + r"""AcceleratorConfig represents a Hardware Accelerator request. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + accelerator_count (int): + The number of the accelerator cards exposed + to an instance. + accelerator_type (str): + The accelerator type resource name. List of supported + accelerators + `here `__ + gpu_partition_size (str): + Size of partitions to create on the GPU. Valid values are + described in the NVIDIA `mig user + guide `__. + max_time_shared_clients_per_gpu (int): + The number of time-shared GPU resources to + expose for each physical GPU. + gpu_sharing_config (google.cloud.container_v1beta1.types.GPUSharingConfig): + The configuration for GPU sharing options. + + This field is a member of `oneof`_ ``_gpu_sharing_config``. + gpu_driver_installation_config (google.cloud.container_v1beta1.types.GPUDriverInstallationConfig): + The configuration for auto installation of + GPU driver. + + This field is a member of `oneof`_ ``_gpu_driver_installation_config``. + """ + + accelerator_count: int = proto.Field( + proto.INT64, + number=1, + ) + accelerator_type: str = proto.Field( + proto.STRING, + number=2, + ) + gpu_partition_size: str = proto.Field( + proto.STRING, + number=3, + ) + max_time_shared_clients_per_gpu: int = proto.Field( + proto.INT64, + number=4, + ) + gpu_sharing_config: 'GPUSharingConfig' = proto.Field( + proto.MESSAGE, + number=5, + optional=True, + message='GPUSharingConfig', + ) + gpu_driver_installation_config: 'GPUDriverInstallationConfig' = proto.Field( + proto.MESSAGE, + number=6, + optional=True, + message='GPUDriverInstallationConfig', + ) + + +class GPUSharingConfig(proto.Message): + r"""GPUSharingConfig represents the GPU sharing configuration for + Hardware Accelerators. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + max_shared_clients_per_gpu (int): + The max number of containers that can share a + physical GPU. + gpu_sharing_strategy (google.cloud.container_v1beta1.types.GPUSharingConfig.GPUSharingStrategy): + The type of GPU sharing strategy to enable on + the GPU node. + + This field is a member of `oneof`_ ``_gpu_sharing_strategy``. + """ + class GPUSharingStrategy(proto.Enum): + r"""The type of GPU sharing strategy currently provided. + + Values: + GPU_SHARING_STRATEGY_UNSPECIFIED (0): + Default value. + TIME_SHARING (1): + GPUs are time-shared between containers. + MPS (2): + GPUs are shared between containers with + NVIDIA MPS. + """ + GPU_SHARING_STRATEGY_UNSPECIFIED = 0 + TIME_SHARING = 1 + MPS = 2 + + max_shared_clients_per_gpu: int = proto.Field( + proto.INT64, + number=1, + ) + gpu_sharing_strategy: GPUSharingStrategy = proto.Field( + proto.ENUM, + number=2, + optional=True, + enum=GPUSharingStrategy, + ) + + +class GPUDriverInstallationConfig(proto.Message): + r"""GPUDriverInstallationConfig specifies the version of GPU + driver to be auto installed. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + gpu_driver_version (google.cloud.container_v1beta1.types.GPUDriverInstallationConfig.GPUDriverVersion): + Mode for how the GPU driver is installed. + + This field is a member of `oneof`_ ``_gpu_driver_version``. + """ + class GPUDriverVersion(proto.Enum): + r"""The GPU driver version to install. + + Values: + GPU_DRIVER_VERSION_UNSPECIFIED (0): + Default value is to not install any GPU + driver. + INSTALLATION_DISABLED (1): + Disable GPU driver auto installation and + needs manual installation + DEFAULT (2): + "Default" GPU driver in COS and Ubuntu. + LATEST (3): + "Latest" GPU driver in COS. + """ + GPU_DRIVER_VERSION_UNSPECIFIED = 0 + INSTALLATION_DISABLED = 1 + DEFAULT = 2 + LATEST = 3 + + gpu_driver_version: GPUDriverVersion = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum=GPUDriverVersion, + ) + + +class ManagedPrometheusConfig(proto.Message): + r"""ManagedPrometheusConfig defines the configuration for + Google Cloud Managed Service for Prometheus. + + Attributes: + enabled (bool): + Enable Managed Collection. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class WorkloadMetadataConfig(proto.Message): + r"""WorkloadMetadataConfig defines the metadata configuration to + expose to workloads on the node pool. + + Attributes: + node_metadata (google.cloud.container_v1beta1.types.WorkloadMetadataConfig.NodeMetadata): + NodeMetadata is the configuration for how to + expose metadata to the workloads running on the + node. + mode (google.cloud.container_v1beta1.types.WorkloadMetadataConfig.Mode): + Mode is the configuration for how to expose + metadata to workloads running on the node pool. + """ + class NodeMetadata(proto.Enum): + r"""NodeMetadata is the configuration for if and how to expose + the node metadata to the workload running on the node. + + Values: + UNSPECIFIED (0): + Not set. + SECURE (1): + Prevent workloads not in hostNetwork from + accessing certain VM metadata, specifically + kube-env, which contains Kubelet credentials, + and the instance identity token. + + Metadata concealment is a temporary security + solution available while the bootstrapping + process for cluster nodes is being redesigned + with significant security improvements. This + feature is scheduled to be deprecated in the + future and later removed. + EXPOSE (2): + Expose all VM metadata to pods. + GKE_METADATA_SERVER (3): + Run the GKE Metadata Server on this node. The + GKE Metadata Server exposes a metadata API to + workloads that is compatible with the V1 Compute + Metadata APIs exposed by the Compute Engine and + App Engine Metadata Servers. This feature can + only be enabled if Workload Identity is enabled + at the cluster level. + """ + UNSPECIFIED = 0 + SECURE = 1 + EXPOSE = 2 + GKE_METADATA_SERVER = 3 + + class Mode(proto.Enum): + r"""Mode is the configuration for how to expose metadata to + workloads running on the node. + + Values: + MODE_UNSPECIFIED (0): + Not set. + GCE_METADATA (1): + Expose all Compute Engine metadata to pods. + GKE_METADATA (2): + Run the GKE Metadata Server on this node. The + GKE Metadata Server exposes a metadata API to + workloads that is compatible with the V1 Compute + Metadata APIs exposed by the Compute Engine and + App Engine Metadata Servers. This feature can + only be enabled if Workload Identity is enabled + at the cluster level. + """ + MODE_UNSPECIFIED = 0 + GCE_METADATA = 1 + GKE_METADATA = 2 + + node_metadata: NodeMetadata = proto.Field( + proto.ENUM, + number=1, + enum=NodeMetadata, + ) + mode: Mode = proto.Field( + proto.ENUM, + number=2, + enum=Mode, + ) + + +class SetNetworkPolicyRequest(proto.Message): + r"""SetNetworkPolicyRequest enables/disables network policy for a + cluster. + + Attributes: + project_id (str): + Required. Deprecated. The Google Developers Console `project + ID or project + number `__. + This field has been deprecated and replaced by the name + field. + zone (str): + Required. Deprecated. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. This field has been deprecated + and replaced by the name field. + cluster_id (str): + Required. Deprecated. The name of the + cluster. This field has been deprecated and + replaced by the name field. + network_policy (google.cloud.container_v1beta1.types.NetworkPolicy): + Required. Configuration options for the + NetworkPolicy feature. + name (str): + The name (project, location, cluster name) of the cluster to + set networking policy. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + network_policy: 'NetworkPolicy' = proto.Field( + proto.MESSAGE, + number=4, + message='NetworkPolicy', + ) + name: str = proto.Field( + proto.STRING, + number=6, + ) + + +class SetMaintenancePolicyRequest(proto.Message): + r"""SetMaintenancePolicyRequest sets the maintenance policy for a + cluster. + + Attributes: + project_id (str): + Required. The Google Developers Console `project ID or + project + number `__. + zone (str): + Required. The name of the Google Compute Engine + `zone `__ + in which the cluster resides. + cluster_id (str): + Required. The name of the cluster to update. + maintenance_policy (google.cloud.container_v1beta1.types.MaintenancePolicy): + Required. The maintenance policy to be set + for the cluster. An empty field clears the + existing maintenance policy. + name (str): + The name (project, location, cluster name) of the cluster to + set maintenance policy. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + zone: str = proto.Field( + proto.STRING, + number=2, + ) + cluster_id: str = proto.Field( + proto.STRING, + number=3, + ) + maintenance_policy: 'MaintenancePolicy' = proto.Field( + proto.MESSAGE, + number=4, + message='MaintenancePolicy', + ) + name: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListLocationsRequest(proto.Message): + r"""ListLocationsRequest is used to request the locations that + offer GKE. + + Attributes: + parent (str): + Required. Contains the name of the resource requested. + Specified in the format ``projects/*``. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + + +class ListLocationsResponse(proto.Message): + r"""ListLocationsResponse returns the list of all GKE locations + and their recommendation state. + + Attributes: + locations (MutableSequence[google.cloud.container_v1beta1.types.Location]): + A full list of GKE locations. + next_page_token (str): + Only return ListLocationsResponse that occur after the + page_token. This value should be populated from the + ListLocationsResponse.next_page_token if that response token + was set (which happens when listing more Locations than fit + in a single ListLocationsResponse). + """ + + @property + def raw_page(self): + return self + + locations: MutableSequence['Location'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Location', + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + + +class Location(proto.Message): + r"""Location returns the location name, and if the location is + recommended for GKE cluster scheduling. + + Attributes: + type_ (google.cloud.container_v1beta1.types.Location.LocationType): + Contains the type of location this Location + is for. Regional or Zonal. + name (str): + Contains the name of the resource requested. Specified in + the format ``projects/*/locations/*``. + recommended (bool): + Whether the location is recommended for GKE + cluster scheduling. + """ + class LocationType(proto.Enum): + r"""LocationType is the type of GKE location, regional or zonal. + + Values: + LOCATION_TYPE_UNSPECIFIED (0): + LOCATION_TYPE_UNSPECIFIED means the location type was not + determined. + ZONE (1): + A GKE Location where Zonal clusters can be + created. + REGION (2): + A GKE Location where Regional clusters can be + created. + """ + LOCATION_TYPE_UNSPECIFIED = 0 + ZONE = 1 + REGION = 2 + + type_: LocationType = proto.Field( + proto.ENUM, + number=1, + enum=LocationType, + ) + name: str = proto.Field( + proto.STRING, + number=2, + ) + recommended: bool = proto.Field( + proto.BOOL, + number=3, + ) + + +class StatusCondition(proto.Message): + r"""StatusCondition describes why a cluster or a node pool has a + certain status (e.g., ERROR or DEGRADED). + + Attributes: + code (google.cloud.container_v1beta1.types.StatusCondition.Code): + Machine-friendly representation of the condition Deprecated. + Use canonical_code instead. + message (str): + Human-friendly representation of the + condition + canonical_code (google.rpc.code_pb2.Code): + Canonical code of the condition. + """ + class Code(proto.Enum): + r"""Code for each condition + + Values: + UNKNOWN (0): + UNKNOWN indicates a generic condition. + GCE_STOCKOUT (1): + GCE_STOCKOUT indicates that Google Compute Engine resources + are temporarily unavailable. + GKE_SERVICE_ACCOUNT_DELETED (2): + GKE_SERVICE_ACCOUNT_DELETED indicates that the user deleted + their robot service account. + GCE_QUOTA_EXCEEDED (3): + Google Compute Engine quota was exceeded. + SET_BY_OPERATOR (4): + Cluster state was manually changed by an SRE + due to a system logic error. + CLOUD_KMS_KEY_ERROR (7): + Unable to perform an encrypt operation + against the CloudKMS key used for etcd level + encryption. + CA_EXPIRING (9): + Cluster CA is expiring soon. + More codes TBA + """ + _pb_options = {'deprecated': True} + UNKNOWN = 0 + GCE_STOCKOUT = 1 + GKE_SERVICE_ACCOUNT_DELETED = 2 + GCE_QUOTA_EXCEEDED = 3 + SET_BY_OPERATOR = 4 + CLOUD_KMS_KEY_ERROR = 7 + CA_EXPIRING = 9 + + code: Code = proto.Field( + proto.ENUM, + number=1, + enum=Code, + ) + message: str = proto.Field( + proto.STRING, + number=2, + ) + canonical_code: code_pb2.Code = proto.Field( + proto.ENUM, + number=3, + enum=code_pb2.Code, + ) + + +class NetworkConfig(proto.Message): + r"""NetworkConfig reports the relative names of network & + subnetwork. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + network (str): + Output only. The relative name of the Google Compute Engine + `network `__ + to which the cluster is connected. Example: + projects/my-project/global/networks/my-network + subnetwork (str): + Output only. The relative name of the Google Compute Engine + `subnetwork `__ + to which the cluster is connected. Example: + projects/my-project/regions/us-central1/subnetworks/my-subnet + enable_intra_node_visibility (bool): + Whether Intra-node visibility is enabled for + this cluster. This makes same node pod to pod + traffic visible for VPC network. + default_snat_status (google.cloud.container_v1beta1.types.DefaultSnatStatus): + Whether the cluster disables default in-node sNAT rules. + In-node sNAT rules will be disabled when default_snat_status + is disabled. When disabled is set to false, default IP + masquerade rules will be applied to the nodes to prevent + sNAT on cluster internal traffic. + enable_l4ilb_subsetting (bool): + Whether L4ILB Subsetting is enabled for this + cluster. + datapath_provider (google.cloud.container_v1beta1.types.DatapathProvider): + The desired datapath provider for this + cluster. By default, uses the IPTables-based + kube-proxy implementation. + private_ipv6_google_access (google.cloud.container_v1beta1.types.PrivateIPv6GoogleAccess): + The desired state of IPv6 connectivity to + Google Services. By default, no private IPv6 + access to or from Google Services (all access + will be via IPv4) + dns_config (google.cloud.container_v1beta1.types.DNSConfig): + DNSConfig contains clusterDNS config for this + cluster. + service_external_ips_config (google.cloud.container_v1beta1.types.ServiceExternalIPsConfig): + ServiceExternalIPsConfig specifies if + services with externalIPs field are blocked or + not. + gateway_api_config (google.cloud.container_v1beta1.types.GatewayAPIConfig): + GatewayAPIConfig contains the desired config + of Gateway API on this cluster. + enable_multi_networking (bool): + Whether multi-networking is enabled for this + cluster. + network_performance_config (google.cloud.container_v1beta1.types.NetworkConfig.ClusterNetworkPerformanceConfig): + Network bandwidth tier configuration. + enable_fqdn_network_policy (bool): + Whether FQDN Network Policy is enabled on + this cluster. + + This field is a member of `oneof`_ ``_enable_fqdn_network_policy``. + in_transit_encryption_config (google.cloud.container_v1beta1.types.InTransitEncryptionConfig): + Specify the details of in-transit encryption. + + This field is a member of `oneof`_ ``_in_transit_encryption_config``. + enable_cilium_clusterwide_network_policy (bool): + Whether CiliumClusterWideNetworkPolicy is + enabled on this cluster. + + This field is a member of `oneof`_ ``_enable_cilium_clusterwide_network_policy``. + """ + + class ClusterNetworkPerformanceConfig(proto.Message): + r"""Configuration of all network bandwidth tiers + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + total_egress_bandwidth_tier (google.cloud.container_v1beta1.types.NetworkConfig.ClusterNetworkPerformanceConfig.Tier): + Specifies the total network bandwidth tier + for the NodePool. + + This field is a member of `oneof`_ ``_total_egress_bandwidth_tier``. + """ + class Tier(proto.Enum): + r"""Node network tier + + Values: + TIER_UNSPECIFIED (0): + Default value + TIER_1 (1): + Higher bandwidth, actual values based on VM + size. + """ + TIER_UNSPECIFIED = 0 + TIER_1 = 1 + + total_egress_bandwidth_tier: 'NetworkConfig.ClusterNetworkPerformanceConfig.Tier' = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum='NetworkConfig.ClusterNetworkPerformanceConfig.Tier', + ) + + network: str = proto.Field( + proto.STRING, + number=1, + ) + subnetwork: str = proto.Field( + proto.STRING, + number=2, + ) + enable_intra_node_visibility: bool = proto.Field( + proto.BOOL, + number=5, + ) + default_snat_status: 'DefaultSnatStatus' = proto.Field( + proto.MESSAGE, + number=7, + message='DefaultSnatStatus', + ) + enable_l4ilb_subsetting: bool = proto.Field( + proto.BOOL, + number=10, + ) + datapath_provider: 'DatapathProvider' = proto.Field( + proto.ENUM, + number=11, + enum='DatapathProvider', + ) + private_ipv6_google_access: 'PrivateIPv6GoogleAccess' = proto.Field( + proto.ENUM, + number=12, + enum='PrivateIPv6GoogleAccess', + ) + dns_config: 'DNSConfig' = proto.Field( + proto.MESSAGE, + number=13, + message='DNSConfig', + ) + service_external_ips_config: 'ServiceExternalIPsConfig' = proto.Field( + proto.MESSAGE, + number=15, + message='ServiceExternalIPsConfig', + ) + gateway_api_config: 'GatewayAPIConfig' = proto.Field( + proto.MESSAGE, + number=16, + message='GatewayAPIConfig', + ) + enable_multi_networking: bool = proto.Field( + proto.BOOL, + number=17, + ) + network_performance_config: ClusterNetworkPerformanceConfig = proto.Field( + proto.MESSAGE, + number=18, + message=ClusterNetworkPerformanceConfig, + ) + enable_fqdn_network_policy: bool = proto.Field( + proto.BOOL, + number=19, + optional=True, + ) + in_transit_encryption_config: 'InTransitEncryptionConfig' = proto.Field( + proto.ENUM, + number=20, + optional=True, + enum='InTransitEncryptionConfig', + ) + enable_cilium_clusterwide_network_policy: bool = proto.Field( + proto.BOOL, + number=21, + optional=True, + ) + + +class GatewayAPIConfig(proto.Message): + r"""GatewayAPIConfig contains the desired config of Gateway API + on this cluster. + + Attributes: + channel (google.cloud.container_v1beta1.types.GatewayAPIConfig.Channel): + The Gateway API release channel to use for + Gateway API. + """ + class Channel(proto.Enum): + r"""Channel describes if/how Gateway API should be installed and + implemented in a cluster. + + Values: + CHANNEL_UNSPECIFIED (0): + Default value. + CHANNEL_DISABLED (1): + Gateway API support is disabled + CHANNEL_EXPERIMENTAL (3): + Deprecated: use CHANNEL_STANDARD instead. Gateway API + support is enabled, experimental CRDs are installed + CHANNEL_STANDARD (4): + Gateway API support is enabled, standard CRDs + are installed + """ + CHANNEL_UNSPECIFIED = 0 + CHANNEL_DISABLED = 1 + CHANNEL_EXPERIMENTAL = 3 + CHANNEL_STANDARD = 4 + + channel: Channel = proto.Field( + proto.ENUM, + number=1, + enum=Channel, + ) + + +class ServiceExternalIPsConfig(proto.Message): + r"""Config to block services with externalIPs field. + + Attributes: + enabled (bool): + Whether Services with ExternalIPs field are + allowed or not. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class ListUsableSubnetworksRequest(proto.Message): + r"""ListUsableSubnetworksRequest requests the list of usable + subnetworks. available to a user for creating clusters. + + Attributes: + parent (str): + Required. The parent project where subnetworks are usable. + Specified in the format ``projects/*``. + filter (str): + Filtering currently only supports equality on the + networkProjectId and must be in the form: + "networkProjectId=[PROJECTID]", where ``networkProjectId`` + is the project which owns the listed subnetworks. This + defaults to the parent project ID. + page_size (int): + The max number of results per page that should be returned. + If the number of available results is larger than + ``page_size``, a ``next_page_token`` is returned which can + be used to get the next page of results in subsequent + requests. Acceptable values are 0 to 500, inclusive. + (Default: 500) + page_token (str): + Specifies a page token to use. Set this to + the nextPageToken returned by previous list + requests to get the next page of results. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + filter: str = proto.Field( + proto.STRING, + number=2, + ) + page_size: int = proto.Field( + proto.INT32, + number=3, + ) + page_token: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListUsableSubnetworksResponse(proto.Message): + r"""ListUsableSubnetworksResponse is the response of + ListUsableSubnetworksRequest. + + Attributes: + subnetworks (MutableSequence[google.cloud.container_v1beta1.types.UsableSubnetwork]): + A list of usable subnetworks in the specified + network project. + next_page_token (str): + This token allows you to get the next page of results for + list requests. If the number of results is larger than + ``page_size``, use the ``next_page_token`` as a value for + the query parameter ``page_token`` in the next request. The + value will become empty when there are no more pages. + """ + + @property + def raw_page(self): + return self + + subnetworks: MutableSequence['UsableSubnetwork'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='UsableSubnetwork', + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + + +class UsableSubnetworkSecondaryRange(proto.Message): + r"""Secondary IP range of a usable subnetwork. + + Attributes: + range_name (str): + The name associated with this subnetwork + secondary range, used when adding an alias IP + range to a VM instance. + ip_cidr_range (str): + The range of IP addresses belonging to this + subnetwork secondary range. + status (google.cloud.container_v1beta1.types.UsableSubnetworkSecondaryRange.Status): + This field is to determine the status of the + secondary range programmably. + """ + class Status(proto.Enum): + r"""Status shows the current usage of a secondary IP range. + + Values: + UNKNOWN (0): + UNKNOWN is the zero value of the Status enum. + It's not a valid status. + UNUSED (1): + UNUSED denotes that this range is unclaimed + by any cluster. + IN_USE_SERVICE (2): + IN_USE_SERVICE denotes that this range is claimed by a + cluster for services. It cannot be used for other clusters. + IN_USE_SHAREABLE_POD (3): + IN_USE_SHAREABLE_POD denotes this range was created by the + network admin and is currently claimed by a cluster for + pods. It can only be used by other clusters as a pod range. + IN_USE_MANAGED_POD (4): + IN_USE_MANAGED_POD denotes this range was created by GKE and + is claimed for pods. It cannot be used for other clusters. + """ + UNKNOWN = 0 + UNUSED = 1 + IN_USE_SERVICE = 2 + IN_USE_SHAREABLE_POD = 3 + IN_USE_MANAGED_POD = 4 + + range_name: str = proto.Field( + proto.STRING, + number=1, + ) + ip_cidr_range: str = proto.Field( + proto.STRING, + number=2, + ) + status: Status = proto.Field( + proto.ENUM, + number=3, + enum=Status, + ) + + +class UsableSubnetwork(proto.Message): + r"""UsableSubnetwork resource returns the subnetwork name, its + associated network and the primary CIDR range. + + Attributes: + subnetwork (str): + Subnetwork Name. + Example: + projects/my-project/regions/us-central1/subnetworks/my-subnet + network (str): + Network Name. + Example: + projects/my-project/global/networks/my-network + ip_cidr_range (str): + The range of internal addresses that are + owned by this subnetwork. + secondary_ip_ranges (MutableSequence[google.cloud.container_v1beta1.types.UsableSubnetworkSecondaryRange]): + Secondary IP ranges. + status_message (str): + A human readable status message representing the reasons for + cases where the caller cannot use the secondary ranges under + the subnet. For example if the secondary_ip_ranges is empty + due to a permission issue, an insufficient permission + message will be given by status_message. + """ + + subnetwork: str = proto.Field( + proto.STRING, + number=1, + ) + network: str = proto.Field( + proto.STRING, + number=2, + ) + ip_cidr_range: str = proto.Field( + proto.STRING, + number=3, + ) + secondary_ip_ranges: MutableSequence['UsableSubnetworkSecondaryRange'] = proto.RepeatedField( + proto.MESSAGE, + number=4, + message='UsableSubnetworkSecondaryRange', + ) + status_message: str = proto.Field( + proto.STRING, + number=5, + ) + + +class VerticalPodAutoscaling(proto.Message): + r"""VerticalPodAutoscaling contains global, per-cluster + information required by Vertical Pod Autoscaler to automatically + adjust the resources of pods controlled by it. + + Attributes: + enabled (bool): + Enables vertical pod autoscaling. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class DefaultSnatStatus(proto.Message): + r"""DefaultSnatStatus contains the desired state of whether + default sNAT should be disabled on the cluster. + + Attributes: + disabled (bool): + Disables cluster default sNAT rules. + """ + + disabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class IntraNodeVisibilityConfig(proto.Message): + r"""IntraNodeVisibilityConfig contains the desired config of the + intra-node visibility on this cluster. + + Attributes: + enabled (bool): + Enables intra node visibility for this + cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class ILBSubsettingConfig(proto.Message): + r"""ILBSubsettingConfig contains the desired config of L4 + Internal LoadBalancer subsetting on this cluster. + + Attributes: + enabled (bool): + Enables l4 ILB subsetting for this cluster + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class DNSConfig(proto.Message): + r"""DNSConfig contains the desired set of options for configuring + clusterDNS. + + Attributes: + cluster_dns (google.cloud.container_v1beta1.types.DNSConfig.Provider): + cluster_dns indicates which in-cluster DNS provider should + be used. + cluster_dns_scope (google.cloud.container_v1beta1.types.DNSConfig.DNSScope): + cluster_dns_scope indicates the scope of access to cluster + DNS records. + cluster_dns_domain (str): + cluster_dns_domain is the suffix used for all cluster + service records. + additive_vpc_scope_dns_domain (str): + Optional. The domain used in Additive VPC + scope. + """ + class Provider(proto.Enum): + r"""Provider lists the various in-cluster DNS providers. + + Values: + PROVIDER_UNSPECIFIED (0): + Default value + PLATFORM_DEFAULT (1): + Use GKE default DNS provider(kube-dns) for + DNS resolution. + CLOUD_DNS (2): + Use CloudDNS for DNS resolution. + KUBE_DNS (3): + Use KubeDNS for DNS resolution. + """ + PROVIDER_UNSPECIFIED = 0 + PLATFORM_DEFAULT = 1 + CLOUD_DNS = 2 + KUBE_DNS = 3 + + class DNSScope(proto.Enum): + r"""DNSScope lists the various scopes of access to cluster DNS + records. + + Values: + DNS_SCOPE_UNSPECIFIED (0): + Default value, will be inferred as cluster + scope. + CLUSTER_SCOPE (1): + DNS records are accessible from within the + cluster. + VPC_SCOPE (2): + DNS records are accessible from within the + VPC. + """ + DNS_SCOPE_UNSPECIFIED = 0 + CLUSTER_SCOPE = 1 + VPC_SCOPE = 2 + + cluster_dns: Provider = proto.Field( + proto.ENUM, + number=1, + enum=Provider, + ) + cluster_dns_scope: DNSScope = proto.Field( + proto.ENUM, + number=2, + enum=DNSScope, + ) + cluster_dns_domain: str = proto.Field( + proto.STRING, + number=3, + ) + additive_vpc_scope_dns_domain: str = proto.Field( + proto.STRING, + number=5, + ) + + +class MaxPodsConstraint(proto.Message): + r"""Constraints applied to pods. + + Attributes: + max_pods_per_node (int): + Constraint enforced on the max num of pods + per node. + """ + + max_pods_per_node: int = proto.Field( + proto.INT64, + number=1, + ) + + +class WorkloadIdentityConfig(proto.Message): + r"""Configuration for the use of Kubernetes Service Accounts in + GCP IAM policies. + + Attributes: + identity_namespace (str): + IAM Identity Namespace to attach all + Kubernetes Service Accounts to. + workload_pool (str): + The workload pool to attach all Kubernetes + service accounts to. + identity_provider (str): + identity provider is the third party identity + provider. + """ + + identity_namespace: str = proto.Field( + proto.STRING, + number=1, + ) + workload_pool: str = proto.Field( + proto.STRING, + number=2, + ) + identity_provider: str = proto.Field( + proto.STRING, + number=3, + ) + + +class WorkloadALTSConfig(proto.Message): + r"""Configuration for direct-path (via ALTS) with workload + identity. + + Attributes: + enable_alts (google.protobuf.wrappers_pb2.BoolValue): + enable_alts controls whether the alts handshaker should be + enabled or not for direct-path. + + Requires Workload Identity + ([workload_pool][google.container.v1beta1.WorkloadIdentityConfig.workload_pool] + must be non-empty). + """ + + enable_alts: wrappers_pb2.BoolValue = proto.Field( + proto.MESSAGE, + number=1, + message=wrappers_pb2.BoolValue, + ) + + +class WorkloadCertificates(proto.Message): + r"""Configuration for issuance of mTLS keys and certificates to + Kubernetes pods. + + Attributes: + enable_certificates (google.protobuf.wrappers_pb2.BoolValue): + enable_certificates controls issuance of workload mTLS + certificates. + + If set, the GKE Workload Identity Certificates controller + and node agent will be deployed in the cluster, which can + then be configured by creating a WorkloadCertificateConfig + Custom Resource. + + Requires Workload Identity + ([workload_pool][google.container.v1beta1.WorkloadIdentityConfig.workload_pool] + must be non-empty). + """ + + enable_certificates: wrappers_pb2.BoolValue = proto.Field( + proto.MESSAGE, + number=1, + message=wrappers_pb2.BoolValue, + ) + + +class MeshCertificates(proto.Message): + r"""Configuration for issuance of mTLS keys and certificates to + Kubernetes pods. + + Attributes: + enable_certificates (google.protobuf.wrappers_pb2.BoolValue): + enable_certificates controls issuance of workload mTLS + certificates. + + If set, the GKE Workload Identity Certificates controller + and node agent will be deployed in the cluster, which can + then be configured by creating a WorkloadCertificateConfig + Custom Resource. + + Requires Workload Identity + ([workload_pool][google.container.v1alpha1.WorkloadIdentityConfig.workload_pool] + must be non-empty). + """ + + enable_certificates: wrappers_pb2.BoolValue = proto.Field( + proto.MESSAGE, + number=1, + message=wrappers_pb2.BoolValue, + ) + + +class DatabaseEncryption(proto.Message): + r"""Configuration of etcd encryption. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + key_name (str): + Name of CloudKMS key to use for the + encryption of secrets in etcd. Ex. + projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key + state (google.cloud.container_v1beta1.types.DatabaseEncryption.State): + The desired state of etcd encryption. + current_state (google.cloud.container_v1beta1.types.DatabaseEncryption.CurrentState): + Output only. The current state of etcd + encryption. + + This field is a member of `oneof`_ ``_current_state``. + decryption_keys (MutableSequence[str]): + Output only. Keys in use by the cluster for decrypting + existing objects, in addition to the key in ``key_name``. + + Each item is a CloudKMS key resource. + last_operation_errors (MutableSequence[google.cloud.container_v1beta1.types.DatabaseEncryption.OperationError]): + Output only. Records errors seen during + DatabaseEncryption update operations. + """ + class State(proto.Enum): + r"""State of etcd encryption. + + Values: + UNKNOWN (0): + Should never be set + ENCRYPTED (1): + Secrets in etcd are encrypted. + DECRYPTED (2): + Secrets in etcd are stored in plain text (at + etcd level) - this is unrelated to Compute + Engine level full disk encryption. + """ + UNKNOWN = 0 + ENCRYPTED = 1 + DECRYPTED = 2 + + class CurrentState(proto.Enum): + r"""Current State of etcd encryption. + + Values: + CURRENT_STATE_UNSPECIFIED (0): + Should never be set + CURRENT_STATE_ENCRYPTED (7): + Secrets in etcd are encrypted. + CURRENT_STATE_DECRYPTED (2): + Secrets in etcd are stored in plain text (at + etcd level) - this is unrelated to Compute + Engine level full disk encryption. + CURRENT_STATE_ENCRYPTION_PENDING (3): + Encryption (or re-encryption with a different + CloudKMS key) of Secrets is in progress. + CURRENT_STATE_ENCRYPTION_ERROR (4): + Encryption (or re-encryption with a different + CloudKMS key) of Secrets in etcd encountered an + error. + CURRENT_STATE_DECRYPTION_PENDING (5): + De-crypting Secrets to plain text in etcd is + in progress. + CURRENT_STATE_DECRYPTION_ERROR (6): + De-crypting Secrets to plain text in etcd + encountered an error. + """ + CURRENT_STATE_UNSPECIFIED = 0 + CURRENT_STATE_ENCRYPTED = 7 + CURRENT_STATE_DECRYPTED = 2 + CURRENT_STATE_ENCRYPTION_PENDING = 3 + CURRENT_STATE_ENCRYPTION_ERROR = 4 + CURRENT_STATE_DECRYPTION_PENDING = 5 + CURRENT_STATE_DECRYPTION_ERROR = 6 + + class OperationError(proto.Message): + r"""OperationError records errors seen from CloudKMS keys + encountered during updates to DatabaseEncryption configuration. + + Attributes: + key_name (str): + CloudKMS key resource that had the error. + error_message (str): + Description of the error seen during the + operation. + timestamp (google.protobuf.timestamp_pb2.Timestamp): + Time when the CloudKMS error was seen. + """ + + key_name: str = proto.Field( + proto.STRING, + number=1, + ) + error_message: str = proto.Field( + proto.STRING, + number=2, + ) + timestamp: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + + key_name: str = proto.Field( + proto.STRING, + number=1, + ) + state: State = proto.Field( + proto.ENUM, + number=2, + enum=State, + ) + current_state: CurrentState = proto.Field( + proto.ENUM, + number=3, + optional=True, + enum=CurrentState, + ) + decryption_keys: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + last_operation_errors: MutableSequence[OperationError] = proto.RepeatedField( + proto.MESSAGE, + number=5, + message=OperationError, + ) + + +class ResourceUsageExportConfig(proto.Message): + r"""Configuration for exporting cluster resource usages. + + Attributes: + bigquery_destination (google.cloud.container_v1beta1.types.ResourceUsageExportConfig.BigQueryDestination): + Configuration to use BigQuery as usage export + destination. + enable_network_egress_metering (bool): + Whether to enable network egress metering for + this cluster. If enabled, a daemonset will be + created in the cluster to meter network egress + traffic. + consumption_metering_config (google.cloud.container_v1beta1.types.ResourceUsageExportConfig.ConsumptionMeteringConfig): + Configuration to enable resource consumption + metering. + """ + + class BigQueryDestination(proto.Message): + r"""Parameters for using BigQuery as the destination of resource + usage export. + + Attributes: + dataset_id (str): + The ID of a BigQuery Dataset. + """ + + dataset_id: str = proto.Field( + proto.STRING, + number=1, + ) + + class ConsumptionMeteringConfig(proto.Message): + r"""Parameters for controlling consumption metering. + + Attributes: + enabled (bool): + Whether to enable consumption metering for + this cluster. If enabled, a second BigQuery + table will be created to hold resource + consumption records. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + bigquery_destination: BigQueryDestination = proto.Field( + proto.MESSAGE, + number=1, + message=BigQueryDestination, + ) + enable_network_egress_metering: bool = proto.Field( + proto.BOOL, + number=2, + ) + consumption_metering_config: ConsumptionMeteringConfig = proto.Field( + proto.MESSAGE, + number=3, + message=ConsumptionMeteringConfig, + ) + + +class ShieldedNodes(proto.Message): + r"""Configuration of Shielded Nodes feature. + + Attributes: + enabled (bool): + Whether Shielded Nodes features are enabled + on all nodes in this cluster. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class VirtualNIC(proto.Message): + r"""Configuration of gVNIC feature. + + Attributes: + enabled (bool): + Whether gVNIC features are enabled in the + node pool. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class FastSocket(proto.Message): + r"""Configuration of Fast Socket feature. + + Attributes: + enabled (bool): + Whether Fast Socket features are enabled in + the node pool. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class GetOpenIDConfigRequest(proto.Message): + r"""GetOpenIDConfigRequest gets the OIDC discovery document for + the cluster. See the OpenID Connect Discovery 1.0 specification + for details. + + Attributes: + parent (str): + The cluster (project, location, cluster name) to get the + discovery document for. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + + +class GetOpenIDConfigResponse(proto.Message): + r"""GetOpenIDConfigResponse is an OIDC discovery document for the + cluster. See the OpenID Connect Discovery 1.0 specification for + details. + + Attributes: + issuer (str): + OIDC Issuer. + jwks_uri (str): + JSON Web Key uri. + response_types_supported (MutableSequence[str]): + Supported response types. + subject_types_supported (MutableSequence[str]): + Supported subject types. + id_token_signing_alg_values_supported (MutableSequence[str]): + supported ID Token signing Algorithms. + claims_supported (MutableSequence[str]): + Supported claims. + grant_types (MutableSequence[str]): + Supported grant types. + """ + + issuer: str = proto.Field( + proto.STRING, + number=1, + ) + jwks_uri: str = proto.Field( + proto.STRING, + number=2, + ) + response_types_supported: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + subject_types_supported: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + id_token_signing_alg_values_supported: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=5, + ) + claims_supported: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=6, + ) + grant_types: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=7, + ) + + +class GetJSONWebKeysRequest(proto.Message): + r"""GetJSONWebKeysRequest gets the public component of the keys used by + the cluster to sign token requests. This will be the jwks_uri for + the discover document returned by getOpenIDConfig. See the OpenID + Connect Discovery 1.0 specification for details. + + Attributes: + parent (str): + The cluster (project, location, cluster name) to get keys + for. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + + +class Jwk(proto.Message): + r"""Jwk is a JSON Web Key as specified in RFC 7517 + + Attributes: + kty (str): + Key Type. + alg (str): + Algorithm. + use (str): + Permitted uses for the public keys. + kid (str): + Key ID. + n (str): + Used for RSA keys. + e (str): + Used for RSA keys. + x (str): + Used for ECDSA keys. + y (str): + Used for ECDSA keys. + crv (str): + Used for ECDSA keys. + """ + + kty: str = proto.Field( + proto.STRING, + number=1, + ) + alg: str = proto.Field( + proto.STRING, + number=2, + ) + use: str = proto.Field( + proto.STRING, + number=3, + ) + kid: str = proto.Field( + proto.STRING, + number=4, + ) + n: str = proto.Field( + proto.STRING, + number=5, + ) + e: str = proto.Field( + proto.STRING, + number=6, + ) + x: str = proto.Field( + proto.STRING, + number=7, + ) + y: str = proto.Field( + proto.STRING, + number=8, + ) + crv: str = proto.Field( + proto.STRING, + number=9, + ) + + +class GetJSONWebKeysResponse(proto.Message): + r"""GetJSONWebKeysResponse is a valid JSON Web Key Set as + specififed in rfc 7517 + + Attributes: + keys (MutableSequence[google.cloud.container_v1beta1.types.Jwk]): + The public component of the keys used by the + cluster to sign token requests. + """ + + keys: MutableSequence['Jwk'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Jwk', + ) + + +class CheckAutopilotCompatibilityRequest(proto.Message): + r"""CheckAutopilotCompatibilityRequest requests getting the + blockers for the given operation in the cluster. + + Attributes: + name (str): + The name (project, location, cluster) of the cluster to + retrieve. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class AutopilotCompatibilityIssue(proto.Message): + r"""AutopilotCompatibilityIssue contains information about a + specific compatibility issue with Autopilot mode. + + Attributes: + last_observation (google.protobuf.timestamp_pb2.Timestamp): + The last time when this issue was observed. + constraint_type (str): + The constraint type of the issue. + incompatibility_type (google.cloud.container_v1beta1.types.AutopilotCompatibilityIssue.IssueType): + The incompatibility type of this issue. + subjects (MutableSequence[str]): + The name of the resources which are subject + to this issue. + documentation_url (str): + A URL to a public documnetation, which + addresses resolving this issue. + description (str): + The description of the issue. + """ + class IssueType(proto.Enum): + r"""The type of the reported issue. + + Values: + UNSPECIFIED (0): + Default value, should not be used. + INCOMPATIBILITY (1): + Indicates that the issue is a known + incompatibility between the cluster and + Autopilot mode. + ADDITIONAL_CONFIG_REQUIRED (2): + Indicates the issue is an incompatibility if + customers take no further action to resolve. + PASSED_WITH_OPTIONAL_CONFIG (3): + Indicates the issue is not an + incompatibility, but depending on the workloads + business logic, there is a potential that they + won't work on Autopilot. + """ + UNSPECIFIED = 0 + INCOMPATIBILITY = 1 + ADDITIONAL_CONFIG_REQUIRED = 2 + PASSED_WITH_OPTIONAL_CONFIG = 3 + + last_observation: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + constraint_type: str = proto.Field( + proto.STRING, + number=2, + ) + incompatibility_type: IssueType = proto.Field( + proto.ENUM, + number=3, + enum=IssueType, + ) + subjects: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + documentation_url: str = proto.Field( + proto.STRING, + number=5, + ) + description: str = proto.Field( + proto.STRING, + number=6, + ) + + +class CheckAutopilotCompatibilityResponse(proto.Message): + r"""CheckAutopilotCompatibilityResponse has a list of + compatibility issues. + + Attributes: + issues (MutableSequence[google.cloud.container_v1beta1.types.AutopilotCompatibilityIssue]): + The list of issues for the given operation. + summary (str): + The summary of the autopilot compatibility + response. + """ + + issues: MutableSequence['AutopilotCompatibilityIssue'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='AutopilotCompatibilityIssue', + ) + summary: str = proto.Field( + proto.STRING, + number=2, + ) + + +class ReleaseChannel(proto.Message): + r"""ReleaseChannel indicates which release channel a cluster is + subscribed to. Release channels are arranged in order of risk. + + When a cluster is subscribed to a release channel, Google + maintains both the master version and the node version. Node + auto-upgrade defaults to true and cannot be disabled. + + Attributes: + channel (google.cloud.container_v1beta1.types.ReleaseChannel.Channel): + channel specifies which release channel the + cluster is subscribed to. + """ + class Channel(proto.Enum): + r"""Possible values for 'channel'. + + Values: + UNSPECIFIED (0): + No channel specified. + RAPID (1): + RAPID channel is offered on an early access + basis for customers who want to test new + releases. + + WARNING: Versions available in the RAPID Channel + may be subject to unresolved issues with no + known workaround and are not subject to any + SLAs. + REGULAR (2): + Clusters subscribed to REGULAR receive + versions that are considered GA quality. REGULAR + is intended for production users who want to + take advantage of new features. + STABLE (3): + Clusters subscribed to STABLE receive + versions that are known to be stable and + reliable in production. + EXTENDED (4): + Clusters subscribed to EXTENDED receive + extended support and availability for versions + which are known to be stable and reliable in + production. + """ + UNSPECIFIED = 0 + RAPID = 1 + REGULAR = 2 + STABLE = 3 + EXTENDED = 4 + + channel: Channel = proto.Field( + proto.ENUM, + number=1, + enum=Channel, + ) + + +class CostManagementConfig(proto.Message): + r"""Configuration for fine-grained cost management feature. + + Attributes: + enabled (bool): + Whether the feature is enabled or not. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class TpuConfig(proto.Message): + r"""Configuration for Cloud TPU. + + Attributes: + enabled (bool): + Whether Cloud TPU integration is enabled or + not. + use_service_networking (bool): + Whether to use service networking for Cloud + TPU or not. + ipv4_cidr_block (str): + IPv4 CIDR block reserved for Cloud TPU in the + VPC. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + use_service_networking: bool = proto.Field( + proto.BOOL, + number=2, + ) + ipv4_cidr_block: str = proto.Field( + proto.STRING, + number=3, + ) + + +class Master(proto.Message): + r"""Master is the configuration for components on master. + """ + + +class AutopilotConversionStatus(proto.Message): + r"""AutopilotConversionStatus represents conversion status. + + Attributes: + state (google.cloud.container_v1beta1.types.AutopilotConversionStatus.State): + Output only. The current state of the + conversion. + """ + class State(proto.Enum): + r"""The current state of the conversion. + + Values: + STATE_UNSPECIFIED (0): + STATE_UNSPECIFIED indicates the state is unspecified. + DONE (5): + DONE indicates the conversion has been + completed. Old node pools will continue being + deleted in the background. + """ + STATE_UNSPECIFIED = 0 + DONE = 5 + + state: State = proto.Field( + proto.ENUM, + number=2, + enum=State, + ) + + +class Autopilot(proto.Message): + r"""Autopilot is the configuration for Autopilot settings on the + cluster. + + Attributes: + enabled (bool): + Enable Autopilot + workload_policy_config (google.cloud.container_v1beta1.types.WorkloadPolicyConfig): + Workload policy configuration for Autopilot. + conversion_status (google.cloud.container_v1beta1.types.AutopilotConversionStatus): + Output only. ConversionStatus shows + conversion status. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + workload_policy_config: 'WorkloadPolicyConfig' = proto.Field( + proto.MESSAGE, + number=2, + message='WorkloadPolicyConfig', + ) + conversion_status: 'AutopilotConversionStatus' = proto.Field( + proto.MESSAGE, + number=3, + message='AutopilotConversionStatus', + ) + + +class WorkloadPolicyConfig(proto.Message): + r"""WorkloadPolicyConfig is the configuration of workload policy + for autopilot clusters. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + allow_net_admin (bool): + If true, workloads can use NET_ADMIN capability. + + This field is a member of `oneof`_ ``_allow_net_admin``. + """ + + allow_net_admin: bool = proto.Field( + proto.BOOL, + number=1, + optional=True, + ) + + +class NotificationConfig(proto.Message): + r"""NotificationConfig is the configuration of notifications. + + Attributes: + pubsub (google.cloud.container_v1beta1.types.NotificationConfig.PubSub): + Notification config for Pub/Sub. + """ + class EventType(proto.Enum): + r"""Types of notifications currently supported. Can be used to + filter what notifications are sent. + + Values: + EVENT_TYPE_UNSPECIFIED (0): + Not set, will be ignored. + UPGRADE_AVAILABLE_EVENT (1): + Corresponds with UpgradeAvailableEvent. + UPGRADE_EVENT (2): + Corresponds with UpgradeEvent. + SECURITY_BULLETIN_EVENT (3): + Corresponds with SecurityBulletinEvent. + """ + EVENT_TYPE_UNSPECIFIED = 0 + UPGRADE_AVAILABLE_EVENT = 1 + UPGRADE_EVENT = 2 + SECURITY_BULLETIN_EVENT = 3 + + class PubSub(proto.Message): + r"""Pub/Sub specific notification config. + + Attributes: + enabled (bool): + Enable notifications for Pub/Sub. + topic (str): + The desired Pub/Sub topic to which notifications will be + sent by GKE. Format is + ``projects/{project}/topics/{topic}``. + filter (google.cloud.container_v1beta1.types.NotificationConfig.Filter): + Allows filtering to one or more specific + event types. If no filter is specified, or if a + filter is specified with no event types, all + event types will be sent + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + topic: str = proto.Field( + proto.STRING, + number=2, + ) + filter: 'NotificationConfig.Filter' = proto.Field( + proto.MESSAGE, + number=3, + message='NotificationConfig.Filter', + ) + + class Filter(proto.Message): + r"""Allows filtering to one or more specific event types. If + event types are present, those and only those event types will + be transmitted to the cluster. Other types will be skipped. If + no filter is specified, or no event types are present, all event + types will be sent + + Attributes: + event_type (MutableSequence[google.cloud.container_v1beta1.types.NotificationConfig.EventType]): + Event types to allowlist. + """ + + event_type: MutableSequence['NotificationConfig.EventType'] = proto.RepeatedField( + proto.ENUM, + number=1, + enum='NotificationConfig.EventType', + ) + + pubsub: PubSub = proto.Field( + proto.MESSAGE, + number=1, + message=PubSub, + ) + + +class ConfidentialNodes(proto.Message): + r"""ConfidentialNodes is configuration for the confidential nodes + feature, which makes nodes run on confidential VMs. + + Attributes: + enabled (bool): + Whether Confidential Nodes feature is + enabled. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class UpgradeEvent(proto.Message): + r"""UpgradeEvent is a notification sent to customers by the + cluster server when a resource is upgrading. + + Attributes: + resource_type (google.cloud.container_v1beta1.types.UpgradeResourceType): + The resource type that is upgrading. + operation (str): + The operation associated with this upgrade. + operation_start_time (google.protobuf.timestamp_pb2.Timestamp): + The time when the operation was started. + current_version (str): + The current version before the upgrade. + target_version (str): + The target version for the upgrade. + resource (str): + Optional relative path to the resource. For + example in node pool upgrades, the relative path + of the node pool. + """ + + resource_type: 'UpgradeResourceType' = proto.Field( + proto.ENUM, + number=1, + enum='UpgradeResourceType', + ) + operation: str = proto.Field( + proto.STRING, + number=2, + ) + operation_start_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + current_version: str = proto.Field( + proto.STRING, + number=4, + ) + target_version: str = proto.Field( + proto.STRING, + number=5, + ) + resource: str = proto.Field( + proto.STRING, + number=6, + ) + + +class UpgradeAvailableEvent(proto.Message): + r"""UpgradeAvailableEvent is a notification sent to customers + when a new available version is released. + + Attributes: + version (str): + The release version available for upgrade. + resource_type (google.cloud.container_v1beta1.types.UpgradeResourceType): + The resource type of the release version. + release_channel (google.cloud.container_v1beta1.types.ReleaseChannel): + The release channel of the version. If empty, + it means a non-channel release. + resource (str): + Optional relative path to the resource. For + example, the relative path of the node pool. + windows_versions (google.cloud.container_v1beta1.types.WindowsVersions): + Windows node versions info. + """ + + version: str = proto.Field( + proto.STRING, + number=1, + ) + resource_type: 'UpgradeResourceType' = proto.Field( + proto.ENUM, + number=2, + enum='UpgradeResourceType', + ) + release_channel: 'ReleaseChannel' = proto.Field( + proto.MESSAGE, + number=3, + message='ReleaseChannel', + ) + resource: str = proto.Field( + proto.STRING, + number=4, + ) + windows_versions: 'WindowsVersions' = proto.Field( + proto.MESSAGE, + number=5, + message='WindowsVersions', + ) + + +class SecurityBulletinEvent(proto.Message): + r"""SecurityBulletinEvent is a notification sent to customers + when a security bulletin has been posted that they are + vulnerable to. + + Attributes: + resource_type_affected (str): + The resource type (node/control plane) that + has the vulnerability. Multiple notifications (1 + notification per resource type) will be sent for + a vulnerability that affects > 1 resource type. + bulletin_id (str): + The ID of the bulletin corresponding to the + vulnerability. + cve_ids (MutableSequence[str]): + The CVEs associated with this bulletin. + severity (str): + The severity of this bulletin as it relates + to GKE. + bulletin_uri (str): + The URI link to the bulletin on the website + for more information. + brief_description (str): + A brief description of the bulletin. See the bulletin + pointed to by the bulletin_uri field for an expanded + description. + affected_supported_minors (MutableSequence[str]): + The GKE minor versions affected by this + vulnerability. + patched_versions (MutableSequence[str]): + The GKE versions where this vulnerability is + patched. + suggested_upgrade_target (str): + This represents a version selected from the patched_versions + field that the cluster receiving this notification should + most likely want to upgrade to based on its current version. + Note that if this notification is being received by a given + cluster, it means that this version is currently available + as an upgrade target in that cluster's location. + manual_steps_required (bool): + If this field is specified, it means there + are manual steps that the user must take to make + their clusters safe. + """ + + resource_type_affected: str = proto.Field( + proto.STRING, + number=1, + ) + bulletin_id: str = proto.Field( + proto.STRING, + number=2, + ) + cve_ids: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + severity: str = proto.Field( + proto.STRING, + number=4, + ) + bulletin_uri: str = proto.Field( + proto.STRING, + number=5, + ) + brief_description: str = proto.Field( + proto.STRING, + number=6, + ) + affected_supported_minors: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=7, + ) + patched_versions: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=8, + ) + suggested_upgrade_target: str = proto.Field( + proto.STRING, + number=9, + ) + manual_steps_required: bool = proto.Field( + proto.BOOL, + number=10, + ) + + +class IdentityServiceConfig(proto.Message): + r"""IdentityServiceConfig is configuration for Identity Service + which allows customers to use external identity providers with + the K8S API + + Attributes: + enabled (bool): + Whether to enable the Identity Service + component + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class LoggingConfig(proto.Message): + r"""LoggingConfig is cluster logging configuration. + + Attributes: + component_config (google.cloud.container_v1beta1.types.LoggingComponentConfig): + Logging components configuration + """ + + component_config: 'LoggingComponentConfig' = proto.Field( + proto.MESSAGE, + number=1, + message='LoggingComponentConfig', + ) + + +class LoggingComponentConfig(proto.Message): + r"""LoggingComponentConfig is cluster logging component + configuration. + + Attributes: + enable_components (MutableSequence[google.cloud.container_v1beta1.types.LoggingComponentConfig.Component]): + Select components to collect logs. An empty + set would disable all logging. + """ + class Component(proto.Enum): + r"""GKE components exposing logs + + Values: + COMPONENT_UNSPECIFIED (0): + Default value. This shouldn't be used. + SYSTEM_COMPONENTS (1): + system components + WORKLOADS (2): + workloads + APISERVER (3): + kube-apiserver + SCHEDULER (4): + kube-scheduler + CONTROLLER_MANAGER (5): + kube-controller-manager + """ + COMPONENT_UNSPECIFIED = 0 + SYSTEM_COMPONENTS = 1 + WORKLOADS = 2 + APISERVER = 3 + SCHEDULER = 4 + CONTROLLER_MANAGER = 5 + + enable_components: MutableSequence[Component] = proto.RepeatedField( + proto.ENUM, + number=1, + enum=Component, + ) + + +class RayClusterLoggingConfig(proto.Message): + r"""RayClusterLoggingConfig specifies logging configuration for + Ray clusters. + + Attributes: + enabled (bool): + Enable log collection for Ray clusters. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class MonitoringConfig(proto.Message): + r"""MonitoringConfig is cluster monitoring configuration. + + Attributes: + component_config (google.cloud.container_v1beta1.types.MonitoringComponentConfig): + Monitoring components configuration + managed_prometheus_config (google.cloud.container_v1beta1.types.ManagedPrometheusConfig): + Enable Google Cloud Managed Service for + Prometheus in the cluster. + advanced_datapath_observability_config (google.cloud.container_v1beta1.types.AdvancedDatapathObservabilityConfig): + Configuration of Advanced Datapath + Observability features. + """ + + component_config: 'MonitoringComponentConfig' = proto.Field( + proto.MESSAGE, + number=1, + message='MonitoringComponentConfig', + ) + managed_prometheus_config: 'ManagedPrometheusConfig' = proto.Field( + proto.MESSAGE, + number=2, + message='ManagedPrometheusConfig', + ) + advanced_datapath_observability_config: 'AdvancedDatapathObservabilityConfig' = proto.Field( + proto.MESSAGE, + number=3, + message='AdvancedDatapathObservabilityConfig', + ) + + +class AdvancedDatapathObservabilityConfig(proto.Message): + r"""AdvancedDatapathObservabilityConfig specifies configuration + of observability features of advanced datapath. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + enable_metrics (bool): + Expose flow metrics on nodes + relay_mode (google.cloud.container_v1beta1.types.AdvancedDatapathObservabilityConfig.RelayMode): + Method used to make Relay available + enable_relay (bool): + Enable Relay component + + This field is a member of `oneof`_ ``_enable_relay``. + """ + class RelayMode(proto.Enum): + r"""Supported Relay modes + + Values: + RELAY_MODE_UNSPECIFIED (0): + Default value. This shouldn't be used. + DISABLED (1): + disabled + INTERNAL_VPC_LB (3): + exposed via internal load balancer + EXTERNAL_LB (4): + exposed via external load balancer + """ + RELAY_MODE_UNSPECIFIED = 0 + DISABLED = 1 + INTERNAL_VPC_LB = 3 + EXTERNAL_LB = 4 + + enable_metrics: bool = proto.Field( + proto.BOOL, + number=1, + ) + relay_mode: RelayMode = proto.Field( + proto.ENUM, + number=2, + enum=RelayMode, + ) + enable_relay: bool = proto.Field( + proto.BOOL, + number=3, + optional=True, + ) + + +class RayClusterMonitoringConfig(proto.Message): + r"""RayClusterMonitoringConfig specifies monitoring configuration + for Ray clusters. + + Attributes: + enabled (bool): + Enable metrics collection for Ray clusters. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + + +class NodePoolLoggingConfig(proto.Message): + r"""NodePoolLoggingConfig specifies logging configuration for + nodepools. + + Attributes: + variant_config (google.cloud.container_v1beta1.types.LoggingVariantConfig): + Logging variant configuration. + """ + + variant_config: 'LoggingVariantConfig' = proto.Field( + proto.MESSAGE, + number=1, + message='LoggingVariantConfig', + ) + + +class LoggingVariantConfig(proto.Message): + r"""LoggingVariantConfig specifies the behaviour of the logging + component. + + Attributes: + variant (google.cloud.container_v1beta1.types.LoggingVariantConfig.Variant): + Logging variant deployed on nodes. + """ + class Variant(proto.Enum): + r"""Logging component variants. + + Values: + VARIANT_UNSPECIFIED (0): + Default value. This shouldn't be used. + DEFAULT (1): + default logging variant. + MAX_THROUGHPUT (2): + maximum logging throughput variant. + """ + VARIANT_UNSPECIFIED = 0 + DEFAULT = 1 + MAX_THROUGHPUT = 2 + + variant: Variant = proto.Field( + proto.ENUM, + number=1, + enum=Variant, + ) + + +class MonitoringComponentConfig(proto.Message): + r"""MonitoringComponentConfig is cluster monitoring component + configuration. + + Attributes: + enable_components (MutableSequence[google.cloud.container_v1beta1.types.MonitoringComponentConfig.Component]): + Select components to collect metrics. An + empty set would disable all monitoring. + """ + class Component(proto.Enum): + r"""GKE components exposing metrics + + Values: + COMPONENT_UNSPECIFIED (0): + Default value. This shouldn't be used. + SYSTEM_COMPONENTS (1): + system components + WORKLOADS (2): + Deprecated: Use Google Cloud Managed Service + for Prometheus. + APISERVER (3): + kube-apiserver + SCHEDULER (4): + kube-scheduler + CONTROLLER_MANAGER (5): + kube-controller-manager + STORAGE (7): + Storage + HPA (8): + Horizontal Pod Autoscaling + POD (9): + Pod + DAEMONSET (10): + DaemonSet + DEPLOYMENT (11): + Deployment + STATEFULSET (12): + Statefulset + CADVISOR (13): + CADVISOR + KUBELET (14): + KUBELET + DCGM (15): + NVIDIA Data Center GPU Manager (DCGM) + """ + COMPONENT_UNSPECIFIED = 0 + SYSTEM_COMPONENTS = 1 + WORKLOADS = 2 + APISERVER = 3 + SCHEDULER = 4 + CONTROLLER_MANAGER = 5 + STORAGE = 7 + HPA = 8 + POD = 9 + DAEMONSET = 10 + DEPLOYMENT = 11 + STATEFULSET = 12 + CADVISOR = 13 + KUBELET = 14 + DCGM = 15 + + enable_components: MutableSequence[Component] = proto.RepeatedField( + proto.ENUM, + number=1, + enum=Component, + ) + + +class Fleet(proto.Message): + r"""Fleet is the fleet configuration for the cluster. + + Attributes: + project (str): + The Fleet host project(project ID or project + number) where this cluster will be registered + to. This field cannot be changed after the + cluster has been registered. + membership (str): + Output only. The full resource name of the registered fleet + membership of the cluster, in the format + ``//gkehub.googleapis.com/projects/*/locations/*/memberships/*``. + pre_registered (bool): + Output only. Whether the cluster has been + registered through the fleet API. + """ + + project: str = proto.Field( + proto.STRING, + number=1, + ) + membership: str = proto.Field( + proto.STRING, + number=2, + ) + pre_registered: bool = proto.Field( + proto.BOOL, + number=3, + ) + + +class ResourceManagerTags(proto.Message): + r"""A map of resource manager tag keys and values to be attached + to the nodes for managing Compute Engine firewalls using Network + Firewall Policies. Tags must be according to specifications in + https://cloud.google.com/vpc/docs/tags-firewalls-overview#specifications. + A maximum of 5 tag key-value pairs can be specified. Existing + tags will be replaced with new values. + + Attributes: + tags (MutableMapping[str, str]): + Tags must be in one of the following formats ([KEY]=[VALUE]) + + 1. ``tagKeys/{tag_key_id}=tagValues/{tag_value_id}`` + 2. ``{org_id}/{tag_key_name}={tag_value_name}`` + 3. ``{project_id}/{tag_key_name}={tag_value_name}`` + """ + + tags: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=1, + ) + + +class EnterpriseConfig(proto.Message): + r"""EnterpriseConfig is the cluster enterprise configuration. + + Attributes: + cluster_tier (google.cloud.container_v1beta1.types.EnterpriseConfig.ClusterTier): + Output only. cluster_tier specifies the premium tier of the + cluster. + """ + class ClusterTier(proto.Enum): + r"""Premium tiers for GKE Cluster. + + Values: + CLUSTER_TIER_UNSPECIFIED (0): + CLUSTER_TIER_UNSPECIFIED is when cluster_tier is not set. + STANDARD (1): + STANDARD indicates a standard GKE cluster. + ENTERPRISE (2): + ENTERPRISE indicates a GKE Enterprise + cluster. + """ + CLUSTER_TIER_UNSPECIFIED = 0 + STANDARD = 1 + ENTERPRISE = 2 + + cluster_tier: ClusterTier = proto.Field( + proto.ENUM, + number=1, + enum=ClusterTier, + ) + + +class SecretManagerConfig(proto.Message): + r"""SecretManagerConfig is config for secret manager enablement. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + enabled (bool): + Whether the cluster is configured to use + secret manager CSI component. + + This field is a member of `oneof`_ ``_enabled``. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + optional=True, + ) + + +class SecondaryBootDisk(proto.Message): + r"""SecondaryBootDisk represents a persistent disk attached to a + node with special configurations based on its mode. + + Attributes: + mode (google.cloud.container_v1beta1.types.SecondaryBootDisk.Mode): + Disk mode (container image cache, etc.) + disk_image (str): + Fully-qualified resource ID for an existing + disk image. + """ + class Mode(proto.Enum): + r"""Mode specifies how the secondary boot disk will be used. + This triggers mode-specified logic in the control plane. + + Values: + MODE_UNSPECIFIED (0): + MODE_UNSPECIFIED is when mode is not set. + CONTAINER_IMAGE_CACHE (1): + CONTAINER_IMAGE_CACHE is for using the secondary boot disk + as a container image cache. + """ + MODE_UNSPECIFIED = 0 + CONTAINER_IMAGE_CACHE = 1 + + mode: Mode = proto.Field( + proto.ENUM, + number=1, + enum=Mode, + ) + disk_image: str = proto.Field( + proto.STRING, + number=2, + ) + + +class SecondaryBootDiskUpdateStrategy(proto.Message): + r"""SecondaryBootDiskUpdateStrategy is a placeholder which will + be extended in the future to define different options for + updating secondary boot disks. + + """ + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/mypy.ini b/owl-bot-staging/google-cloud-container/v1beta1/mypy.ini new file mode 100644 index 000000000000..574c5aed394b --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/mypy.ini @@ -0,0 +1,3 @@ +[mypy] +python_version = 3.7 +namespace_packages = True diff --git a/owl-bot-staging/google-cloud-container/v1beta1/noxfile.py b/owl-bot-staging/google-cloud-container/v1beta1/noxfile.py new file mode 100644 index 000000000000..56fbc67e34dc --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/noxfile.py @@ -0,0 +1,280 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 re +import shutil +import subprocess +import sys + + +import nox # type: ignore + +ALL_PYTHON = [ + "3.7", + "3.8", + "3.9", + "3.10", + "3.11", + "3.12", + "3.13", +] + +CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() + +LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +PACKAGE_NAME = 'google-cloud-container' + +BLACK_VERSION = "black==22.3.0" +BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] +DEFAULT_PYTHON_VERSION = "3.13" + +nox.sessions = [ + "unit", + "cover", + "mypy", + "check_lower_bounds" + # exclude update_lower_bounds from default + "docs", + "blacken", + "lint", + "prerelease_deps", +] + +@nox.session(python=ALL_PYTHON) +@nox.parametrize( + "protobuf_implementation", + [ "python", "upb", "cpp" ], +) +def unit(session, protobuf_implementation): + """Run the unit test suite.""" + + if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): + session.skip("cpp implementation is not supported in python 3.11+") + + session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') + session.install('-e', '.', "-c", f"testing/constraints-{session.python}.txt") + + # Remove the 'cpp' implementation once support for Protobuf 3.x is dropped. + # The 'cpp' implementation requires Protobuf<4. + if protobuf_implementation == "cpp": + session.install("protobuf<4") + + session.run( + 'py.test', + '--quiet', + '--cov=google/cloud/container_v1beta1/', + '--cov=tests/', + '--cov-config=.coveragerc', + '--cov-report=term', + '--cov-report=html', + os.path.join('tests', 'unit', ''.join(session.posargs)), + env={ + "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, + }, + ) + +@nox.session(python=ALL_PYTHON[-1]) +@nox.parametrize( + "protobuf_implementation", + [ "python", "upb", "cpp" ], +) +def prerelease_deps(session, protobuf_implementation): + """Run the unit test suite against pre-release versions of dependencies.""" + + if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): + session.skip("cpp implementation is not supported in python 3.11+") + + # Install test environment dependencies + session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') + + # Install the package without dependencies + session.install('-e', '.', '--no-deps') + + # We test the minimum dependency versions using the minimum Python + # version so the lowest python runtime that we test has a corresponding constraints + # file, located at `testing/constraints--.txt`, which contains all of the + # dependencies and extras. + with open( + CURRENT_DIRECTORY + / "testing" + / f"constraints-{ALL_PYTHON[0]}.txt", + encoding="utf-8", + ) as constraints_file: + constraints_text = constraints_file.read() + + # Ignore leading whitespace and comment lines. + constraints_deps = [ + match.group(1) + for match in re.finditer( + r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE + ) + ] + + session.install(*constraints_deps) + + prerel_deps = [ + "googleapis-common-protos", + "google-api-core", + "google-auth", + # Exclude grpcio!=1.67.0rc1 which does not support python 3.13 + "grpcio!=1.67.0rc1", + "grpcio-status", + "protobuf", + "proto-plus", + ] + + for dep in prerel_deps: + session.install("--pre", "--no-deps", "--upgrade", dep) + + # Remaining dependencies + other_deps = [ + "requests", + ] + session.install(*other_deps) + + # Print out prerelease package versions + + session.run("python", "-c", "import google.api_core; print(google.api_core.__version__)") + session.run("python", "-c", "import google.auth; print(google.auth.__version__)") + session.run("python", "-c", "import grpc; print(grpc.__version__)") + session.run( + "python", "-c", "import google.protobuf; print(google.protobuf.__version__)" + ) + session.run( + "python", "-c", "import proto; print(proto.__version__)" + ) + + session.run( + 'py.test', + '--quiet', + '--cov=google/cloud/container_v1beta1/', + '--cov=tests/', + '--cov-config=.coveragerc', + '--cov-report=term', + '--cov-report=html', + os.path.join('tests', 'unit', ''.join(session.posargs)), + env={ + "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, + }, + ) + + +@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', + '-p', + '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==7.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, + ) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_async.py new file mode 100644 index 000000000000..c1ea365a58cd --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CancelOperation +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_CancelOperation_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 import container_v1beta1 + + +async def sample_cancel_operation(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CancelOperationRequest( + project_id="project_id_value", + zone="zone_value", + operation_id="operation_id_value", + ) + + # Make the request + await client.cancel_operation(request=request) + + +# [END container_v1beta1_generated_ClusterManager_CancelOperation_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_sync.py new file mode 100644 index 000000000000..4feacdc1fe11 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CancelOperation +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_CancelOperation_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 import container_v1beta1 + + +def sample_cancel_operation(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CancelOperationRequest( + project_id="project_id_value", + zone="zone_value", + operation_id="operation_id_value", + ) + + # Make the request + client.cancel_operation(request=request) + + +# [END container_v1beta1_generated_ClusterManager_CancelOperation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py new file mode 100644 index 000000000000..db3c1832592a --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CheckAutopilotCompatibility +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_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 import container_v1beta1 + + +async def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = await client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py new file mode 100644 index 000000000000..4a28c080e6d6 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CheckAutopilotCompatibility +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_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 import container_v1beta1 + + +def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_async.py new file mode 100644 index 000000000000..c69e0e4a42dc --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CompleteIPRotation +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_CompleteIPRotation_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 import container_v1beta1 + + +async def sample_complete_ip_rotation(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CompleteIPRotationRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.complete_ip_rotation(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_CompleteIPRotation_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_sync.py new file mode 100644 index 000000000000..d824eaba52e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CompleteIPRotation +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_CompleteIPRotation_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 import container_v1beta1 + + +def sample_complete_ip_rotation(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CompleteIPRotationRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.complete_ip_rotation(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_CompleteIPRotation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py new file mode 100644 index 000000000000..c632dbad5a7d --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CompleteNodePoolUpgrade +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_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 import container_v1beta1 + + +async def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + await client.complete_node_pool_upgrade(request=request) + + +# [END container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py new file mode 100644 index 000000000000..08190a467b84 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CompleteNodePoolUpgrade +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_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 import container_v1beta1 + + +def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + client.complete_node_pool_upgrade(request=request) + + +# [END container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_async.py new file mode 100644 index 000000000000..93ff9cc1bff8 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CreateCluster +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_CreateCluster_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 import container_v1beta1 + + +async def sample_create_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CreateClusterRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = await client.create_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_CreateCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_sync.py new file mode 100644 index 000000000000..eeb6ed305223 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CreateCluster +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_CreateCluster_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 import container_v1beta1 + + +def sample_create_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CreateClusterRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = client.create_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_CreateCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_async.py new file mode 100644 index 000000000000..492590335c2a --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CreateNodePool +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_CreateNodePool_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 import container_v1beta1 + + +async def sample_create_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CreateNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.create_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_CreateNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_sync.py new file mode 100644 index 000000000000..7675d5dc6664 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 CreateNodePool +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_CreateNodePool_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 import container_v1beta1 + + +def sample_create_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CreateNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.create_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_CreateNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_async.py new file mode 100644 index 000000000000..b8c2f59d69f8 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 DeleteCluster +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_DeleteCluster_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 import container_v1beta1 + + +async def sample_delete_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.DeleteClusterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.delete_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_DeleteCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_sync.py new file mode 100644 index 000000000000..5ad62be2c90b --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 DeleteCluster +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_DeleteCluster_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 import container_v1beta1 + + +def sample_delete_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.DeleteClusterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.delete_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_DeleteCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_async.py new file mode 100644 index 000000000000..489c3f7944ca --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 DeleteNodePool +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_DeleteNodePool_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 import container_v1beta1 + + +async def sample_delete_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.DeleteNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = await client.delete_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_DeleteNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_sync.py new file mode 100644 index 000000000000..6a2342fa5962 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 DeleteNodePool +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_DeleteNodePool_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 import container_v1beta1 + + +def sample_delete_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.DeleteNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = client.delete_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_DeleteNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_async.py new file mode 100644 index 000000000000..30cfe625ee4f --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetCluster +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_GetCluster_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 import container_v1beta1 + + +async def sample_get_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.GetClusterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.get_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_GetCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_sync.py new file mode 100644 index 000000000000..48f0058e36aa --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetCluster +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_GetCluster_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 import container_v1beta1 + + +def sample_get_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.GetClusterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.get_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_GetCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_async.py new file mode 100644 index 000000000000..908801c1151d --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetJSONWebKeys +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_GetJSONWebKeys_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 import container_v1beta1 + + +async def sample_get_json_web_keys(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.GetJSONWebKeysRequest( + ) + + # Make the request + response = await client.get_json_web_keys(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_GetJSONWebKeys_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_sync.py new file mode 100644 index 000000000000..0e0526fe6700 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetJSONWebKeys +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_GetJSONWebKeys_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 import container_v1beta1 + + +def sample_get_json_web_keys(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.GetJSONWebKeysRequest( + ) + + # Make the request + response = client.get_json_web_keys(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_GetJSONWebKeys_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_async.py new file mode 100644 index 000000000000..0d3387eba3fc --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetNodePool +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_GetNodePool_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 import container_v1beta1 + + +async def sample_get_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.GetNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = await client.get_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_GetNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_sync.py new file mode 100644 index 000000000000..0d40fab15fb0 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetNodePool +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_GetNodePool_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 import container_v1beta1 + + +def sample_get_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.GetNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = client.get_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_GetNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_async.py new file mode 100644 index 000000000000..f02b55b89741 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetOperation +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_GetOperation_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 import container_v1beta1 + + +async def sample_get_operation(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.GetOperationRequest( + project_id="project_id_value", + zone="zone_value", + operation_id="operation_id_value", + ) + + # Make the request + response = await client.get_operation(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_GetOperation_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_sync.py new file mode 100644 index 000000000000..85cf497df166 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetOperation +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_GetOperation_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 import container_v1beta1 + + +def sample_get_operation(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.GetOperationRequest( + project_id="project_id_value", + zone="zone_value", + operation_id="operation_id_value", + ) + + # Make the request + response = client.get_operation(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_GetOperation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_async.py new file mode 100644 index 000000000000..970ee5759f2a --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetServerConfig +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_GetServerConfig_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 import container_v1beta1 + + +async def sample_get_server_config(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.GetServerConfigRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = await client.get_server_config(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_GetServerConfig_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_sync.py new file mode 100644 index 000000000000..c5283c85267d --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 GetServerConfig +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_GetServerConfig_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 import container_v1beta1 + + +def sample_get_server_config(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.GetServerConfigRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = client.get_server_config(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_GetServerConfig_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_async.py new file mode 100644 index 000000000000..8de8ac39ab9f --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListClusters +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_ListClusters_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 import container_v1beta1 + + +async def sample_list_clusters(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.ListClustersRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = await client.list_clusters(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_ListClusters_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_sync.py new file mode 100644 index 000000000000..f61bf48bec55 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListClusters +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_ListClusters_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 import container_v1beta1 + + +def sample_list_clusters(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.ListClustersRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = client.list_clusters(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_ListClusters_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_async.py new file mode 100644 index 000000000000..aedd9c4d796a --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListLocations +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_ListLocations_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 import container_v1beta1 + + +async def sample_list_locations(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.ListLocationsRequest( + parent="parent_value", + ) + + # Make the request + response = await client.list_locations(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_ListLocations_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_sync.py new file mode 100644 index 000000000000..3dbd04439d82 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListLocations +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_ListLocations_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 import container_v1beta1 + + +def sample_list_locations(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.ListLocationsRequest( + parent="parent_value", + ) + + # Make the request + response = client.list_locations(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_ListLocations_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_async.py new file mode 100644 index 000000000000..450a160a14be --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListNodePools +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_ListNodePools_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 import container_v1beta1 + + +async def sample_list_node_pools(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.ListNodePoolsRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.list_node_pools(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_ListNodePools_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_sync.py new file mode 100644 index 000000000000..74e78ae94303 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListNodePools +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_ListNodePools_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 import container_v1beta1 + + +def sample_list_node_pools(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.ListNodePoolsRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.list_node_pools(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_ListNodePools_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_async.py new file mode 100644 index 000000000000..76f947e78a73 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListOperations +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_ListOperations_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 import container_v1beta1 + + +async def sample_list_operations(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.ListOperationsRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = await client.list_operations(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_ListOperations_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_sync.py new file mode 100644 index 000000000000..916dcfb14964 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListOperations +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_ListOperations_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 import container_v1beta1 + + +def sample_list_operations(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.ListOperationsRequest( + project_id="project_id_value", + zone="zone_value", + ) + + # Make the request + response = client.list_operations(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_ListOperations_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_async.py new file mode 100644 index 000000000000..1bb6f99ff5a5 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListUsableSubnetworks +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_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 import container_v1beta1 + + +async def sample_list_usable_subnetworks(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.ListUsableSubnetworksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_usable_subnetworks(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_sync.py new file mode 100644 index 000000000000..286e0deed75a --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 ListUsableSubnetworks +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_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 import container_v1beta1 + + +def sample_list_usable_subnetworks(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.ListUsableSubnetworksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_usable_subnetworks(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_async.py new file mode 100644 index 000000000000..91d25a9dca95 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 RollbackNodePoolUpgrade +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_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 import container_v1beta1 + + +async def sample_rollback_node_pool_upgrade(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.RollbackNodePoolUpgradeRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = await client.rollback_node_pool_upgrade(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py new file mode 100644 index 000000000000..6c1ebcfe084c --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 RollbackNodePoolUpgrade +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_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 import container_v1beta1 + + +def sample_rollback_node_pool_upgrade(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.RollbackNodePoolUpgradeRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = client.rollback_node_pool_upgrade(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_async.py new file mode 100644 index 000000000000..a77709da3037 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetAddonsConfig +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetAddonsConfig_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 import container_v1beta1 + + +async def sample_set_addons_config(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetAddonsConfigRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.set_addons_config(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetAddonsConfig_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_sync.py new file mode 100644 index 000000000000..70a4f122f8b2 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetAddonsConfig +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetAddonsConfig_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 import container_v1beta1 + + +def sample_set_addons_config(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetAddonsConfigRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.set_addons_config(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetAddonsConfig_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_async.py new file mode 100644 index 000000000000..5d6ba506002c --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLabels +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetLabels_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 import container_v1beta1 + + +async def sample_set_labels(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLabelsRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + label_fingerprint="label_fingerprint_value", + ) + + # Make the request + response = await client.set_labels(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetLabels_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_sync.py new file mode 100644 index 000000000000..046ae80a1cd9 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLabels +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetLabels_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 import container_v1beta1 + + +def sample_set_labels(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLabelsRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + label_fingerprint="label_fingerprint_value", + ) + + # Make the request + response = client.set_labels(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetLabels_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_async.py new file mode 100644 index 000000000000..8d8e3c574225 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLegacyAbac +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetLegacyAbac_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 import container_v1beta1 + + +async def sample_set_legacy_abac(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLegacyAbacRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + enabled=True, + ) + + # Make the request + response = await client.set_legacy_abac(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetLegacyAbac_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_sync.py new file mode 100644 index 000000000000..ab5375941d99 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLegacyAbac +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetLegacyAbac_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 import container_v1beta1 + + +def sample_set_legacy_abac(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLegacyAbacRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + enabled=True, + ) + + # Make the request + response = client.set_legacy_abac(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetLegacyAbac_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_async.py new file mode 100644 index 000000000000..85b77c9f3ec3 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLocations +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetLocations_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 import container_v1beta1 + + +async def sample_set_locations(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLocationsRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + locations=['locations_value1', 'locations_value2'], + ) + + # Make the request + response = await client.set_locations(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetLocations_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_sync.py new file mode 100644 index 000000000000..b75e4845bdc6 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLocations +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetLocations_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 import container_v1beta1 + + +def sample_set_locations(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLocationsRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + locations=['locations_value1', 'locations_value2'], + ) + + # Make the request + response = client.set_locations(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetLocations_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_async.py new file mode 100644 index 000000000000..06af3ddf004b --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLoggingService +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetLoggingService_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 import container_v1beta1 + + +async def sample_set_logging_service(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLoggingServiceRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + logging_service="logging_service_value", + ) + + # Make the request + response = await client.set_logging_service(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetLoggingService_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_sync.py new file mode 100644 index 000000000000..f50d24b82e6d --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetLoggingService +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetLoggingService_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 import container_v1beta1 + + +def sample_set_logging_service(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetLoggingServiceRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + logging_service="logging_service_value", + ) + + # Make the request + response = client.set_logging_service(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetLoggingService_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_async.py new file mode 100644 index 000000000000..c57e1468731a --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetMaintenancePolicy +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_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 import container_v1beta1 + + +async def sample_set_maintenance_policy(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetMaintenancePolicyRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.set_maintenance_policy(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_sync.py new file mode 100644 index 000000000000..f55224117345 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetMaintenancePolicy +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_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 import container_v1beta1 + + +def sample_set_maintenance_policy(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetMaintenancePolicyRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.set_maintenance_policy(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_async.py new file mode 100644 index 000000000000..078eedc19f68 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetMasterAuth +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetMasterAuth_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 import container_v1beta1 + + +async def sample_set_master_auth(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetMasterAuthRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + action="SET_USERNAME", + ) + + # Make the request + response = await client.set_master_auth(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetMasterAuth_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_sync.py new file mode 100644 index 000000000000..0b352a531d24 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetMasterAuth +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetMasterAuth_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 import container_v1beta1 + + +def sample_set_master_auth(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetMasterAuthRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + action="SET_USERNAME", + ) + + # Make the request + response = client.set_master_auth(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetMasterAuth_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_async.py new file mode 100644 index 000000000000..8b6bbcef8829 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetMonitoringService +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetMonitoringService_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 import container_v1beta1 + + +async def sample_set_monitoring_service(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetMonitoringServiceRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + monitoring_service="monitoring_service_value", + ) + + # Make the request + response = await client.set_monitoring_service(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetMonitoringService_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_sync.py new file mode 100644 index 000000000000..05bd4ce3d8cf --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetMonitoringService +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetMonitoringService_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 import container_v1beta1 + + +def sample_set_monitoring_service(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetMonitoringServiceRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + monitoring_service="monitoring_service_value", + ) + + # Make the request + response = client.set_monitoring_service(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetMonitoringService_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_async.py new file mode 100644 index 000000000000..360642acb5b5 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNetworkPolicy +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetNetworkPolicy_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 import container_v1beta1 + + +async def sample_set_network_policy(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNetworkPolicyRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.set_network_policy(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetNetworkPolicy_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_sync.py new file mode 100644 index 000000000000..cd9551639b17 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNetworkPolicy +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetNetworkPolicy_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 import container_v1beta1 + + +def sample_set_network_policy(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNetworkPolicyRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.set_network_policy(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetNetworkPolicy_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_async.py new file mode 100644 index 000000000000..34b65cd7461e --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNodePoolAutoscaling +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_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 import container_v1beta1 + + +async def sample_set_node_pool_autoscaling(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNodePoolAutoscalingRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = await client.set_node_pool_autoscaling(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_sync.py new file mode 100644 index 000000000000..78a7e8f4e631 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNodePoolAutoscaling +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_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 import container_v1beta1 + + +def sample_set_node_pool_autoscaling(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNodePoolAutoscalingRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = client.set_node_pool_autoscaling(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_async.py new file mode 100644 index 000000000000..0d8fafdf74d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNodePoolManagement +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetNodePoolManagement_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 import container_v1beta1 + + +async def sample_set_node_pool_management(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNodePoolManagementRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = await client.set_node_pool_management(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetNodePoolManagement_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_sync.py new file mode 100644 index 000000000000..d4a1c065ece5 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNodePoolManagement +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetNodePoolManagement_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 import container_v1beta1 + + +def sample_set_node_pool_management(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNodePoolManagementRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + ) + + # Make the request + response = client.set_node_pool_management(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetNodePoolManagement_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_async.py new file mode 100644 index 000000000000..892d141e9c68 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNodePoolSize +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetNodePoolSize_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 import container_v1beta1 + + +async def sample_set_node_pool_size(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNodePoolSizeRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + node_count=1070, + ) + + # Make the request + response = await client.set_node_pool_size(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetNodePoolSize_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_sync.py new file mode 100644 index 000000000000..bc9b343ab962 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 SetNodePoolSize +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_SetNodePoolSize_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 import container_v1beta1 + + +def sample_set_node_pool_size(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.SetNodePoolSizeRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + node_count=1070, + ) + + # Make the request + response = client.set_node_pool_size(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_SetNodePoolSize_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_async.py new file mode 100644 index 000000000000..9c846b9cdcbe --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 StartIPRotation +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_StartIPRotation_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 import container_v1beta1 + + +async def sample_start_ip_rotation(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.StartIPRotationRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.start_ip_rotation(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_StartIPRotation_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_sync.py new file mode 100644 index 000000000000..dfe296ab6db3 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 StartIPRotation +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_StartIPRotation_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 import container_v1beta1 + + +def sample_start_ip_rotation(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.StartIPRotationRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.start_ip_rotation(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_StartIPRotation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_async.py new file mode 100644 index 000000000000..a8a5fb1bc41f --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 UpdateCluster +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_UpdateCluster_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 import container_v1beta1 + + +async def sample_update_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.UpdateClusterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = await client.update_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_UpdateCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_sync.py new file mode 100644 index 000000000000..3d8090ea9526 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 UpdateCluster +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_UpdateCluster_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 import container_v1beta1 + + +def sample_update_cluster(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.UpdateClusterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + ) + + # Make the request + response = client.update_cluster(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_UpdateCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_async.py new file mode 100644 index 000000000000..d802e8f2d3e3 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 UpdateMaster +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_UpdateMaster_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 import container_v1beta1 + + +async def sample_update_master(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.UpdateMasterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + master_version="master_version_value", + ) + + # Make the request + response = await client.update_master(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_UpdateMaster_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_sync.py new file mode 100644 index 000000000000..a47f3aaa5e99 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 UpdateMaster +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_UpdateMaster_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 import container_v1beta1 + + +def sample_update_master(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.UpdateMasterRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + master_version="master_version_value", + ) + + # Make the request + response = client.update_master(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_UpdateMaster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_async.py new file mode 100644 index 000000000000..e3bb4c1aedba --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 UpdateNodePool +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_UpdateNodePool_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 import container_v1beta1 + + +async def sample_update_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.UpdateNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + node_version="node_version_value", + image_type="image_type_value", + ) + + # Make the request + response = await client.update_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_UpdateNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_sync.py new file mode 100644 index 000000000000..3c7ee0c68e78 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 UpdateNodePool +# 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-container + + +# [START container_v1beta1_generated_ClusterManager_UpdateNodePool_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 import container_v1beta1 + + +def sample_update_node_pool(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.UpdateNodePoolRequest( + project_id="project_id_value", + zone="zone_value", + cluster_id="cluster_id_value", + node_pool_id="node_pool_id_value", + node_version="node_version_value", + image_type="image_type_value", + ) + + # Make the request + response = client.update_node_pool(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_UpdateNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/snippet_metadata_google.container.v1beta1.json b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/snippet_metadata_google.container.v1beta1.json new file mode 100644 index 000000000000..a1b63076c321 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/snippet_metadata_google.container.v1beta1.json @@ -0,0 +1,6110 @@ +{ + "clientLibrary": { + "apis": [ + { + "id": "google.container.v1beta1", + "version": "v1beta1" + } + ], + "language": "PYTHON", + "name": "google-cloud-container", + "version": "0.1.0" + }, + "snippets": [ + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.cancel_operation", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CancelOperation", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CancelOperation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CancelOperationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "operation_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "shortName": "cancel_operation" + }, + "description": "Sample for CancelOperation", + "file": "container_v1beta1_generated_cluster_manager_cancel_operation_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CancelOperation_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_cancel_operation_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.cancel_operation", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CancelOperation", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CancelOperation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CancelOperationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "operation_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "shortName": "cancel_operation" + }, + "description": "Sample for CancelOperation", + "file": "container_v1beta1_generated_cluster_manager_cancel_operation_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CancelOperation_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_cancel_operation_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.check_autopilot_compatibility", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CheckAutopilotCompatibility", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CheckAutopilotCompatibility" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityResponse", + "shortName": "check_autopilot_compatibility" + }, + "description": "Sample for CheckAutopilotCompatibility", + "file": "container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.check_autopilot_compatibility", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CheckAutopilotCompatibility", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CheckAutopilotCompatibility" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityResponse", + "shortName": "check_autopilot_compatibility" + }, + "description": "Sample for CheckAutopilotCompatibility", + "file": "container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.complete_ip_rotation", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CompleteIPRotation", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CompleteIPRotation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CompleteIPRotationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "complete_ip_rotation" + }, + "description": "Sample for CompleteIPRotation", + "file": "container_v1beta1_generated_cluster_manager_complete_ip_rotation_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CompleteIPRotation_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_complete_ip_rotation_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.complete_ip_rotation", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CompleteIPRotation", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CompleteIPRotation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CompleteIPRotationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "complete_ip_rotation" + }, + "description": "Sample for CompleteIPRotation", + "file": "container_v1beta1_generated_cluster_manager_complete_ip_rotation_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CompleteIPRotation_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_complete_ip_rotation_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.complete_node_pool_upgrade", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CompleteNodePoolUpgrade", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CompleteNodePoolUpgrade" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CompleteNodePoolUpgradeRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "shortName": "complete_node_pool_upgrade" + }, + "description": "Sample for CompleteNodePoolUpgrade", + "file": "container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.complete_node_pool_upgrade", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CompleteNodePoolUpgrade", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CompleteNodePoolUpgrade" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CompleteNodePoolUpgradeRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "shortName": "complete_node_pool_upgrade" + }, + "description": "Sample for CompleteNodePoolUpgrade", + "file": "container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.create_cluster", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CreateCluster", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CreateCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CreateClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster", + "type": "google.cloud.container_v1beta1.types.Cluster" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "create_cluster" + }, + "description": "Sample for CreateCluster", + "file": "container_v1beta1_generated_cluster_manager_create_cluster_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CreateCluster_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": "container_v1beta1_generated_cluster_manager_create_cluster_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.create_cluster", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CreateCluster", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CreateCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CreateClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster", + "type": "google.cloud.container_v1beta1.types.Cluster" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "create_cluster" + }, + "description": "Sample for CreateCluster", + "file": "container_v1beta1_generated_cluster_manager_create_cluster_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CreateCluster_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": "container_v1beta1_generated_cluster_manager_create_cluster_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.create_node_pool", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CreateNodePool", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CreateNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CreateNodePoolRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool", + "type": "google.cloud.container_v1beta1.types.NodePool" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "create_node_pool" + }, + "description": "Sample for CreateNodePool", + "file": "container_v1beta1_generated_cluster_manager_create_node_pool_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CreateNodePool_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_create_node_pool_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.create_node_pool", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CreateNodePool", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CreateNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CreateNodePoolRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool", + "type": "google.cloud.container_v1beta1.types.NodePool" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "create_node_pool" + }, + "description": "Sample for CreateNodePool", + "file": "container_v1beta1_generated_cluster_manager_create_node_pool_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CreateNodePool_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_create_node_pool_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.delete_cluster", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.DeleteCluster", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "DeleteCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.DeleteClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "delete_cluster" + }, + "description": "Sample for DeleteCluster", + "file": "container_v1beta1_generated_cluster_manager_delete_cluster_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_DeleteCluster_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_delete_cluster_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.delete_cluster", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.DeleteCluster", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "DeleteCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.DeleteClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "delete_cluster" + }, + "description": "Sample for DeleteCluster", + "file": "container_v1beta1_generated_cluster_manager_delete_cluster_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_DeleteCluster_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_delete_cluster_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.delete_node_pool", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.DeleteNodePool", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "DeleteNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.DeleteNodePoolRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "delete_node_pool" + }, + "description": "Sample for DeleteNodePool", + "file": "container_v1beta1_generated_cluster_manager_delete_node_pool_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_DeleteNodePool_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": "container_v1beta1_generated_cluster_manager_delete_node_pool_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.delete_node_pool", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.DeleteNodePool", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "DeleteNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.DeleteNodePoolRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "delete_node_pool" + }, + "description": "Sample for DeleteNodePool", + "file": "container_v1beta1_generated_cluster_manager_delete_node_pool_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_DeleteNodePool_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": "container_v1beta1_generated_cluster_manager_delete_node_pool_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.get_cluster", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.GetCluster", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.GetClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Cluster", + "shortName": "get_cluster" + }, + "description": "Sample for GetCluster", + "file": "container_v1beta1_generated_cluster_manager_get_cluster_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_GetCluster_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_get_cluster_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.get_cluster", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.GetCluster", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.GetClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Cluster", + "shortName": "get_cluster" + }, + "description": "Sample for GetCluster", + "file": "container_v1beta1_generated_cluster_manager_get_cluster_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_GetCluster_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_get_cluster_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.get_json_web_keys", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.GetJSONWebKeys", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetJSONWebKeys" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.GetJSONWebKeysRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.GetJSONWebKeysResponse", + "shortName": "get_json_web_keys" + }, + "description": "Sample for GetJSONWebKeys", + "file": "container_v1beta1_generated_cluster_manager_get_json_web_keys_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_GetJSONWebKeys_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_get_json_web_keys_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.get_json_web_keys", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.GetJSONWebKeys", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetJSONWebKeys" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.GetJSONWebKeysRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.GetJSONWebKeysResponse", + "shortName": "get_json_web_keys" + }, + "description": "Sample for GetJSONWebKeys", + "file": "container_v1beta1_generated_cluster_manager_get_json_web_keys_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_GetJSONWebKeys_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_get_json_web_keys_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.get_node_pool", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.GetNodePool", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.GetNodePoolRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.NodePool", + "shortName": "get_node_pool" + }, + "description": "Sample for GetNodePool", + "file": "container_v1beta1_generated_cluster_manager_get_node_pool_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_GetNodePool_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": "container_v1beta1_generated_cluster_manager_get_node_pool_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.get_node_pool", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.GetNodePool", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.GetNodePoolRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.NodePool", + "shortName": "get_node_pool" + }, + "description": "Sample for GetNodePool", + "file": "container_v1beta1_generated_cluster_manager_get_node_pool_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_GetNodePool_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": "container_v1beta1_generated_cluster_manager_get_node_pool_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.get_operation", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.GetOperation", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetOperation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.GetOperationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "operation_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "get_operation" + }, + "description": "Sample for GetOperation", + "file": "container_v1beta1_generated_cluster_manager_get_operation_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_GetOperation_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_get_operation_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.get_operation", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.GetOperation", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetOperation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.GetOperationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "operation_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "get_operation" + }, + "description": "Sample for GetOperation", + "file": "container_v1beta1_generated_cluster_manager_get_operation_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_GetOperation_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_get_operation_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.get_server_config", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.GetServerConfig", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetServerConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.GetServerConfigRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.ServerConfig", + "shortName": "get_server_config" + }, + "description": "Sample for GetServerConfig", + "file": "container_v1beta1_generated_cluster_manager_get_server_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_GetServerConfig_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": "container_v1beta1_generated_cluster_manager_get_server_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.get_server_config", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.GetServerConfig", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "GetServerConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.GetServerConfigRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.ServerConfig", + "shortName": "get_server_config" + }, + "description": "Sample for GetServerConfig", + "file": "container_v1beta1_generated_cluster_manager_get_server_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_GetServerConfig_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": "container_v1beta1_generated_cluster_manager_get_server_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.list_clusters", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.ListClusters", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListClusters" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.ListClustersRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.ListClustersResponse", + "shortName": "list_clusters" + }, + "description": "Sample for ListClusters", + "file": "container_v1beta1_generated_cluster_manager_list_clusters_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_ListClusters_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": "container_v1beta1_generated_cluster_manager_list_clusters_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.list_clusters", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.ListClusters", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListClusters" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.ListClustersRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.ListClustersResponse", + "shortName": "list_clusters" + }, + "description": "Sample for ListClusters", + "file": "container_v1beta1_generated_cluster_manager_list_clusters_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_ListClusters_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": "container_v1beta1_generated_cluster_manager_list_clusters_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.list_locations", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.ListLocations", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListLocations" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.ListLocationsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.ListLocationsResponse", + "shortName": "list_locations" + }, + "description": "Sample for ListLocations", + "file": "container_v1beta1_generated_cluster_manager_list_locations_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_ListLocations_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": "container_v1beta1_generated_cluster_manager_list_locations_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.list_locations", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.ListLocations", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListLocations" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.ListLocationsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.ListLocationsResponse", + "shortName": "list_locations" + }, + "description": "Sample for ListLocations", + "file": "container_v1beta1_generated_cluster_manager_list_locations_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_ListLocations_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": "container_v1beta1_generated_cluster_manager_list_locations_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.list_node_pools", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.ListNodePools", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListNodePools" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.ListNodePoolsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.ListNodePoolsResponse", + "shortName": "list_node_pools" + }, + "description": "Sample for ListNodePools", + "file": "container_v1beta1_generated_cluster_manager_list_node_pools_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_ListNodePools_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_list_node_pools_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.list_node_pools", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.ListNodePools", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListNodePools" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.ListNodePoolsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.ListNodePoolsResponse", + "shortName": "list_node_pools" + }, + "description": "Sample for ListNodePools", + "file": "container_v1beta1_generated_cluster_manager_list_node_pools_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_ListNodePools_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_list_node_pools_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.list_operations", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.ListOperations", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListOperations" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.ListOperationsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.ListOperationsResponse", + "shortName": "list_operations" + }, + "description": "Sample for ListOperations", + "file": "container_v1beta1_generated_cluster_manager_list_operations_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_ListOperations_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": "container_v1beta1_generated_cluster_manager_list_operations_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.list_operations", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.ListOperations", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListOperations" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.ListOperationsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.ListOperationsResponse", + "shortName": "list_operations" + }, + "description": "Sample for ListOperations", + "file": "container_v1beta1_generated_cluster_manager_list_operations_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_ListOperations_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": "container_v1beta1_generated_cluster_manager_list_operations_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.list_usable_subnetworks", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.ListUsableSubnetworks", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListUsableSubnetworks" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.ListUsableSubnetworksRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.services.cluster_manager.pagers.ListUsableSubnetworksAsyncPager", + "shortName": "list_usable_subnetworks" + }, + "description": "Sample for ListUsableSubnetworks", + "file": "container_v1beta1_generated_cluster_manager_list_usable_subnetworks_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_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": "container_v1beta1_generated_cluster_manager_list_usable_subnetworks_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.list_usable_subnetworks", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.ListUsableSubnetworks", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "ListUsableSubnetworks" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.ListUsableSubnetworksRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.services.cluster_manager.pagers.ListUsableSubnetworksPager", + "shortName": "list_usable_subnetworks" + }, + "description": "Sample for ListUsableSubnetworks", + "file": "container_v1beta1_generated_cluster_manager_list_usable_subnetworks_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_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": "container_v1beta1_generated_cluster_manager_list_usable_subnetworks_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.rollback_node_pool_upgrade", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.RollbackNodePoolUpgrade", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "RollbackNodePoolUpgrade" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.RollbackNodePoolUpgradeRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "rollback_node_pool_upgrade" + }, + "description": "Sample for RollbackNodePoolUpgrade", + "file": "container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_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": "container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.rollback_node_pool_upgrade", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.RollbackNodePoolUpgrade", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "RollbackNodePoolUpgrade" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.RollbackNodePoolUpgradeRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "rollback_node_pool_upgrade" + }, + "description": "Sample for RollbackNodePoolUpgrade", + "file": "container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_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": "container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_addons_config", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetAddonsConfig", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetAddonsConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetAddonsConfigRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "addons_config", + "type": "google.cloud.container_v1beta1.types.AddonsConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_addons_config" + }, + "description": "Sample for SetAddonsConfig", + "file": "container_v1beta1_generated_cluster_manager_set_addons_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetAddonsConfig_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_set_addons_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_addons_config", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetAddonsConfig", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetAddonsConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetAddonsConfigRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "addons_config", + "type": "google.cloud.container_v1beta1.types.AddonsConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_addons_config" + }, + "description": "Sample for SetAddonsConfig", + "file": "container_v1beta1_generated_cluster_manager_set_addons_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetAddonsConfig_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_set_addons_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_labels", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetLabels", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLabels" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetLabelsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "resource_labels", + "type": "MutableMapping[str, str]" + }, + { + "name": "label_fingerprint", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_labels" + }, + "description": "Sample for SetLabels", + "file": "container_v1beta1_generated_cluster_manager_set_labels_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetLabels_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": "container_v1beta1_generated_cluster_manager_set_labels_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_labels", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetLabels", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLabels" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetLabelsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "resource_labels", + "type": "MutableMapping[str, str]" + }, + { + "name": "label_fingerprint", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_labels" + }, + "description": "Sample for SetLabels", + "file": "container_v1beta1_generated_cluster_manager_set_labels_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetLabels_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": "container_v1beta1_generated_cluster_manager_set_labels_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_legacy_abac", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetLegacyAbac", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLegacyAbac" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetLegacyAbacRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "enabled", + "type": "bool" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_legacy_abac" + }, + "description": "Sample for SetLegacyAbac", + "file": "container_v1beta1_generated_cluster_manager_set_legacy_abac_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetLegacyAbac_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": "container_v1beta1_generated_cluster_manager_set_legacy_abac_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_legacy_abac", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetLegacyAbac", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLegacyAbac" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetLegacyAbacRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "enabled", + "type": "bool" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_legacy_abac" + }, + "description": "Sample for SetLegacyAbac", + "file": "container_v1beta1_generated_cluster_manager_set_legacy_abac_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetLegacyAbac_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": "container_v1beta1_generated_cluster_manager_set_legacy_abac_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_locations", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetLocations", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLocations" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetLocationsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "locations", + "type": "MutableSequence[str]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_locations" + }, + "description": "Sample for SetLocations", + "file": "container_v1beta1_generated_cluster_manager_set_locations_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetLocations_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": "container_v1beta1_generated_cluster_manager_set_locations_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_locations", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetLocations", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLocations" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetLocationsRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "locations", + "type": "MutableSequence[str]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_locations" + }, + "description": "Sample for SetLocations", + "file": "container_v1beta1_generated_cluster_manager_set_locations_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetLocations_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": "container_v1beta1_generated_cluster_manager_set_locations_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_logging_service", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetLoggingService", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLoggingService" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetLoggingServiceRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "logging_service", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_logging_service" + }, + "description": "Sample for SetLoggingService", + "file": "container_v1beta1_generated_cluster_manager_set_logging_service_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetLoggingService_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": "container_v1beta1_generated_cluster_manager_set_logging_service_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_logging_service", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetLoggingService", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetLoggingService" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetLoggingServiceRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "logging_service", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_logging_service" + }, + "description": "Sample for SetLoggingService", + "file": "container_v1beta1_generated_cluster_manager_set_logging_service_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetLoggingService_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": "container_v1beta1_generated_cluster_manager_set_logging_service_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_maintenance_policy", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetMaintenancePolicy", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetMaintenancePolicy" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetMaintenancePolicyRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "maintenance_policy", + "type": "google.cloud.container_v1beta1.types.MaintenancePolicy" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_maintenance_policy" + }, + "description": "Sample for SetMaintenancePolicy", + "file": "container_v1beta1_generated_cluster_manager_set_maintenance_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_set_maintenance_policy_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_maintenance_policy", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetMaintenancePolicy", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetMaintenancePolicy" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetMaintenancePolicyRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "maintenance_policy", + "type": "google.cloud.container_v1beta1.types.MaintenancePolicy" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_maintenance_policy" + }, + "description": "Sample for SetMaintenancePolicy", + "file": "container_v1beta1_generated_cluster_manager_set_maintenance_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_set_maintenance_policy_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_master_auth", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetMasterAuth", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetMasterAuth" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetMasterAuthRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_master_auth" + }, + "description": "Sample for SetMasterAuth", + "file": "container_v1beta1_generated_cluster_manager_set_master_auth_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetMasterAuth_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": "container_v1beta1_generated_cluster_manager_set_master_auth_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_master_auth", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetMasterAuth", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetMasterAuth" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetMasterAuthRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_master_auth" + }, + "description": "Sample for SetMasterAuth", + "file": "container_v1beta1_generated_cluster_manager_set_master_auth_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetMasterAuth_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": "container_v1beta1_generated_cluster_manager_set_master_auth_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_monitoring_service", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetMonitoringService", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetMonitoringService" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetMonitoringServiceRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "monitoring_service", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_monitoring_service" + }, + "description": "Sample for SetMonitoringService", + "file": "container_v1beta1_generated_cluster_manager_set_monitoring_service_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetMonitoringService_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": "container_v1beta1_generated_cluster_manager_set_monitoring_service_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_monitoring_service", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetMonitoringService", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetMonitoringService" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetMonitoringServiceRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "monitoring_service", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_monitoring_service" + }, + "description": "Sample for SetMonitoringService", + "file": "container_v1beta1_generated_cluster_manager_set_monitoring_service_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetMonitoringService_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": "container_v1beta1_generated_cluster_manager_set_monitoring_service_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_network_policy", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetNetworkPolicy", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNetworkPolicy" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetNetworkPolicyRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "network_policy", + "type": "google.cloud.container_v1beta1.types.NetworkPolicy" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_network_policy" + }, + "description": "Sample for SetNetworkPolicy", + "file": "container_v1beta1_generated_cluster_manager_set_network_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetNetworkPolicy_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_set_network_policy_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_network_policy", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetNetworkPolicy", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNetworkPolicy" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetNetworkPolicyRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "network_policy", + "type": "google.cloud.container_v1beta1.types.NetworkPolicy" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_network_policy" + }, + "description": "Sample for SetNetworkPolicy", + "file": "container_v1beta1_generated_cluster_manager_set_network_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetNetworkPolicy_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_set_network_policy_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_node_pool_autoscaling", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolAutoscaling", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNodePoolAutoscaling" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetNodePoolAutoscalingRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_node_pool_autoscaling" + }, + "description": "Sample for SetNodePoolAutoscaling", + "file": "container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_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": "container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_node_pool_autoscaling", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolAutoscaling", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNodePoolAutoscaling" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetNodePoolAutoscalingRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_node_pool_autoscaling" + }, + "description": "Sample for SetNodePoolAutoscaling", + "file": "container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_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": "container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_node_pool_management", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolManagement", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNodePoolManagement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetNodePoolManagementRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "management", + "type": "google.cloud.container_v1beta1.types.NodeManagement" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_node_pool_management" + }, + "description": "Sample for SetNodePoolManagement", + "file": "container_v1beta1_generated_cluster_manager_set_node_pool_management_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolManagement_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": "container_v1beta1_generated_cluster_manager_set_node_pool_management_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_node_pool_management", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolManagement", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNodePoolManagement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetNodePoolManagementRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "node_pool_id", + "type": "str" + }, + { + "name": "management", + "type": "google.cloud.container_v1beta1.types.NodeManagement" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_node_pool_management" + }, + "description": "Sample for SetNodePoolManagement", + "file": "container_v1beta1_generated_cluster_manager_set_node_pool_management_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolManagement_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": "container_v1beta1_generated_cluster_manager_set_node_pool_management_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_node_pool_size", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolSize", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNodePoolSize" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetNodePoolSizeRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_node_pool_size" + }, + "description": "Sample for SetNodePoolSize", + "file": "container_v1beta1_generated_cluster_manager_set_node_pool_size_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolSize_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": "container_v1beta1_generated_cluster_manager_set_node_pool_size_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_node_pool_size", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolSize", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "SetNodePoolSize" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.SetNodePoolSizeRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "set_node_pool_size" + }, + "description": "Sample for SetNodePoolSize", + "file": "container_v1beta1_generated_cluster_manager_set_node_pool_size_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolSize_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": "container_v1beta1_generated_cluster_manager_set_node_pool_size_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.start_ip_rotation", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.StartIPRotation", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "StartIPRotation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.StartIPRotationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "start_ip_rotation" + }, + "description": "Sample for StartIPRotation", + "file": "container_v1beta1_generated_cluster_manager_start_ip_rotation_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_StartIPRotation_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_start_ip_rotation_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.start_ip_rotation", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.StartIPRotation", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "StartIPRotation" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.StartIPRotationRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "start_ip_rotation" + }, + "description": "Sample for StartIPRotation", + "file": "container_v1beta1_generated_cluster_manager_start_ip_rotation_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_StartIPRotation_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_start_ip_rotation_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.update_cluster", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.UpdateCluster", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "UpdateCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.UpdateClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "update", + "type": "google.cloud.container_v1beta1.types.ClusterUpdate" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "update_cluster" + }, + "description": "Sample for UpdateCluster", + "file": "container_v1beta1_generated_cluster_manager_update_cluster_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_UpdateCluster_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_update_cluster_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.update_cluster", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.UpdateCluster", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "UpdateCluster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.UpdateClusterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "update", + "type": "google.cloud.container_v1beta1.types.ClusterUpdate" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "update_cluster" + }, + "description": "Sample for UpdateCluster", + "file": "container_v1beta1_generated_cluster_manager_update_cluster_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_UpdateCluster_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_update_cluster_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.update_master", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.UpdateMaster", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "UpdateMaster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.UpdateMasterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "master_version", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "update_master" + }, + "description": "Sample for UpdateMaster", + "file": "container_v1beta1_generated_cluster_manager_update_master_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_UpdateMaster_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": "container_v1beta1_generated_cluster_manager_update_master_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.update_master", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.UpdateMaster", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "UpdateMaster" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.UpdateMasterRequest" + }, + { + "name": "project_id", + "type": "str" + }, + { + "name": "zone", + "type": "str" + }, + { + "name": "cluster_id", + "type": "str" + }, + { + "name": "master_version", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "update_master" + }, + "description": "Sample for UpdateMaster", + "file": "container_v1beta1_generated_cluster_manager_update_master_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_UpdateMaster_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": "container_v1beta1_generated_cluster_manager_update_master_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.update_node_pool", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.UpdateNodePool", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "UpdateNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.UpdateNodePoolRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "update_node_pool" + }, + "description": "Sample for UpdateNodePool", + "file": "container_v1beta1_generated_cluster_manager_update_node_pool_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_UpdateNodePool_async", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_update_node_pool_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.update_node_pool", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.UpdateNodePool", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "UpdateNodePool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.UpdateNodePoolRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, Union[str, bytes]]]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.Operation", + "shortName": "update_node_pool" + }, + "description": "Sample for UpdateNodePool", + "file": "container_v1beta1_generated_cluster_manager_update_node_pool_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_UpdateNodePool_sync", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_update_node_pool_sync.py" + } + ] +} diff --git a/owl-bot-staging/google-cloud-container/v1beta1/scripts/fixup_container_v1beta1_keywords.py b/owl-bot-staging/google-cloud-container/v1beta1/scripts/fixup_container_v1beta1_keywords.py new file mode 100644 index 000000000000..b44a3331c2dc --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/scripts/fixup_container_v1beta1_keywords.py @@ -0,0 +1,210 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 containerCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'cancel_operation': ('project_id', 'zone', 'operation_id', 'name', ), + 'check_autopilot_compatibility': ('name', ), + 'complete_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', ), + 'complete_node_pool_upgrade': ('name', ), + 'create_cluster': ('project_id', 'zone', 'cluster', 'parent', ), + 'create_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool', 'parent', ), + 'delete_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), + 'delete_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'get_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), + 'get_json_web_keys': ('parent', ), + 'get_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'get_operation': ('project_id', 'zone', 'operation_id', 'name', ), + 'get_server_config': ('project_id', 'zone', 'name', ), + 'list_clusters': ('project_id', 'zone', 'parent', ), + 'list_locations': ('parent', ), + 'list_node_pools': ('project_id', 'zone', 'cluster_id', 'parent', ), + 'list_operations': ('project_id', 'zone', 'parent', ), + 'list_usable_subnetworks': ('parent', 'filter', 'page_size', 'page_token', ), + 'rollback_node_pool_upgrade': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', 'respect_pdb', ), + 'set_addons_config': ('project_id', 'zone', 'cluster_id', 'addons_config', 'name', ), + 'set_labels': ('project_id', 'zone', 'cluster_id', 'resource_labels', 'label_fingerprint', 'name', ), + 'set_legacy_abac': ('project_id', 'zone', 'cluster_id', 'enabled', 'name', ), + 'set_locations': ('project_id', 'zone', 'cluster_id', 'locations', 'name', ), + 'set_logging_service': ('project_id', 'zone', 'cluster_id', 'logging_service', 'name', ), + 'set_maintenance_policy': ('project_id', 'zone', 'cluster_id', 'maintenance_policy', 'name', ), + 'set_master_auth': ('project_id', 'zone', 'cluster_id', 'action', 'update', 'name', ), + 'set_monitoring_service': ('project_id', 'zone', 'cluster_id', 'monitoring_service', 'name', ), + 'set_network_policy': ('project_id', 'zone', 'cluster_id', 'network_policy', 'name', ), + 'set_node_pool_autoscaling': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'autoscaling', 'name', ), + 'set_node_pool_management': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'management', 'name', ), + 'set_node_pool_size': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'node_count', 'name', ), + 'start_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', 'rotate_credentials', ), + 'update_cluster': ('project_id', 'zone', 'cluster_id', 'update', 'name', ), + 'update_master': ('project_id', 'zone', 'cluster_id', 'master_version', 'name', ), + 'update_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'node_version', 'image_type', 'locations', 'workload_metadata_config', 'name', 'upgrade_settings', 'tags', 'taints', 'labels', 'linux_node_config', 'kubelet_config', 'node_network_config', 'gcfs_config', 'confidential_nodes', 'gvnic', 'etag', 'fast_socket', 'logging_config', 'resource_labels', 'windows_node_config', 'accelerators', 'machine_type', 'disk_type', 'disk_size_gb', 'resource_manager_tags', 'containerd_config', 'queued_provisioning', ), + } + + 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=containerCallTransformer(), +): + """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 container 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/google-cloud-container/v1beta1/setup.py b/owl-bot-staging/google-cloud-container/v1beta1/setup.py new file mode 100644 index 000000000000..0085de6f1022 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/setup.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 re + +import setuptools # type: ignore + +package_root = os.path.abspath(os.path.dirname(__file__)) + +name = 'google-cloud-container' + + +description = "Google Cloud Container API client library" + +version = None + +with open(os.path.join(package_root, 'google/cloud/container/gapic_version.py')) as fp: + version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read()) + assert (len(version_candidates) == 1) + version = version_candidates[0] + +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.1, <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.*", + # Exclude incompatible versions of `google-auth` + # See https://github.com/googleapis/google-cloud-python/issues/12364 + "google-auth >= 2.14.1, <3.0.0dev,!=2.24.0,!=2.25.0", + "proto-plus >= 1.22.3, <2.0.0dev", + "proto-plus >= 1.25.0, <2.0.0dev; python_version >= '3.13'", + "protobuf>=3.20.2,<6.0.0dev,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", +] +extras = { +} +url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-container" + +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.find_namespace_packages() + if package.startswith("google") +] + +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", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Operating System :: OS Independent", + "Topic :: Internet", + ], + platforms="Posix; MacOS X; Windows", + packages=packages, + python_requires=">=3.7", + install_requires=dependencies, + extras_require=extras, + include_package_data=True, + zip_safe=False, +) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.10.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.10.txt new file mode 100644 index 000000000000..ed7f9aed2559 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1beta1/testing/constraints-3.11.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.11.txt new file mode 100644 index 000000000000..ed7f9aed2559 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1beta1/testing/constraints-3.12.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.12.txt new file mode 100644 index 000000000000..ed7f9aed2559 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1beta1/testing/constraints-3.13.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.13.txt new file mode 100644 index 000000000000..ed7f9aed2559 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.13.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/google-cloud-container/v1beta1/testing/constraints-3.7.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.7.txt new file mode 100644 index 000000000000..fc812592b0ee --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.7.txt @@ -0,0 +1,10 @@ +# 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.1 +google-auth==2.14.1 +proto-plus==1.22.3 +protobuf==3.20.2 diff --git a/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.8.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.8.txt new file mode 100644 index 000000000000..ed7f9aed2559 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1beta1/testing/constraints-3.9.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.9.txt new file mode 100644 index 000000000000..ed7f9aed2559 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1beta1/tests/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/tests/__init__.py new file mode 100644 index 000000000000..7b3de3117f38 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/tests/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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/google-cloud-container/v1beta1/tests/unit/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/__init__.py new file mode 100644 index 000000000000..7b3de3117f38 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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/google-cloud-container/v1beta1/tests/unit/gapic/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/__init__.py new file mode 100644 index 000000000000..7b3de3117f38 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/__init__.py new file mode 100644 index 000000000000..7b3de3117f38 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/test_cluster_manager.py b/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/test_cluster_manager.py new file mode 100644 index 000000000000..657b141ea187 --- /dev/null +++ b/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/test_cluster_manager.py @@ -0,0 +1,15801 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 google.api_core import api_core_version +from proto.marshal.rules.dates import DurationRule, TimestampRule +from proto.marshal.rules import wrappers + +try: + from google.auth.aio import credentials as ga_credentials_async + HAS_GOOGLE_AUTH_AIO = True +except ImportError: # pragma: NO COVER + HAS_GOOGLE_AUTH_AIO = False + +from google.api_core import client_options +from google.api_core import exceptions as core_exceptions +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 path_template +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.container_v1beta1.services.cluster_manager import ClusterManagerAsyncClient +from google.cloud.container_v1beta1.services.cluster_manager import ClusterManagerClient +from google.cloud.container_v1beta1.services.cluster_manager import pagers +from google.cloud.container_v1beta1.services.cluster_manager import transports +from google.cloud.container_v1beta1.types import cluster_service +from google.oauth2 import service_account +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.protobuf import wrappers_pb2 # type: ignore +from google.rpc import code_pb2 # type: ignore +from google.rpc import status_pb2 # type: ignore +import google.auth + + +async def mock_async_gen(data, chunk_size=1): + for i in range(0, len(data)): # pragma: NO COVER + chunk = data[i : i + chunk_size] + yield chunk.encode("utf-8") + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + +# TODO: use async auth anon credentials by default once the minimum version of google-auth is upgraded. +# See related issue: https://github.com/googleapis/gapic-generator-python/issues/2107. +def async_anonymous_credentials(): + if HAS_GOOGLE_AUTH_AIO: + return ga_credentials_async.AnonymousCredentials() + return ga_credentials.AnonymousCredentials() + +# 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 + +# If default endpoint template is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint template so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint_template(client): + return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE + + +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 ClusterManagerClient._get_default_mtls_endpoint(None) is None + assert ClusterManagerClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint + assert ClusterManagerClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint + assert ClusterManagerClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint + assert ClusterManagerClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint + assert ClusterManagerClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + +def test__read_environment_variables(): + assert ClusterManagerClient._read_environment_variables() == (False, "auto", None) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + assert ClusterManagerClient._read_environment_variables() == (True, "auto", None) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + assert ClusterManagerClient._read_environment_variables() == (False, "auto", None) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): + with pytest.raises(ValueError) as excinfo: + ClusterManagerClient._read_environment_variables() + assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + assert ClusterManagerClient._read_environment_variables() == (False, "never", None) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + assert ClusterManagerClient._read_environment_variables() == (False, "always", None) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}): + assert ClusterManagerClient._read_environment_variables() == (False, "auto", None) + + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError) as excinfo: + ClusterManagerClient._read_environment_variables() + assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + + with mock.patch.dict(os.environ, {"GOOGLE_CLOUD_UNIVERSE_DOMAIN": "foo.com"}): + assert ClusterManagerClient._read_environment_variables() == (False, "auto", "foo.com") + +def test__get_client_cert_source(): + mock_provided_cert_source = mock.Mock() + mock_default_cert_source = mock.Mock() + + assert ClusterManagerClient._get_client_cert_source(None, False) is None + assert ClusterManagerClient._get_client_cert_source(mock_provided_cert_source, False) is None + assert ClusterManagerClient._get_client_cert_source(mock_provided_cert_source, True) == mock_provided_cert_source + + 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_default_cert_source): + assert ClusterManagerClient._get_client_cert_source(None, True) is mock_default_cert_source + assert ClusterManagerClient._get_client_cert_source(mock_provided_cert_source, "true") is mock_provided_cert_source + +@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) +@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) +def test__get_api_endpoint(): + api_override = "foo.com" + mock_client_cert_source = mock.Mock() + default_universe = ClusterManagerClient._DEFAULT_UNIVERSE + default_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=default_universe) + mock_universe = "bar.com" + mock_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=mock_universe) + + assert ClusterManagerClient._get_api_endpoint(api_override, mock_client_cert_source, default_universe, "always") == api_override + assert ClusterManagerClient._get_api_endpoint(None, mock_client_cert_source, default_universe, "auto") == ClusterManagerClient.DEFAULT_MTLS_ENDPOINT + assert ClusterManagerClient._get_api_endpoint(None, None, default_universe, "auto") == default_endpoint + assert ClusterManagerClient._get_api_endpoint(None, None, default_universe, "always") == ClusterManagerClient.DEFAULT_MTLS_ENDPOINT + assert ClusterManagerClient._get_api_endpoint(None, mock_client_cert_source, default_universe, "always") == ClusterManagerClient.DEFAULT_MTLS_ENDPOINT + assert ClusterManagerClient._get_api_endpoint(None, None, mock_universe, "never") == mock_endpoint + assert ClusterManagerClient._get_api_endpoint(None, None, default_universe, "never") == default_endpoint + + with pytest.raises(MutualTLSChannelError) as excinfo: + ClusterManagerClient._get_api_endpoint(None, mock_client_cert_source, mock_universe, "auto") + assert str(excinfo.value) == "mTLS is not supported in any universe other than googleapis.com." + + +def test__get_universe_domain(): + client_universe_domain = "foo.com" + universe_domain_env = "bar.com" + + assert ClusterManagerClient._get_universe_domain(client_universe_domain, universe_domain_env) == client_universe_domain + assert ClusterManagerClient._get_universe_domain(None, universe_domain_env) == universe_domain_env + assert ClusterManagerClient._get_universe_domain(None, None) == ClusterManagerClient._DEFAULT_UNIVERSE + + with pytest.raises(ValueError) as excinfo: + ClusterManagerClient._get_universe_domain("", None) + assert str(excinfo.value) == "Universe Domain cannot be an empty string." + + +@pytest.mark.parametrize("client_class,transport_name", [ + (ClusterManagerClient, "grpc"), + (ClusterManagerAsyncClient, "grpc_asyncio"), +]) +def test_cluster_manager_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 == ( + 'container.googleapis.com:443' + ) + + +@pytest.mark.parametrize("transport_class,transport_name", [ + (transports.ClusterManagerGrpcTransport, "grpc"), + (transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_cluster_manager_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", [ + (ClusterManagerClient, "grpc"), + (ClusterManagerAsyncClient, "grpc_asyncio"), +]) +def test_cluster_manager_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 == ( + 'container.googleapis.com:443' + ) + + +def test_cluster_manager_client_get_transport_class(): + transport = ClusterManagerClient.get_transport_class() + available_transports = [ + transports.ClusterManagerGrpcTransport, + ] + assert transport in available_transports + + transport = ClusterManagerClient.get_transport_class("grpc") + assert transport == transports.ClusterManagerGrpcTransport + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc"), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio"), +]) +@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) +@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) +def test_cluster_manager_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(ClusterManagerClient, '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(ClusterManagerClient, '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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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) as excinfo: + client = client_class(transport=transport_name) + assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + + # 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) as excinfo: + client = client_class(transport=transport_name) + assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + + # 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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", [ + (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", "true"), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", "true"), + (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", "false"), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", "false"), +]) +@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) +@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE) + 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE) + 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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", [ + ClusterManagerClient, ClusterManagerAsyncClient +]) +@mock.patch.object(ClusterManagerClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ClusterManagerClient)) +@mock.patch.object(ClusterManagerAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ClusterManagerAsyncClient)) +def test_cluster_manager_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 + + # 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) as excinfo: + client_class.get_mtls_endpoint_and_cert_source() + + assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + + # 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) as excinfo: + client_class.get_mtls_endpoint_and_cert_source() + + assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + +@pytest.mark.parametrize("client_class", [ + ClusterManagerClient, ClusterManagerAsyncClient +]) +@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) +@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) +def test_cluster_manager_client_client_api_endpoint(client_class): + mock_client_cert_source = client_cert_source_callback + api_override = "foo.com" + default_universe = ClusterManagerClient._DEFAULT_UNIVERSE + default_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=default_universe) + mock_universe = "bar.com" + mock_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=mock_universe) + + # If ClientOptions.api_endpoint is set and GOOGLE_API_USE_CLIENT_CERTIFICATE="true", + # use ClientOptions.api_endpoint as the api endpoint regardless. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch("google.auth.transport.requests.AuthorizedSession.configure_mtls_channel"): + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=api_override) + client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) + assert client.api_endpoint == api_override + + # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", + # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + client = client_class(credentials=ga_credentials.AnonymousCredentials()) + assert client.api_endpoint == default_endpoint + + # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", + # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + client = client_class(credentials=ga_credentials.AnonymousCredentials()) + assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + + # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), + # GOOGLE_API_USE_CLIENT_CERTIFICATE="false" (default), default cert source doesn't exist, + # and ClientOptions.universe_domain="bar.com", + # use the _DEFAULT_ENDPOINT_TEMPLATE populated with universe domain as the api endpoint. + options = client_options.ClientOptions() + universe_exists = hasattr(options, "universe_domain") + if universe_exists: + options = client_options.ClientOptions(universe_domain=mock_universe) + client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) + else: + client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) + assert client.api_endpoint == (mock_endpoint if universe_exists else default_endpoint) + assert client.universe_domain == (mock_universe if universe_exists else default_universe) + + # If ClientOptions does not have a universe domain attribute and GOOGLE_API_USE_MTLS_ENDPOINT="never", + # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. + options = client_options.ClientOptions() + if hasattr(options, "universe_domain"): + delattr(options, "universe_domain") + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) + assert client.api_endpoint == default_endpoint + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc"), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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", [ + (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", grpc_helpers), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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_cluster_manager_client_client_options_from_dict(): + with mock.patch('google.cloud.container_v1beta1.services.cluster_manager.transports.ClusterManagerGrpcTransport.__init__') as grpc_transport: + grpc_transport.return_value = None + client = ClusterManagerClient( + 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", [ + (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", grpc_helpers), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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( + "container.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="container.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.ListClustersRequest, + dict, +]) +def test_list_clusters(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_clusters), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListClustersResponse( + missing_zones=['missing_zones_value'], + ) + response = client.list_clusters(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.ListClustersRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListClustersResponse) + assert response.missing_zones == ['missing_zones_value'] + + +def test_list_clusters_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.ListClustersRequest( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.list_clusters(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.ListClustersRequest( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + +def test_list_clusters_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.list_clusters in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.list_clusters] = mock_rpc + request = {} + client.list_clusters(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_clusters(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_clusters_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.list_clusters in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.list_clusters] = mock_rpc + + request = {} + await client.list_clusters(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.list_clusters(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_clusters_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListClustersRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_clusters), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse( + missing_zones=['missing_zones_value'], + )) + response = await client.list_clusters(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.ListClustersRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListClustersResponse) + assert response.missing_zones == ['missing_zones_value'] + + +@pytest.mark.asyncio +async def test_list_clusters_async_from_dict(): + await test_list_clusters_async(request_type=dict) + +def test_list_clusters_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListClustersRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + call.return_value = cluster_service.ListClustersResponse() + client.list_clusters(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_clusters_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListClustersRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse()) + await client.list_clusters(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_clusters_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListClustersResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_clusters( + project_id='project_id_value', + zone='zone_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + + +def test_list_clusters_flattened_error(): + client = ClusterManagerClient( + 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_clusters( + cluster_service.ListClustersRequest(), + project_id='project_id_value', + zone='zone_value', + ) + +@pytest.mark.asyncio +async def test_list_clusters_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListClustersResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_clusters( + project_id='project_id_value', + zone='zone_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_clusters_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_clusters( + cluster_service.ListClustersRequest(), + project_id='project_id_value', + zone='zone_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetClusterRequest, + dict, +]) +def test_get_cluster(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Cluster( + name='name_value', + description='description_value', + initial_node_count=1911, + logging_service='logging_service_value', + monitoring_service='monitoring_service_value', + network='network_value', + cluster_ipv4_cidr='cluster_ipv4_cidr_value', + subnetwork='subnetwork_value', + locations=['locations_value'], + enable_kubernetes_alpha=True, + label_fingerprint='label_fingerprint_value', + private_cluster=True, + master_ipv4_cidr_block='master_ipv4_cidr_block_value', + self_link='self_link_value', + zone='zone_value', + endpoint='endpoint_value', + initial_cluster_version='initial_cluster_version_value', + current_master_version='current_master_version_value', + current_node_version='current_node_version_value', + create_time='create_time_value', + status=cluster_service.Cluster.Status.PROVISIONING, + status_message='status_message_value', + node_ipv4_cidr_size=1955, + services_ipv4_cidr='services_ipv4_cidr_value', + instance_group_urls=['instance_group_urls_value'], + current_node_count=1936, + expire_time='expire_time_value', + location='location_value', + enable_tpu=True, + tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', + id='id_value', + etag='etag_value', + satisfies_pzs=True, + satisfies_pzi=True, + ) + response = client.get_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.GetClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Cluster) + assert response.name == 'name_value' + assert response.description == 'description_value' + assert response.initial_node_count == 1911 + assert response.logging_service == 'logging_service_value' + assert response.monitoring_service == 'monitoring_service_value' + assert response.network == 'network_value' + assert response.cluster_ipv4_cidr == 'cluster_ipv4_cidr_value' + assert response.subnetwork == 'subnetwork_value' + assert response.locations == ['locations_value'] + assert response.enable_kubernetes_alpha is True + assert response.label_fingerprint == 'label_fingerprint_value' + assert response.private_cluster is True + assert response.master_ipv4_cidr_block == 'master_ipv4_cidr_block_value' + assert response.self_link == 'self_link_value' + assert response.zone == 'zone_value' + assert response.endpoint == 'endpoint_value' + assert response.initial_cluster_version == 'initial_cluster_version_value' + assert response.current_master_version == 'current_master_version_value' + assert response.current_node_version == 'current_node_version_value' + assert response.create_time == 'create_time_value' + assert response.status == cluster_service.Cluster.Status.PROVISIONING + assert response.status_message == 'status_message_value' + assert response.node_ipv4_cidr_size == 1955 + assert response.services_ipv4_cidr == 'services_ipv4_cidr_value' + assert response.instance_group_urls == ['instance_group_urls_value'] + assert response.current_node_count == 1936 + assert response.expire_time == 'expire_time_value' + assert response.location == 'location_value' + assert response.enable_tpu is True + assert response.tpu_ipv4_cidr_block == 'tpu_ipv4_cidr_block_value' + assert response.id == 'id_value' + assert response.etag == 'etag_value' + assert response.satisfies_pzs is True + assert response.satisfies_pzi is True + + +def test_get_cluster_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.GetClusterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.get_cluster(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.GetClusterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_get_cluster_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_cluster in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_cluster] = mock_rpc + request = {} + client.get_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.get_cluster in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.get_cluster] = mock_rpc + + request = {} + await client.get_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.get_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetClusterRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster( + name='name_value', + description='description_value', + initial_node_count=1911, + logging_service='logging_service_value', + monitoring_service='monitoring_service_value', + network='network_value', + cluster_ipv4_cidr='cluster_ipv4_cidr_value', + subnetwork='subnetwork_value', + locations=['locations_value'], + enable_kubernetes_alpha=True, + label_fingerprint='label_fingerprint_value', + private_cluster=True, + master_ipv4_cidr_block='master_ipv4_cidr_block_value', + self_link='self_link_value', + zone='zone_value', + endpoint='endpoint_value', + initial_cluster_version='initial_cluster_version_value', + current_master_version='current_master_version_value', + current_node_version='current_node_version_value', + create_time='create_time_value', + status=cluster_service.Cluster.Status.PROVISIONING, + status_message='status_message_value', + node_ipv4_cidr_size=1955, + services_ipv4_cidr='services_ipv4_cidr_value', + instance_group_urls=['instance_group_urls_value'], + current_node_count=1936, + expire_time='expire_time_value', + location='location_value', + enable_tpu=True, + tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', + id='id_value', + etag='etag_value', + satisfies_pzs=True, + satisfies_pzi=True, + )) + response = await client.get_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.GetClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Cluster) + assert response.name == 'name_value' + assert response.description == 'description_value' + assert response.initial_node_count == 1911 + assert response.logging_service == 'logging_service_value' + assert response.monitoring_service == 'monitoring_service_value' + assert response.network == 'network_value' + assert response.cluster_ipv4_cidr == 'cluster_ipv4_cidr_value' + assert response.subnetwork == 'subnetwork_value' + assert response.locations == ['locations_value'] + assert response.enable_kubernetes_alpha is True + assert response.label_fingerprint == 'label_fingerprint_value' + assert response.private_cluster is True + assert response.master_ipv4_cidr_block == 'master_ipv4_cidr_block_value' + assert response.self_link == 'self_link_value' + assert response.zone == 'zone_value' + assert response.endpoint == 'endpoint_value' + assert response.initial_cluster_version == 'initial_cluster_version_value' + assert response.current_master_version == 'current_master_version_value' + assert response.current_node_version == 'current_node_version_value' + assert response.create_time == 'create_time_value' + assert response.status == cluster_service.Cluster.Status.PROVISIONING + assert response.status_message == 'status_message_value' + assert response.node_ipv4_cidr_size == 1955 + assert response.services_ipv4_cidr == 'services_ipv4_cidr_value' + assert response.instance_group_urls == ['instance_group_urls_value'] + assert response.current_node_count == 1936 + assert response.expire_time == 'expire_time_value' + assert response.location == 'location_value' + assert response.enable_tpu is True + assert response.tpu_ipv4_cidr_block == 'tpu_ipv4_cidr_block_value' + assert response.id == 'id_value' + assert response.etag == 'etag_value' + assert response.satisfies_pzs is True + assert response.satisfies_pzi is True + + +@pytest.mark.asyncio +async def test_get_cluster_async_from_dict(): + await test_get_cluster_async(request_type=dict) + +def test_get_cluster_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetClusterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + call.return_value = cluster_service.Cluster() + client.get_cluster(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_cluster_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetClusterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster()) + await client.get_cluster(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_cluster_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Cluster() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_cluster( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + + +def test_get_cluster_flattened_error(): + client = ClusterManagerClient( + 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_cluster( + cluster_service.GetClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + ) + +@pytest.mark.asyncio +async def test_get_cluster_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Cluster() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_cluster( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_cluster_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_cluster( + cluster_service.GetClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CreateClusterRequest, + dict, +]) +def test_create_cluster(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.create_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.CreateClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_create_cluster_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.CreateClusterRequest( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.create_cluster(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CreateClusterRequest( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + +def test_create_cluster_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.create_cluster in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.create_cluster] = mock_rpc + request = {} + client.create_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.create_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_create_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.create_cluster in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.create_cluster] = mock_rpc + + request = {} + await client.create_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.create_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_create_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CreateClusterRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.create_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.CreateClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_create_cluster_async_from_dict(): + await test_create_cluster_async(request_type=dict) + +def test_create_cluster_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CreateClusterRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.create_cluster(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_cluster_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CreateClusterRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.create_cluster(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_cluster_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_cluster( + project_id='project_id_value', + zone='zone_value', + cluster=cluster_service.Cluster(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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster + mock_val = cluster_service.Cluster(name='name_value') + assert arg == mock_val + + +def test_create_cluster_flattened_error(): + client = ClusterManagerClient( + 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_cluster( + cluster_service.CreateClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster=cluster_service.Cluster(name='name_value'), + ) + +@pytest.mark.asyncio +async def test_create_cluster_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_cluster( + project_id='project_id_value', + zone='zone_value', + cluster=cluster_service.Cluster(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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster + mock_val = cluster_service.Cluster(name='name_value') + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_cluster_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_cluster( + cluster_service.CreateClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster=cluster_service.Cluster(name='name_value'), + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.UpdateClusterRequest, + dict, +]) +def test_update_cluster(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.update_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.UpdateClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_update_cluster_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.UpdateClusterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.update_cluster(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.UpdateClusterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_update_cluster_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.update_cluster in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.update_cluster] = mock_rpc + request = {} + client.update_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.update_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_update_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.update_cluster in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.update_cluster] = mock_rpc + + request = {} + await client.update_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.update_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_update_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.UpdateClusterRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.update_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.UpdateClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_update_cluster_async_from_dict(): + await test_update_cluster_async(request_type=dict) + +def test_update_cluster_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.UpdateClusterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.update_cluster(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_update_cluster_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.UpdateClusterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.update_cluster(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_update_cluster_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_cluster( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].update + mock_val = cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value') + assert arg == mock_val + + +def test_update_cluster_flattened_error(): + client = ClusterManagerClient( + 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_cluster( + cluster_service.UpdateClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), + ) + +@pytest.mark.asyncio +async def test_update_cluster_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_cluster( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].update + mock_val = cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value') + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_cluster_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_cluster( + cluster_service.UpdateClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.UpdateNodePoolRequest, + dict, +]) +def test_update_node_pool(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.update_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.UpdateNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_update_node_pool_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.UpdateNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + node_version='node_version_value', + image_type='image_type_value', + name='name_value', + etag='etag_value', + machine_type='machine_type_value', + disk_type='disk_type_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_node_pool), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.update_node_pool(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.UpdateNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + node_version='node_version_value', + image_type='image_type_value', + name='name_value', + etag='etag_value', + machine_type='machine_type_value', + disk_type='disk_type_value', + ) + +def test_update_node_pool_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.update_node_pool in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.update_node_pool] = mock_rpc + request = {} + client.update_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.update_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_update_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.update_node_pool in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.update_node_pool] = mock_rpc + + request = {} + await client.update_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.update_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_update_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.UpdateNodePoolRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.update_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.UpdateNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_update_node_pool_async_from_dict(): + await test_update_node_pool_async(request_type=dict) + +def test_update_node_pool_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.UpdateNodePoolRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_node_pool), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.update_node_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_update_node_pool_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.UpdateNodePoolRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_node_pool), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.update_node_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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetNodePoolAutoscalingRequest, + dict, +]) +def test_set_node_pool_autoscaling(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_node_pool_autoscaling), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_node_pool_autoscaling(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNodePoolAutoscalingRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_node_pool_autoscaling_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetNodePoolAutoscalingRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_autoscaling), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_node_pool_autoscaling(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetNodePoolAutoscalingRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +def test_set_node_pool_autoscaling_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_node_pool_autoscaling in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_node_pool_autoscaling] = mock_rpc + request = {} + client.set_node_pool_autoscaling(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_node_pool_autoscaling(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_node_pool_autoscaling_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_node_pool_autoscaling in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_node_pool_autoscaling] = mock_rpc + + request = {} + await client.set_node_pool_autoscaling(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_node_pool_autoscaling(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_node_pool_autoscaling_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNodePoolAutoscalingRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_node_pool_autoscaling), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_node_pool_autoscaling(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNodePoolAutoscalingRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_node_pool_autoscaling_async_from_dict(): + await test_set_node_pool_autoscaling_async(request_type=dict) + +def test_set_node_pool_autoscaling_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNodePoolAutoscalingRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_autoscaling), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_node_pool_autoscaling(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_set_node_pool_autoscaling_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNodePoolAutoscalingRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_autoscaling), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_node_pool_autoscaling(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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetLoggingServiceRequest, + dict, +]) +def test_set_logging_service(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_logging_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_logging_service(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLoggingServiceRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_logging_service_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetLoggingServiceRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_logging_service(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetLoggingServiceRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_value', + name='name_value', + ) + +def test_set_logging_service_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_logging_service in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_logging_service] = mock_rpc + request = {} + client.set_logging_service(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_logging_service(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_logging_service_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_logging_service in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_logging_service] = mock_rpc + + request = {} + await client.set_logging_service(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_logging_service(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_logging_service_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLoggingServiceRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_logging_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_logging_service(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLoggingServiceRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_logging_service_async_from_dict(): + await test_set_logging_service_async(request_type=dict) + +def test_set_logging_service_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLoggingServiceRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_logging_service(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_set_logging_service_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLoggingServiceRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_logging_service(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_set_logging_service_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_logging_service( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].logging_service + mock_val = 'logging_service_value' + assert arg == mock_val + + +def test_set_logging_service_flattened_error(): + client = ClusterManagerClient( + 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.set_logging_service( + cluster_service.SetLoggingServiceRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_value', + ) + +@pytest.mark.asyncio +async def test_set_logging_service_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_logging_service( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].logging_service + mock_val = 'logging_service_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_logging_service_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_logging_service( + cluster_service.SetLoggingServiceRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + logging_service='logging_service_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetMonitoringServiceRequest, + dict, +]) +def test_set_monitoring_service(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_monitoring_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_monitoring_service(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetMonitoringServiceRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_monitoring_service_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetMonitoringServiceRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_monitoring_service(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetMonitoringServiceRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_value', + name='name_value', + ) + +def test_set_monitoring_service_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_monitoring_service in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_monitoring_service] = mock_rpc + request = {} + client.set_monitoring_service(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_monitoring_service(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_monitoring_service_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_monitoring_service in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_monitoring_service] = mock_rpc + + request = {} + await client.set_monitoring_service(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_monitoring_service(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_monitoring_service_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetMonitoringServiceRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_monitoring_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_monitoring_service(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetMonitoringServiceRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_monitoring_service_async_from_dict(): + await test_set_monitoring_service_async(request_type=dict) + +def test_set_monitoring_service_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetMonitoringServiceRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_monitoring_service(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_set_monitoring_service_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetMonitoringServiceRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_monitoring_service(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_set_monitoring_service_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_monitoring_service( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].monitoring_service + mock_val = 'monitoring_service_value' + assert arg == mock_val + + +def test_set_monitoring_service_flattened_error(): + client = ClusterManagerClient( + 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.set_monitoring_service( + cluster_service.SetMonitoringServiceRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_value', + ) + +@pytest.mark.asyncio +async def test_set_monitoring_service_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_monitoring_service( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].monitoring_service + mock_val = 'monitoring_service_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_monitoring_service_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_monitoring_service( + cluster_service.SetMonitoringServiceRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + monitoring_service='monitoring_service_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetAddonsConfigRequest, + dict, +]) +def test_set_addons_config(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_addons_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_addons_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetAddonsConfigRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_addons_config_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetAddonsConfigRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_addons_config(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetAddonsConfigRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_set_addons_config_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_addons_config in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_addons_config] = mock_rpc + request = {} + client.set_addons_config(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_addons_config(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_addons_config_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_addons_config in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_addons_config] = mock_rpc + + request = {} + await client.set_addons_config(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_addons_config(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_addons_config_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetAddonsConfigRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_addons_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_addons_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetAddonsConfigRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_addons_config_async_from_dict(): + await test_set_addons_config_async(request_type=dict) + +def test_set_addons_config_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetAddonsConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_addons_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_set_addons_config_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetAddonsConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_addons_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_set_addons_config_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_addons_config( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), + ) + + # 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].addons_config + mock_val = cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)) + assert arg == mock_val + + +def test_set_addons_config_flattened_error(): + client = ClusterManagerClient( + 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.set_addons_config( + cluster_service.SetAddonsConfigRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), + ) + +@pytest.mark.asyncio +async def test_set_addons_config_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_addons_config( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), + ) + + # 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].addons_config + mock_val = cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_addons_config_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_addons_config( + cluster_service.SetAddonsConfigRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetLocationsRequest, + dict, +]) +def test_set_locations(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_locations(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLocationsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_locations_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetLocationsRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_locations(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetLocationsRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_set_locations_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_locations in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_locations] = mock_rpc + request = {} + client.set_locations(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_locations(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_locations_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_locations in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_locations] = mock_rpc + + request = {} + await client.set_locations(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_locations(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_locations_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLocationsRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_locations(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLocationsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_locations_async_from_dict(): + await test_set_locations_async(request_type=dict) + +def test_set_locations_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLocationsRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_locations(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_set_locations_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLocationsRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_locations(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_set_locations_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_locations( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + locations=['locations_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].locations + mock_val = ['locations_value'] + assert arg == mock_val + + +def test_set_locations_flattened_error(): + client = ClusterManagerClient( + 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.set_locations( + cluster_service.SetLocationsRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + locations=['locations_value'], + ) + +@pytest.mark.asyncio +async def test_set_locations_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_locations( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + locations=['locations_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].locations + mock_val = ['locations_value'] + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_locations_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_locations( + cluster_service.SetLocationsRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + locations=['locations_value'], + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.UpdateMasterRequest, + dict, +]) +def test_update_master(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_master), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.update_master(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.UpdateMasterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_update_master_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.UpdateMasterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.update_master(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.UpdateMasterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_value', + name='name_value', + ) + +def test_update_master_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.update_master in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.update_master] = mock_rpc + request = {} + client.update_master(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.update_master(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_update_master_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.update_master in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.update_master] = mock_rpc + + request = {} + await client.update_master(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.update_master(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_update_master_async(transport: str = 'grpc_asyncio', request_type=cluster_service.UpdateMasterRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_master), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.update_master(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.UpdateMasterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_update_master_async_from_dict(): + await test_update_master_async(request_type=dict) + +def test_update_master_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.UpdateMasterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.update_master(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_update_master_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.UpdateMasterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.update_master(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_update_master_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_master( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].master_version + mock_val = 'master_version_value' + assert arg == mock_val + + +def test_update_master_flattened_error(): + client = ClusterManagerClient( + 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_master( + cluster_service.UpdateMasterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_value', + ) + +@pytest.mark.asyncio +async def test_update_master_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_master( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].master_version + mock_val = 'master_version_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_master_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_master( + cluster_service.UpdateMasterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + master_version='master_version_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetMasterAuthRequest, + dict, +]) +def test_set_master_auth(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_master_auth), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_master_auth(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetMasterAuthRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_master_auth_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetMasterAuthRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_master_auth), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_master_auth(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetMasterAuthRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_set_master_auth_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_master_auth in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_master_auth] = mock_rpc + request = {} + client.set_master_auth(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_master_auth(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_master_auth_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_master_auth in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_master_auth] = mock_rpc + + request = {} + await client.set_master_auth(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_master_auth(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_master_auth_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetMasterAuthRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_master_auth), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_master_auth(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetMasterAuthRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_master_auth_async_from_dict(): + await test_set_master_auth_async(request_type=dict) + +def test_set_master_auth_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetMasterAuthRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_master_auth), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_master_auth(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_set_master_auth_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetMasterAuthRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_master_auth), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_master_auth(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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.DeleteClusterRequest, + dict, +]) +def test_delete_cluster(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.delete_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.DeleteClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_delete_cluster_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.DeleteClusterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.delete_cluster(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.DeleteClusterRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_delete_cluster_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.delete_cluster in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.delete_cluster] = mock_rpc + request = {} + client.delete_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.delete_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_delete_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.delete_cluster in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.delete_cluster] = mock_rpc + + request = {} + await client.delete_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.delete_cluster(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_delete_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.DeleteClusterRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.delete_cluster(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.DeleteClusterRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_delete_cluster_async_from_dict(): + await test_delete_cluster_async(request_type=dict) + +def test_delete_cluster_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.DeleteClusterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.delete_cluster(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_cluster_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.DeleteClusterRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.delete_cluster(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_cluster_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_cluster( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + + +def test_delete_cluster_flattened_error(): + client = ClusterManagerClient( + 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_cluster( + cluster_service.DeleteClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + ) + +@pytest.mark.asyncio +async def test_delete_cluster_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_cluster( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_cluster_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_cluster( + cluster_service.DeleteClusterRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.ListOperationsRequest, + dict, +]) +def test_list_operations(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_operations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListOperationsResponse( + missing_zones=['missing_zones_value'], + ) + response = client.list_operations(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.ListOperationsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListOperationsResponse) + assert response.missing_zones == ['missing_zones_value'] + + +def test_list_operations_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.ListOperationsRequest( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.list_operations(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.ListOperationsRequest( + project_id='project_id_value', + zone='zone_value', + parent='parent_value', + ) + +def test_list_operations_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.list_operations in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.list_operations] = mock_rpc + request = {} + client.list_operations(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_operations(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_operations_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.list_operations in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.list_operations] = mock_rpc + + request = {} + await client.list_operations(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.list_operations(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_operations_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListOperationsRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_operations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse( + missing_zones=['missing_zones_value'], + )) + response = await client.list_operations(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.ListOperationsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListOperationsResponse) + assert response.missing_zones == ['missing_zones_value'] + + +@pytest.mark.asyncio +async def test_list_operations_async_from_dict(): + await test_list_operations_async(request_type=dict) + +def test_list_operations_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListOperationsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + call.return_value = cluster_service.ListOperationsResponse() + client.list_operations(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_operations_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListOperationsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse()) + await client.list_operations(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_operations_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListOperationsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_operations( + project_id='project_id_value', + zone='zone_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + + +def test_list_operations_flattened_error(): + client = ClusterManagerClient( + 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_operations( + cluster_service.ListOperationsRequest(), + project_id='project_id_value', + zone='zone_value', + ) + +@pytest.mark.asyncio +async def test_list_operations_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListOperationsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_operations( + project_id='project_id_value', + zone='zone_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_operations_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_operations( + cluster_service.ListOperationsRequest(), + project_id='project_id_value', + zone='zone_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetOperationRequest, + dict, +]) +def test_get_operation(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.get_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.GetOperationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_get_operation_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.GetOperationRequest( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.get_operation(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.GetOperationRequest( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + +def test_get_operation_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_operation in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_operation] = mock_rpc + request = {} + client.get_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_operation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_operation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.get_operation in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.get_operation] = mock_rpc + + request = {} + await client.get_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.get_operation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_operation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetOperationRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.get_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.GetOperationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_get_operation_async_from_dict(): + await test_get_operation_async(request_type=dict) + +def test_get_operation_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetOperationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.get_operation(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_operation_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetOperationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.get_operation(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_operation_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_operation( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].operation_id + mock_val = 'operation_id_value' + assert arg == mock_val + + +def test_get_operation_flattened_error(): + client = ClusterManagerClient( + 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_operation( + cluster_service.GetOperationRequest(), + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + ) + +@pytest.mark.asyncio +async def test_get_operation_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_operation( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].operation_id + mock_val = 'operation_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_operation_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_operation( + cluster_service.GetOperationRequest(), + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CancelOperationRequest, + dict, +]) +def test_cancel_operation(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.cancel_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.cancel_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.CancelOperationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +def test_cancel_operation_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.CancelOperationRequest( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.cancel_operation(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CancelOperationRequest( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + name='name_value', + ) + +def test_cancel_operation_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.cancel_operation in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.cancel_operation] = mock_rpc + request = {} + client.cancel_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.cancel_operation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_cancel_operation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.cancel_operation in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.cancel_operation] = mock_rpc + + request = {} + await client.cancel_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.cancel_operation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_cancel_operation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CancelOperationRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.cancel_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.cancel_operation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.CancelOperationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_cancel_operation_async_from_dict(): + await test_cancel_operation_async(request_type=dict) + +def test_cancel_operation_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CancelOperationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + call.return_value = None + client.cancel_operation(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_cancel_operation_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CancelOperationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.cancel_operation(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_cancel_operation_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.cancel_operation( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].operation_id + mock_val = 'operation_id_value' + assert arg == mock_val + + +def test_cancel_operation_flattened_error(): + client = ClusterManagerClient( + 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.cancel_operation( + cluster_service.CancelOperationRequest(), + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + ) + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.cancel_operation( + project_id='project_id_value', + zone='zone_value', + operation_id='operation_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].operation_id + mock_val = 'operation_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_cancel_operation_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.cancel_operation( + cluster_service.CancelOperationRequest(), + project_id='project_id_value', + zone='zone_value', + operation_id='operation_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetServerConfigRequest, + dict, +]) +def test_get_server_config(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_server_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ServerConfig( + default_cluster_version='default_cluster_version_value', + valid_node_versions=['valid_node_versions_value'], + default_image_type='default_image_type_value', + valid_image_types=['valid_image_types_value'], + valid_master_versions=['valid_master_versions_value'], + ) + response = client.get_server_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.GetServerConfigRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ServerConfig) + assert response.default_cluster_version == 'default_cluster_version_value' + assert response.valid_node_versions == ['valid_node_versions_value'] + assert response.default_image_type == 'default_image_type_value' + assert response.valid_image_types == ['valid_image_types_value'] + assert response.valid_master_versions == ['valid_master_versions_value'] + + +def test_get_server_config_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.GetServerConfigRequest( + project_id='project_id_value', + zone='zone_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.get_server_config(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.GetServerConfigRequest( + project_id='project_id_value', + zone='zone_value', + name='name_value', + ) + +def test_get_server_config_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_server_config in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_server_config] = mock_rpc + request = {} + client.get_server_config(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_server_config(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_server_config_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.get_server_config in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.get_server_config] = mock_rpc + + request = {} + await client.get_server_config(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.get_server_config(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_server_config_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetServerConfigRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_server_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig( + default_cluster_version='default_cluster_version_value', + valid_node_versions=['valid_node_versions_value'], + default_image_type='default_image_type_value', + valid_image_types=['valid_image_types_value'], + valid_master_versions=['valid_master_versions_value'], + )) + response = await client.get_server_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.GetServerConfigRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ServerConfig) + assert response.default_cluster_version == 'default_cluster_version_value' + assert response.valid_node_versions == ['valid_node_versions_value'] + assert response.default_image_type == 'default_image_type_value' + assert response.valid_image_types == ['valid_image_types_value'] + assert response.valid_master_versions == ['valid_master_versions_value'] + + +@pytest.mark.asyncio +async def test_get_server_config_async_from_dict(): + await test_get_server_config_async(request_type=dict) + +def test_get_server_config_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetServerConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + call.return_value = cluster_service.ServerConfig() + client.get_server_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_server_config_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetServerConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig()) + await client.get_server_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_server_config_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ServerConfig() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_server_config( + project_id='project_id_value', + zone='zone_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + + +def test_get_server_config_flattened_error(): + client = ClusterManagerClient( + 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_server_config( + cluster_service.GetServerConfigRequest(), + project_id='project_id_value', + zone='zone_value', + ) + +@pytest.mark.asyncio +async def test_get_server_config_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ServerConfig() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_server_config( + project_id='project_id_value', + zone='zone_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_server_config_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_server_config( + cluster_service.GetServerConfigRequest(), + project_id='project_id_value', + zone='zone_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetJSONWebKeysRequest, + dict, +]) +def test_get_json_web_keys(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_json_web_keys), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.GetJSONWebKeysResponse( + ) + response = client.get_json_web_keys(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.GetJSONWebKeysRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.GetJSONWebKeysResponse) + + +def test_get_json_web_keys_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.GetJSONWebKeysRequest( + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_json_web_keys), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.get_json_web_keys(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.GetJSONWebKeysRequest( + parent='parent_value', + ) + +def test_get_json_web_keys_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_json_web_keys in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_json_web_keys] = mock_rpc + request = {} + client.get_json_web_keys(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_json_web_keys(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_json_web_keys_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.get_json_web_keys in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.get_json_web_keys] = mock_rpc + + request = {} + await client.get_json_web_keys(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.get_json_web_keys(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_json_web_keys_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetJSONWebKeysRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_json_web_keys), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.GetJSONWebKeysResponse( + )) + response = await client.get_json_web_keys(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.GetJSONWebKeysRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.GetJSONWebKeysResponse) + + +@pytest.mark.asyncio +async def test_get_json_web_keys_async_from_dict(): + await test_get_json_web_keys_async(request_type=dict) + +def test_get_json_web_keys_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetJSONWebKeysRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_json_web_keys), + '__call__') as call: + call.return_value = cluster_service.GetJSONWebKeysResponse() + client.get_json_web_keys(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_get_json_web_keys_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetJSONWebKeysRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_json_web_keys), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.GetJSONWebKeysResponse()) + await client.get_json_web_keys(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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.ListNodePoolsRequest, + dict, +]) +def test_list_node_pools(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_node_pools), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListNodePoolsResponse( + ) + response = client.list_node_pools(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.ListNodePoolsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListNodePoolsResponse) + + +def test_list_node_pools_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.ListNodePoolsRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.list_node_pools(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.ListNodePoolsRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + parent='parent_value', + ) + +def test_list_node_pools_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.list_node_pools in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.list_node_pools] = mock_rpc + request = {} + client.list_node_pools(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_node_pools(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_node_pools_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.list_node_pools in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.list_node_pools] = mock_rpc + + request = {} + await client.list_node_pools(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.list_node_pools(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_node_pools_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListNodePoolsRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_node_pools), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse( + )) + response = await client.list_node_pools(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.ListNodePoolsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListNodePoolsResponse) + + +@pytest.mark.asyncio +async def test_list_node_pools_async_from_dict(): + await test_list_node_pools_async(request_type=dict) + +def test_list_node_pools_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListNodePoolsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + call.return_value = cluster_service.ListNodePoolsResponse() + client.list_node_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_node_pools_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListNodePoolsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse()) + await client.list_node_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_node_pools_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListNodePoolsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_node_pools( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + + +def test_list_node_pools_flattened_error(): + client = ClusterManagerClient( + 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_node_pools( + cluster_service.ListNodePoolsRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + ) + +@pytest.mark.asyncio +async def test_list_node_pools_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListNodePoolsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_node_pools( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_node_pools_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_node_pools( + cluster_service.ListNodePoolsRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.GetNodePoolRequest, + dict, +]) +def test_get_node_pool(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.NodePool( + name='name_value', + initial_node_count=1911, + locations=['locations_value'], + self_link='self_link_value', + version='version_value', + instance_group_urls=['instance_group_urls_value'], + status=cluster_service.NodePool.Status.PROVISIONING, + status_message='status_message_value', + pod_ipv4_cidr_size=1856, + etag='etag_value', + ) + response = client.get_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.GetNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.NodePool) + assert response.name == 'name_value' + assert response.initial_node_count == 1911 + assert response.locations == ['locations_value'] + assert response.self_link == 'self_link_value' + assert response.version == 'version_value' + assert response.instance_group_urls == ['instance_group_urls_value'] + assert response.status == cluster_service.NodePool.Status.PROVISIONING + assert response.status_message == 'status_message_value' + assert response.pod_ipv4_cidr_size == 1856 + assert response.etag == 'etag_value' + + +def test_get_node_pool_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.GetNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.get_node_pool(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.GetNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +def test_get_node_pool_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.get_node_pool in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.get_node_pool] = mock_rpc + request = {} + client.get_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.get_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.get_node_pool in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.get_node_pool] = mock_rpc + + request = {} + await client.get_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.get_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_get_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetNodePoolRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool( + name='name_value', + initial_node_count=1911, + locations=['locations_value'], + self_link='self_link_value', + version='version_value', + instance_group_urls=['instance_group_urls_value'], + status=cluster_service.NodePool.Status.PROVISIONING, + status_message='status_message_value', + pod_ipv4_cidr_size=1856, + etag='etag_value', + )) + response = await client.get_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.GetNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.NodePool) + assert response.name == 'name_value' + assert response.initial_node_count == 1911 + assert response.locations == ['locations_value'] + assert response.self_link == 'self_link_value' + assert response.version == 'version_value' + assert response.instance_group_urls == ['instance_group_urls_value'] + assert response.status == cluster_service.NodePool.Status.PROVISIONING + assert response.status_message == 'status_message_value' + assert response.pod_ipv4_cidr_size == 1856 + assert response.etag == 'etag_value' + + +@pytest.mark.asyncio +async def test_get_node_pool_async_from_dict(): + await test_get_node_pool_async(request_type=dict) + +def test_get_node_pool_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetNodePoolRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + call.return_value = cluster_service.NodePool() + client.get_node_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_node_pool_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.GetNodePoolRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool()) + await client.get_node_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_node_pool_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.NodePool() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_node_pool( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + + +def test_get_node_pool_flattened_error(): + client = ClusterManagerClient( + 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_node_pool( + cluster_service.GetNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + ) + +@pytest.mark.asyncio +async def test_get_node_pool_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.NodePool() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_node_pool( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_node_pool_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_node_pool( + cluster_service.GetNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CreateNodePoolRequest, + dict, +]) +def test_create_node_pool(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.create_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.CreateNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_create_node_pool_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.CreateNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.create_node_pool(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CreateNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + parent='parent_value', + ) + +def test_create_node_pool_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.create_node_pool in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.create_node_pool] = mock_rpc + request = {} + client.create_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.create_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_create_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.create_node_pool in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.create_node_pool] = mock_rpc + + request = {} + await client.create_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.create_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_create_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CreateNodePoolRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.create_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.CreateNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_create_node_pool_async_from_dict(): + await test_create_node_pool_async(request_type=dict) + +def test_create_node_pool_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CreateNodePoolRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.create_node_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_node_pool_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CreateNodePoolRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.create_node_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_node_pool_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_node_pool( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool=cluster_service.NodePool(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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool + mock_val = cluster_service.NodePool(name='name_value') + assert arg == mock_val + + +def test_create_node_pool_flattened_error(): + client = ClusterManagerClient( + 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_node_pool( + cluster_service.CreateNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool=cluster_service.NodePool(name='name_value'), + ) + +@pytest.mark.asyncio +async def test_create_node_pool_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_node_pool( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool=cluster_service.NodePool(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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool + mock_val = cluster_service.NodePool(name='name_value') + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_node_pool_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_node_pool( + cluster_service.CreateNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool=cluster_service.NodePool(name='name_value'), + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.DeleteNodePoolRequest, + dict, +]) +def test_delete_node_pool(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.delete_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.DeleteNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_delete_node_pool_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.DeleteNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.delete_node_pool(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.DeleteNodePoolRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +def test_delete_node_pool_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.delete_node_pool in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.delete_node_pool] = mock_rpc + request = {} + client.delete_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.delete_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_delete_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.delete_node_pool in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.delete_node_pool] = mock_rpc + + request = {} + await client.delete_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.delete_node_pool(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_delete_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.DeleteNodePoolRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.delete_node_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.DeleteNodePoolRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_delete_node_pool_async_from_dict(): + await test_delete_node_pool_async(request_type=dict) + +def test_delete_node_pool_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.DeleteNodePoolRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.delete_node_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_node_pool_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.DeleteNodePoolRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.delete_node_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_node_pool_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_node_pool( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + + +def test_delete_node_pool_flattened_error(): + client = ClusterManagerClient( + 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_node_pool( + cluster_service.DeleteNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + ) + +@pytest.mark.asyncio +async def test_delete_node_pool_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_node_pool( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_node_pool_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_node_pool( + cluster_service.DeleteNodePoolRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CompleteNodePoolUpgradeRequest, + dict, +]) +def test_complete_node_pool_upgrade(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.complete_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.CompleteNodePoolUpgradeRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +def test_complete_node_pool_upgrade_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.CompleteNodePoolUpgradeRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.complete_node_pool_upgrade(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CompleteNodePoolUpgradeRequest( + name='name_value', + ) + +def test_complete_node_pool_upgrade_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.complete_node_pool_upgrade in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.complete_node_pool_upgrade] = mock_rpc + request = {} + client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.complete_node_pool_upgrade(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.complete_node_pool_upgrade in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.complete_node_pool_upgrade] = mock_rpc + + request = {} + await client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.complete_node_pool_upgrade(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CompleteNodePoolUpgradeRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.complete_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.CompleteNodePoolUpgradeRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_async_from_dict(): + await test_complete_node_pool_upgrade_async(request_type=dict) + +def test_complete_node_pool_upgrade_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CompleteNodePoolUpgradeRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), + '__call__') as call: + call.return_value = None + client.complete_node_pool_upgrade(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_complete_node_pool_upgrade_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CompleteNodePoolUpgradeRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.complete_node_pool_upgrade(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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.RollbackNodePoolUpgradeRequest, + dict, +]) +def test_rollback_node_pool_upgrade(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.rollback_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.rollback_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.RollbackNodePoolUpgradeRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_rollback_node_pool_upgrade_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.RollbackNodePoolUpgradeRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.rollback_node_pool_upgrade(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +def test_rollback_node_pool_upgrade_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.rollback_node_pool_upgrade in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.rollback_node_pool_upgrade] = mock_rpc + request = {} + client.rollback_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.rollback_node_pool_upgrade(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_rollback_node_pool_upgrade_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.rollback_node_pool_upgrade in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.rollback_node_pool_upgrade] = mock_rpc + + request = {} + await client.rollback_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.rollback_node_pool_upgrade(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_rollback_node_pool_upgrade_async(transport: str = 'grpc_asyncio', request_type=cluster_service.RollbackNodePoolUpgradeRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.rollback_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.rollback_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.RollbackNodePoolUpgradeRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_rollback_node_pool_upgrade_async_from_dict(): + await test_rollback_node_pool_upgrade_async(request_type=dict) + +def test_rollback_node_pool_upgrade_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.RollbackNodePoolUpgradeRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.rollback_node_pool_upgrade(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_rollback_node_pool_upgrade_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.RollbackNodePoolUpgradeRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.rollback_node_pool_upgrade(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_rollback_node_pool_upgrade_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.rollback_node_pool_upgrade( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + + +def test_rollback_node_pool_upgrade_flattened_error(): + client = ClusterManagerClient( + 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.rollback_node_pool_upgrade( + cluster_service.RollbackNodePoolUpgradeRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + ) + +@pytest.mark.asyncio +async def test_rollback_node_pool_upgrade_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.rollback_node_pool_upgrade( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_rollback_node_pool_upgrade_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.rollback_node_pool_upgrade( + cluster_service.RollbackNodePoolUpgradeRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetNodePoolManagementRequest, + dict, +]) +def test_set_node_pool_management(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_node_pool_management), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_node_pool_management(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNodePoolManagementRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_node_pool_management_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetNodePoolManagementRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_node_pool_management(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetNodePoolManagementRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +def test_set_node_pool_management_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_node_pool_management in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_node_pool_management] = mock_rpc + request = {} + client.set_node_pool_management(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_node_pool_management(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_node_pool_management_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_node_pool_management in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_node_pool_management] = mock_rpc + + request = {} + await client.set_node_pool_management(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_node_pool_management(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_node_pool_management_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNodePoolManagementRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_node_pool_management), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_node_pool_management(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNodePoolManagementRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_node_pool_management_async_from_dict(): + await test_set_node_pool_management_async(request_type=dict) + +def test_set_node_pool_management_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNodePoolManagementRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_node_pool_management(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_set_node_pool_management_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNodePoolManagementRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_node_pool_management(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_set_node_pool_management_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_node_pool_management( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + management=cluster_service.NodeManagement(auto_upgrade=True), + ) + + # 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + arg = args[0].management + mock_val = cluster_service.NodeManagement(auto_upgrade=True) + assert arg == mock_val + + +def test_set_node_pool_management_flattened_error(): + client = ClusterManagerClient( + 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.set_node_pool_management( + cluster_service.SetNodePoolManagementRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + management=cluster_service.NodeManagement(auto_upgrade=True), + ) + +@pytest.mark.asyncio +async def test_set_node_pool_management_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_node_pool_management( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + management=cluster_service.NodeManagement(auto_upgrade=True), + ) + + # 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].node_pool_id + mock_val = 'node_pool_id_value' + assert arg == mock_val + arg = args[0].management + mock_val = cluster_service.NodeManagement(auto_upgrade=True) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_node_pool_management_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_node_pool_management( + cluster_service.SetNodePoolManagementRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + management=cluster_service.NodeManagement(auto_upgrade=True), + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetLabelsRequest, + dict, +]) +def test_set_labels(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_labels), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_labels(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLabelsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_labels_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetLabelsRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + label_fingerprint='label_fingerprint_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_labels), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_labels(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetLabelsRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + label_fingerprint='label_fingerprint_value', + name='name_value', + ) + +def test_set_labels_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_labels in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_labels] = mock_rpc + request = {} + client.set_labels(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_labels(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_labels_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_labels in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_labels] = mock_rpc + + request = {} + await client.set_labels(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_labels(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_labels_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLabelsRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_labels), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_labels(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLabelsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_labels_async_from_dict(): + await test_set_labels_async(request_type=dict) + +def test_set_labels_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLabelsRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_labels), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_labels(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_set_labels_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLabelsRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_labels), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_labels(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_set_labels_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_labels), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_labels( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + resource_labels={'key_value': 'value_value'}, + label_fingerprint='label_fingerprint_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].resource_labels + mock_val = {'key_value': 'value_value'} + assert arg == mock_val + arg = args[0].label_fingerprint + mock_val = 'label_fingerprint_value' + assert arg == mock_val + + +def test_set_labels_flattened_error(): + client = ClusterManagerClient( + 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.set_labels( + cluster_service.SetLabelsRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + resource_labels={'key_value': 'value_value'}, + label_fingerprint='label_fingerprint_value', + ) + +@pytest.mark.asyncio +async def test_set_labels_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_labels), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_labels( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + resource_labels={'key_value': 'value_value'}, + label_fingerprint='label_fingerprint_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].resource_labels + mock_val = {'key_value': 'value_value'} + assert arg == mock_val + arg = args[0].label_fingerprint + mock_val = 'label_fingerprint_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_labels_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_labels( + cluster_service.SetLabelsRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + resource_labels={'key_value': 'value_value'}, + label_fingerprint='label_fingerprint_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetLegacyAbacRequest, + dict, +]) +def test_set_legacy_abac(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_legacy_abac), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_legacy_abac(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLegacyAbacRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_legacy_abac_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetLegacyAbacRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_legacy_abac(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetLegacyAbacRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_set_legacy_abac_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_legacy_abac in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_legacy_abac] = mock_rpc + request = {} + client.set_legacy_abac(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_legacy_abac(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_legacy_abac_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_legacy_abac in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_legacy_abac] = mock_rpc + + request = {} + await client.set_legacy_abac(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_legacy_abac(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_legacy_abac_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLegacyAbacRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_legacy_abac), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_legacy_abac(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetLegacyAbacRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_legacy_abac_async_from_dict(): + await test_set_legacy_abac_async(request_type=dict) + +def test_set_legacy_abac_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLegacyAbacRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_legacy_abac(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_set_legacy_abac_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetLegacyAbacRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_legacy_abac(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_set_legacy_abac_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_legacy_abac( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + enabled=True, + ) + + # 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].enabled + mock_val = True + assert arg == mock_val + + +def test_set_legacy_abac_flattened_error(): + client = ClusterManagerClient( + 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.set_legacy_abac( + cluster_service.SetLegacyAbacRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + enabled=True, + ) + +@pytest.mark.asyncio +async def test_set_legacy_abac_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_legacy_abac( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + enabled=True, + ) + + # 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].enabled + mock_val = True + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_legacy_abac_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_legacy_abac( + cluster_service.SetLegacyAbacRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + enabled=True, + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.StartIPRotationRequest, + dict, +]) +def test_start_ip_rotation(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.start_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.start_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.StartIPRotationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_start_ip_rotation_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.StartIPRotationRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.start_ip_rotation(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.StartIPRotationRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_start_ip_rotation_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.start_ip_rotation in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.start_ip_rotation] = mock_rpc + request = {} + client.start_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.start_ip_rotation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_start_ip_rotation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.start_ip_rotation in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.start_ip_rotation] = mock_rpc + + request = {} + await client.start_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.start_ip_rotation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_start_ip_rotation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.StartIPRotationRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.start_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.start_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.StartIPRotationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_start_ip_rotation_async_from_dict(): + await test_start_ip_rotation_async(request_type=dict) + +def test_start_ip_rotation_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.StartIPRotationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.start_ip_rotation(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_start_ip_rotation_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.StartIPRotationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.start_ip_rotation(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_start_ip_rotation_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.start_ip_rotation( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + + +def test_start_ip_rotation_flattened_error(): + client = ClusterManagerClient( + 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.start_ip_rotation( + cluster_service.StartIPRotationRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + ) + +@pytest.mark.asyncio +async def test_start_ip_rotation_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.start_ip_rotation( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_start_ip_rotation_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.start_ip_rotation( + cluster_service.StartIPRotationRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.CompleteIPRotationRequest, + dict, +]) +def test_complete_ip_rotation(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.complete_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.complete_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.CompleteIPRotationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_complete_ip_rotation_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.CompleteIPRotationRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.complete_ip_rotation(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CompleteIPRotationRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_complete_ip_rotation_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.complete_ip_rotation in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.complete_ip_rotation] = mock_rpc + request = {} + client.complete_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.complete_ip_rotation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_complete_ip_rotation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.complete_ip_rotation in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.complete_ip_rotation] = mock_rpc + + request = {} + await client.complete_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.complete_ip_rotation(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_complete_ip_rotation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CompleteIPRotationRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.complete_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.complete_ip_rotation(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.CompleteIPRotationRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_complete_ip_rotation_async_from_dict(): + await test_complete_ip_rotation_async(request_type=dict) + +def test_complete_ip_rotation_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CompleteIPRotationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.complete_ip_rotation(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_complete_ip_rotation_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CompleteIPRotationRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.complete_ip_rotation(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_complete_ip_rotation_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.complete_ip_rotation( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + + +def test_complete_ip_rotation_flattened_error(): + client = ClusterManagerClient( + 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.complete_ip_rotation( + cluster_service.CompleteIPRotationRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + ) + +@pytest.mark.asyncio +async def test_complete_ip_rotation_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.complete_ip_rotation( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_complete_ip_rotation_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.complete_ip_rotation( + cluster_service.CompleteIPRotationRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetNodePoolSizeRequest, + dict, +]) +def test_set_node_pool_size(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_node_pool_size), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_node_pool_size(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNodePoolSizeRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_node_pool_size_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetNodePoolSizeRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_size), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_node_pool_size(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetNodePoolSizeRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + node_pool_id='node_pool_id_value', + name='name_value', + ) + +def test_set_node_pool_size_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_node_pool_size in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_node_pool_size] = mock_rpc + request = {} + client.set_node_pool_size(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_node_pool_size(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_node_pool_size_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_node_pool_size in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_node_pool_size] = mock_rpc + + request = {} + await client.set_node_pool_size(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_node_pool_size(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_node_pool_size_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNodePoolSizeRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_node_pool_size), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_node_pool_size(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNodePoolSizeRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_node_pool_size_async_from_dict(): + await test_set_node_pool_size_async(request_type=dict) + +def test_set_node_pool_size_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNodePoolSizeRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_size), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_node_pool_size(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_set_node_pool_size_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNodePoolSizeRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_size), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_node_pool_size(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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetNetworkPolicyRequest, + dict, +]) +def test_set_network_policy(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_network_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_network_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNetworkPolicyRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_network_policy_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetNetworkPolicyRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_network_policy(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetNetworkPolicyRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_set_network_policy_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_network_policy in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_network_policy] = mock_rpc + request = {} + client.set_network_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_network_policy(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_network_policy_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_network_policy in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_network_policy] = mock_rpc + + request = {} + await client.set_network_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_network_policy(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_network_policy_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNetworkPolicyRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_network_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_network_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetNetworkPolicyRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_network_policy_async_from_dict(): + await test_set_network_policy_async(request_type=dict) + +def test_set_network_policy_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNetworkPolicyRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_network_policy(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_set_network_policy_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetNetworkPolicyRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_network_policy(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_set_network_policy_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_network_policy( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), + ) + + # 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].network_policy + mock_val = cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO) + assert arg == mock_val + + +def test_set_network_policy_flattened_error(): + client = ClusterManagerClient( + 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.set_network_policy( + cluster_service.SetNetworkPolicyRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), + ) + +@pytest.mark.asyncio +async def test_set_network_policy_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_network_policy( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), + ) + + # 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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].network_policy + mock_val = cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_network_policy_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_network_policy( + cluster_service.SetNetworkPolicyRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.SetMaintenancePolicyRequest, + dict, +]) +def test_set_maintenance_policy(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.set_maintenance_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + ) + response = client.set_maintenance_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.SetMaintenancePolicyRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +def test_set_maintenance_policy_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.SetMaintenancePolicyRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.set_maintenance_policy(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.SetMaintenancePolicyRequest( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + name='name_value', + ) + +def test_set_maintenance_policy_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.set_maintenance_policy in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.set_maintenance_policy] = mock_rpc + request = {} + client.set_maintenance_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.set_maintenance_policy(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_maintenance_policy_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.set_maintenance_policy in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.set_maintenance_policy] = mock_rpc + + request = {} + await client.set_maintenance_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.set_maintenance_policy(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_set_maintenance_policy_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetMaintenancePolicyRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.set_maintenance_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + response = await client.set_maintenance_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.SetMaintenancePolicyRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.Operation) + assert response.name == 'name_value' + assert response.zone == 'zone_value' + assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER + assert response.status == cluster_service.Operation.Status.PENDING + assert response.detail == 'detail_value' + assert response.status_message == 'status_message_value' + assert response.self_link == 'self_link_value' + assert response.target_link == 'target_link_value' + assert response.location == 'location_value' + assert response.start_time == 'start_time_value' + assert response.end_time == 'end_time_value' + + +@pytest.mark.asyncio +async def test_set_maintenance_policy_async_from_dict(): + await test_set_maintenance_policy_async(request_type=dict) + +def test_set_maintenance_policy_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetMaintenancePolicyRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_maintenance_policy(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_set_maintenance_policy_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.SetMaintenancePolicyRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + await client.set_maintenance_policy(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_set_maintenance_policy_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.set_maintenance_policy( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].maintenance_policy + mock_val = cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))) + assert arg == mock_val + + +def test_set_maintenance_policy_flattened_error(): + client = ClusterManagerClient( + 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.set_maintenance_policy( + cluster_service.SetMaintenancePolicyRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), + ) + +@pytest.mark.asyncio +async def test_set_maintenance_policy_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.Operation() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.set_maintenance_policy( + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_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].project_id + mock_val = 'project_id_value' + assert arg == mock_val + arg = args[0].zone + mock_val = 'zone_value' + assert arg == mock_val + arg = args[0].cluster_id + mock_val = 'cluster_id_value' + assert arg == mock_val + arg = args[0].maintenance_policy + mock_val = cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_set_maintenance_policy_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.set_maintenance_policy( + cluster_service.SetMaintenancePolicyRequest(), + project_id='project_id_value', + zone='zone_value', + cluster_id='cluster_id_value', + maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), + ) + + +@pytest.mark.parametrize("request_type", [ + cluster_service.ListUsableSubnetworksRequest, + dict, +]) +def test_list_usable_subnetworks(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_usable_subnetworks), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListUsableSubnetworksResponse( + next_page_token='next_page_token_value', + ) + response = client.list_usable_subnetworks(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.ListUsableSubnetworksRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListUsableSubnetworksPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_usable_subnetworks_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.ListUsableSubnetworksRequest( + parent='parent_value', + filter='filter_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.list_usable_subnetworks(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.ListUsableSubnetworksRequest( + parent='parent_value', + filter='filter_value', + page_token='page_token_value', + ) + +def test_list_usable_subnetworks_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.list_usable_subnetworks in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.list_usable_subnetworks] = mock_rpc + request = {} + client.list_usable_subnetworks(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_usable_subnetworks(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_usable_subnetworks_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.list_usable_subnetworks in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.list_usable_subnetworks] = mock_rpc + + request = {} + await client.list_usable_subnetworks(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.list_usable_subnetworks(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_usable_subnetworks_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListUsableSubnetworksRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_usable_subnetworks), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_usable_subnetworks(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.ListUsableSubnetworksRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListUsableSubnetworksAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_usable_subnetworks_async_from_dict(): + await test_list_usable_subnetworks_async(request_type=dict) + +def test_list_usable_subnetworks_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListUsableSubnetworksRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__') as call: + call.return_value = cluster_service.ListUsableSubnetworksResponse() + client.list_usable_subnetworks(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_usable_subnetworks_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListUsableSubnetworksRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse()) + await client.list_usable_subnetworks(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_usable_subnetworks_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListUsableSubnetworksResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_usable_subnetworks( + 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_usable_subnetworks_flattened_error(): + client = ClusterManagerClient( + 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_usable_subnetworks( + cluster_service.ListUsableSubnetworksRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_usable_subnetworks_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListUsableSubnetworksResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_usable_subnetworks( + 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_usable_subnetworks_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_usable_subnetworks( + cluster_service.ListUsableSubnetworksRequest(), + parent='parent_value', + ) + + +def test_list_usable_subnetworks_pager(transport_name: str = "grpc"): + client = ClusterManagerClient( + 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_usable_subnetworks), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + next_page_token='abc', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[], + next_page_token='def', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + ], + next_page_token='ghi', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + ), + RuntimeError, + ) + + expected_metadata = () + retry = retries.Retry() + timeout = 5 + expected_metadata = tuple(expected_metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_usable_subnetworks(request={}, retry=retry, timeout=timeout) + + assert pager._metadata == expected_metadata + assert pager._retry == retry + assert pager._timeout == timeout + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, cluster_service.UsableSubnetwork) + for i in results) +def test_list_usable_subnetworks_pages(transport_name: str = "grpc"): + client = ClusterManagerClient( + 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_usable_subnetworks), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + next_page_token='abc', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[], + next_page_token='def', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + ], + next_page_token='ghi', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + ), + RuntimeError, + ) + pages = list(client.list_usable_subnetworks(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_usable_subnetworks_async_pager(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + next_page_token='abc', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[], + next_page_token='def', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + ], + next_page_token='ghi', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_usable_subnetworks(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, cluster_service.UsableSubnetwork) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_usable_subnetworks_async_pages(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + next_page_token='abc', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[], + next_page_token='def', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + ], + next_page_token='ghi', + ), + cluster_service.ListUsableSubnetworksResponse( + subnetworks=[ + cluster_service.UsableSubnetwork(), + cluster_service.UsableSubnetwork(), + ], + ), + RuntimeError, + ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_usable_subnetworks(request={}) + ).pages: + 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", [ + cluster_service.CheckAutopilotCompatibilityRequest, + dict, +]) +def test_check_autopilot_compatibility(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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.check_autopilot_compatibility), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.CheckAutopilotCompatibilityResponse( + summary='summary_value', + ) + response = client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.CheckAutopilotCompatibilityRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) + assert response.summary == 'summary_value' + + +def test_check_autopilot_compatibility_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.CheckAutopilotCompatibilityRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.check_autopilot_compatibility(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CheckAutopilotCompatibilityRequest( + name='name_value', + ) + +def test_check_autopilot_compatibility_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.check_autopilot_compatibility in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.check_autopilot_compatibility] = mock_rpc + request = {} + client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.check_autopilot_compatibility(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.check_autopilot_compatibility in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.check_autopilot_compatibility] = mock_rpc + + request = {} + await client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.check_autopilot_compatibility(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CheckAutopilotCompatibilityRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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.check_autopilot_compatibility), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.CheckAutopilotCompatibilityResponse( + summary='summary_value', + )) + response = await client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.CheckAutopilotCompatibilityRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) + assert response.summary == 'summary_value' + + +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_async_from_dict(): + await test_check_autopilot_compatibility_async(request_type=dict) + +def test_check_autopilot_compatibility_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CheckAutopilotCompatibilityRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), + '__call__') as call: + call.return_value = cluster_service.CheckAutopilotCompatibilityResponse() + client.check_autopilot_compatibility(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_check_autopilot_compatibility_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CheckAutopilotCompatibilityRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.CheckAutopilotCompatibilityResponse()) + await client.check_autopilot_compatibility(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'] + + +@pytest.mark.parametrize("request_type", [ + cluster_service.ListLocationsRequest, + dict, +]) +def test_list_locations(request_type, transport: str = 'grpc'): + client = ClusterManagerClient( + 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_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListLocationsResponse( + next_page_token='next_page_token_value', + ) + response = client.list_locations(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + request = cluster_service.ListLocationsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response.raw_page is response + assert isinstance(response, cluster_service.ListLocationsResponse) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_locations_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cluster_service.ListLocationsRequest( + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_locations), + '__call__') as call: + call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client.list_locations(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.ListLocationsRequest( + parent='parent_value', + ) + +def test_list_locations_use_cached_wrapped_rpc(): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._transport.list_locations in client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.Mock() + mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. + client._transport._wrapped_methods[client._transport.list_locations] = mock_rpc + request = {} + client.list_locations(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + client.list_locations(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_locations_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): + # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, + # instead of constructing them on each call + with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport=transport, + ) + + # Should wrap all calls on client creation + assert wrapper_fn.call_count > 0 + wrapper_fn.reset_mock() + + # Ensure method has been cached + assert client._client._transport.list_locations in client._client._transport._wrapped_methods + + # Replace cached wrapped function with mock + mock_rpc = mock.AsyncMock() + mock_rpc.return_value = mock.Mock() + client._client._transport._wrapped_methods[client._client._transport.list_locations] = mock_rpc + + request = {} + await client.list_locations(request) + + # Establish that the underlying gRPC stub method was called. + assert mock_rpc.call_count == 1 + + await client.list_locations(request) + + # Establish that a new wrapper was not created for this call + assert wrapper_fn.call_count == 0 + assert mock_rpc.call_count == 2 + +@pytest.mark.asyncio +async def test_list_locations_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListLocationsRequest): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListLocationsResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_locations(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + request = cluster_service.ListLocationsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.ListLocationsResponse) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_locations_async_from_dict(): + await test_list_locations_async(request_type=dict) + +def test_list_locations_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListLocationsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_locations), + '__call__') as call: + call.return_value = cluster_service.ListLocationsResponse() + client.list_locations(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_locations_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.ListLocationsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_locations), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListLocationsResponse()) + await client.list_locations(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_locations_flattened(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListLocationsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_locations( + 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_locations_flattened_error(): + client = ClusterManagerClient( + 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_locations( + cluster_service.ListLocationsRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_locations_flattened_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.ListLocationsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListLocationsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_locations( + 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_locations_flattened_error_async(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_locations( + cluster_service.ListLocationsRequest(), + parent='parent_value', + ) + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.ClusterManagerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.ClusterManagerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ClusterManagerClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.ClusterManagerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = ClusterManagerClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = ClusterManagerClient( + client_options=options, + credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.ClusterManagerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ClusterManagerClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.ClusterManagerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = ClusterManagerClient(transport=transport) + assert client.transport is transport + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.ClusterManagerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.ClusterManagerGrpcAsyncIOTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + +@pytest.mark.parametrize("transport_class", [ + transports.ClusterManagerGrpcTransport, + transports.ClusterManagerGrpcAsyncIOTransport, +]) +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() + +def test_transport_kind_grpc(): + transport = ClusterManagerClient.get_transport_class("grpc")( + credentials=ga_credentials.AnonymousCredentials() + ) + assert transport.kind == "grpc" + + +def test_initialize_client_w_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc" + ) + assert client is not None + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_clusters_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + call.return_value = cluster_service.ListClustersResponse() + client.list_clusters(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListClustersRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_cluster_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + call.return_value = cluster_service.Cluster() + client.get_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_create_cluster_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.create_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CreateClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_cluster_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.update_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_node_pool_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_node_pool), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.update_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_node_pool_autoscaling_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_autoscaling), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_node_pool_autoscaling(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolAutoscalingRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_logging_service_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_logging_service(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLoggingServiceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_monitoring_service_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_monitoring_service(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMonitoringServiceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_addons_config_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_addons_config(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetAddonsConfigRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_locations_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_locations(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLocationsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_master_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.update_master(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateMasterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_master_auth_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_master_auth), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_master_auth(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMasterAuthRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_cluster_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.delete_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.DeleteClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_operations_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + call.return_value = cluster_service.ListOperationsResponse() + client.list_operations(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListOperationsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_operation_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.get_operation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetOperationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_cancel_operation_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + call.return_value = None + client.cancel_operation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CancelOperationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_server_config_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + call.return_value = cluster_service.ServerConfig() + client.get_server_config(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetServerConfigRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_json_web_keys_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_json_web_keys), + '__call__') as call: + call.return_value = cluster_service.GetJSONWebKeysResponse() + client.get_json_web_keys(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetJSONWebKeysRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_node_pools_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + call.return_value = cluster_service.ListNodePoolsResponse() + client.list_node_pools(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListNodePoolsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_node_pool_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + call.return_value = cluster_service.NodePool() + client.get_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_create_node_pool_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.create_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CreateNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_node_pool_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.delete_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.DeleteNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_complete_node_pool_upgrade_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), + '__call__') as call: + call.return_value = None + client.complete_node_pool_upgrade(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CompleteNodePoolUpgradeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_rollback_node_pool_upgrade_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.rollback_node_pool_upgrade(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.RollbackNodePoolUpgradeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_node_pool_management_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_node_pool_management(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolManagementRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_labels_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_labels), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_labels(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLabelsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_legacy_abac_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_legacy_abac(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLegacyAbacRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_start_ip_rotation_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.start_ip_rotation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.StartIPRotationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_complete_ip_rotation_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.complete_ip_rotation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CompleteIPRotationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_node_pool_size_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_size), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_node_pool_size(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolSizeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_network_policy_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_network_policy(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNetworkPolicyRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_set_maintenance_policy_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + call.return_value = cluster_service.Operation() + client.set_maintenance_policy(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMaintenancePolicyRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_usable_subnetworks_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__') as call: + call.return_value = cluster_service.ListUsableSubnetworksResponse() + client.list_usable_subnetworks(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListUsableSubnetworksRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_check_autopilot_compatibility_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), + '__call__') as call: + call.return_value = cluster_service.CheckAutopilotCompatibilityResponse() + client.check_autopilot_compatibility(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CheckAutopilotCompatibilityRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_locations_empty_call_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_locations), + '__call__') as call: + call.return_value = cluster_service.ListLocationsResponse() + client.list_locations(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListLocationsRequest() + + assert args[0] == request_msg + + +def test_transport_kind_grpc_asyncio(): + transport = ClusterManagerAsyncClient.get_transport_class("grpc_asyncio")( + credentials=async_anonymous_credentials() + ) + assert transport.kind == "grpc_asyncio" + + +def test_initialize_client_w_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio" + ) + assert client is not None + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_list_clusters_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_clusters), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse( + missing_zones=['missing_zones_value'], + )) + await client.list_clusters(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListClustersRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_cluster_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster( + name='name_value', + description='description_value', + initial_node_count=1911, + logging_service='logging_service_value', + monitoring_service='monitoring_service_value', + network='network_value', + cluster_ipv4_cidr='cluster_ipv4_cidr_value', + subnetwork='subnetwork_value', + locations=['locations_value'], + enable_kubernetes_alpha=True, + label_fingerprint='label_fingerprint_value', + private_cluster=True, + master_ipv4_cidr_block='master_ipv4_cidr_block_value', + self_link='self_link_value', + zone='zone_value', + endpoint='endpoint_value', + initial_cluster_version='initial_cluster_version_value', + current_master_version='current_master_version_value', + current_node_version='current_node_version_value', + create_time='create_time_value', + status=cluster_service.Cluster.Status.PROVISIONING, + status_message='status_message_value', + node_ipv4_cidr_size=1955, + services_ipv4_cidr='services_ipv4_cidr_value', + instance_group_urls=['instance_group_urls_value'], + current_node_count=1936, + expire_time='expire_time_value', + location='location_value', + enable_tpu=True, + tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', + id='id_value', + etag='etag_value', + satisfies_pzs=True, + satisfies_pzi=True, + )) + await client.get_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_create_cluster_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.create_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CreateClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_update_cluster_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.update_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_update_node_pool_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.update_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_node_pool_autoscaling_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_autoscaling), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_node_pool_autoscaling(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolAutoscalingRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_logging_service_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_logging_service(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLoggingServiceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_monitoring_service_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_monitoring_service(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMonitoringServiceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_addons_config_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_addons_config(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetAddonsConfigRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_locations_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_locations(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLocationsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_update_master_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_master), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.update_master(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.UpdateMasterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_master_auth_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_master_auth), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_master_auth(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMasterAuthRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_delete_cluster_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_cluster), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.delete_cluster(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.DeleteClusterRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_list_operations_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_operations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse( + missing_zones=['missing_zones_value'], + )) + await client.list_operations(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListOperationsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_operation_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.get_operation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetOperationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_cancel_operation_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.cancel_operation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.cancel_operation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CancelOperationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_server_config_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig( + default_cluster_version='default_cluster_version_value', + valid_node_versions=['valid_node_versions_value'], + default_image_type='default_image_type_value', + valid_image_types=['valid_image_types_value'], + valid_master_versions=['valid_master_versions_value'], + )) + await client.get_server_config(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetServerConfigRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_json_web_keys_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_json_web_keys), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.GetJSONWebKeysResponse( + )) + await client.get_json_web_keys(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetJSONWebKeysRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_list_node_pools_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_node_pools), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse( + )) + await client.list_node_pools(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListNodePoolsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_node_pool_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool( + name='name_value', + initial_node_count=1911, + locations=['locations_value'], + self_link='self_link_value', + version='version_value', + instance_group_urls=['instance_group_urls_value'], + status=cluster_service.NodePool.Status.PROVISIONING, + status_message='status_message_value', + pod_ipv4_cidr_size=1856, + etag='etag_value', + )) + await client.get_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.GetNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_create_node_pool_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.create_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CreateNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_delete_node_pool_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_node_pool), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.delete_node_pool(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.DeleteNodePoolRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.complete_node_pool_upgrade(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CompleteNodePoolUpgradeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_rollback_node_pool_upgrade_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.rollback_node_pool_upgrade(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.RollbackNodePoolUpgradeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_node_pool_management_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_node_pool_management(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolManagementRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_labels_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_labels), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_labels(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLabelsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_legacy_abac_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_legacy_abac), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_legacy_abac(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetLegacyAbacRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_start_ip_rotation_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.start_ip_rotation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.StartIPRotationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_complete_ip_rotation_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.complete_ip_rotation(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CompleteIPRotationRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_node_pool_size_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_size), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_node_pool_size(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNodePoolSizeRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_network_policy_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_network_policy(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetNetworkPolicyRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_set_maintenance_policy_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( + name='name_value', + zone='zone_value', + operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, + status=cluster_service.Operation.Status.PENDING, + detail='detail_value', + status_message='status_message_value', + self_link='self_link_value', + target_link='target_link_value', + location='location_value', + start_time='start_time_value', + end_time='end_time_value', + )) + await client.set_maintenance_policy(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.SetMaintenancePolicyRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_list_usable_subnetworks_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse( + next_page_token='next_page_token_value', + )) + await client.list_usable_subnetworks(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListUsableSubnetworksRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.CheckAutopilotCompatibilityResponse( + summary='summary_value', + )) + await client.check_autopilot_compatibility(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.CheckAutopilotCompatibilityRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_list_locations_empty_call_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + transport="grpc_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_locations), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListLocationsResponse( + next_page_token='next_page_token_value', + )) + await client.list_locations(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cluster_service.ListLocationsRequest() + + assert args[0] == request_msg + + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ClusterManagerGrpcTransport, + ) + +def test_cluster_manager_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.ClusterManagerTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json" + ) + + +def test_cluster_manager_base_transport(): + # Instantiate the base transport. + with mock.patch('google.cloud.container_v1beta1.services.cluster_manager.transports.ClusterManagerTransport.__init__') as Transport: + Transport.return_value = None + transport = transports.ClusterManagerTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + 'list_clusters', + 'get_cluster', + 'create_cluster', + 'update_cluster', + 'update_node_pool', + 'set_node_pool_autoscaling', + 'set_logging_service', + 'set_monitoring_service', + 'set_addons_config', + 'set_locations', + 'update_master', + 'set_master_auth', + 'delete_cluster', + 'list_operations', + 'get_operation', + 'cancel_operation', + 'get_server_config', + 'get_json_web_keys', + 'list_node_pools', + 'get_node_pool', + 'create_node_pool', + 'delete_node_pool', + 'complete_node_pool_upgrade', + 'rollback_node_pool_upgrade', + 'set_node_pool_management', + 'set_labels', + 'set_legacy_abac', + 'start_ip_rotation', + 'complete_ip_rotation', + 'set_node_pool_size', + 'set_network_policy', + 'set_maintenance_policy', + 'list_usable_subnetworks', + 'check_autopilot_compatibility', + 'list_locations', + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + with pytest.raises(NotImplementedError): + transport.close() + + # Catch all for all remaining methods and properties + remainder = [ + 'kind', + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + + +def test_cluster_manager_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.container_v1beta1.services.cluster_manager.transports.ClusterManagerTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.ClusterManagerTransport( + 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_cluster_manager_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.container_v1beta1.services.cluster_manager.transports.ClusterManagerTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.ClusterManagerTransport() + adc.assert_called_once() + + +def test_cluster_manager_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) + ClusterManagerClient() + 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.ClusterManagerGrpcTransport, + transports.ClusterManagerGrpcAsyncIOTransport, + ], +) +def test_cluster_manager_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.ClusterManagerGrpcTransport, + transports.ClusterManagerGrpcAsyncIOTransport, + ], +) +def test_cluster_manager_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.ClusterManagerGrpcTransport, grpc_helpers), + (transports.ClusterManagerGrpcAsyncIOTransport, grpc_helpers_async) + ], +) +def test_cluster_manager_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( + "container.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="container.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("transport_class", [transports.ClusterManagerGrpcTransport, transports.ClusterManagerGrpcAsyncIOTransport]) +def test_cluster_manager_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_cluster_manager_host_no_port(transport_name): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='container.googleapis.com'), + transport=transport_name, + ) + assert client.transport._host == ( + 'container.googleapis.com:443' + ) + +@pytest.mark.parametrize("transport_name", [ + "grpc", + "grpc_asyncio", +]) +def test_cluster_manager_host_with_port(transport_name): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='container.googleapis.com:8000'), + transport=transport_name, + ) + assert client.transport._host == ( + 'container.googleapis.com:8000' + ) + +def test_cluster_manager_grpc_transport_channel(): + channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.ClusterManagerGrpcTransport( + 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_cluster_manager_grpc_asyncio_transport_channel(): + channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.ClusterManagerGrpcAsyncIOTransport( + 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.ClusterManagerGrpcTransport, transports.ClusterManagerGrpcAsyncIOTransport]) +def test_cluster_manager_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.ClusterManagerGrpcTransport, transports.ClusterManagerGrpcAsyncIOTransport]) +def test_cluster_manager_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_topic_path(): + project = "squid" + topic = "clam" + expected = "projects/{project}/topics/{topic}".format(project=project, topic=topic, ) + actual = ClusterManagerClient.topic_path(project, topic) + assert expected == actual + + +def test_parse_topic_path(): + expected = { + "project": "whelk", + "topic": "octopus", + } + path = ClusterManagerClient.topic_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.parse_topic_path(path) + assert expected == actual + +def test_common_billing_account_path(): + billing_account = "oyster" + expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + actual = ClusterManagerClient.common_billing_account_path(billing_account) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "nudibranch", + } + path = ClusterManagerClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.parse_common_billing_account_path(path) + assert expected == actual + +def test_common_folder_path(): + folder = "cuttlefish" + expected = "folders/{folder}".format(folder=folder, ) + actual = ClusterManagerClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "mussel", + } + path = ClusterManagerClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.parse_common_folder_path(path) + assert expected == actual + +def test_common_organization_path(): + organization = "winkle" + expected = "organizations/{organization}".format(organization=organization, ) + actual = ClusterManagerClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "nautilus", + } + path = ClusterManagerClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.parse_common_organization_path(path) + assert expected == actual + +def test_common_project_path(): + project = "scallop" + expected = "projects/{project}".format(project=project, ) + actual = ClusterManagerClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "abalone", + } + path = ClusterManagerClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.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 = ClusterManagerClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "whelk", + "location": "octopus", + } + path = ClusterManagerClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = ClusterManagerClient.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.ClusterManagerTransport, '_prep_wrapped_messages') as prep: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object(transports.ClusterManagerTransport, '_prep_wrapped_messages') as prep: + transport_class = ClusterManagerClient.get_transport_class() + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + +def test_transport_close_grpc(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc" + ) + with mock.patch.object(type(getattr(client.transport, "_grpc_channel")), "close") as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +@pytest.mark.asyncio +async def test_transport_close_grpc_asyncio(): + client = ClusterManagerAsyncClient( + credentials=async_anonymous_credentials(), + 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_client_ctx(): + transports = [ + 'grpc', + ] + for transport in transports: + client = ClusterManagerClient( + 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", [ + (ClusterManagerClient, transports.ClusterManagerGrpcTransport), + (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport), +]) +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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), + 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 d3374af3427824d93d6547a03ed1f600a2e0d948 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Sun, 26 Jan 2025 19:05:22 +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 --- .../google-cloud-container/v1/.coveragerc | 13 - .../google-cloud-container/v1/.flake8 | 33 - .../google-cloud-container/v1/MANIFEST.in | 2 - .../google-cloud-container/v1/README.rst | 49 - .../v1/docs/_static/custom.css | 3 - .../google-cloud-container/v1/docs/conf.py | 376 - .../v1/docs/container_v1/cluster_manager.rst | 10 - .../v1/docs/container_v1/services_.rst | 6 - .../v1/docs/container_v1/types_.rst | 6 - .../google-cloud-container/v1/docs/index.rst | 7 - .../v1/google/cloud/container/__init__.py | 387 - .../google/cloud/container/gapic_version.py | 16 - .../v1/google/cloud/container/py.typed | 2 - .../v1/google/cloud/container_v1/__init__.py | 388 - .../cloud/container_v1/gapic_metadata.json | 538 - .../cloud/container_v1/gapic_version.py | 16 - .../v1/google/cloud/container_v1/py.typed | 2 - .../cloud/container_v1/services/__init__.py | 15 - .../services/cluster_manager/__init__.py | 22 - .../services/cluster_manager/async_client.py | 4768 --- .../services/cluster_manager/client.py | 5097 ---- .../services/cluster_manager/pagers.py | 166 - .../cluster_manager/transports/README.rst | 9 - .../cluster_manager/transports/__init__.py | 38 - .../cluster_manager/transports/base.py | 707 - .../cluster_manager/transports/grpc.py | 1247 - .../transports/grpc_asyncio.py | 1522 - .../cluster_manager/transports/rest.py | 5424 ---- .../cluster_manager/transports/rest_base.py | 1575 - .../cloud/container_v1/types/__init__.py | 380 - .../container_v1/types/cluster_service.py | 10586 ------- .../google-cloud-container/v1/mypy.ini | 3 - .../google-cloud-container/v1/noxfile.py | 280 - ..._cluster_manager_cancel_operation_async.py | 49 - ...d_cluster_manager_cancel_operation_sync.py | 49 - ...ger_check_autopilot_compatibility_async.py | 51 - ...ager_check_autopilot_compatibility_sync.py | 51 - ...ster_manager_complete_ip_rotation_async.py | 51 - ...uster_manager_complete_ip_rotation_sync.py | 51 - ...anager_complete_node_pool_upgrade_async.py | 49 - ...manager_complete_node_pool_upgrade_sync.py | 49 - ...ed_cluster_manager_create_cluster_async.py | 51 - ...ted_cluster_manager_create_cluster_sync.py | 51 - ..._cluster_manager_create_node_pool_async.py | 51 - ...d_cluster_manager_create_node_pool_sync.py | 51 - ...ed_cluster_manager_delete_cluster_async.py | 51 - ...ted_cluster_manager_delete_cluster_sync.py | 51 - ..._cluster_manager_delete_node_pool_async.py | 51 - ...d_cluster_manager_delete_node_pool_sync.py | 51 - ...rated_cluster_manager_get_cluster_async.py | 51 - ...erated_cluster_manager_get_cluster_sync.py | 51 - ...cluster_manager_get_json_web_keys_async.py | 51 - ..._cluster_manager_get_json_web_keys_sync.py | 51 - ...ted_cluster_manager_get_node_pool_async.py | 51 - ...ated_cluster_manager_get_node_pool_sync.py | 51 - ...ted_cluster_manager_get_operation_async.py | 51 - ...ated_cluster_manager_get_operation_sync.py | 51 - ...cluster_manager_get_server_config_async.py | 51 - ..._cluster_manager_get_server_config_sync.py | 51 - ...ted_cluster_manager_list_clusters_async.py | 51 - ...ated_cluster_manager_list_clusters_sync.py | 51 - ...d_cluster_manager_list_node_pools_async.py | 51 - ...ed_cluster_manager_list_node_pools_sync.py | 51 - ...d_cluster_manager_list_operations_async.py | 51 - ...ed_cluster_manager_list_operations_sync.py | 51 - ...r_manager_list_usable_subnetworks_async.py | 52 - ...er_manager_list_usable_subnetworks_sync.py | 52 - ...anager_rollback_node_pool_upgrade_async.py | 51 - ...manager_rollback_node_pool_upgrade_sync.py | 51 - ...cluster_manager_set_addons_config_async.py | 51 - ..._cluster_manager_set_addons_config_sync.py | 51 - ...erated_cluster_manager_set_labels_async.py | 52 - ...nerated_cluster_manager_set_labels_sync.py | 52 - ...d_cluster_manager_set_legacy_abac_async.py | 52 - ...ed_cluster_manager_set_legacy_abac_sync.py | 52 - ...ted_cluster_manager_set_locations_async.py | 52 - ...ated_cluster_manager_set_locations_sync.py | 52 - ...uster_manager_set_logging_service_async.py | 52 - ...luster_manager_set_logging_service_sync.py | 52 - ...er_manager_set_maintenance_policy_async.py | 54 - ...ter_manager_set_maintenance_policy_sync.py | 54 - ...d_cluster_manager_set_master_auth_async.py | 52 - ...ed_cluster_manager_set_master_auth_sync.py | 52 - ...er_manager_set_monitoring_service_async.py | 52 - ...ter_manager_set_monitoring_service_sync.py | 52 - ...luster_manager_set_network_policy_async.py | 51 - ...cluster_manager_set_network_policy_sync.py | 51 - ...manager_set_node_pool_autoscaling_async.py | 51 - ..._manager_set_node_pool_autoscaling_sync.py | 51 - ..._manager_set_node_pool_management_async.py | 51 - ...r_manager_set_node_pool_management_sync.py | 51 - ...luster_manager_set_node_pool_size_async.py | 52 - ...cluster_manager_set_node_pool_size_sync.py | 52 - ...cluster_manager_start_ip_rotation_async.py | 51 - ..._cluster_manager_start_ip_rotation_sync.py | 51 - ...ed_cluster_manager_update_cluster_async.py | 51 - ...ted_cluster_manager_update_cluster_sync.py | 51 - ...ted_cluster_manager_update_master_async.py | 52 - ...ated_cluster_manager_update_master_sync.py | 52 - ..._cluster_manager_update_node_pool_async.py | 53 - ...d_cluster_manager_update_node_pool_sync.py | 53 - .../snippet_metadata_google.container.v1.json | 6053 ---- .../v1/scripts/fixup_container_v1_keywords.py | 209 - .../google-cloud-container/v1/setup.py | 98 - .../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.13.txt | 6 - .../v1/testing/constraints-3.7.txt | 10 - .../v1/testing/constraints-3.8.txt | 6 - .../v1/testing/constraints-3.9.txt | 6 - .../v1/tests/__init__.py | 16 - .../v1/tests/unit/__init__.py | 16 - .../v1/tests/unit/gapic/__init__.py | 16 - .../tests/unit/gapic/container_v1/__init__.py | 16 - .../container_v1/test_cluster_manager.py | 24315 ---------------- .../v1beta1/.coveragerc | 13 - .../google-cloud-container/v1beta1/.flake8 | 33 - .../v1beta1/MANIFEST.in | 2 - .../google-cloud-container/v1beta1/README.rst | 49 - .../v1beta1/docs/_static/custom.css | 3 - .../v1beta1/docs/conf.py | 376 - .../container_v1beta1/cluster_manager.rst | 10 - .../docs/container_v1beta1/services_.rst | 6 - .../v1beta1/docs/container_v1beta1/types_.rst | 6 - .../v1beta1/docs/index.rst | 7 - .../google/cloud/container/__init__.py | 407 - .../google/cloud/container/gapic_version.py | 16 - .../v1beta1/google/cloud/container/py.typed | 2 - .../cloud/container_v1beta1/__init__.py | 408 - .../container_v1beta1/gapic_metadata.json | 373 - .../cloud/container_v1beta1/gapic_version.py | 16 - .../google/cloud/container_v1beta1/py.typed | 2 - .../container_v1beta1/services/__init__.py | 15 - .../services/cluster_manager/__init__.py | 22 - .../services/cluster_manager/async_client.py | 4885 ---- .../services/cluster_manager/client.py | 5189 ---- .../services/cluster_manager/pagers.py | 166 - .../cluster_manager/transports/README.rst | 9 - .../cluster_manager/transports/__init__.py | 33 - .../cluster_manager/transports/base.py | 741 - .../cluster_manager/transports/grpc.py | 1274 - .../transports/grpc_asyncio.py | 1574 - .../cloud/container_v1beta1/types/__init__.py | 400 - .../types/cluster_service.py | 10986 ------- .../google-cloud-container/v1beta1/mypy.ini | 3 - .../google-cloud-container/v1beta1/noxfile.py | 280 - ..._cluster_manager_cancel_operation_async.py | 52 - ...d_cluster_manager_cancel_operation_sync.py | 52 - ...ger_check_autopilot_compatibility_async.py | 51 - ...ager_check_autopilot_compatibility_sync.py | 51 - ...ster_manager_complete_ip_rotation_async.py | 54 - ...uster_manager_complete_ip_rotation_sync.py | 54 - ...anager_complete_node_pool_upgrade_async.py | 49 - ...manager_complete_node_pool_upgrade_sync.py | 49 - ...ed_cluster_manager_create_cluster_async.py | 53 - ...ted_cluster_manager_create_cluster_sync.py | 53 - ..._cluster_manager_create_node_pool_async.py | 54 - ...d_cluster_manager_create_node_pool_sync.py | 54 - ...ed_cluster_manager_delete_cluster_async.py | 54 - ...ted_cluster_manager_delete_cluster_sync.py | 54 - ..._cluster_manager_delete_node_pool_async.py | 55 - ...d_cluster_manager_delete_node_pool_sync.py | 55 - ...rated_cluster_manager_get_cluster_async.py | 54 - ...erated_cluster_manager_get_cluster_sync.py | 54 - ...cluster_manager_get_json_web_keys_async.py | 51 - ..._cluster_manager_get_json_web_keys_sync.py | 51 - ...ted_cluster_manager_get_node_pool_async.py | 55 - ...ated_cluster_manager_get_node_pool_sync.py | 55 - ...ted_cluster_manager_get_operation_async.py | 54 - ...ated_cluster_manager_get_operation_sync.py | 54 - ...cluster_manager_get_server_config_async.py | 53 - ..._cluster_manager_get_server_config_sync.py | 53 - ...ted_cluster_manager_list_clusters_async.py | 53 - ...ated_cluster_manager_list_clusters_sync.py | 53 - ...ed_cluster_manager_list_locations_async.py | 52 - ...ted_cluster_manager_list_locations_sync.py | 52 - ...d_cluster_manager_list_node_pools_async.py | 54 - ...ed_cluster_manager_list_node_pools_sync.py | 54 - ...d_cluster_manager_list_operations_async.py | 53 - ...ed_cluster_manager_list_operations_sync.py | 53 - ...r_manager_list_usable_subnetworks_async.py | 53 - ...er_manager_list_usable_subnetworks_sync.py | 53 - ...anager_rollback_node_pool_upgrade_async.py | 55 - ...manager_rollback_node_pool_upgrade_sync.py | 55 - ...cluster_manager_set_addons_config_async.py | 54 - ..._cluster_manager_set_addons_config_sync.py | 54 - ...erated_cluster_manager_set_labels_async.py | 55 - ...nerated_cluster_manager_set_labels_sync.py | 55 - ...d_cluster_manager_set_legacy_abac_async.py | 55 - ...ed_cluster_manager_set_legacy_abac_sync.py | 55 - ...ted_cluster_manager_set_locations_async.py | 55 - ...ated_cluster_manager_set_locations_sync.py | 55 - ...uster_manager_set_logging_service_async.py | 55 - ...luster_manager_set_logging_service_sync.py | 55 - ...er_manager_set_maintenance_policy_async.py | 54 - ...ter_manager_set_maintenance_policy_sync.py | 54 - ...d_cluster_manager_set_master_auth_async.py | 55 - ...ed_cluster_manager_set_master_auth_sync.py | 55 - ...er_manager_set_monitoring_service_async.py | 55 - ...ter_manager_set_monitoring_service_sync.py | 55 - ...luster_manager_set_network_policy_async.py | 54 - ...cluster_manager_set_network_policy_sync.py | 54 - ...manager_set_node_pool_autoscaling_async.py | 55 - ..._manager_set_node_pool_autoscaling_sync.py | 55 - ..._manager_set_node_pool_management_async.py | 55 - ...r_manager_set_node_pool_management_sync.py | 55 - ...luster_manager_set_node_pool_size_async.py | 56 - ...cluster_manager_set_node_pool_size_sync.py | 56 - ...cluster_manager_start_ip_rotation_async.py | 54 - ..._cluster_manager_start_ip_rotation_sync.py | 54 - ...ed_cluster_manager_update_cluster_async.py | 54 - ...ted_cluster_manager_update_cluster_sync.py | 54 - ...ted_cluster_manager_update_master_async.py | 55 - ...ated_cluster_manager_update_master_sync.py | 55 - ..._cluster_manager_update_node_pool_async.py | 57 - ...d_cluster_manager_update_node_pool_sync.py | 57 - ...pet_metadata_google.container.v1beta1.json | 6110 ---- .../fixup_container_v1beta1_keywords.py | 210 - .../google-cloud-container/v1beta1/setup.py | 98 - .../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.13.txt | 6 - .../v1beta1/testing/constraints-3.7.txt | 10 - .../v1beta1/testing/constraints-3.8.txt | 6 - .../v1beta1/testing/constraints-3.9.txt | 6 - .../v1beta1/tests/__init__.py | 16 - .../v1beta1/tests/unit/__init__.py | 16 - .../v1beta1/tests/unit/gapic/__init__.py | 16 - .../unit/gapic/container_v1beta1/__init__.py | 16 - .../container_v1beta1/test_cluster_manager.py | 15801 ---------- .../google/cloud/container/gapic_version.py | 2 +- .../cloud/container_v1/gapic_version.py | 2 +- .../container_v1/types/cluster_service.py | 2 +- .../cloud/container_v1beta1/gapic_version.py | 2 +- .../types/cluster_service.py | 2 +- .../snippet_metadata_google.container.v1.json | 2 +- ...pet_metadata_google.container.v1beta1.json | 2 +- 239 files changed, 7 insertions(+), 121382 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-container/v1/.coveragerc delete mode 100644 owl-bot-staging/google-cloud-container/v1/.flake8 delete mode 100644 owl-bot-staging/google-cloud-container/v1/MANIFEST.in delete mode 100644 owl-bot-staging/google-cloud-container/v1/README.rst delete mode 100644 owl-bot-staging/google-cloud-container/v1/docs/_static/custom.css delete mode 100644 owl-bot-staging/google-cloud-container/v1/docs/conf.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/docs/container_v1/cluster_manager.rst delete mode 100644 owl-bot-staging/google-cloud-container/v1/docs/container_v1/services_.rst delete mode 100644 owl-bot-staging/google-cloud-container/v1/docs/container_v1/types_.rst delete mode 100644 owl-bot-staging/google-cloud-container/v1/docs/index.rst delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container/gapic_version.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container/py.typed delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_version.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/py.typed delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/async_client.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/client.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/pagers.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/README.rst delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/base.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest_base.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/cluster_service.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/mypy.ini delete mode 100644 owl-bot-staging/google-cloud-container/v1/noxfile.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/samples/generated_samples/snippet_metadata_google.container.v1.json delete mode 100644 owl-bot-staging/google-cloud-container/v1/scripts/fixup_container_v1_keywords.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/setup.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.10.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.11.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.12.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.13.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.7.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.8.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1/testing/constraints-3.9.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1/tests/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/tests/unit/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/container_v1/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/container_v1/test_cluster_manager.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/.coveragerc delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/.flake8 delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/MANIFEST.in delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/README.rst delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/docs/_static/custom.css delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/docs/conf.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/cluster_manager.rst delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/services_.rst delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/types_.rst delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/docs/index.rst delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/gapic_version.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/py.typed delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_version.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/py.typed delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/async_client.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/client.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/pagers.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/README.rst delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/cluster_service.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/mypy.ini delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/noxfile.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_async.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_sync.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/snippet_metadata_google.container.v1beta1.json delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/scripts/fixup_container_v1beta1_keywords.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/setup.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.10.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.11.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.12.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.13.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.7.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.8.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.9.txt delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/tests/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/tests/unit/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/__init__.py delete mode 100644 owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/test_cluster_manager.py diff --git a/owl-bot-staging/google-cloud-container/v1/.coveragerc b/owl-bot-staging/google-cloud-container/v1/.coveragerc deleted file mode 100644 index 113f6dbccc9f..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -branch = True - -[report] -show_missing = True -omit = - google/cloud/container/__init__.py - google/cloud/container/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/google-cloud-container/v1/.flake8 b/owl-bot-staging/google-cloud-container/v1/.flake8 deleted file mode 100644 index 29227d4cf419..000000000000 --- a/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1/MANIFEST.in b/owl-bot-staging/google-cloud-container/v1/MANIFEST.in deleted file mode 100644 index 8ff819564a87..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -recursive-include google/cloud/container *.py -recursive-include google/cloud/container_v1 *.py diff --git a/owl-bot-staging/google-cloud-container/v1/README.rst b/owl-bot-staging/google-cloud-container/v1/README.rst deleted file mode 100644 index 4f18726b102d..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/README.rst +++ /dev/null @@ -1,49 +0,0 @@ -Python Client for Google Cloud Container 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 Container 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/google-cloud-container/v1/docs/_static/custom.css b/owl-bot-staging/google-cloud-container/v1/docs/_static/custom.css deleted file mode 100644 index 06423be0b592..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/docs/_static/custom.css +++ /dev/null @@ -1,3 +0,0 @@ -dl.field-list > dt { - min-width: 100px -} diff --git a/owl-bot-staging/google-cloud-container/v1/docs/conf.py b/owl-bot-staging/google-cloud-container/v1/docs/conf.py deleted file mode 100644 index 5a9f847ff28e..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/docs/conf.py +++ /dev/null @@ -1,376 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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-container 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-container" -copyright = u"2023, 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 = 'en' - -# 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 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-container-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-container.tex", - u"google-cloud-container 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-container", - u"Google Cloud Container 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-container", - u"google-cloud-container Documentation", - author, - "google-cloud-container", - "GAPIC library for Google Cloud Container 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/google-cloud-container/v1/docs/container_v1/cluster_manager.rst b/owl-bot-staging/google-cloud-container/v1/docs/container_v1/cluster_manager.rst deleted file mode 100644 index dc27a3bd5897..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/docs/container_v1/cluster_manager.rst +++ /dev/null @@ -1,10 +0,0 @@ -ClusterManager --------------------------------- - -.. automodule:: google.cloud.container_v1.services.cluster_manager - :members: - :inherited-members: - -.. automodule:: google.cloud.container_v1.services.cluster_manager.pagers - :members: - :inherited-members: diff --git a/owl-bot-staging/google-cloud-container/v1/docs/container_v1/services_.rst b/owl-bot-staging/google-cloud-container/v1/docs/container_v1/services_.rst deleted file mode 100644 index a98a2319ff3c..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/docs/container_v1/services_.rst +++ /dev/null @@ -1,6 +0,0 @@ -Services for Google Cloud Container v1 API -========================================== -.. toctree:: - :maxdepth: 2 - - cluster_manager diff --git a/owl-bot-staging/google-cloud-container/v1/docs/container_v1/types_.rst b/owl-bot-staging/google-cloud-container/v1/docs/container_v1/types_.rst deleted file mode 100644 index 3ae28cbf51a9..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/docs/container_v1/types_.rst +++ /dev/null @@ -1,6 +0,0 @@ -Types for Google Cloud Container v1 API -======================================= - -.. automodule:: google.cloud.container_v1.types - :members: - :show-inheritance: diff --git a/owl-bot-staging/google-cloud-container/v1/docs/index.rst b/owl-bot-staging/google-cloud-container/v1/docs/index.rst deleted file mode 100644 index 1aafbdaf8390..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/docs/index.rst +++ /dev/null @@ -1,7 +0,0 @@ -API Reference -------------- -.. toctree:: - :maxdepth: 2 - - container_v1/services_ - container_v1/types_ diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container/__init__.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container/__init__.py deleted file mode 100644 index d7806508d08e..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container/__init__.py +++ /dev/null @@ -1,387 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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.container import gapic_version as package_version - -__version__ = package_version.__version__ - - -from google.cloud.container_v1.services.cluster_manager.client import ClusterManagerClient -from google.cloud.container_v1.services.cluster_manager.async_client import ClusterManagerAsyncClient - -from google.cloud.container_v1.types.cluster_service import AcceleratorConfig -from google.cloud.container_v1.types.cluster_service import AdditionalNodeNetworkConfig -from google.cloud.container_v1.types.cluster_service import AdditionalPodNetworkConfig -from google.cloud.container_v1.types.cluster_service import AdditionalPodRangesConfig -from google.cloud.container_v1.types.cluster_service import AddonsConfig -from google.cloud.container_v1.types.cluster_service import AdvancedDatapathObservabilityConfig -from google.cloud.container_v1.types.cluster_service import AdvancedMachineFeatures -from google.cloud.container_v1.types.cluster_service import AuthenticatorGroupsConfig -from google.cloud.container_v1.types.cluster_service import Autopilot -from google.cloud.container_v1.types.cluster_service import AutopilotCompatibilityIssue -from google.cloud.container_v1.types.cluster_service import AutoprovisioningNodePoolDefaults -from google.cloud.container_v1.types.cluster_service import AutoUpgradeOptions -from google.cloud.container_v1.types.cluster_service import BestEffortProvisioning -from google.cloud.container_v1.types.cluster_service import BinaryAuthorization -from google.cloud.container_v1.types.cluster_service import BlueGreenSettings -from google.cloud.container_v1.types.cluster_service import CancelOperationRequest -from google.cloud.container_v1.types.cluster_service import CheckAutopilotCompatibilityRequest -from google.cloud.container_v1.types.cluster_service import CheckAutopilotCompatibilityResponse -from google.cloud.container_v1.types.cluster_service import ClientCertificateConfig -from google.cloud.container_v1.types.cluster_service import CloudRunConfig -from google.cloud.container_v1.types.cluster_service import Cluster -from google.cloud.container_v1.types.cluster_service import ClusterAutoscaling -from google.cloud.container_v1.types.cluster_service import ClusterUpdate -from google.cloud.container_v1.types.cluster_service import CompleteIPRotationRequest -from google.cloud.container_v1.types.cluster_service import CompleteNodePoolUpgradeRequest -from google.cloud.container_v1.types.cluster_service import CompliancePostureConfig -from google.cloud.container_v1.types.cluster_service import ConfidentialNodes -from google.cloud.container_v1.types.cluster_service import ConfigConnectorConfig -from google.cloud.container_v1.types.cluster_service import ContainerdConfig -from google.cloud.container_v1.types.cluster_service import ControlPlaneEndpointsConfig -from google.cloud.container_v1.types.cluster_service import CostManagementConfig -from google.cloud.container_v1.types.cluster_service import CreateClusterRequest -from google.cloud.container_v1.types.cluster_service import CreateNodePoolRequest -from google.cloud.container_v1.types.cluster_service import DailyMaintenanceWindow -from google.cloud.container_v1.types.cluster_service import DatabaseEncryption -from google.cloud.container_v1.types.cluster_service import DefaultSnatStatus -from google.cloud.container_v1.types.cluster_service import DeleteClusterRequest -from google.cloud.container_v1.types.cluster_service import DeleteNodePoolRequest -from google.cloud.container_v1.types.cluster_service import DesiredEnterpriseConfig -from google.cloud.container_v1.types.cluster_service import DnsCacheConfig -from google.cloud.container_v1.types.cluster_service import DNSConfig -from google.cloud.container_v1.types.cluster_service import EnterpriseConfig -from google.cloud.container_v1.types.cluster_service import EphemeralStorageLocalSsdConfig -from google.cloud.container_v1.types.cluster_service import FastSocket -from google.cloud.container_v1.types.cluster_service import Fleet -from google.cloud.container_v1.types.cluster_service import GatewayAPIConfig -from google.cloud.container_v1.types.cluster_service import GcePersistentDiskCsiDriverConfig -from google.cloud.container_v1.types.cluster_service import GcfsConfig -from google.cloud.container_v1.types.cluster_service import GcpFilestoreCsiDriverConfig -from google.cloud.container_v1.types.cluster_service import GcsFuseCsiDriverConfig -from google.cloud.container_v1.types.cluster_service import GetClusterRequest -from google.cloud.container_v1.types.cluster_service import GetJSONWebKeysRequest -from google.cloud.container_v1.types.cluster_service import GetJSONWebKeysResponse -from google.cloud.container_v1.types.cluster_service import GetNodePoolRequest -from google.cloud.container_v1.types.cluster_service import GetOpenIDConfigRequest -from google.cloud.container_v1.types.cluster_service import GetOpenIDConfigResponse -from google.cloud.container_v1.types.cluster_service import GetOperationRequest -from google.cloud.container_v1.types.cluster_service import GetServerConfigRequest -from google.cloud.container_v1.types.cluster_service import GkeBackupAgentConfig -from google.cloud.container_v1.types.cluster_service import GPUDriverInstallationConfig -from google.cloud.container_v1.types.cluster_service import GPUSharingConfig -from google.cloud.container_v1.types.cluster_service import HorizontalPodAutoscaling -from google.cloud.container_v1.types.cluster_service import HttpLoadBalancing -from google.cloud.container_v1.types.cluster_service import IdentityServiceConfig -from google.cloud.container_v1.types.cluster_service import ILBSubsettingConfig -from google.cloud.container_v1.types.cluster_service import IntraNodeVisibilityConfig -from google.cloud.container_v1.types.cluster_service import IPAllocationPolicy -from google.cloud.container_v1.types.cluster_service import Jwk -from google.cloud.container_v1.types.cluster_service import K8sBetaAPIConfig -from google.cloud.container_v1.types.cluster_service import KubernetesDashboard -from google.cloud.container_v1.types.cluster_service import LegacyAbac -from google.cloud.container_v1.types.cluster_service import LinuxNodeConfig -from google.cloud.container_v1.types.cluster_service import ListClustersRequest -from google.cloud.container_v1.types.cluster_service import ListClustersResponse -from google.cloud.container_v1.types.cluster_service import ListNodePoolsRequest -from google.cloud.container_v1.types.cluster_service import ListNodePoolsResponse -from google.cloud.container_v1.types.cluster_service import ListOperationsRequest -from google.cloud.container_v1.types.cluster_service import ListOperationsResponse -from google.cloud.container_v1.types.cluster_service import ListUsableSubnetworksRequest -from google.cloud.container_v1.types.cluster_service import ListUsableSubnetworksResponse -from google.cloud.container_v1.types.cluster_service import LocalNvmeSsdBlockConfig -from google.cloud.container_v1.types.cluster_service import LoggingComponentConfig -from google.cloud.container_v1.types.cluster_service import LoggingConfig -from google.cloud.container_v1.types.cluster_service import LoggingVariantConfig -from google.cloud.container_v1.types.cluster_service import MaintenanceExclusionOptions -from google.cloud.container_v1.types.cluster_service import MaintenancePolicy -from google.cloud.container_v1.types.cluster_service import MaintenanceWindow -from google.cloud.container_v1.types.cluster_service import ManagedPrometheusConfig -from google.cloud.container_v1.types.cluster_service import MasterAuth -from google.cloud.container_v1.types.cluster_service import MasterAuthorizedNetworksConfig -from google.cloud.container_v1.types.cluster_service import MaxPodsConstraint -from google.cloud.container_v1.types.cluster_service import MeshCertificates -from google.cloud.container_v1.types.cluster_service import MonitoringComponentConfig -from google.cloud.container_v1.types.cluster_service import MonitoringConfig -from google.cloud.container_v1.types.cluster_service import NetworkConfig -from google.cloud.container_v1.types.cluster_service import NetworkPolicy -from google.cloud.container_v1.types.cluster_service import NetworkPolicyConfig -from google.cloud.container_v1.types.cluster_service import NetworkTags -from google.cloud.container_v1.types.cluster_service import NodeConfig -from google.cloud.container_v1.types.cluster_service import NodeConfigDefaults -from google.cloud.container_v1.types.cluster_service import NodeKubeletConfig -from google.cloud.container_v1.types.cluster_service import NodeLabels -from google.cloud.container_v1.types.cluster_service import NodeManagement -from google.cloud.container_v1.types.cluster_service import NodeNetworkConfig -from google.cloud.container_v1.types.cluster_service import NodePool -from google.cloud.container_v1.types.cluster_service import NodePoolAutoConfig -from google.cloud.container_v1.types.cluster_service import NodePoolAutoscaling -from google.cloud.container_v1.types.cluster_service import NodePoolDefaults -from google.cloud.container_v1.types.cluster_service import NodePoolLoggingConfig -from google.cloud.container_v1.types.cluster_service import NodeTaint -from google.cloud.container_v1.types.cluster_service import NodeTaints -from google.cloud.container_v1.types.cluster_service import NotificationConfig -from google.cloud.container_v1.types.cluster_service import Operation -from google.cloud.container_v1.types.cluster_service import OperationProgress -from google.cloud.container_v1.types.cluster_service import ParallelstoreCsiDriverConfig -from google.cloud.container_v1.types.cluster_service import PodCIDROverprovisionConfig -from google.cloud.container_v1.types.cluster_service import PrivateClusterConfig -from google.cloud.container_v1.types.cluster_service import PrivateClusterMasterGlobalAccessConfig -from google.cloud.container_v1.types.cluster_service import RangeInfo -from google.cloud.container_v1.types.cluster_service import RayClusterLoggingConfig -from google.cloud.container_v1.types.cluster_service import RayClusterMonitoringConfig -from google.cloud.container_v1.types.cluster_service import RayOperatorConfig -from google.cloud.container_v1.types.cluster_service import RBACBindingConfig -from google.cloud.container_v1.types.cluster_service import RecurringTimeWindow -from google.cloud.container_v1.types.cluster_service import ReleaseChannel -from google.cloud.container_v1.types.cluster_service import ReservationAffinity -from google.cloud.container_v1.types.cluster_service import ResourceLabels -from google.cloud.container_v1.types.cluster_service import ResourceLimit -from google.cloud.container_v1.types.cluster_service import ResourceManagerTags -from google.cloud.container_v1.types.cluster_service import ResourceUsageExportConfig -from google.cloud.container_v1.types.cluster_service import RollbackNodePoolUpgradeRequest -from google.cloud.container_v1.types.cluster_service import SandboxConfig -from google.cloud.container_v1.types.cluster_service import SecondaryBootDisk -from google.cloud.container_v1.types.cluster_service import SecondaryBootDiskUpdateStrategy -from google.cloud.container_v1.types.cluster_service import SecretManagerConfig -from google.cloud.container_v1.types.cluster_service import SecurityBulletinEvent -from google.cloud.container_v1.types.cluster_service import SecurityPostureConfig -from google.cloud.container_v1.types.cluster_service import ServerConfig -from google.cloud.container_v1.types.cluster_service import ServiceExternalIPsConfig -from google.cloud.container_v1.types.cluster_service import SetAddonsConfigRequest -from google.cloud.container_v1.types.cluster_service import SetLabelsRequest -from google.cloud.container_v1.types.cluster_service import SetLegacyAbacRequest -from google.cloud.container_v1.types.cluster_service import SetLocationsRequest -from google.cloud.container_v1.types.cluster_service import SetLoggingServiceRequest -from google.cloud.container_v1.types.cluster_service import SetMaintenancePolicyRequest -from google.cloud.container_v1.types.cluster_service import SetMasterAuthRequest -from google.cloud.container_v1.types.cluster_service import SetMonitoringServiceRequest -from google.cloud.container_v1.types.cluster_service import SetNetworkPolicyRequest -from google.cloud.container_v1.types.cluster_service import SetNodePoolAutoscalingRequest -from google.cloud.container_v1.types.cluster_service import SetNodePoolManagementRequest -from google.cloud.container_v1.types.cluster_service import SetNodePoolSizeRequest -from google.cloud.container_v1.types.cluster_service import ShieldedInstanceConfig -from google.cloud.container_v1.types.cluster_service import ShieldedNodes -from google.cloud.container_v1.types.cluster_service import SoleTenantConfig -from google.cloud.container_v1.types.cluster_service import StartIPRotationRequest -from google.cloud.container_v1.types.cluster_service import StatefulHAConfig -from google.cloud.container_v1.types.cluster_service import StatusCondition -from google.cloud.container_v1.types.cluster_service import TimeWindow -from google.cloud.container_v1.types.cluster_service import UpdateClusterRequest -from google.cloud.container_v1.types.cluster_service import UpdateMasterRequest -from google.cloud.container_v1.types.cluster_service import UpdateNodePoolRequest -from google.cloud.container_v1.types.cluster_service import UpgradeAvailableEvent -from google.cloud.container_v1.types.cluster_service import UpgradeEvent -from google.cloud.container_v1.types.cluster_service import UpgradeInfoEvent -from google.cloud.container_v1.types.cluster_service import UsableSubnetwork -from google.cloud.container_v1.types.cluster_service import UsableSubnetworkSecondaryRange -from google.cloud.container_v1.types.cluster_service import UserManagedKeysConfig -from google.cloud.container_v1.types.cluster_service import VerticalPodAutoscaling -from google.cloud.container_v1.types.cluster_service import VirtualNIC -from google.cloud.container_v1.types.cluster_service import WindowsNodeConfig -from google.cloud.container_v1.types.cluster_service import WorkloadIdentityConfig -from google.cloud.container_v1.types.cluster_service import WorkloadMetadataConfig -from google.cloud.container_v1.types.cluster_service import WorkloadPolicyConfig -from google.cloud.container_v1.types.cluster_service import DatapathProvider -from google.cloud.container_v1.types.cluster_service import InTransitEncryptionConfig -from google.cloud.container_v1.types.cluster_service import IPv6AccessType -from google.cloud.container_v1.types.cluster_service import NodePoolUpdateStrategy -from google.cloud.container_v1.types.cluster_service import PrivateIPv6GoogleAccess -from google.cloud.container_v1.types.cluster_service import StackType -from google.cloud.container_v1.types.cluster_service import UpgradeResourceType - -__all__ = ('ClusterManagerClient', - 'ClusterManagerAsyncClient', - 'AcceleratorConfig', - 'AdditionalNodeNetworkConfig', - 'AdditionalPodNetworkConfig', - 'AdditionalPodRangesConfig', - 'AddonsConfig', - 'AdvancedDatapathObservabilityConfig', - 'AdvancedMachineFeatures', - 'AuthenticatorGroupsConfig', - 'Autopilot', - 'AutopilotCompatibilityIssue', - 'AutoprovisioningNodePoolDefaults', - 'AutoUpgradeOptions', - 'BestEffortProvisioning', - 'BinaryAuthorization', - 'BlueGreenSettings', - 'CancelOperationRequest', - 'CheckAutopilotCompatibilityRequest', - 'CheckAutopilotCompatibilityResponse', - 'ClientCertificateConfig', - 'CloudRunConfig', - 'Cluster', - 'ClusterAutoscaling', - 'ClusterUpdate', - 'CompleteIPRotationRequest', - 'CompleteNodePoolUpgradeRequest', - 'CompliancePostureConfig', - 'ConfidentialNodes', - 'ConfigConnectorConfig', - 'ContainerdConfig', - 'ControlPlaneEndpointsConfig', - 'CostManagementConfig', - 'CreateClusterRequest', - 'CreateNodePoolRequest', - 'DailyMaintenanceWindow', - 'DatabaseEncryption', - 'DefaultSnatStatus', - 'DeleteClusterRequest', - 'DeleteNodePoolRequest', - 'DesiredEnterpriseConfig', - 'DnsCacheConfig', - 'DNSConfig', - 'EnterpriseConfig', - 'EphemeralStorageLocalSsdConfig', - 'FastSocket', - 'Fleet', - 'GatewayAPIConfig', - 'GcePersistentDiskCsiDriverConfig', - 'GcfsConfig', - 'GcpFilestoreCsiDriverConfig', - 'GcsFuseCsiDriverConfig', - 'GetClusterRequest', - 'GetJSONWebKeysRequest', - 'GetJSONWebKeysResponse', - 'GetNodePoolRequest', - 'GetOpenIDConfigRequest', - 'GetOpenIDConfigResponse', - 'GetOperationRequest', - 'GetServerConfigRequest', - 'GkeBackupAgentConfig', - 'GPUDriverInstallationConfig', - 'GPUSharingConfig', - 'HorizontalPodAutoscaling', - 'HttpLoadBalancing', - 'IdentityServiceConfig', - 'ILBSubsettingConfig', - 'IntraNodeVisibilityConfig', - 'IPAllocationPolicy', - 'Jwk', - 'K8sBetaAPIConfig', - 'KubernetesDashboard', - 'LegacyAbac', - 'LinuxNodeConfig', - 'ListClustersRequest', - 'ListClustersResponse', - 'ListNodePoolsRequest', - 'ListNodePoolsResponse', - 'ListOperationsRequest', - 'ListOperationsResponse', - 'ListUsableSubnetworksRequest', - 'ListUsableSubnetworksResponse', - 'LocalNvmeSsdBlockConfig', - 'LoggingComponentConfig', - 'LoggingConfig', - 'LoggingVariantConfig', - 'MaintenanceExclusionOptions', - 'MaintenancePolicy', - 'MaintenanceWindow', - 'ManagedPrometheusConfig', - 'MasterAuth', - 'MasterAuthorizedNetworksConfig', - 'MaxPodsConstraint', - 'MeshCertificates', - 'MonitoringComponentConfig', - 'MonitoringConfig', - 'NetworkConfig', - 'NetworkPolicy', - 'NetworkPolicyConfig', - 'NetworkTags', - 'NodeConfig', - 'NodeConfigDefaults', - 'NodeKubeletConfig', - 'NodeLabels', - 'NodeManagement', - 'NodeNetworkConfig', - 'NodePool', - 'NodePoolAutoConfig', - 'NodePoolAutoscaling', - 'NodePoolDefaults', - 'NodePoolLoggingConfig', - 'NodeTaint', - 'NodeTaints', - 'NotificationConfig', - 'Operation', - 'OperationProgress', - 'ParallelstoreCsiDriverConfig', - 'PodCIDROverprovisionConfig', - 'PrivateClusterConfig', - 'PrivateClusterMasterGlobalAccessConfig', - 'RangeInfo', - 'RayClusterLoggingConfig', - 'RayClusterMonitoringConfig', - 'RayOperatorConfig', - 'RBACBindingConfig', - 'RecurringTimeWindow', - 'ReleaseChannel', - 'ReservationAffinity', - 'ResourceLabels', - 'ResourceLimit', - 'ResourceManagerTags', - 'ResourceUsageExportConfig', - 'RollbackNodePoolUpgradeRequest', - 'SandboxConfig', - 'SecondaryBootDisk', - 'SecondaryBootDiskUpdateStrategy', - 'SecretManagerConfig', - 'SecurityBulletinEvent', - 'SecurityPostureConfig', - 'ServerConfig', - 'ServiceExternalIPsConfig', - 'SetAddonsConfigRequest', - 'SetLabelsRequest', - 'SetLegacyAbacRequest', - 'SetLocationsRequest', - 'SetLoggingServiceRequest', - 'SetMaintenancePolicyRequest', - 'SetMasterAuthRequest', - 'SetMonitoringServiceRequest', - 'SetNetworkPolicyRequest', - 'SetNodePoolAutoscalingRequest', - 'SetNodePoolManagementRequest', - 'SetNodePoolSizeRequest', - 'ShieldedInstanceConfig', - 'ShieldedNodes', - 'SoleTenantConfig', - 'StartIPRotationRequest', - 'StatefulHAConfig', - 'StatusCondition', - 'TimeWindow', - 'UpdateClusterRequest', - 'UpdateMasterRequest', - 'UpdateNodePoolRequest', - 'UpgradeAvailableEvent', - 'UpgradeEvent', - 'UpgradeInfoEvent', - 'UsableSubnetwork', - 'UsableSubnetworkSecondaryRange', - 'UserManagedKeysConfig', - 'VerticalPodAutoscaling', - 'VirtualNIC', - 'WindowsNodeConfig', - 'WorkloadIdentityConfig', - 'WorkloadMetadataConfig', - 'WorkloadPolicyConfig', - 'DatapathProvider', - 'InTransitEncryptionConfig', - 'IPv6AccessType', - 'NodePoolUpdateStrategy', - 'PrivateIPv6GoogleAccess', - 'StackType', - 'UpgradeResourceType', -) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container/gapic_version.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container/gapic_version.py deleted file mode 100644 index 558c8aab67c5..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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.0.0" # {x-release-please-version} diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container/py.typed b/owl-bot-staging/google-cloud-container/v1/google/cloud/container/py.typed deleted file mode 100644 index d5b0e29f91b4..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-container package uses inline types. diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/__init__.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/__init__.py deleted file mode 100644 index a996173c43cf..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/__init__.py +++ /dev/null @@ -1,388 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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.container_v1 import gapic_version as package_version - -__version__ = package_version.__version__ - - -from .services.cluster_manager import ClusterManagerClient -from .services.cluster_manager import ClusterManagerAsyncClient - -from .types.cluster_service import AcceleratorConfig -from .types.cluster_service import AdditionalNodeNetworkConfig -from .types.cluster_service import AdditionalPodNetworkConfig -from .types.cluster_service import AdditionalPodRangesConfig -from .types.cluster_service import AddonsConfig -from .types.cluster_service import AdvancedDatapathObservabilityConfig -from .types.cluster_service import AdvancedMachineFeatures -from .types.cluster_service import AuthenticatorGroupsConfig -from .types.cluster_service import Autopilot -from .types.cluster_service import AutopilotCompatibilityIssue -from .types.cluster_service import AutoprovisioningNodePoolDefaults -from .types.cluster_service import AutoUpgradeOptions -from .types.cluster_service import BestEffortProvisioning -from .types.cluster_service import BinaryAuthorization -from .types.cluster_service import BlueGreenSettings -from .types.cluster_service import CancelOperationRequest -from .types.cluster_service import CheckAutopilotCompatibilityRequest -from .types.cluster_service import CheckAutopilotCompatibilityResponse -from .types.cluster_service import ClientCertificateConfig -from .types.cluster_service import CloudRunConfig -from .types.cluster_service import Cluster -from .types.cluster_service import ClusterAutoscaling -from .types.cluster_service import ClusterUpdate -from .types.cluster_service import CompleteIPRotationRequest -from .types.cluster_service import CompleteNodePoolUpgradeRequest -from .types.cluster_service import CompliancePostureConfig -from .types.cluster_service import ConfidentialNodes -from .types.cluster_service import ConfigConnectorConfig -from .types.cluster_service import ContainerdConfig -from .types.cluster_service import ControlPlaneEndpointsConfig -from .types.cluster_service import CostManagementConfig -from .types.cluster_service import CreateClusterRequest -from .types.cluster_service import CreateNodePoolRequest -from .types.cluster_service import DailyMaintenanceWindow -from .types.cluster_service import DatabaseEncryption -from .types.cluster_service import DefaultSnatStatus -from .types.cluster_service import DeleteClusterRequest -from .types.cluster_service import DeleteNodePoolRequest -from .types.cluster_service import DesiredEnterpriseConfig -from .types.cluster_service import DnsCacheConfig -from .types.cluster_service import DNSConfig -from .types.cluster_service import EnterpriseConfig -from .types.cluster_service import EphemeralStorageLocalSsdConfig -from .types.cluster_service import FastSocket -from .types.cluster_service import Fleet -from .types.cluster_service import GatewayAPIConfig -from .types.cluster_service import GcePersistentDiskCsiDriverConfig -from .types.cluster_service import GcfsConfig -from .types.cluster_service import GcpFilestoreCsiDriverConfig -from .types.cluster_service import GcsFuseCsiDriverConfig -from .types.cluster_service import GetClusterRequest -from .types.cluster_service import GetJSONWebKeysRequest -from .types.cluster_service import GetJSONWebKeysResponse -from .types.cluster_service import GetNodePoolRequest -from .types.cluster_service import GetOpenIDConfigRequest -from .types.cluster_service import GetOpenIDConfigResponse -from .types.cluster_service import GetOperationRequest -from .types.cluster_service import GetServerConfigRequest -from .types.cluster_service import GkeBackupAgentConfig -from .types.cluster_service import GPUDriverInstallationConfig -from .types.cluster_service import GPUSharingConfig -from .types.cluster_service import HorizontalPodAutoscaling -from .types.cluster_service import HttpLoadBalancing -from .types.cluster_service import IdentityServiceConfig -from .types.cluster_service import ILBSubsettingConfig -from .types.cluster_service import IntraNodeVisibilityConfig -from .types.cluster_service import IPAllocationPolicy -from .types.cluster_service import Jwk -from .types.cluster_service import K8sBetaAPIConfig -from .types.cluster_service import KubernetesDashboard -from .types.cluster_service import LegacyAbac -from .types.cluster_service import LinuxNodeConfig -from .types.cluster_service import ListClustersRequest -from .types.cluster_service import ListClustersResponse -from .types.cluster_service import ListNodePoolsRequest -from .types.cluster_service import ListNodePoolsResponse -from .types.cluster_service import ListOperationsRequest -from .types.cluster_service import ListOperationsResponse -from .types.cluster_service import ListUsableSubnetworksRequest -from .types.cluster_service import ListUsableSubnetworksResponse -from .types.cluster_service import LocalNvmeSsdBlockConfig -from .types.cluster_service import LoggingComponentConfig -from .types.cluster_service import LoggingConfig -from .types.cluster_service import LoggingVariantConfig -from .types.cluster_service import MaintenanceExclusionOptions -from .types.cluster_service import MaintenancePolicy -from .types.cluster_service import MaintenanceWindow -from .types.cluster_service import ManagedPrometheusConfig -from .types.cluster_service import MasterAuth -from .types.cluster_service import MasterAuthorizedNetworksConfig -from .types.cluster_service import MaxPodsConstraint -from .types.cluster_service import MeshCertificates -from .types.cluster_service import MonitoringComponentConfig -from .types.cluster_service import MonitoringConfig -from .types.cluster_service import NetworkConfig -from .types.cluster_service import NetworkPolicy -from .types.cluster_service import NetworkPolicyConfig -from .types.cluster_service import NetworkTags -from .types.cluster_service import NodeConfig -from .types.cluster_service import NodeConfigDefaults -from .types.cluster_service import NodeKubeletConfig -from .types.cluster_service import NodeLabels -from .types.cluster_service import NodeManagement -from .types.cluster_service import NodeNetworkConfig -from .types.cluster_service import NodePool -from .types.cluster_service import NodePoolAutoConfig -from .types.cluster_service import NodePoolAutoscaling -from .types.cluster_service import NodePoolDefaults -from .types.cluster_service import NodePoolLoggingConfig -from .types.cluster_service import NodeTaint -from .types.cluster_service import NodeTaints -from .types.cluster_service import NotificationConfig -from .types.cluster_service import Operation -from .types.cluster_service import OperationProgress -from .types.cluster_service import ParallelstoreCsiDriverConfig -from .types.cluster_service import PodCIDROverprovisionConfig -from .types.cluster_service import PrivateClusterConfig -from .types.cluster_service import PrivateClusterMasterGlobalAccessConfig -from .types.cluster_service import RangeInfo -from .types.cluster_service import RayClusterLoggingConfig -from .types.cluster_service import RayClusterMonitoringConfig -from .types.cluster_service import RayOperatorConfig -from .types.cluster_service import RBACBindingConfig -from .types.cluster_service import RecurringTimeWindow -from .types.cluster_service import ReleaseChannel -from .types.cluster_service import ReservationAffinity -from .types.cluster_service import ResourceLabels -from .types.cluster_service import ResourceLimit -from .types.cluster_service import ResourceManagerTags -from .types.cluster_service import ResourceUsageExportConfig -from .types.cluster_service import RollbackNodePoolUpgradeRequest -from .types.cluster_service import SandboxConfig -from .types.cluster_service import SecondaryBootDisk -from .types.cluster_service import SecondaryBootDiskUpdateStrategy -from .types.cluster_service import SecretManagerConfig -from .types.cluster_service import SecurityBulletinEvent -from .types.cluster_service import SecurityPostureConfig -from .types.cluster_service import ServerConfig -from .types.cluster_service import ServiceExternalIPsConfig -from .types.cluster_service import SetAddonsConfigRequest -from .types.cluster_service import SetLabelsRequest -from .types.cluster_service import SetLegacyAbacRequest -from .types.cluster_service import SetLocationsRequest -from .types.cluster_service import SetLoggingServiceRequest -from .types.cluster_service import SetMaintenancePolicyRequest -from .types.cluster_service import SetMasterAuthRequest -from .types.cluster_service import SetMonitoringServiceRequest -from .types.cluster_service import SetNetworkPolicyRequest -from .types.cluster_service import SetNodePoolAutoscalingRequest -from .types.cluster_service import SetNodePoolManagementRequest -from .types.cluster_service import SetNodePoolSizeRequest -from .types.cluster_service import ShieldedInstanceConfig -from .types.cluster_service import ShieldedNodes -from .types.cluster_service import SoleTenantConfig -from .types.cluster_service import StartIPRotationRequest -from .types.cluster_service import StatefulHAConfig -from .types.cluster_service import StatusCondition -from .types.cluster_service import TimeWindow -from .types.cluster_service import UpdateClusterRequest -from .types.cluster_service import UpdateMasterRequest -from .types.cluster_service import UpdateNodePoolRequest -from .types.cluster_service import UpgradeAvailableEvent -from .types.cluster_service import UpgradeEvent -from .types.cluster_service import UpgradeInfoEvent -from .types.cluster_service import UsableSubnetwork -from .types.cluster_service import UsableSubnetworkSecondaryRange -from .types.cluster_service import UserManagedKeysConfig -from .types.cluster_service import VerticalPodAutoscaling -from .types.cluster_service import VirtualNIC -from .types.cluster_service import WindowsNodeConfig -from .types.cluster_service import WorkloadIdentityConfig -from .types.cluster_service import WorkloadMetadataConfig -from .types.cluster_service import WorkloadPolicyConfig -from .types.cluster_service import DatapathProvider -from .types.cluster_service import InTransitEncryptionConfig -from .types.cluster_service import IPv6AccessType -from .types.cluster_service import NodePoolUpdateStrategy -from .types.cluster_service import PrivateIPv6GoogleAccess -from .types.cluster_service import StackType -from .types.cluster_service import UpgradeResourceType - -__all__ = ( - 'ClusterManagerAsyncClient', -'AcceleratorConfig', -'AdditionalNodeNetworkConfig', -'AdditionalPodNetworkConfig', -'AdditionalPodRangesConfig', -'AddonsConfig', -'AdvancedDatapathObservabilityConfig', -'AdvancedMachineFeatures', -'AuthenticatorGroupsConfig', -'AutoUpgradeOptions', -'Autopilot', -'AutopilotCompatibilityIssue', -'AutoprovisioningNodePoolDefaults', -'BestEffortProvisioning', -'BinaryAuthorization', -'BlueGreenSettings', -'CancelOperationRequest', -'CheckAutopilotCompatibilityRequest', -'CheckAutopilotCompatibilityResponse', -'ClientCertificateConfig', -'CloudRunConfig', -'Cluster', -'ClusterAutoscaling', -'ClusterManagerClient', -'ClusterUpdate', -'CompleteIPRotationRequest', -'CompleteNodePoolUpgradeRequest', -'CompliancePostureConfig', -'ConfidentialNodes', -'ConfigConnectorConfig', -'ContainerdConfig', -'ControlPlaneEndpointsConfig', -'CostManagementConfig', -'CreateClusterRequest', -'CreateNodePoolRequest', -'DNSConfig', -'DailyMaintenanceWindow', -'DatabaseEncryption', -'DatapathProvider', -'DefaultSnatStatus', -'DeleteClusterRequest', -'DeleteNodePoolRequest', -'DesiredEnterpriseConfig', -'DnsCacheConfig', -'EnterpriseConfig', -'EphemeralStorageLocalSsdConfig', -'FastSocket', -'Fleet', -'GPUDriverInstallationConfig', -'GPUSharingConfig', -'GatewayAPIConfig', -'GcePersistentDiskCsiDriverConfig', -'GcfsConfig', -'GcpFilestoreCsiDriverConfig', -'GcsFuseCsiDriverConfig', -'GetClusterRequest', -'GetJSONWebKeysRequest', -'GetJSONWebKeysResponse', -'GetNodePoolRequest', -'GetOpenIDConfigRequest', -'GetOpenIDConfigResponse', -'GetOperationRequest', -'GetServerConfigRequest', -'GkeBackupAgentConfig', -'HorizontalPodAutoscaling', -'HttpLoadBalancing', -'ILBSubsettingConfig', -'IPAllocationPolicy', -'IPv6AccessType', -'IdentityServiceConfig', -'InTransitEncryptionConfig', -'IntraNodeVisibilityConfig', -'Jwk', -'K8sBetaAPIConfig', -'KubernetesDashboard', -'LegacyAbac', -'LinuxNodeConfig', -'ListClustersRequest', -'ListClustersResponse', -'ListNodePoolsRequest', -'ListNodePoolsResponse', -'ListOperationsRequest', -'ListOperationsResponse', -'ListUsableSubnetworksRequest', -'ListUsableSubnetworksResponse', -'LocalNvmeSsdBlockConfig', -'LoggingComponentConfig', -'LoggingConfig', -'LoggingVariantConfig', -'MaintenanceExclusionOptions', -'MaintenancePolicy', -'MaintenanceWindow', -'ManagedPrometheusConfig', -'MasterAuth', -'MasterAuthorizedNetworksConfig', -'MaxPodsConstraint', -'MeshCertificates', -'MonitoringComponentConfig', -'MonitoringConfig', -'NetworkConfig', -'NetworkPolicy', -'NetworkPolicyConfig', -'NetworkTags', -'NodeConfig', -'NodeConfigDefaults', -'NodeKubeletConfig', -'NodeLabels', -'NodeManagement', -'NodeNetworkConfig', -'NodePool', -'NodePoolAutoConfig', -'NodePoolAutoscaling', -'NodePoolDefaults', -'NodePoolLoggingConfig', -'NodePoolUpdateStrategy', -'NodeTaint', -'NodeTaints', -'NotificationConfig', -'Operation', -'OperationProgress', -'ParallelstoreCsiDriverConfig', -'PodCIDROverprovisionConfig', -'PrivateClusterConfig', -'PrivateClusterMasterGlobalAccessConfig', -'PrivateIPv6GoogleAccess', -'RBACBindingConfig', -'RangeInfo', -'RayClusterLoggingConfig', -'RayClusterMonitoringConfig', -'RayOperatorConfig', -'RecurringTimeWindow', -'ReleaseChannel', -'ReservationAffinity', -'ResourceLabels', -'ResourceLimit', -'ResourceManagerTags', -'ResourceUsageExportConfig', -'RollbackNodePoolUpgradeRequest', -'SandboxConfig', -'SecondaryBootDisk', -'SecondaryBootDiskUpdateStrategy', -'SecretManagerConfig', -'SecurityBulletinEvent', -'SecurityPostureConfig', -'ServerConfig', -'ServiceExternalIPsConfig', -'SetAddonsConfigRequest', -'SetLabelsRequest', -'SetLegacyAbacRequest', -'SetLocationsRequest', -'SetLoggingServiceRequest', -'SetMaintenancePolicyRequest', -'SetMasterAuthRequest', -'SetMonitoringServiceRequest', -'SetNetworkPolicyRequest', -'SetNodePoolAutoscalingRequest', -'SetNodePoolManagementRequest', -'SetNodePoolSizeRequest', -'ShieldedInstanceConfig', -'ShieldedNodes', -'SoleTenantConfig', -'StackType', -'StartIPRotationRequest', -'StatefulHAConfig', -'StatusCondition', -'TimeWindow', -'UpdateClusterRequest', -'UpdateMasterRequest', -'UpdateNodePoolRequest', -'UpgradeAvailableEvent', -'UpgradeEvent', -'UpgradeInfoEvent', -'UpgradeResourceType', -'UsableSubnetwork', -'UsableSubnetworkSecondaryRange', -'UserManagedKeysConfig', -'VerticalPodAutoscaling', -'VirtualNIC', -'WindowsNodeConfig', -'WorkloadIdentityConfig', -'WorkloadMetadataConfig', -'WorkloadPolicyConfig', -) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_metadata.json b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_metadata.json deleted file mode 100644 index 0183acedf64a..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_metadata.json +++ /dev/null @@ -1,538 +0,0 @@ - { - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "python", - "libraryPackage": "google.cloud.container_v1", - "protoPackage": "google.container.v1", - "schema": "1.0", - "services": { - "ClusterManager": { - "clients": { - "grpc": { - "libraryClient": "ClusterManagerClient", - "rpcs": { - "CancelOperation": { - "methods": [ - "cancel_operation" - ] - }, - "CheckAutopilotCompatibility": { - "methods": [ - "check_autopilot_compatibility" - ] - }, - "CompleteIPRotation": { - "methods": [ - "complete_ip_rotation" - ] - }, - "CompleteNodePoolUpgrade": { - "methods": [ - "complete_node_pool_upgrade" - ] - }, - "CreateCluster": { - "methods": [ - "create_cluster" - ] - }, - "CreateNodePool": { - "methods": [ - "create_node_pool" - ] - }, - "DeleteCluster": { - "methods": [ - "delete_cluster" - ] - }, - "DeleteNodePool": { - "methods": [ - "delete_node_pool" - ] - }, - "GetCluster": { - "methods": [ - "get_cluster" - ] - }, - "GetJSONWebKeys": { - "methods": [ - "get_json_web_keys" - ] - }, - "GetNodePool": { - "methods": [ - "get_node_pool" - ] - }, - "GetOperation": { - "methods": [ - "get_operation" - ] - }, - "GetServerConfig": { - "methods": [ - "get_server_config" - ] - }, - "ListClusters": { - "methods": [ - "list_clusters" - ] - }, - "ListNodePools": { - "methods": [ - "list_node_pools" - ] - }, - "ListOperations": { - "methods": [ - "list_operations" - ] - }, - "ListUsableSubnetworks": { - "methods": [ - "list_usable_subnetworks" - ] - }, - "RollbackNodePoolUpgrade": { - "methods": [ - "rollback_node_pool_upgrade" - ] - }, - "SetAddonsConfig": { - "methods": [ - "set_addons_config" - ] - }, - "SetLabels": { - "methods": [ - "set_labels" - ] - }, - "SetLegacyAbac": { - "methods": [ - "set_legacy_abac" - ] - }, - "SetLocations": { - "methods": [ - "set_locations" - ] - }, - "SetLoggingService": { - "methods": [ - "set_logging_service" - ] - }, - "SetMaintenancePolicy": { - "methods": [ - "set_maintenance_policy" - ] - }, - "SetMasterAuth": { - "methods": [ - "set_master_auth" - ] - }, - "SetMonitoringService": { - "methods": [ - "set_monitoring_service" - ] - }, - "SetNetworkPolicy": { - "methods": [ - "set_network_policy" - ] - }, - "SetNodePoolAutoscaling": { - "methods": [ - "set_node_pool_autoscaling" - ] - }, - "SetNodePoolManagement": { - "methods": [ - "set_node_pool_management" - ] - }, - "SetNodePoolSize": { - "methods": [ - "set_node_pool_size" - ] - }, - "StartIPRotation": { - "methods": [ - "start_ip_rotation" - ] - }, - "UpdateCluster": { - "methods": [ - "update_cluster" - ] - }, - "UpdateMaster": { - "methods": [ - "update_master" - ] - }, - "UpdateNodePool": { - "methods": [ - "update_node_pool" - ] - } - } - }, - "grpc-async": { - "libraryClient": "ClusterManagerAsyncClient", - "rpcs": { - "CancelOperation": { - "methods": [ - "cancel_operation" - ] - }, - "CheckAutopilotCompatibility": { - "methods": [ - "check_autopilot_compatibility" - ] - }, - "CompleteIPRotation": { - "methods": [ - "complete_ip_rotation" - ] - }, - "CompleteNodePoolUpgrade": { - "methods": [ - "complete_node_pool_upgrade" - ] - }, - "CreateCluster": { - "methods": [ - "create_cluster" - ] - }, - "CreateNodePool": { - "methods": [ - "create_node_pool" - ] - }, - "DeleteCluster": { - "methods": [ - "delete_cluster" - ] - }, - "DeleteNodePool": { - "methods": [ - "delete_node_pool" - ] - }, - "GetCluster": { - "methods": [ - "get_cluster" - ] - }, - "GetJSONWebKeys": { - "methods": [ - "get_json_web_keys" - ] - }, - "GetNodePool": { - "methods": [ - "get_node_pool" - ] - }, - "GetOperation": { - "methods": [ - "get_operation" - ] - }, - "GetServerConfig": { - "methods": [ - "get_server_config" - ] - }, - "ListClusters": { - "methods": [ - "list_clusters" - ] - }, - "ListNodePools": { - "methods": [ - "list_node_pools" - ] - }, - "ListOperations": { - "methods": [ - "list_operations" - ] - }, - "ListUsableSubnetworks": { - "methods": [ - "list_usable_subnetworks" - ] - }, - "RollbackNodePoolUpgrade": { - "methods": [ - "rollback_node_pool_upgrade" - ] - }, - "SetAddonsConfig": { - "methods": [ - "set_addons_config" - ] - }, - "SetLabels": { - "methods": [ - "set_labels" - ] - }, - "SetLegacyAbac": { - "methods": [ - "set_legacy_abac" - ] - }, - "SetLocations": { - "methods": [ - "set_locations" - ] - }, - "SetLoggingService": { - "methods": [ - "set_logging_service" - ] - }, - "SetMaintenancePolicy": { - "methods": [ - "set_maintenance_policy" - ] - }, - "SetMasterAuth": { - "methods": [ - "set_master_auth" - ] - }, - "SetMonitoringService": { - "methods": [ - "set_monitoring_service" - ] - }, - "SetNetworkPolicy": { - "methods": [ - "set_network_policy" - ] - }, - "SetNodePoolAutoscaling": { - "methods": [ - "set_node_pool_autoscaling" - ] - }, - "SetNodePoolManagement": { - "methods": [ - "set_node_pool_management" - ] - }, - "SetNodePoolSize": { - "methods": [ - "set_node_pool_size" - ] - }, - "StartIPRotation": { - "methods": [ - "start_ip_rotation" - ] - }, - "UpdateCluster": { - "methods": [ - "update_cluster" - ] - }, - "UpdateMaster": { - "methods": [ - "update_master" - ] - }, - "UpdateNodePool": { - "methods": [ - "update_node_pool" - ] - } - } - }, - "rest": { - "libraryClient": "ClusterManagerClient", - "rpcs": { - "CancelOperation": { - "methods": [ - "cancel_operation" - ] - }, - "CheckAutopilotCompatibility": { - "methods": [ - "check_autopilot_compatibility" - ] - }, - "CompleteIPRotation": { - "methods": [ - "complete_ip_rotation" - ] - }, - "CompleteNodePoolUpgrade": { - "methods": [ - "complete_node_pool_upgrade" - ] - }, - "CreateCluster": { - "methods": [ - "create_cluster" - ] - }, - "CreateNodePool": { - "methods": [ - "create_node_pool" - ] - }, - "DeleteCluster": { - "methods": [ - "delete_cluster" - ] - }, - "DeleteNodePool": { - "methods": [ - "delete_node_pool" - ] - }, - "GetCluster": { - "methods": [ - "get_cluster" - ] - }, - "GetJSONWebKeys": { - "methods": [ - "get_json_web_keys" - ] - }, - "GetNodePool": { - "methods": [ - "get_node_pool" - ] - }, - "GetOperation": { - "methods": [ - "get_operation" - ] - }, - "GetServerConfig": { - "methods": [ - "get_server_config" - ] - }, - "ListClusters": { - "methods": [ - "list_clusters" - ] - }, - "ListNodePools": { - "methods": [ - "list_node_pools" - ] - }, - "ListOperations": { - "methods": [ - "list_operations" - ] - }, - "ListUsableSubnetworks": { - "methods": [ - "list_usable_subnetworks" - ] - }, - "RollbackNodePoolUpgrade": { - "methods": [ - "rollback_node_pool_upgrade" - ] - }, - "SetAddonsConfig": { - "methods": [ - "set_addons_config" - ] - }, - "SetLabels": { - "methods": [ - "set_labels" - ] - }, - "SetLegacyAbac": { - "methods": [ - "set_legacy_abac" - ] - }, - "SetLocations": { - "methods": [ - "set_locations" - ] - }, - "SetLoggingService": { - "methods": [ - "set_logging_service" - ] - }, - "SetMaintenancePolicy": { - "methods": [ - "set_maintenance_policy" - ] - }, - "SetMasterAuth": { - "methods": [ - "set_master_auth" - ] - }, - "SetMonitoringService": { - "methods": [ - "set_monitoring_service" - ] - }, - "SetNetworkPolicy": { - "methods": [ - "set_network_policy" - ] - }, - "SetNodePoolAutoscaling": { - "methods": [ - "set_node_pool_autoscaling" - ] - }, - "SetNodePoolManagement": { - "methods": [ - "set_node_pool_management" - ] - }, - "SetNodePoolSize": { - "methods": [ - "set_node_pool_size" - ] - }, - "StartIPRotation": { - "methods": [ - "start_ip_rotation" - ] - }, - "UpdateCluster": { - "methods": [ - "update_cluster" - ] - }, - "UpdateMaster": { - "methods": [ - "update_master" - ] - }, - "UpdateNodePool": { - "methods": [ - "update_node_pool" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_version.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_version.py deleted file mode 100644 index 558c8aab67c5..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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.0.0" # {x-release-please-version} diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/py.typed b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/py.typed deleted file mode 100644 index d5b0e29f91b4..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-container package uses inline types. diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/__init__.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/__init__.py deleted file mode 100644 index 8f6cf068242c..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/__init__.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/__init__.py deleted file mode 100644 index f3aa6cc7d359..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ClusterManagerClient -from .async_client import ClusterManagerAsyncClient - -__all__ = ( - 'ClusterManagerClient', - 'ClusterManagerAsyncClient', -) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/async_client.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/async_client.py deleted file mode 100644 index 2b965387bb5e..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/async_client.py +++ /dev/null @@ -1,4768 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 logging as std_logging -from collections import OrderedDict -import re -from typing import Dict, Callable, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union -import warnings - -from google.cloud.container_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_async as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - - -try: - OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore - -from google.cloud.container_v1.services.cluster_manager import pagers -from google.cloud.container_v1.types import cluster_service -from google.rpc import status_pb2 # type: ignore -from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import ClusterManagerGrpcAsyncIOTransport -from .client import ClusterManagerClient - -try: - from google.api_core import client_logging # type: ignore - CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER -except ImportError: # pragma: NO COVER - CLIENT_LOGGING_SUPPORTED = False - -_LOGGER = std_logging.getLogger(__name__) - -class ClusterManagerAsyncClient: - """Google Kubernetes Engine Cluster Manager v1""" - - _client: ClusterManagerClient - - # Copy defaults from the synchronous client for use here. - # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead. - DEFAULT_ENDPOINT = ClusterManagerClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = ClusterManagerClient.DEFAULT_MTLS_ENDPOINT - _DEFAULT_ENDPOINT_TEMPLATE = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE - _DEFAULT_UNIVERSE = ClusterManagerClient._DEFAULT_UNIVERSE - - ca_pool_path = staticmethod(ClusterManagerClient.ca_pool_path) - parse_ca_pool_path = staticmethod(ClusterManagerClient.parse_ca_pool_path) - crypto_key_version_path = staticmethod(ClusterManagerClient.crypto_key_version_path) - parse_crypto_key_version_path = staticmethod(ClusterManagerClient.parse_crypto_key_version_path) - topic_path = staticmethod(ClusterManagerClient.topic_path) - parse_topic_path = staticmethod(ClusterManagerClient.parse_topic_path) - common_billing_account_path = staticmethod(ClusterManagerClient.common_billing_account_path) - parse_common_billing_account_path = staticmethod(ClusterManagerClient.parse_common_billing_account_path) - common_folder_path = staticmethod(ClusterManagerClient.common_folder_path) - parse_common_folder_path = staticmethod(ClusterManagerClient.parse_common_folder_path) - common_organization_path = staticmethod(ClusterManagerClient.common_organization_path) - parse_common_organization_path = staticmethod(ClusterManagerClient.parse_common_organization_path) - common_project_path = staticmethod(ClusterManagerClient.common_project_path) - parse_common_project_path = staticmethod(ClusterManagerClient.parse_common_project_path) - common_location_path = staticmethod(ClusterManagerClient.common_location_path) - parse_common_location_path = staticmethod(ClusterManagerClient.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: - ClusterManagerAsyncClient: The constructed client. - """ - return ClusterManagerClient.from_service_account_info.__func__(ClusterManagerAsyncClient, 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: - ClusterManagerAsyncClient: The constructed client. - """ - return ClusterManagerClient.from_service_account_file.__func__(ClusterManagerAsyncClient, 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 ClusterManagerClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> ClusterManagerTransport: - """Returns the transport used by the client instance. - - Returns: - ClusterManagerTransport: The transport used by the client instance. - """ - return self._client.transport - - @property - def api_endpoint(self): - """Return the API endpoint used by the client instance. - - Returns: - str: The API endpoint used by the client instance. - """ - return self._client._api_endpoint - - @property - def universe_domain(self) -> str: - """Return the universe domain used by the client instance. - - Returns: - str: The universe domain used - by the client instance. - """ - return self._client._universe_domain - - get_transport_class = ClusterManagerClient.get_transport_class - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, ClusterManagerTransport, Callable[..., ClusterManagerTransport]]] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the cluster manager async 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 (Optional[Union[str,ClusterManagerTransport,Callable[..., ClusterManagerTransport]]]): - The transport to use, or a Callable that constructs and returns a new transport to use. - If a Callable is given, it will be called with the same set of initialization - arguments as used in the ClusterManagerTransport constructor. - 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. - - 1. The ``api_endpoint`` property can be used to override the - default endpoint provided by the client when ``transport`` is - not explicitly provided. Only if this property is not set and - ``transport`` was not explicitly provided, the endpoint is - determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment - variable, which have one of the following values: - "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). - - 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide a client certificate for mTLS 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. - - 3. The ``universe_domain`` property can be used to override the - default "googleapis.com" universe. Note that ``api_endpoint`` - property still takes precedence; and ``universe_domain`` is - currently not supported for mTLS. - - 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. - """ - self._client = ClusterManagerClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - - ) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG): # pragma: NO COVER - _LOGGER.debug( - "Created client `google.container_v1.ClusterManagerAsyncClient`.", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "universeDomain": getattr(self._client._transport._credentials, "universe_domain", ""), - "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}", - "credentialsInfo": getattr(self.transport._credentials, "get_cred_info", lambda: None)(), - } if hasattr(self._client._transport, "_credentials") else { - "serviceName": "google.container.v1.ClusterManager", - "credentialsType": None, - } - ) - - async def list_clusters(self, - request: Optional[Union[cluster_service.ListClustersRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListClustersResponse: - r"""Lists all clusters owned by a project in either the - specified zone or all zones. - - .. 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 import container_v1 - - async def sample_list_clusters(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.ListClustersRequest( - ) - - # Make the request - response = await client.list_clusters(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.ListClustersRequest, dict]]): - The request object. ListClustersRequest lists clusters. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides, or "-" for all zones. This - field has been deprecated and replaced by the parent - field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - parent (:class:`str`): - The parent (project and location) where the clusters - will be listed. Specified in the format - ``projects/*/locations/*``. Location "-" matches all - zones and all regions. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.ListClustersResponse: - ListClustersResponse is the result of - ListClustersRequest. - - """ - # 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([project_id, zone, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListClustersRequest): - request = cluster_service.ListClustersRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.list_clusters] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_cluster(self, - request: Optional[Union[cluster_service.GetClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Cluster: - r"""Gets the details of a specific cluster. - - .. 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 import container_v1 - - async def sample_get_cluster(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.GetClusterRequest( - ) - - # Make the request - response = await client.get_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.GetClusterRequest, dict]]): - The request object. GetClusterRequest gets the settings - of a cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster - to retrieve. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster) of the cluster to - retrieve. Specified in the format - ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Cluster: - A Google Kubernetes Engine cluster. - """ - # 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([project_id, zone, cluster_id, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetClusterRequest): - request = cluster_service.GetClusterRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.get_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_cluster(self, - request: Optional[Union[cluster_service.CreateClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster: Optional[cluster_service.Cluster] = None, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Creates a cluster, consisting of the specified number and type - of Google Compute Engine instances. - - By default, the cluster is created in the project's `default - network `__. - - One firewall is added for the cluster. After cluster creation, - the Kubelet creates routes for each node to allow the containers - on that node to communicate with all other instances in the - cluster. - - Finally, an entry is added to the project's global metadata - indicating which CIDR range the cluster is using. - - .. 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 import container_v1 - - async def sample_create_cluster(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.CreateClusterRequest( - ) - - # Make the request - response = await client.create_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.CreateClusterRequest, dict]]): - The request object. CreateClusterRequest creates a - cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the parent field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster (:class:`google.cloud.container_v1.types.Cluster`): - Required. A `cluster - resource `__ - - This corresponds to the ``cluster`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - parent (:class:`str`): - The parent (project and location) where the cluster will - be created. Specified 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_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CreateClusterRequest): - request = cluster_service.CreateClusterRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster is not None: - request.cluster = cluster - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.create_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_cluster(self, - request: Optional[Union[cluster_service.UpdateClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - update: Optional[cluster_service.ClusterUpdate] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Updates the settings of a specific cluster. - - .. 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 import container_v1 - - async def sample_update_cluster(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.UpdateClusterRequest( - ) - - # Make the request - response = await client.update_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.UpdateClusterRequest, dict]]): - The request object. UpdateClusterRequest updates the - settings of a cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster - to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update (:class:`google.cloud.container_v1.types.ClusterUpdate`): - Required. A description of the - update. - - This corresponds to the ``update`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster) of the cluster to - update. Specified in the format - ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, update, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.UpdateClusterRequest): - request = cluster_service.UpdateClusterRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if update is not None: - request.update = update - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.update_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_node_pool(self, - request: Optional[Union[cluster_service.UpdateNodePoolRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Updates the version and/or image type for the - specified node pool. - - .. 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 import container_v1 - - async def sample_update_node_pool(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.UpdateNodePoolRequest( - node_version="node_version_value", - image_type="image_type_value", - ) - - # Make the request - response = await client.update_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.UpdateNodePoolRequest, dict]]): - The request object. UpdateNodePoolRequests update a node - pool's image and/or version. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.UpdateNodePoolRequest): - request = cluster_service.UpdateNodePoolRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.update_node_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_node_pool_autoscaling(self, - request: Optional[Union[cluster_service.SetNodePoolAutoscalingRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the autoscaling settings for the specified node - pool. - - .. 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 import container_v1 - - async def sample_set_node_pool_autoscaling(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetNodePoolAutoscalingRequest( - ) - - # Make the request - response = await client.set_node_pool_autoscaling(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.SetNodePoolAutoscalingRequest, dict]]): - The request object. SetNodePoolAutoscalingRequest sets - the autoscaler settings of a node pool. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNodePoolAutoscalingRequest): - request = cluster_service.SetNodePoolAutoscalingRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_node_pool_autoscaling] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_logging_service(self, - request: Optional[Union[cluster_service.SetLoggingServiceRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - logging_service: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the logging service for a specific cluster. - - .. 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 import container_v1 - - async def sample_set_logging_service(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetLoggingServiceRequest( - logging_service="logging_service_value", - ) - - # Make the request - response = await client.set_logging_service(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.SetLoggingServiceRequest, dict]]): - The request object. SetLoggingServiceRequest sets the - logging service of a cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster - to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - logging_service (:class:`str`): - Required. The logging service the cluster should use to - write logs. Currently available options: - - - ``logging.googleapis.com/kubernetes`` - The Cloud - Logging service with a Kubernetes-native resource - model - - ``logging.googleapis.com`` - The legacy Cloud Logging - service (no longer available as of GKE 1.15). - - ``none`` - no logs will be exported from the cluster. - - If left as an empty - string,\ ``logging.googleapis.com/kubernetes`` will be - used for GKE 1.14+ or ``logging.googleapis.com`` for - earlier versions. - - This corresponds to the ``logging_service`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster) of the cluster to - set logging. Specified in the format - ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, logging_service, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLoggingServiceRequest): - request = cluster_service.SetLoggingServiceRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if logging_service is not None: - request.logging_service = logging_service - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_logging_service] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_monitoring_service(self, - request: Optional[Union[cluster_service.SetMonitoringServiceRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - monitoring_service: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the monitoring service for a specific cluster. - - .. 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 import container_v1 - - async def sample_set_monitoring_service(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetMonitoringServiceRequest( - monitoring_service="monitoring_service_value", - ) - - # Make the request - response = await client.set_monitoring_service(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.SetMonitoringServiceRequest, dict]]): - The request object. SetMonitoringServiceRequest sets the - monitoring service of a cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster - to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - monitoring_service (:class:`str`): - Required. The monitoring service the cluster should use - to write metrics. Currently available options: - - - "monitoring.googleapis.com/kubernetes" - The Cloud - Monitoring service with a Kubernetes-native resource - model - - ``monitoring.googleapis.com`` - The legacy Cloud - Monitoring service (no longer available as of GKE - 1.15). - - ``none`` - No metrics will be exported from the - cluster. - - If left as an empty - string,\ ``monitoring.googleapis.com/kubernetes`` will - be used for GKE 1.14+ or ``monitoring.googleapis.com`` - for earlier versions. - - This corresponds to the ``monitoring_service`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster) of the cluster to - set monitoring. Specified in the format - ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, monitoring_service, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetMonitoringServiceRequest): - request = cluster_service.SetMonitoringServiceRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if monitoring_service is not None: - request.monitoring_service = monitoring_service - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_monitoring_service] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_addons_config(self, - request: Optional[Union[cluster_service.SetAddonsConfigRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - addons_config: Optional[cluster_service.AddonsConfig] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the addons for a specific cluster. - - .. 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 import container_v1 - - async def sample_set_addons_config(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetAddonsConfigRequest( - ) - - # Make the request - response = await client.set_addons_config(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.SetAddonsConfigRequest, dict]]): - The request object. SetAddonsConfigRequest sets the - addons associated with the cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster - to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - addons_config (:class:`google.cloud.container_v1.types.AddonsConfig`): - Required. The desired configurations - for the various addons available to run - in the cluster. - - This corresponds to the ``addons_config`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster) of the cluster to - set addons. Specified in the format - ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, addons_config, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetAddonsConfigRequest): - request = cluster_service.SetAddonsConfigRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if addons_config is not None: - request.addons_config = addons_config - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_addons_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_locations(self, - request: Optional[Union[cluster_service.SetLocationsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - locations: Optional[MutableSequence[str]] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the locations for a specific cluster. Deprecated. Use - `projects.locations.clusters.update `__ - instead. - - .. 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 import container_v1 - - async def sample_set_locations(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetLocationsRequest( - locations=['locations_value1', 'locations_value2'], - ) - - # Make the request - response = await client.set_locations(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.SetLocationsRequest, dict]]): - The request object. SetLocationsRequest sets the - locations of the cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster - to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - locations (:class:`MutableSequence[str]`): - Required. The desired list of Google Compute Engine - `zones `__ - in which the cluster's nodes should be located. Changing - the locations a cluster is in will result in nodes being - either created or removed from the cluster, depending on - whether locations are being added or removed. - - This list must always include the cluster's primary - zone. - - This corresponds to the ``locations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster) of the cluster to - set locations. Specified in the format - ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - warnings.warn("ClusterManagerAsyncClient.set_locations is deprecated", - DeprecationWarning) - - # 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([project_id, zone, cluster_id, locations, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLocationsRequest): - request = cluster_service.SetLocationsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if name is not None: - request.name = name - if locations: - request.locations.extend(locations) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_locations] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_master(self, - request: Optional[Union[cluster_service.UpdateMasterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - master_version: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Updates the master for a specific cluster. - - .. 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 import container_v1 - - async def sample_update_master(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.UpdateMasterRequest( - master_version="master_version_value", - ) - - # Make the request - response = await client.update_master(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.UpdateMasterRequest, dict]]): - The request object. UpdateMasterRequest updates the - master of the cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster - to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - master_version (:class:`str`): - Required. The Kubernetes version to - change the master to. - Users may specify either explicit - versions offered by Kubernetes Engine or - version aliases, which have the - following behavior: - - - "latest": picks the highest valid - Kubernetes version - - "1.X": picks the highest valid - patch+gke.N patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N - patch in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit - Kubernetes version - - "-": picks the default Kubernetes - version - - This corresponds to the ``master_version`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster) of the cluster to - update. Specified in the format - ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, master_version, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.UpdateMasterRequest): - request = cluster_service.UpdateMasterRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if master_version is not None: - request.master_version = master_version - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.update_master] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_master_auth(self, - request: Optional[Union[cluster_service.SetMasterAuthRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets master auth materials. Currently supports - changing the admin password or a specific cluster, - either via password generation or explicitly setting the - password. - - .. 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 import container_v1 - - async def sample_set_master_auth(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetMasterAuthRequest( - action="SET_USERNAME", - ) - - # Make the request - response = await client.set_master_auth(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.SetMasterAuthRequest, dict]]): - The request object. SetMasterAuthRequest updates the - admin password of a cluster. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetMasterAuthRequest): - request = cluster_service.SetMasterAuthRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_master_auth] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def delete_cluster(self, - request: Optional[Union[cluster_service.DeleteClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Deletes the cluster, including the Kubernetes - endpoint and all worker nodes. - - Firewalls and routes that were configured during cluster - creation are also deleted. - - Other Google Compute Engine resources that might be in - use by the cluster, such as load balancer resources, are - not deleted if they weren't present when the cluster was - initially created. - - .. 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 import container_v1 - - async def sample_delete_cluster(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.DeleteClusterRequest( - ) - - # Make the request - response = await client.delete_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.DeleteClusterRequest, dict]]): - The request object. DeleteClusterRequest deletes a - cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster - to delete. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster) of the cluster to - delete. Specified in the format - ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.DeleteClusterRequest): - request = cluster_service.DeleteClusterRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.delete_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_operations(self, - request: Optional[Union[cluster_service.ListOperationsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListOperationsResponse: - r"""Lists all operations in a project in a specific zone - or all zones. - - .. 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 import container_v1 - - async def sample_list_operations(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.ListOperationsRequest( - ) - - # Make the request - response = await client.list_operations(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.ListOperationsRequest, dict]]): - The request object. ListOperationsRequest lists - operations. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - to return operations for, or ``-`` for all zones. This - field has been deprecated and replaced by the parent - field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - parent (:class:`str`): - The parent (project and location) where the operations - will be listed. Specified in the format - ``projects/*/locations/*``. Location "-" matches all - zones and all regions. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.ListOperationsResponse: - ListOperationsResponse is the result - of ListOperationsRequest. - - """ - # 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([project_id, zone, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListOperationsRequest): - request = cluster_service.ListOperationsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.list_operations] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_operation(self, - request: Optional[Union[cluster_service.GetOperationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - operation_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Gets the specified operation. - - .. 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 import container_v1 - - async def sample_get_operation(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.GetOperationRequest( - ) - - # Make the request - response = await client.get_operation(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.GetOperationRequest, dict]]): - The request object. GetOperationRequest gets a single - operation. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation_id (:class:`str`): - Deprecated. The server-assigned ``name`` of the - operation. This field has been deprecated and replaced - by the name field. - - This corresponds to the ``operation_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, operation id) of the - operation to get. Specified in the format - ``projects/*/locations/*/operations/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, operation_id, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetOperationRequest): - request = cluster_service.GetOperationRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if operation_id is not None: - request.operation_id = operation_id - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.get_operation] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def cancel_operation(self, - request: Optional[Union[cluster_service.CancelOperationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - operation_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> None: - r"""Cancels the specified operation. - - .. 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 import container_v1 - - async def sample_cancel_operation(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.CancelOperationRequest( - ) - - # Make the request - await client.cancel_operation(request=request) - - Args: - request (Optional[Union[google.cloud.container_v1.types.CancelOperationRequest, dict]]): - The request object. CancelOperationRequest cancels a - single operation. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the operation resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation_id (:class:`str`): - Deprecated. The server-assigned ``name`` of the - operation. This field has been deprecated and replaced - by the name field. - - This corresponds to the ``operation_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, operation id) of the - operation to cancel. Specified in the format - ``projects/*/locations/*/operations/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - # 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([project_id, zone, operation_id, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CancelOperationRequest): - request = cluster_service.CancelOperationRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if operation_id is not None: - request.operation_id = operation_id - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.cancel_operation] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - async def get_server_config(self, - request: Optional[Union[cluster_service.GetServerConfigRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ServerConfig: - r"""Returns configuration info about the Google - Kubernetes Engine service. - - .. 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 import container_v1 - - async def sample_get_server_config(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.GetServerConfigRequest( - ) - - # Make the request - response = await client.get_server_config(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.GetServerConfigRequest, dict]]): - The request object. Gets the current Kubernetes Engine - service configuration. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - to return operations for. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project and location) of the server config to - get, specified in the format ``projects/*/locations/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.ServerConfig: - Kubernetes Engine service - configuration. - - """ - # 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([project_id, zone, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetServerConfigRequest): - request = cluster_service.GetServerConfigRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.get_server_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_json_web_keys(self, - request: Optional[Union[cluster_service.GetJSONWebKeysRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.GetJSONWebKeysResponse: - r"""Gets the public component of the cluster signing keys - in JSON Web Key format. - - .. 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 import container_v1 - - async def sample_get_json_web_keys(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.GetJSONWebKeysRequest( - ) - - # Make the request - response = await client.get_json_web_keys(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.GetJSONWebKeysRequest, dict]]): - The request object. GetJSONWebKeysRequest gets the public component of the - keys used by the cluster to sign token requests. This - will be the jwks_uri for the discover document returned - by getOpenIDConfig. See the OpenID Connect Discovery 1.0 - specification for details. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.GetJSONWebKeysResponse: - GetJSONWebKeysResponse is a valid - JSON Web Key Set as specififed in rfc - 7517 - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetJSONWebKeysRequest): - request = cluster_service.GetJSONWebKeysRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.get_json_web_keys] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_node_pools(self, - request: Optional[Union[cluster_service.ListNodePoolsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListNodePoolsResponse: - r"""Lists the node pools for a cluster. - - .. 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 import container_v1 - - async def sample_list_node_pools(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.ListNodePoolsRequest( - ) - - # Make the request - response = await client.list_node_pools(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.ListNodePoolsRequest, dict]]): - The request object. ListNodePoolsRequest lists the node - pool(s) for a cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the parent field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the parent field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - parent (:class:`str`): - The parent (project, location, cluster name) where the - node pools will be listed. Specified in the format - ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.ListNodePoolsResponse: - ListNodePoolsResponse is the result - of ListNodePoolsRequest. - - """ - # 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([project_id, zone, cluster_id, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListNodePoolsRequest): - request = cluster_service.ListNodePoolsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.list_node_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_node_pool(self, - request: Optional[Union[cluster_service.GetNodePoolRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.NodePool: - r"""Retrieves the requested node pool. - - .. 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 import container_v1 - - async def sample_get_node_pool(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.GetNodePoolRequest( - ) - - # Make the request - response = await client.get_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.GetNodePoolRequest, dict]]): - The request object. GetNodePoolRequest retrieves a node - pool for a cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (:class:`str`): - Deprecated. The name of the node - pool. This field has been deprecated and - replaced by the name field. - - This corresponds to the ``node_pool_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster, node pool id) of - the node pool to get. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.NodePool: - NodePool contains the name and - configuration for a cluster's node pool. - Node pools are a set of nodes (i.e. - VM's), with a common configuration and - specification, under the control of the - cluster master. They may have a set of - Kubernetes labels applied to them, which - may be used to reference them during pod - scheduling. They may also be resized up - or down, to accommodate the workload. - - """ - # 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([project_id, zone, cluster_id, node_pool_id, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetNodePoolRequest): - request = cluster_service.GetNodePoolRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.get_node_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_node_pool(self, - request: Optional[Union[cluster_service.CreateNodePoolRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool: Optional[cluster_service.NodePool] = None, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Creates a node pool for a cluster. - - .. 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 import container_v1 - - async def sample_create_node_pool(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.CreateNodePoolRequest( - ) - - # Make the request - response = await client.create_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.CreateNodePoolRequest, dict]]): - The request object. CreateNodePoolRequest creates a node - pool for a cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the parent field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the parent field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool (:class:`google.cloud.container_v1.types.NodePool`): - Required. The node pool to create. - This corresponds to the ``node_pool`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - parent (:class:`str`): - The parent (project, location, cluster name) where the - node pool will be created. Specified in the format - ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_pool, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CreateNodePoolRequest): - request = cluster_service.CreateNodePoolRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool is not None: - request.node_pool = node_pool - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.create_node_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def delete_node_pool(self, - request: Optional[Union[cluster_service.DeleteNodePoolRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Deletes a node pool from a cluster. - - .. 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 import container_v1 - - async def sample_delete_node_pool(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.DeleteNodePoolRequest( - ) - - # Make the request - response = await client.delete_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.DeleteNodePoolRequest, dict]]): - The request object. DeleteNodePoolRequest deletes a node - pool for a cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (:class:`str`): - Deprecated. The name of the node pool - to delete. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``node_pool_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster, node pool id) of - the node pool to delete. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_pool_id, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.DeleteNodePoolRequest): - request = cluster_service.DeleteNodePoolRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.delete_node_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def complete_node_pool_upgrade(self, - request: Optional[Union[cluster_service.CompleteNodePoolUpgradeRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> None: - r"""CompleteNodePoolUpgrade will signal an on-going node - pool upgrade to complete. - - .. 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 import container_v1 - - async def sample_complete_node_pool_upgrade(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.CompleteNodePoolUpgradeRequest( - ) - - # Make the request - await client.complete_node_pool_upgrade(request=request) - - Args: - request (Optional[Union[google.cloud.container_v1.types.CompleteNodePoolUpgradeRequest, dict]]): - The request object. CompleteNodePoolUpgradeRequest sets - the name of target node pool to complete - upgrade. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CompleteNodePoolUpgradeRequest): - request = cluster_service.CompleteNodePoolUpgradeRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.complete_node_pool_upgrade] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - async def rollback_node_pool_upgrade(self, - request: Optional[Union[cluster_service.RollbackNodePoolUpgradeRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Rolls back a previously Aborted or Failed NodePool - upgrade. This makes no changes if the last upgrade - successfully completed. - - .. 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 import container_v1 - - async def sample_rollback_node_pool_upgrade(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.RollbackNodePoolUpgradeRequest( - ) - - # Make the request - response = await client.rollback_node_pool_upgrade(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.RollbackNodePoolUpgradeRequest, dict]]): - The request object. RollbackNodePoolUpgradeRequest - rollbacks the previously Aborted or - Failed NodePool upgrade. This will be an - no-op if the last upgrade successfully - completed. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster - to rollback. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (:class:`str`): - Deprecated. The name of the node pool - to rollback. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``node_pool_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster, node pool id) of - the node poll to rollback upgrade. Specified in the - format - ``projects/*/locations/*/clusters/*/nodePools/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_pool_id, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.RollbackNodePoolUpgradeRequest): - request = cluster_service.RollbackNodePoolUpgradeRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.rollback_node_pool_upgrade] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_node_pool_management(self, - request: Optional[Union[cluster_service.SetNodePoolManagementRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the NodeManagement options for a node pool. - - .. 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 import container_v1 - - async def sample_set_node_pool_management(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetNodePoolManagementRequest( - ) - - # Make the request - response = await client.set_node_pool_management(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.SetNodePoolManagementRequest, dict]]): - The request object. SetNodePoolManagementRequest sets the - node management properties of a node - pool. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNodePoolManagementRequest): - request = cluster_service.SetNodePoolManagementRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_node_pool_management] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_labels(self, - request: Optional[Union[cluster_service.SetLabelsRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets labels on a cluster. - - .. 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 import container_v1 - - async def sample_set_labels(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetLabelsRequest( - label_fingerprint="label_fingerprint_value", - ) - - # Make the request - response = await client.set_labels(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.SetLabelsRequest, dict]]): - The request object. SetLabelsRequest sets the Google - Cloud Platform labels on a Google - Container Engine cluster, which will in - turn set them for Google Compute Engine - resources used by that cluster - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLabelsRequest): - request = cluster_service.SetLabelsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_labels] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_legacy_abac(self, - request: Optional[Union[cluster_service.SetLegacyAbacRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - enabled: Optional[bool] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Enables or disables the ABAC authorization mechanism - on a cluster. - - .. 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 import container_v1 - - async def sample_set_legacy_abac(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetLegacyAbacRequest( - enabled=True, - ) - - # Make the request - response = await client.set_legacy_abac(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.SetLegacyAbacRequest, dict]]): - The request object. SetLegacyAbacRequest enables or - disables the ABAC authorization - mechanism for a cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster - to update. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - enabled (:class:`bool`): - Required. Whether ABAC authorization - will be enabled in the cluster. - - This corresponds to the ``enabled`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster name) of the - cluster to set legacy abac. Specified in the format - ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, enabled, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLegacyAbacRequest): - request = cluster_service.SetLegacyAbacRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if enabled is not None: - request.enabled = enabled - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_legacy_abac] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def start_ip_rotation(self, - request: Optional[Union[cluster_service.StartIPRotationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Starts master IP rotation. - - .. 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 import container_v1 - - async def sample_start_ip_rotation(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.StartIPRotationRequest( - ) - - # Make the request - response = await client.start_ip_rotation(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.StartIPRotationRequest, dict]]): - The request object. StartIPRotationRequest creates a new - IP for the cluster and then performs a - node upgrade on each node pool to point - to the new IP. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster name) of the - cluster to start IP rotation. Specified in the format - ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.StartIPRotationRequest): - request = cluster_service.StartIPRotationRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.start_ip_rotation] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def complete_ip_rotation(self, - request: Optional[Union[cluster_service.CompleteIPRotationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Completes master IP rotation. - - .. 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 import container_v1 - - async def sample_complete_ip_rotation(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.CompleteIPRotationRequest( - ) - - # Make the request - response = await client.complete_ip_rotation(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.CompleteIPRotationRequest, dict]]): - The request object. CompleteIPRotationRequest moves the - cluster master back into single-IP mode. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster name) of the - cluster to complete IP rotation. Specified in the format - ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CompleteIPRotationRequest): - request = cluster_service.CompleteIPRotationRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.complete_ip_rotation] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_node_pool_size(self, - request: Optional[Union[cluster_service.SetNodePoolSizeRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the size for a specific node pool. The new size will be - used for all replicas, including future replicas created by - modifying - [NodePool.locations][google.container.v1.NodePool.locations]. - - .. 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 import container_v1 - - async def sample_set_node_pool_size(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetNodePoolSizeRequest( - node_count=1070, - ) - - # Make the request - response = await client.set_node_pool_size(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.SetNodePoolSizeRequest, dict]]): - The request object. SetNodePoolSizeRequest sets the size - of a node pool. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNodePoolSizeRequest): - request = cluster_service.SetNodePoolSizeRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_node_pool_size] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_network_policy(self, - request: Optional[Union[cluster_service.SetNetworkPolicyRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - network_policy: Optional[cluster_service.NetworkPolicy] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Enables or disables Network Policy for a cluster. - - .. 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 import container_v1 - - async def sample_set_network_policy(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetNetworkPolicyRequest( - ) - - # Make the request - response = await client.set_network_policy(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.SetNetworkPolicyRequest, dict]]): - The request object. SetNetworkPolicyRequest - enables/disables network policy for a - cluster. - project_id (:class:`str`): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - network_policy (:class:`google.cloud.container_v1.types.NetworkPolicy`): - Required. Configuration options for - the NetworkPolicy feature. - - This corresponds to the ``network_policy`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster name) of the - cluster to set networking policy. Specified in the - format ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, network_policy, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNetworkPolicyRequest): - request = cluster_service.SetNetworkPolicyRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if network_policy is not None: - request.network_policy = network_policy - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_network_policy] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_maintenance_policy(self, - request: Optional[Union[cluster_service.SetMaintenancePolicyRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - maintenance_policy: Optional[cluster_service.MaintenancePolicy] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the maintenance policy for a cluster. - - .. 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 import container_v1 - - async def sample_set_maintenance_policy(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetMaintenancePolicyRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.set_maintenance_policy(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.SetMaintenancePolicyRequest, dict]]): - The request object. SetMaintenancePolicyRequest sets the - maintenance policy for a cluster. - project_id (:class:`str`): - Required. The Google Developers Console `project ID or - project - number `__. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. The name of the cluster to - update. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - maintenance_policy (:class:`google.cloud.container_v1.types.MaintenancePolicy`): - Required. The maintenance policy to - be set for the cluster. An empty field - clears the existing maintenance policy. - - This corresponds to the ``maintenance_policy`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (:class:`str`): - The name (project, location, cluster name) of the - cluster to set maintenance policy. Specified in the - format ``projects/*/locations/*/clusters/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, maintenance_policy, 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetMaintenancePolicyRequest): - request = cluster_service.SetMaintenancePolicyRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if maintenance_policy is not None: - request.maintenance_policy = maintenance_policy - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_maintenance_policy] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_usable_subnetworks(self, - request: Optional[Union[cluster_service.ListUsableSubnetworksRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> pagers.ListUsableSubnetworksAsyncPager: - r"""Lists subnetworks that are usable for creating - clusters in a project. - - .. 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 import container_v1 - - async def sample_list_usable_subnetworks(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.ListUsableSubnetworksRequest( - ) - - # Make the request - page_result = client.list_usable_subnetworks(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.ListUsableSubnetworksRequest, dict]]): - The request object. ListUsableSubnetworksRequest requests - the list of usable subnetworks available - to a user for creating clusters. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.services.cluster_manager.pagers.ListUsableSubnetworksAsyncPager: - ListUsableSubnetworksResponse is the - response of - ListUsableSubnetworksRequest. - - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListUsableSubnetworksRequest): - request = cluster_service.ListUsableSubnetworksRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.list_usable_subnetworks] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # 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.ListUsableSubnetworksAsyncPager( - method=rpc, - request=request, - response=response, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def check_autopilot_compatibility(self, - request: Optional[Union[cluster_service.CheckAutopilotCompatibilityRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.CheckAutopilotCompatibilityResponse: - r"""Checks the cluster compatibility with Autopilot mode, - and returns a list of compatibility issues. - - .. 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 import container_v1 - - async def sample_check_autopilot_compatibility(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.CheckAutopilotCompatibilityRequest( - ) - - # Make the request - response = await client.check_autopilot_compatibility(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1.types.CheckAutopilotCompatibilityRequest, dict]]): - The request object. CheckAutopilotCompatibilityRequest - requests getting the blockers for the - given operation in the cluster. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.CheckAutopilotCompatibilityResponse: - CheckAutopilotCompatibilityResponse - has a list of compatibility issues. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CheckAutopilotCompatibilityRequest): - request = cluster_service.CheckAutopilotCompatibilityRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.check_autopilot_compatibility] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def __aenter__(self) -> "ClusterManagerAsyncClient": - 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__ = ( - "ClusterManagerAsyncClient", -) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/client.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/client.py deleted file mode 100644 index f8cc3a3fb28c..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/client.py +++ /dev/null @@ -1,5097 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 logging as std_logging -import os -import re -from typing import Dict, Callable, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast -import warnings - -from google.cloud.container_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, None] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object, None] # type: ignore - -try: - from google.api_core import client_logging # type: ignore - CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER -except ImportError: # pragma: NO COVER - CLIENT_LOGGING_SUPPORTED = False - -_LOGGER = std_logging.getLogger(__name__) - -from google.cloud.container_v1.services.cluster_manager import pagers -from google.cloud.container_v1.types import cluster_service -from google.rpc import status_pb2 # type: ignore -from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import ClusterManagerGrpcTransport -from .transports.grpc_asyncio import ClusterManagerGrpcAsyncIOTransport -from .transports.rest import ClusterManagerRestTransport - - -class ClusterManagerClientMeta(type): - """Metaclass for the ClusterManager 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[ClusterManagerTransport]] - _transport_registry["grpc"] = ClusterManagerGrpcTransport - _transport_registry["grpc_asyncio"] = ClusterManagerGrpcAsyncIOTransport - _transport_registry["rest"] = ClusterManagerRestTransport - - def get_transport_class(cls, - label: Optional[str] = None, - ) -> Type[ClusterManagerTransport]: - """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 ClusterManagerClient(metaclass=ClusterManagerClientMeta): - """Google Kubernetes Engine Cluster Manager v1""" - - @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") - - # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead. - DEFAULT_ENDPOINT = "container.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - _DEFAULT_ENDPOINT_TEMPLATE = "container.{UNIVERSE_DOMAIN}" - _DEFAULT_UNIVERSE = "googleapis.com" - - @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: - ClusterManagerClient: 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: - ClusterManagerClient: 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) -> ClusterManagerTransport: - """Returns the transport used by the client instance. - - Returns: - ClusterManagerTransport: 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 crypto_key_version_path(project: str,location: str,key_ring: str,crypto_key: str,crypto_key_version: str,) -> str: - """Returns a fully-qualified crypto_key_version string.""" - return "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}".format(project=project, location=location, key_ring=key_ring, crypto_key=crypto_key, crypto_key_version=crypto_key_version, ) - - @staticmethod - def parse_crypto_key_version_path(path: str) -> Dict[str,str]: - """Parses a crypto_key_version path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/keyRings/(?P.+?)/cryptoKeys/(?P.+?)/cryptoKeyVersions/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def topic_path(project: str,topic: str,) -> str: - """Returns a fully-qualified topic string.""" - return "projects/{project}/topics/{topic}".format(project=project, topic=topic, ) - - @staticmethod - def parse_topic_path(path: str) -> Dict[str,str]: - """Parses a topic path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/topics/(?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): - """Deprecated. 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. - """ - - warnings.warn("get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.", - DeprecationWarning) - 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 - - @staticmethod - def _read_environment_variables(): - """Returns the environment variables used by the client. - - Returns: - Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE, - GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables. - - Raises: - ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not - any of ["true", "false"]. - google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT - is not any of ["auto", "never", "always"]. - """ - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false").lower() - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower() - universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN") - 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`") - return use_client_cert == "true", use_mtls_endpoint, universe_domain_env - - @staticmethod - def _get_client_cert_source(provided_cert_source, use_cert_flag): - """Return the client cert source to be used by the client. - - Args: - provided_cert_source (bytes): The client certificate source provided. - use_cert_flag (bool): A flag indicating whether to use the client certificate. - - Returns: - bytes or None: The client cert source to be used by the client. - """ - client_cert_source = None - if use_cert_flag: - if provided_cert_source: - client_cert_source = provided_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - return client_cert_source - - @staticmethod - def _get_api_endpoint(api_override, client_cert_source, universe_domain, use_mtls_endpoint): - """Return the API endpoint used by the client. - - Args: - api_override (str): The API endpoint override. If specified, this is always - the return value of this function and the other arguments are not used. - client_cert_source (bytes): The client certificate source used by the client. - universe_domain (str): The universe domain used by the client. - use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters. - Possible values are "always", "auto", or "never". - - Returns: - str: The API endpoint to be used by the client. - """ - if api_override is not None: - api_endpoint = api_override - elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): - _default_universe = ClusterManagerClient._DEFAULT_UNIVERSE - if universe_domain != _default_universe: - raise MutualTLSChannelError(f"mTLS is not supported in any universe other than {_default_universe}.") - api_endpoint = ClusterManagerClient.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=universe_domain) - return api_endpoint - - @staticmethod - def _get_universe_domain(client_universe_domain: Optional[str], universe_domain_env: Optional[str]) -> str: - """Return the universe domain used by the client. - - Args: - client_universe_domain (Optional[str]): The universe domain configured via the client options. - universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable. - - Returns: - str: The universe domain to be used by the client. - - Raises: - ValueError: If the universe domain is an empty string. - """ - universe_domain = ClusterManagerClient._DEFAULT_UNIVERSE - if client_universe_domain is not None: - universe_domain = client_universe_domain - elif universe_domain_env is not None: - universe_domain = universe_domain_env - if len(universe_domain.strip()) == 0: - raise ValueError("Universe Domain cannot be an empty string.") - return universe_domain - - def _validate_universe_domain(self): - """Validates client's and credentials' universe domains are consistent. - - Returns: - bool: True iff the configured universe domain is valid. - - Raises: - ValueError: If the configured universe domain is not valid. - """ - - # NOTE (b/349488459): universe validation is disabled until further notice. - return True - - @property - def api_endpoint(self): - """Return the API endpoint used by the client instance. - - Returns: - str: The API endpoint used by the client instance. - """ - return self._api_endpoint - - @property - def universe_domain(self) -> str: - """Return the universe domain used by the client instance. - - Returns: - str: The universe domain used by the client instance. - """ - return self._universe_domain - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, ClusterManagerTransport, Callable[..., ClusterManagerTransport]]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the cluster manager 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 (Optional[Union[str,ClusterManagerTransport,Callable[..., ClusterManagerTransport]]]): - The transport to use, or a Callable that constructs and returns a new transport. - If a Callable is given, it will be called with the same set of initialization - arguments as used in the ClusterManagerTransport constructor. - 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. - - 1. The ``api_endpoint`` property can be used to override the - default endpoint provided by the client when ``transport`` is - not explicitly provided. Only if this property is not set and - ``transport`` was not explicitly provided, the endpoint is - determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment - variable, which have one of the following values: - "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). - - 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide a client certificate for mTLS 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. - - 3. The ``universe_domain`` property can be used to override the - default "googleapis.com" universe. Note that the ``api_endpoint`` - property still takes precedence; and ``universe_domain`` is - currently not supported for mTLS. - - 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. - """ - self._client_options = client_options - if isinstance(self._client_options, dict): - self._client_options = client_options_lib.from_dict(self._client_options) - if self._client_options is None: - self._client_options = client_options_lib.ClientOptions() - self._client_options = cast(client_options_lib.ClientOptions, self._client_options) - - universe_domain_opt = getattr(self._client_options, 'universe_domain', None) - - self._use_client_cert, self._use_mtls_endpoint, self._universe_domain_env = ClusterManagerClient._read_environment_variables() - self._client_cert_source = ClusterManagerClient._get_client_cert_source(self._client_options.client_cert_source, self._use_client_cert) - self._universe_domain = ClusterManagerClient._get_universe_domain(universe_domain_opt, self._universe_domain_env) - self._api_endpoint = None # updated below, depending on `transport` - - # Initialize the universe domain validation. - self._is_universe_domain_valid = False - - if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER - # Setup logging. - client_logging.initialize_logging() - - api_key_value = getattr(self._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. - transport_provided = isinstance(transport, ClusterManagerTransport) - if transport_provided: - # transport is a ClusterManagerTransport instance. - if credentials or self._client_options.credentials_file or api_key_value: - raise ValueError("When providing a transport instance, " - "provide its credentials directly.") - if self._client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = cast(ClusterManagerTransport, transport) - self._api_endpoint = self._transport.host - - self._api_endpoint = (self._api_endpoint or - ClusterManagerClient._get_api_endpoint( - self._client_options.api_endpoint, - self._client_cert_source, - self._universe_domain, - self._use_mtls_endpoint)) - - if not transport_provided: - 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_init: Union[Type[ClusterManagerTransport], Callable[..., ClusterManagerTransport]] = ( - ClusterManagerClient.get_transport_class(transport) - if isinstance(transport, str) or transport is None - else cast(Callable[..., ClusterManagerTransport], transport) - ) - # initialize with the provided callable or the passed in class - self._transport = transport_init( - credentials=credentials, - credentials_file=self._client_options.credentials_file, - host=self._api_endpoint, - scopes=self._client_options.scopes, - client_cert_source_for_mtls=self._client_cert_source, - quota_project_id=self._client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=self._client_options.api_audience, - ) - - if "async" not in str(self._transport): - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG): # pragma: NO COVER - _LOGGER.debug( - "Created client `google.container_v1.ClusterManagerClient`.", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "universeDomain": getattr(self._transport._credentials, "universe_domain", ""), - "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}", - "credentialsInfo": getattr(self.transport._credentials, "get_cred_info", lambda: None)(), - } if hasattr(self._transport, "_credentials") else { - "serviceName": "google.container.v1.ClusterManager", - "credentialsType": None, - } - ) - - def list_clusters(self, - request: Optional[Union[cluster_service.ListClustersRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListClustersResponse: - r"""Lists all clusters owned by a project in either the - specified zone or all zones. - - .. 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 import container_v1 - - def sample_list_clusters(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.ListClustersRequest( - ) - - # Make the request - response = client.list_clusters(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.ListClustersRequest, dict]): - The request object. ListClustersRequest lists clusters. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides, or "-" for all zones. This - field has been deprecated and replaced by the parent - field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - parent (str): - The parent (project and location) where the clusters - will be listed. Specified in the format - ``projects/*/locations/*``. Location "-" matches all - zones and all regions. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.ListClustersResponse: - ListClustersResponse is the result of - ListClustersRequest. - - """ - # 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([project_id, zone, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListClustersRequest): - request = cluster_service.ListClustersRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - 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_clusters] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_cluster(self, - request: Optional[Union[cluster_service.GetClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Cluster: - r"""Gets the details of a specific cluster. - - .. 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 import container_v1 - - def sample_get_cluster(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.GetClusterRequest( - ) - - # Make the request - response = client.get_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.GetClusterRequest, dict]): - The request object. GetClusterRequest gets the settings - of a cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster - to retrieve. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster) of the cluster to - retrieve. Specified in the format - ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Cluster: - A Google Kubernetes Engine cluster. - """ - # 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([project_id, zone, cluster_id, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetClusterRequest): - request = cluster_service.GetClusterRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - 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_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_cluster(self, - request: Optional[Union[cluster_service.CreateClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster: Optional[cluster_service.Cluster] = None, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Creates a cluster, consisting of the specified number and type - of Google Compute Engine instances. - - By default, the cluster is created in the project's `default - network `__. - - One firewall is added for the cluster. After cluster creation, - the Kubelet creates routes for each node to allow the containers - on that node to communicate with all other instances in the - cluster. - - Finally, an entry is added to the project's global metadata - indicating which CIDR range the cluster is using. - - .. 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 import container_v1 - - def sample_create_cluster(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.CreateClusterRequest( - ) - - # Make the request - response = client.create_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.CreateClusterRequest, dict]): - The request object. CreateClusterRequest creates a - cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the parent field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster (google.cloud.container_v1.types.Cluster): - Required. A `cluster - resource `__ - - This corresponds to the ``cluster`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - parent (str): - The parent (project and location) where the cluster will - be created. Specified 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CreateClusterRequest): - request = cluster_service.CreateClusterRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster is not None: - request.cluster = cluster - 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.create_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_cluster(self, - request: Optional[Union[cluster_service.UpdateClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - update: Optional[cluster_service.ClusterUpdate] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Updates the settings of a specific cluster. - - .. 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 import container_v1 - - def sample_update_cluster(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.UpdateClusterRequest( - ) - - # Make the request - response = client.update_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.UpdateClusterRequest, dict]): - The request object. UpdateClusterRequest updates the - settings of a cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster - to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update (google.cloud.container_v1.types.ClusterUpdate): - Required. A description of the - update. - - This corresponds to the ``update`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster) of the cluster to - update. Specified in the format - ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, update, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.UpdateClusterRequest): - request = cluster_service.UpdateClusterRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if update is not None: - request.update = update - 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.update_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_node_pool(self, - request: Optional[Union[cluster_service.UpdateNodePoolRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Updates the version and/or image type for the - specified node pool. - - .. 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 import container_v1 - - def sample_update_node_pool(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.UpdateNodePoolRequest( - node_version="node_version_value", - image_type="image_type_value", - ) - - # Make the request - response = client.update_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.UpdateNodePoolRequest, dict]): - The request object. UpdateNodePoolRequests update a node - pool's image and/or version. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.UpdateNodePoolRequest): - request = cluster_service.UpdateNodePoolRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_node_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_node_pool_autoscaling(self, - request: Optional[Union[cluster_service.SetNodePoolAutoscalingRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the autoscaling settings for the specified node - pool. - - .. 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 import container_v1 - - def sample_set_node_pool_autoscaling(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetNodePoolAutoscalingRequest( - ) - - # Make the request - response = client.set_node_pool_autoscaling(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.SetNodePoolAutoscalingRequest, dict]): - The request object. SetNodePoolAutoscalingRequest sets - the autoscaler settings of a node pool. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNodePoolAutoscalingRequest): - request = cluster_service.SetNodePoolAutoscalingRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_node_pool_autoscaling] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_logging_service(self, - request: Optional[Union[cluster_service.SetLoggingServiceRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - logging_service: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the logging service for a specific cluster. - - .. 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 import container_v1 - - def sample_set_logging_service(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetLoggingServiceRequest( - logging_service="logging_service_value", - ) - - # Make the request - response = client.set_logging_service(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.SetLoggingServiceRequest, dict]): - The request object. SetLoggingServiceRequest sets the - logging service of a cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster - to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - logging_service (str): - Required. The logging service the cluster should use to - write logs. Currently available options: - - - ``logging.googleapis.com/kubernetes`` - The Cloud - Logging service with a Kubernetes-native resource - model - - ``logging.googleapis.com`` - The legacy Cloud Logging - service (no longer available as of GKE 1.15). - - ``none`` - no logs will be exported from the cluster. - - If left as an empty - string,\ ``logging.googleapis.com/kubernetes`` will be - used for GKE 1.14+ or ``logging.googleapis.com`` for - earlier versions. - - This corresponds to the ``logging_service`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster) of the cluster to - set logging. Specified in the format - ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, logging_service, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLoggingServiceRequest): - request = cluster_service.SetLoggingServiceRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if logging_service is not None: - request.logging_service = logging_service - 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.set_logging_service] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_monitoring_service(self, - request: Optional[Union[cluster_service.SetMonitoringServiceRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - monitoring_service: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the monitoring service for a specific cluster. - - .. 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 import container_v1 - - def sample_set_monitoring_service(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetMonitoringServiceRequest( - monitoring_service="monitoring_service_value", - ) - - # Make the request - response = client.set_monitoring_service(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.SetMonitoringServiceRequest, dict]): - The request object. SetMonitoringServiceRequest sets the - monitoring service of a cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster - to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - monitoring_service (str): - Required. The monitoring service the cluster should use - to write metrics. Currently available options: - - - "monitoring.googleapis.com/kubernetes" - The Cloud - Monitoring service with a Kubernetes-native resource - model - - ``monitoring.googleapis.com`` - The legacy Cloud - Monitoring service (no longer available as of GKE - 1.15). - - ``none`` - No metrics will be exported from the - cluster. - - If left as an empty - string,\ ``monitoring.googleapis.com/kubernetes`` will - be used for GKE 1.14+ or ``monitoring.googleapis.com`` - for earlier versions. - - This corresponds to the ``monitoring_service`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster) of the cluster to - set monitoring. Specified in the format - ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, monitoring_service, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetMonitoringServiceRequest): - request = cluster_service.SetMonitoringServiceRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if monitoring_service is not None: - request.monitoring_service = monitoring_service - 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.set_monitoring_service] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_addons_config(self, - request: Optional[Union[cluster_service.SetAddonsConfigRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - addons_config: Optional[cluster_service.AddonsConfig] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the addons for a specific cluster. - - .. 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 import container_v1 - - def sample_set_addons_config(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetAddonsConfigRequest( - ) - - # Make the request - response = client.set_addons_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.SetAddonsConfigRequest, dict]): - The request object. SetAddonsConfigRequest sets the - addons associated with the cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster - to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - addons_config (google.cloud.container_v1.types.AddonsConfig): - Required. The desired configurations - for the various addons available to run - in the cluster. - - This corresponds to the ``addons_config`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster) of the cluster to - set addons. Specified in the format - ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, addons_config, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetAddonsConfigRequest): - request = cluster_service.SetAddonsConfigRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if addons_config is not None: - request.addons_config = addons_config - 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.set_addons_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_locations(self, - request: Optional[Union[cluster_service.SetLocationsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - locations: Optional[MutableSequence[str]] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the locations for a specific cluster. Deprecated. Use - `projects.locations.clusters.update `__ - instead. - - .. 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 import container_v1 - - def sample_set_locations(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetLocationsRequest( - locations=['locations_value1', 'locations_value2'], - ) - - # Make the request - response = client.set_locations(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.SetLocationsRequest, dict]): - The request object. SetLocationsRequest sets the - locations of the cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster - to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - locations (MutableSequence[str]): - Required. The desired list of Google Compute Engine - `zones `__ - in which the cluster's nodes should be located. Changing - the locations a cluster is in will result in nodes being - either created or removed from the cluster, depending on - whether locations are being added or removed. - - This list must always include the cluster's primary - zone. - - This corresponds to the ``locations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster) of the cluster to - set locations. Specified in the format - ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - warnings.warn("ClusterManagerClient.set_locations is deprecated", - DeprecationWarning) - - # 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([project_id, zone, cluster_id, locations, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLocationsRequest): - request = cluster_service.SetLocationsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if locations is not None: - request.locations = locations - 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.set_locations] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_master(self, - request: Optional[Union[cluster_service.UpdateMasterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - master_version: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Updates the master for a specific cluster. - - .. 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 import container_v1 - - def sample_update_master(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.UpdateMasterRequest( - master_version="master_version_value", - ) - - # Make the request - response = client.update_master(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.UpdateMasterRequest, dict]): - The request object. UpdateMasterRequest updates the - master of the cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster - to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - master_version (str): - Required. The Kubernetes version to - change the master to. - Users may specify either explicit - versions offered by Kubernetes Engine or - version aliases, which have the - following behavior: - - - "latest": picks the highest valid - Kubernetes version - - "1.X": picks the highest valid - patch+gke.N patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N - patch in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit - Kubernetes version - - "-": picks the default Kubernetes - version - - This corresponds to the ``master_version`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster) of the cluster to - update. Specified in the format - ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, master_version, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.UpdateMasterRequest): - request = cluster_service.UpdateMasterRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if master_version is not None: - request.master_version = master_version - 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.update_master] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_master_auth(self, - request: Optional[Union[cluster_service.SetMasterAuthRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets master auth materials. Currently supports - changing the admin password or a specific cluster, - either via password generation or explicitly setting the - password. - - .. 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 import container_v1 - - def sample_set_master_auth(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetMasterAuthRequest( - action="SET_USERNAME", - ) - - # Make the request - response = client.set_master_auth(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.SetMasterAuthRequest, dict]): - The request object. SetMasterAuthRequest updates the - admin password of a cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetMasterAuthRequest): - request = cluster_service.SetMasterAuthRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_master_auth] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def delete_cluster(self, - request: Optional[Union[cluster_service.DeleteClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Deletes the cluster, including the Kubernetes - endpoint and all worker nodes. - - Firewalls and routes that were configured during cluster - creation are also deleted. - - Other Google Compute Engine resources that might be in - use by the cluster, such as load balancer resources, are - not deleted if they weren't present when the cluster was - initially created. - - .. 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 import container_v1 - - def sample_delete_cluster(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.DeleteClusterRequest( - ) - - # Make the request - response = client.delete_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.DeleteClusterRequest, dict]): - The request object. DeleteClusterRequest deletes a - cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster - to delete. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster) of the cluster to - delete. Specified in the format - ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.DeleteClusterRequest): - request = cluster_service.DeleteClusterRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - 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_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_operations(self, - request: Optional[Union[cluster_service.ListOperationsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListOperationsResponse: - r"""Lists all operations in a project in a specific zone - or all zones. - - .. 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 import container_v1 - - def sample_list_operations(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.ListOperationsRequest( - ) - - # Make the request - response = client.list_operations(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.ListOperationsRequest, dict]): - The request object. ListOperationsRequest lists - operations. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - to return operations for, or ``-`` for all zones. This - field has been deprecated and replaced by the parent - field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - parent (str): - The parent (project and location) where the operations - will be listed. Specified in the format - ``projects/*/locations/*``. Location "-" matches all - zones and all regions. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.ListOperationsResponse: - ListOperationsResponse is the result - of ListOperationsRequest. - - """ - # 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([project_id, zone, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListOperationsRequest): - request = cluster_service.ListOperationsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - 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_operations] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_operation(self, - request: Optional[Union[cluster_service.GetOperationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - operation_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Gets the specified operation. - - .. 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 import container_v1 - - def sample_get_operation(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.GetOperationRequest( - ) - - # Make the request - response = client.get_operation(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.GetOperationRequest, dict]): - The request object. GetOperationRequest gets a single - operation. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation_id (str): - Deprecated. The server-assigned ``name`` of the - operation. This field has been deprecated and replaced - by the name field. - - This corresponds to the ``operation_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, operation id) of the - operation to get. Specified in the format - ``projects/*/locations/*/operations/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, operation_id, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetOperationRequest): - request = cluster_service.GetOperationRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if operation_id is not None: - request.operation_id = operation_id - 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_operation] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def cancel_operation(self, - request: Optional[Union[cluster_service.CancelOperationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - operation_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> None: - r"""Cancels the specified operation. - - .. 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 import container_v1 - - def sample_cancel_operation(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.CancelOperationRequest( - ) - - # Make the request - client.cancel_operation(request=request) - - Args: - request (Union[google.cloud.container_v1.types.CancelOperationRequest, dict]): - The request object. CancelOperationRequest cancels a - single operation. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the operation resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation_id (str): - Deprecated. The server-assigned ``name`` of the - operation. This field has been deprecated and replaced - by the name field. - - This corresponds to the ``operation_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, operation id) of the - operation to cancel. Specified in the format - ``projects/*/locations/*/operations/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - # 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([project_id, zone, operation_id, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CancelOperationRequest): - request = cluster_service.CancelOperationRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if operation_id is not None: - request.operation_id = operation_id - 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.cancel_operation] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - def get_server_config(self, - request: Optional[Union[cluster_service.GetServerConfigRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ServerConfig: - r"""Returns configuration info about the Google - Kubernetes Engine service. - - .. 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 import container_v1 - - def sample_get_server_config(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.GetServerConfigRequest( - ) - - # Make the request - response = client.get_server_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.GetServerConfigRequest, dict]): - The request object. Gets the current Kubernetes Engine - service configuration. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - to return operations for. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project and location) of the server config to - get, specified in the format ``projects/*/locations/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.ServerConfig: - Kubernetes Engine service - configuration. - - """ - # 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([project_id, zone, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetServerConfigRequest): - request = cluster_service.GetServerConfigRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - 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_server_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_json_web_keys(self, - request: Optional[Union[cluster_service.GetJSONWebKeysRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.GetJSONWebKeysResponse: - r"""Gets the public component of the cluster signing keys - in JSON Web Key format. - - .. 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 import container_v1 - - def sample_get_json_web_keys(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.GetJSONWebKeysRequest( - ) - - # Make the request - response = client.get_json_web_keys(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.GetJSONWebKeysRequest, dict]): - The request object. GetJSONWebKeysRequest gets the public component of the - keys used by the cluster to sign token requests. This - will be the jwks_uri for the discover document returned - by getOpenIDConfig. See the OpenID Connect Discovery 1.0 - specification for details. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.GetJSONWebKeysResponse: - GetJSONWebKeysResponse is a valid - JSON Web Key Set as specififed in rfc - 7517 - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetJSONWebKeysRequest): - request = cluster_service.GetJSONWebKeysRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_json_web_keys] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_node_pools(self, - request: Optional[Union[cluster_service.ListNodePoolsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListNodePoolsResponse: - r"""Lists the node pools for a cluster. - - .. 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 import container_v1 - - def sample_list_node_pools(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.ListNodePoolsRequest( - ) - - # Make the request - response = client.list_node_pools(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.ListNodePoolsRequest, dict]): - The request object. ListNodePoolsRequest lists the node - pool(s) for a cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the parent field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the parent field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - parent (str): - The parent (project, location, cluster name) where the - node pools will be listed. Specified in the format - ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.ListNodePoolsResponse: - ListNodePoolsResponse is the result - of ListNodePoolsRequest. - - """ - # 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([project_id, zone, cluster_id, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListNodePoolsRequest): - request = cluster_service.ListNodePoolsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - 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_node_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_node_pool(self, - request: Optional[Union[cluster_service.GetNodePoolRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.NodePool: - r"""Retrieves the requested node pool. - - .. 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 import container_v1 - - def sample_get_node_pool(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.GetNodePoolRequest( - ) - - # Make the request - response = client.get_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.GetNodePoolRequest, dict]): - The request object. GetNodePoolRequest retrieves a node - pool for a cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (str): - Deprecated. The name of the node - pool. This field has been deprecated and - replaced by the name field. - - This corresponds to the ``node_pool_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster, node pool id) of - the node pool to get. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.NodePool: - NodePool contains the name and - configuration for a cluster's node pool. - Node pools are a set of nodes (i.e. - VM's), with a common configuration and - specification, under the control of the - cluster master. They may have a set of - Kubernetes labels applied to them, which - may be used to reference them during pod - scheduling. They may also be resized up - or down, to accommodate the workload. - - """ - # 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([project_id, zone, cluster_id, node_pool_id, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetNodePoolRequest): - request = cluster_service.GetNodePoolRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - 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_node_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_node_pool(self, - request: Optional[Union[cluster_service.CreateNodePoolRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool: Optional[cluster_service.NodePool] = None, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Creates a node pool for a cluster. - - .. 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 import container_v1 - - def sample_create_node_pool(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.CreateNodePoolRequest( - ) - - # Make the request - response = client.create_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.CreateNodePoolRequest, dict]): - The request object. CreateNodePoolRequest creates a node - pool for a cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the parent field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the parent field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool (google.cloud.container_v1.types.NodePool): - Required. The node pool to create. - This corresponds to the ``node_pool`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - parent (str): - The parent (project, location, cluster name) where the - node pool will be created. Specified in the format - ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_pool, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CreateNodePoolRequest): - request = cluster_service.CreateNodePoolRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool is not None: - request.node_pool = node_pool - 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.create_node_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def delete_node_pool(self, - request: Optional[Union[cluster_service.DeleteNodePoolRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Deletes a node pool from a cluster. - - .. 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 import container_v1 - - def sample_delete_node_pool(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.DeleteNodePoolRequest( - ) - - # Make the request - response = client.delete_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.DeleteNodePoolRequest, dict]): - The request object. DeleteNodePoolRequest deletes a node - pool for a cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (str): - Deprecated. The name of the node pool - to delete. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``node_pool_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster, node pool id) of - the node pool to delete. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_pool_id, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.DeleteNodePoolRequest): - request = cluster_service.DeleteNodePoolRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - 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_node_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def complete_node_pool_upgrade(self, - request: Optional[Union[cluster_service.CompleteNodePoolUpgradeRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> None: - r"""CompleteNodePoolUpgrade will signal an on-going node - pool upgrade to complete. - - .. 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 import container_v1 - - def sample_complete_node_pool_upgrade(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.CompleteNodePoolUpgradeRequest( - ) - - # Make the request - client.complete_node_pool_upgrade(request=request) - - Args: - request (Union[google.cloud.container_v1.types.CompleteNodePoolUpgradeRequest, dict]): - The request object. CompleteNodePoolUpgradeRequest sets - the name of target node pool to complete - upgrade. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CompleteNodePoolUpgradeRequest): - request = cluster_service.CompleteNodePoolUpgradeRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.complete_node_pool_upgrade] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - def rollback_node_pool_upgrade(self, - request: Optional[Union[cluster_service.RollbackNodePoolUpgradeRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Rolls back a previously Aborted or Failed NodePool - upgrade. This makes no changes if the last upgrade - successfully completed. - - .. 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 import container_v1 - - def sample_rollback_node_pool_upgrade(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.RollbackNodePoolUpgradeRequest( - ) - - # Make the request - response = client.rollback_node_pool_upgrade(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.RollbackNodePoolUpgradeRequest, dict]): - The request object. RollbackNodePoolUpgradeRequest - rollbacks the previously Aborted or - Failed NodePool upgrade. This will be an - no-op if the last upgrade successfully - completed. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster - to rollback. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (str): - Deprecated. The name of the node pool - to rollback. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``node_pool_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster, node pool id) of - the node poll to rollback upgrade. Specified in the - format - ``projects/*/locations/*/clusters/*/nodePools/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_pool_id, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.RollbackNodePoolUpgradeRequest): - request = cluster_service.RollbackNodePoolUpgradeRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - 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.rollback_node_pool_upgrade] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_node_pool_management(self, - request: Optional[Union[cluster_service.SetNodePoolManagementRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the NodeManagement options for a node pool. - - .. 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 import container_v1 - - def sample_set_node_pool_management(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetNodePoolManagementRequest( - ) - - # Make the request - response = client.set_node_pool_management(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.SetNodePoolManagementRequest, dict]): - The request object. SetNodePoolManagementRequest sets the - node management properties of a node - pool. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNodePoolManagementRequest): - request = cluster_service.SetNodePoolManagementRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_node_pool_management] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_labels(self, - request: Optional[Union[cluster_service.SetLabelsRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets labels on a cluster. - - .. 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 import container_v1 - - def sample_set_labels(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetLabelsRequest( - label_fingerprint="label_fingerprint_value", - ) - - # Make the request - response = client.set_labels(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.SetLabelsRequest, dict]): - The request object. SetLabelsRequest sets the Google - Cloud Platform labels on a Google - Container Engine cluster, which will in - turn set them for Google Compute Engine - resources used by that cluster - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLabelsRequest): - request = cluster_service.SetLabelsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_labels] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_legacy_abac(self, - request: Optional[Union[cluster_service.SetLegacyAbacRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - enabled: Optional[bool] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Enables or disables the ABAC authorization mechanism - on a cluster. - - .. 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 import container_v1 - - def sample_set_legacy_abac(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetLegacyAbacRequest( - enabled=True, - ) - - # Make the request - response = client.set_legacy_abac(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.SetLegacyAbacRequest, dict]): - The request object. SetLegacyAbacRequest enables or - disables the ABAC authorization - mechanism for a cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster - to update. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - enabled (bool): - Required. Whether ABAC authorization - will be enabled in the cluster. - - This corresponds to the ``enabled`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster name) of the - cluster to set legacy abac. Specified in the format - ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, enabled, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLegacyAbacRequest): - request = cluster_service.SetLegacyAbacRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if enabled is not None: - request.enabled = enabled - 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.set_legacy_abac] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def start_ip_rotation(self, - request: Optional[Union[cluster_service.StartIPRotationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Starts master IP rotation. - - .. 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 import container_v1 - - def sample_start_ip_rotation(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.StartIPRotationRequest( - ) - - # Make the request - response = client.start_ip_rotation(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.StartIPRotationRequest, dict]): - The request object. StartIPRotationRequest creates a new - IP for the cluster and then performs a - node upgrade on each node pool to point - to the new IP. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster name) of the - cluster to start IP rotation. Specified in the format - ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.StartIPRotationRequest): - request = cluster_service.StartIPRotationRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - 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.start_ip_rotation] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def complete_ip_rotation(self, - request: Optional[Union[cluster_service.CompleteIPRotationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Completes master IP rotation. - - .. 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 import container_v1 - - def sample_complete_ip_rotation(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.CompleteIPRotationRequest( - ) - - # Make the request - response = client.complete_ip_rotation(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.CompleteIPRotationRequest, dict]): - The request object. CompleteIPRotationRequest moves the - cluster master back into single-IP mode. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster name) of the - cluster to complete IP rotation. Specified in the format - ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CompleteIPRotationRequest): - request = cluster_service.CompleteIPRotationRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - 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.complete_ip_rotation] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_node_pool_size(self, - request: Optional[Union[cluster_service.SetNodePoolSizeRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the size for a specific node pool. The new size will be - used for all replicas, including future replicas created by - modifying - [NodePool.locations][google.container.v1.NodePool.locations]. - - .. 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 import container_v1 - - def sample_set_node_pool_size(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetNodePoolSizeRequest( - node_count=1070, - ) - - # Make the request - response = client.set_node_pool_size(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.SetNodePoolSizeRequest, dict]): - The request object. SetNodePoolSizeRequest sets the size - of a node pool. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNodePoolSizeRequest): - request = cluster_service.SetNodePoolSizeRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_node_pool_size] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_network_policy(self, - request: Optional[Union[cluster_service.SetNetworkPolicyRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - network_policy: Optional[cluster_service.NetworkPolicy] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Enables or disables Network Policy for a cluster. - - .. 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 import container_v1 - - def sample_set_network_policy(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetNetworkPolicyRequest( - ) - - # Make the request - response = client.set_network_policy(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.SetNetworkPolicyRequest, dict]): - The request object. SetNetworkPolicyRequest - enables/disables network policy for a - cluster. - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and - replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - network_policy (google.cloud.container_v1.types.NetworkPolicy): - Required. Configuration options for - the NetworkPolicy feature. - - This corresponds to the ``network_policy`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster name) of the - cluster to set networking policy. Specified in the - format ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, network_policy, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNetworkPolicyRequest): - request = cluster_service.SetNetworkPolicyRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if network_policy is not None: - request.network_policy = network_policy - 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.set_network_policy] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_maintenance_policy(self, - request: Optional[Union[cluster_service.SetMaintenancePolicyRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - maintenance_policy: Optional[cluster_service.MaintenancePolicy] = None, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the maintenance policy for a cluster. - - .. 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 import container_v1 - - def sample_set_maintenance_policy(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetMaintenancePolicyRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.set_maintenance_policy(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.SetMaintenancePolicyRequest, dict]): - The request object. SetMaintenancePolicyRequest sets the - maintenance policy for a cluster. - project_id (str): - Required. The Google Developers Console `project ID or - project - number `__. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. The name of the cluster to - update. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - maintenance_policy (google.cloud.container_v1.types.MaintenancePolicy): - Required. The maintenance policy to - be set for the cluster. An empty field - clears the existing maintenance policy. - - This corresponds to the ``maintenance_policy`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - name (str): - The name (project, location, cluster name) of the - cluster to set maintenance policy. Specified in the - format ``projects/*/locations/*/clusters/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, maintenance_policy, 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetMaintenancePolicyRequest): - request = cluster_service.SetMaintenancePolicyRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if maintenance_policy is not None: - request.maintenance_policy = maintenance_policy - 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.set_maintenance_policy] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_usable_subnetworks(self, - request: Optional[Union[cluster_service.ListUsableSubnetworksRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> pagers.ListUsableSubnetworksPager: - r"""Lists subnetworks that are usable for creating - clusters in a project. - - .. 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 import container_v1 - - def sample_list_usable_subnetworks(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.ListUsableSubnetworksRequest( - ) - - # Make the request - page_result = client.list_usable_subnetworks(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.container_v1.types.ListUsableSubnetworksRequest, dict]): - The request object. ListUsableSubnetworksRequest requests - the list of usable subnetworks available - to a user for creating clusters. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.services.cluster_manager.pagers.ListUsableSubnetworksPager: - ListUsableSubnetworksResponse is the - response of - ListUsableSubnetworksRequest. - - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListUsableSubnetworksRequest): - request = cluster_service.ListUsableSubnetworksRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_usable_subnetworks] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # 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.ListUsableSubnetworksPager( - method=rpc, - request=request, - response=response, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def check_autopilot_compatibility(self, - request: Optional[Union[cluster_service.CheckAutopilotCompatibilityRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.CheckAutopilotCompatibilityResponse: - r"""Checks the cluster compatibility with Autopilot mode, - and returns a list of compatibility issues. - - .. 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 import container_v1 - - def sample_check_autopilot_compatibility(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.CheckAutopilotCompatibilityRequest( - ) - - # Make the request - response = client.check_autopilot_compatibility(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1.types.CheckAutopilotCompatibilityRequest, dict]): - The request object. CheckAutopilotCompatibilityRequest - requests getting the blockers for the - given operation in the cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1.types.CheckAutopilotCompatibilityResponse: - CheckAutopilotCompatibilityResponse - has a list of compatibility issues. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CheckAutopilotCompatibilityRequest): - request = cluster_service.CheckAutopilotCompatibilityRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.check_autopilot_compatibility] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def __enter__(self) -> "ClusterManagerClient": - 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__ = ( - "ClusterManagerClient", -) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/pagers.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/pagers.py deleted file mode 100644 index 6e073460eafd..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/pagers.py +++ /dev/null @@ -1,166 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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.api_core import gapic_v1 -from google.api_core import retry as retries -from google.api_core import retry_async as retries_async -from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator, Union -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] - OptionalAsyncRetry = Union[retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object, None] # type: ignore - OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore - -from google.cloud.container_v1.types import cluster_service - - -class ListUsableSubnetworksPager: - """A pager for iterating through ``list_usable_subnetworks`` requests. - - This class thinly wraps an initial - :class:`google.cloud.container_v1.types.ListUsableSubnetworksResponse` object, and - provides an ``__iter__`` method to iterate through its - ``subnetworks`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListUsableSubnetworks`` requests and continue to iterate - through the ``subnetworks`` field on the - corresponding responses. - - All the usual :class:`google.cloud.container_v1.types.ListUsableSubnetworksResponse` - 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[..., cluster_service.ListUsableSubnetworksResponse], - request: cluster_service.ListUsableSubnetworksRequest, - response: cluster_service.ListUsableSubnetworksResponse, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.container_v1.types.ListUsableSubnetworksRequest): - The initial request object. - response (google.cloud.container_v1.types.ListUsableSubnetworksResponse): - The initial response object. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - self._method = method - self._request = cluster_service.ListUsableSubnetworksRequest(request) - self._response = response - self._retry = retry - self._timeout = timeout - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[cluster_service.ListUsableSubnetworksResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, retry=self._retry, timeout=self._timeout, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[cluster_service.UsableSubnetwork]: - for page in self.pages: - yield from page.subnetworks - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListUsableSubnetworksAsyncPager: - """A pager for iterating through ``list_usable_subnetworks`` requests. - - This class thinly wraps an initial - :class:`google.cloud.container_v1.types.ListUsableSubnetworksResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``subnetworks`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListUsableSubnetworks`` requests and continue to iterate - through the ``subnetworks`` field on the - corresponding responses. - - All the usual :class:`google.cloud.container_v1.types.ListUsableSubnetworksResponse` - 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[cluster_service.ListUsableSubnetworksResponse]], - request: cluster_service.ListUsableSubnetworksRequest, - response: cluster_service.ListUsableSubnetworksResponse, - *, - retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.container_v1.types.ListUsableSubnetworksRequest): - The initial request object. - response (google.cloud.container_v1.types.ListUsableSubnetworksResponse): - The initial response object. - retry (google.api_core.retry.AsyncRetry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - self._method = method - self._request = cluster_service.ListUsableSubnetworksRequest(request) - self._response = response - self._retry = retry - self._timeout = timeout - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[cluster_service.ListUsableSubnetworksResponse]: - 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, retry=self._retry, timeout=self._timeout, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[cluster_service.UsableSubnetwork]: - async def async_generator(): - async for page in self.pages: - for response in page.subnetworks: - 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/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/README.rst b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/README.rst deleted file mode 100644 index 4b8234a968af..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/README.rst +++ /dev/null @@ -1,9 +0,0 @@ - -transport inheritance structure -_______________________________ - -`ClusterManagerTransport` is the ABC for all transports. -- public child `ClusterManagerGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ClusterManagerGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseClusterManagerRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ClusterManagerRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/__init__.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/__init__.py deleted file mode 100644 index f779c4fbc7cc..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/__init__.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ClusterManagerTransport -from .grpc import ClusterManagerGrpcTransport -from .grpc_asyncio import ClusterManagerGrpcAsyncIOTransport -from .rest import ClusterManagerRestTransport -from .rest import ClusterManagerRestInterceptor - - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[ClusterManagerTransport]] -_transport_registry['grpc'] = ClusterManagerGrpcTransport -_transport_registry['grpc_asyncio'] = ClusterManagerGrpcAsyncIOTransport -_transport_registry['rest'] = ClusterManagerRestTransport - -__all__ = ( - 'ClusterManagerTransport', - 'ClusterManagerGrpcTransport', - 'ClusterManagerGrpcAsyncIOTransport', - 'ClusterManagerRestTransport', - 'ClusterManagerRestInterceptor', -) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/base.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/base.py deleted file mode 100644 index 839d6d2f047b..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/base.py +++ /dev/null @@ -1,707 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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.container_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.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.container_v1.types import cluster_service -from google.protobuf import empty_pb2 # type: ignore - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) - - -class ClusterManagerTransport(abc.ABC): - """Abstract transport class for ClusterManager.""" - - AUTH_SCOPES = ( - 'https://www.googleapis.com/auth/cloud-platform', - ) - - DEFAULT_HOST: str = 'container.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 (default: 'container.googleapis.com'). - 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 not hasattr(self, "_ignore_credentials"): - self._ignore_credentials: bool = False - - # 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 and not self._ignore_credentials: - 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 - - @property - def host(self): - return self._host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.list_clusters: gapic_v1.method.wrap_method( - self.list_clusters, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_cluster: gapic_v1.method.wrap_method( - self.get_cluster, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.create_cluster: gapic_v1.method.wrap_method( - self.create_cluster, - default_timeout=45.0, - client_info=client_info, - ), - self.update_cluster: gapic_v1.method.wrap_method( - self.update_cluster, - default_timeout=45.0, - client_info=client_info, - ), - self.update_node_pool: gapic_v1.method.wrap_method( - self.update_node_pool, - default_timeout=45.0, - client_info=client_info, - ), - self.set_node_pool_autoscaling: gapic_v1.method.wrap_method( - self.set_node_pool_autoscaling, - default_timeout=45.0, - client_info=client_info, - ), - self.set_logging_service: gapic_v1.method.wrap_method( - self.set_logging_service, - default_timeout=45.0, - client_info=client_info, - ), - self.set_monitoring_service: gapic_v1.method.wrap_method( - self.set_monitoring_service, - default_timeout=45.0, - client_info=client_info, - ), - self.set_addons_config: gapic_v1.method.wrap_method( - self.set_addons_config, - default_timeout=45.0, - client_info=client_info, - ), - self.set_locations: gapic_v1.method.wrap_method( - self.set_locations, - default_timeout=45.0, - client_info=client_info, - ), - self.update_master: gapic_v1.method.wrap_method( - self.update_master, - default_timeout=45.0, - client_info=client_info, - ), - self.set_master_auth: gapic_v1.method.wrap_method( - self.set_master_auth, - default_timeout=45.0, - client_info=client_info, - ), - self.delete_cluster: gapic_v1.method.wrap_method( - self.delete_cluster, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.list_operations: gapic_v1.method.wrap_method( - self.list_operations, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_operation: gapic_v1.method.wrap_method( - self.get_operation, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.cancel_operation: gapic_v1.method.wrap_method( - self.cancel_operation, - default_timeout=45.0, - client_info=client_info, - ), - self.get_server_config: gapic_v1.method.wrap_method( - self.get_server_config, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_json_web_keys: gapic_v1.method.wrap_method( - self.get_json_web_keys, - default_timeout=None, - client_info=client_info, - ), - self.list_node_pools: gapic_v1.method.wrap_method( - self.list_node_pools, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_node_pool: gapic_v1.method.wrap_method( - self.get_node_pool, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.create_node_pool: gapic_v1.method.wrap_method( - self.create_node_pool, - default_timeout=45.0, - client_info=client_info, - ), - self.delete_node_pool: gapic_v1.method.wrap_method( - self.delete_node_pool, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.complete_node_pool_upgrade: gapic_v1.method.wrap_method( - self.complete_node_pool_upgrade, - default_timeout=None, - client_info=client_info, - ), - self.rollback_node_pool_upgrade: gapic_v1.method.wrap_method( - self.rollback_node_pool_upgrade, - default_timeout=45.0, - client_info=client_info, - ), - self.set_node_pool_management: gapic_v1.method.wrap_method( - self.set_node_pool_management, - default_timeout=45.0, - client_info=client_info, - ), - self.set_labels: gapic_v1.method.wrap_method( - self.set_labels, - default_timeout=45.0, - client_info=client_info, - ), - self.set_legacy_abac: gapic_v1.method.wrap_method( - self.set_legacy_abac, - default_timeout=45.0, - client_info=client_info, - ), - self.start_ip_rotation: gapic_v1.method.wrap_method( - self.start_ip_rotation, - default_timeout=45.0, - client_info=client_info, - ), - self.complete_ip_rotation: gapic_v1.method.wrap_method( - self.complete_ip_rotation, - default_timeout=45.0, - client_info=client_info, - ), - self.set_node_pool_size: gapic_v1.method.wrap_method( - self.set_node_pool_size, - default_timeout=45.0, - client_info=client_info, - ), - self.set_network_policy: gapic_v1.method.wrap_method( - self.set_network_policy, - default_timeout=45.0, - client_info=client_info, - ), - self.set_maintenance_policy: gapic_v1.method.wrap_method( - self.set_maintenance_policy, - default_timeout=45.0, - client_info=client_info, - ), - self.list_usable_subnetworks: gapic_v1.method.wrap_method( - self.list_usable_subnetworks, - default_timeout=None, - client_info=client_info, - ), - self.check_autopilot_compatibility: gapic_v1.method.wrap_method( - self.check_autopilot_compatibility, - 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 list_clusters(self) -> Callable[ - [cluster_service.ListClustersRequest], - Union[ - cluster_service.ListClustersResponse, - Awaitable[cluster_service.ListClustersResponse] - ]]: - raise NotImplementedError() - - @property - def get_cluster(self) -> Callable[ - [cluster_service.GetClusterRequest], - Union[ - cluster_service.Cluster, - Awaitable[cluster_service.Cluster] - ]]: - raise NotImplementedError() - - @property - def create_cluster(self) -> Callable[ - [cluster_service.CreateClusterRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def update_cluster(self) -> Callable[ - [cluster_service.UpdateClusterRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def update_node_pool(self) -> Callable[ - [cluster_service.UpdateNodePoolRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_node_pool_autoscaling(self) -> Callable[ - [cluster_service.SetNodePoolAutoscalingRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_logging_service(self) -> Callable[ - [cluster_service.SetLoggingServiceRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_monitoring_service(self) -> Callable[ - [cluster_service.SetMonitoringServiceRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_addons_config(self) -> Callable[ - [cluster_service.SetAddonsConfigRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_locations(self) -> Callable[ - [cluster_service.SetLocationsRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def update_master(self) -> Callable[ - [cluster_service.UpdateMasterRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_master_auth(self) -> Callable[ - [cluster_service.SetMasterAuthRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def delete_cluster(self) -> Callable[ - [cluster_service.DeleteClusterRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def list_operations(self) -> Callable[ - [cluster_service.ListOperationsRequest], - Union[ - cluster_service.ListOperationsResponse, - Awaitable[cluster_service.ListOperationsResponse] - ]]: - raise NotImplementedError() - - @property - def get_operation(self) -> Callable[ - [cluster_service.GetOperationRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def cancel_operation(self) -> Callable[ - [cluster_service.CancelOperationRequest], - Union[ - empty_pb2.Empty, - Awaitable[empty_pb2.Empty] - ]]: - raise NotImplementedError() - - @property - def get_server_config(self) -> Callable[ - [cluster_service.GetServerConfigRequest], - Union[ - cluster_service.ServerConfig, - Awaitable[cluster_service.ServerConfig] - ]]: - raise NotImplementedError() - - @property - def get_json_web_keys(self) -> Callable[ - [cluster_service.GetJSONWebKeysRequest], - Union[ - cluster_service.GetJSONWebKeysResponse, - Awaitable[cluster_service.GetJSONWebKeysResponse] - ]]: - raise NotImplementedError() - - @property - def list_node_pools(self) -> Callable[ - [cluster_service.ListNodePoolsRequest], - Union[ - cluster_service.ListNodePoolsResponse, - Awaitable[cluster_service.ListNodePoolsResponse] - ]]: - raise NotImplementedError() - - @property - def get_node_pool(self) -> Callable[ - [cluster_service.GetNodePoolRequest], - Union[ - cluster_service.NodePool, - Awaitable[cluster_service.NodePool] - ]]: - raise NotImplementedError() - - @property - def create_node_pool(self) -> Callable[ - [cluster_service.CreateNodePoolRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def delete_node_pool(self) -> Callable[ - [cluster_service.DeleteNodePoolRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def complete_node_pool_upgrade(self) -> Callable[ - [cluster_service.CompleteNodePoolUpgradeRequest], - Union[ - empty_pb2.Empty, - Awaitable[empty_pb2.Empty] - ]]: - raise NotImplementedError() - - @property - def rollback_node_pool_upgrade(self) -> Callable[ - [cluster_service.RollbackNodePoolUpgradeRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_node_pool_management(self) -> Callable[ - [cluster_service.SetNodePoolManagementRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_labels(self) -> Callable[ - [cluster_service.SetLabelsRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_legacy_abac(self) -> Callable[ - [cluster_service.SetLegacyAbacRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def start_ip_rotation(self) -> Callable[ - [cluster_service.StartIPRotationRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def complete_ip_rotation(self) -> Callable[ - [cluster_service.CompleteIPRotationRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_node_pool_size(self) -> Callable[ - [cluster_service.SetNodePoolSizeRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_network_policy(self) -> Callable[ - [cluster_service.SetNetworkPolicyRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_maintenance_policy(self) -> Callable[ - [cluster_service.SetMaintenancePolicyRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def list_usable_subnetworks(self) -> Callable[ - [cluster_service.ListUsableSubnetworksRequest], - Union[ - cluster_service.ListUsableSubnetworksResponse, - Awaitable[cluster_service.ListUsableSubnetworksResponse] - ]]: - raise NotImplementedError() - - @property - def check_autopilot_compatibility(self) -> Callable[ - [cluster_service.CheckAutopilotCompatibilityRequest], - Union[ - cluster_service.CheckAutopilotCompatibilityResponse, - Awaitable[cluster_service.CheckAutopilotCompatibilityResponse] - ]]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ( - 'ClusterManagerTransport', -) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc.py deleted file mode 100644 index 1ee39197a675..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc.py +++ /dev/null @@ -1,1247 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 json -import logging as std_logging -import pickle -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import grpc_helpers -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 -from google.protobuf.json_format import MessageToJson -import google.protobuf.message - -import grpc # type: ignore -import proto # type: ignore - -from google.cloud.container_v1.types import cluster_service -from google.protobuf import empty_pb2 # type: ignore -from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO - -try: - from google.api_core import client_logging # type: ignore - CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER -except ImportError: # pragma: NO COVER - CLIENT_LOGGING_SUPPORTED = False - -_LOGGER = std_logging.getLogger(__name__) - - -class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER - def intercept_unary_unary(self, continuation, client_call_details, request): - logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG) - if logging_enabled: # pragma: NO COVER - request_metadata = client_call_details.metadata - if isinstance(request, proto.Message): - request_payload = type(request).to_json(request) - elif isinstance(request, google.protobuf.message.Message): - request_payload = MessageToJson(request) - else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" - - request_metadata = { - key: value.decode("utf-8") if isinstance(value, bytes) else value - for key, value in request_metadata - } - grpc_request = { - "payload": request_payload, - "requestMethod": "grpc", - "metadata": dict(request_metadata), - } - _LOGGER.debug( - f"Sending request for {client_call_details.method}", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": client_call_details.method, - "request": grpc_request, - "metadata": grpc_request["metadata"], - }, - ) - - response = continuation(client_call_details, request) - if logging_enabled: # pragma: NO COVER - response_metadata = response.trailing_metadata() - # Convert gRPC metadata `` to list of tuples - metadata = dict([(k, str(v)) for k, v in response_metadata]) if response_metadata else None - result = response.result() - if isinstance(result, proto.Message): - response_payload = type(result).to_json(result) - elif isinstance(result, google.protobuf.message.Message): - response_payload = MessageToJson(result) - else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" - grpc_response = { - "payload": response_payload, - "metadata": metadata, - "status": "OK", - } - _LOGGER.debug( - f"Received response for {client_call_details.method}.", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": client_call_details.method, - "response": grpc_response, - "metadata": grpc_response["metadata"], - }, - ) - return response - - -class ClusterManagerGrpcTransport(ClusterManagerTransport): - """gRPC backend transport for ClusterManager. - - Google Kubernetes Engine Cluster Manager v1 - - 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 = 'container.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[Union[grpc.Channel, Callable[..., 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 (default: 'container.googleapis.com'). - 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 a ``channel`` instance 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 a ``channel`` instance is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if a ``channel`` instance is provided. - channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]): - A ``Channel`` instance through which to make calls, or a Callable - that constructs and returns one. If set to None, ``self.create_channel`` - is used to create the channel. If a Callable is given, it will be called - with the same arguments as used in ``self.create_channel``. - 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 a ``channel`` instance 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 a ``channel`` instance 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] = {} - - 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 isinstance(channel, grpc.Channel): - # Ignore credentials if a channel was passed. - credentials = None - self._ignore_credentials = True - # 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: - # initialize with the provided callable or the default channel - channel_init = channel or type(self).create_channel - self._grpc_channel = channel_init( - 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), - ], - ) - - self._interceptor = _LoggingClientInterceptor() - self._logged_channel = grpc.intercept_channel(self._grpc_channel, self._interceptor) - - # Wrap messages. This must be done after self._logged_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel(cls, - host: str = 'container.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 list_clusters(self) -> Callable[ - [cluster_service.ListClustersRequest], - cluster_service.ListClustersResponse]: - r"""Return a callable for the list clusters method over gRPC. - - Lists all clusters owned by a project in either the - specified zone or all zones. - - Returns: - Callable[[~.ListClustersRequest], - ~.ListClustersResponse]: - 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_clusters' not in self._stubs: - self._stubs['list_clusters'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/ListClusters', - request_serializer=cluster_service.ListClustersRequest.serialize, - response_deserializer=cluster_service.ListClustersResponse.deserialize, - ) - return self._stubs['list_clusters'] - - @property - def get_cluster(self) -> Callable[ - [cluster_service.GetClusterRequest], - cluster_service.Cluster]: - r"""Return a callable for the get cluster method over gRPC. - - Gets the details of a specific cluster. - - Returns: - Callable[[~.GetClusterRequest], - ~.Cluster]: - 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_cluster' not in self._stubs: - self._stubs['get_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/GetCluster', - request_serializer=cluster_service.GetClusterRequest.serialize, - response_deserializer=cluster_service.Cluster.deserialize, - ) - return self._stubs['get_cluster'] - - @property - def create_cluster(self) -> Callable[ - [cluster_service.CreateClusterRequest], - cluster_service.Operation]: - r"""Return a callable for the create cluster method over gRPC. - - Creates a cluster, consisting of the specified number and type - of Google Compute Engine instances. - - By default, the cluster is created in the project's `default - network `__. - - One firewall is added for the cluster. After cluster creation, - the Kubelet creates routes for each node to allow the containers - on that node to communicate with all other instances in the - cluster. - - Finally, an entry is added to the project's global metadata - indicating which CIDR range the cluster is using. - - Returns: - Callable[[~.CreateClusterRequest], - ~.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_cluster' not in self._stubs: - self._stubs['create_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/CreateCluster', - request_serializer=cluster_service.CreateClusterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['create_cluster'] - - @property - def update_cluster(self) -> Callable[ - [cluster_service.UpdateClusterRequest], - cluster_service.Operation]: - r"""Return a callable for the update cluster method over gRPC. - - Updates the settings of a specific cluster. - - Returns: - Callable[[~.UpdateClusterRequest], - ~.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_cluster' not in self._stubs: - self._stubs['update_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/UpdateCluster', - request_serializer=cluster_service.UpdateClusterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['update_cluster'] - - @property - def update_node_pool(self) -> Callable[ - [cluster_service.UpdateNodePoolRequest], - cluster_service.Operation]: - r"""Return a callable for the update node pool method over gRPC. - - Updates the version and/or image type for the - specified node pool. - - Returns: - Callable[[~.UpdateNodePoolRequest], - ~.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_node_pool' not in self._stubs: - self._stubs['update_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/UpdateNodePool', - request_serializer=cluster_service.UpdateNodePoolRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['update_node_pool'] - - @property - def set_node_pool_autoscaling(self) -> Callable[ - [cluster_service.SetNodePoolAutoscalingRequest], - cluster_service.Operation]: - r"""Return a callable for the set node pool autoscaling method over gRPC. - - Sets the autoscaling settings for the specified node - pool. - - Returns: - Callable[[~.SetNodePoolAutoscalingRequest], - ~.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 'set_node_pool_autoscaling' not in self._stubs: - self._stubs['set_node_pool_autoscaling'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetNodePoolAutoscaling', - request_serializer=cluster_service.SetNodePoolAutoscalingRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_node_pool_autoscaling'] - - @property - def set_logging_service(self) -> Callable[ - [cluster_service.SetLoggingServiceRequest], - cluster_service.Operation]: - r"""Return a callable for the set logging service method over gRPC. - - Sets the logging service for a specific cluster. - - Returns: - Callable[[~.SetLoggingServiceRequest], - ~.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 'set_logging_service' not in self._stubs: - self._stubs['set_logging_service'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetLoggingService', - request_serializer=cluster_service.SetLoggingServiceRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_logging_service'] - - @property - def set_monitoring_service(self) -> Callable[ - [cluster_service.SetMonitoringServiceRequest], - cluster_service.Operation]: - r"""Return a callable for the set monitoring service method over gRPC. - - Sets the monitoring service for a specific cluster. - - Returns: - Callable[[~.SetMonitoringServiceRequest], - ~.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 'set_monitoring_service' not in self._stubs: - self._stubs['set_monitoring_service'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetMonitoringService', - request_serializer=cluster_service.SetMonitoringServiceRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_monitoring_service'] - - @property - def set_addons_config(self) -> Callable[ - [cluster_service.SetAddonsConfigRequest], - cluster_service.Operation]: - r"""Return a callable for the set addons config method over gRPC. - - Sets the addons for a specific cluster. - - Returns: - Callable[[~.SetAddonsConfigRequest], - ~.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 'set_addons_config' not in self._stubs: - self._stubs['set_addons_config'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetAddonsConfig', - request_serializer=cluster_service.SetAddonsConfigRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_addons_config'] - - @property - def set_locations(self) -> Callable[ - [cluster_service.SetLocationsRequest], - cluster_service.Operation]: - r"""Return a callable for the set locations method over gRPC. - - Sets the locations for a specific cluster. Deprecated. Use - `projects.locations.clusters.update `__ - instead. - - Returns: - Callable[[~.SetLocationsRequest], - ~.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 'set_locations' not in self._stubs: - self._stubs['set_locations'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetLocations', - request_serializer=cluster_service.SetLocationsRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_locations'] - - @property - def update_master(self) -> Callable[ - [cluster_service.UpdateMasterRequest], - cluster_service.Operation]: - r"""Return a callable for the update master method over gRPC. - - Updates the master for a specific cluster. - - Returns: - Callable[[~.UpdateMasterRequest], - ~.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_master' not in self._stubs: - self._stubs['update_master'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/UpdateMaster', - request_serializer=cluster_service.UpdateMasterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['update_master'] - - @property - def set_master_auth(self) -> Callable[ - [cluster_service.SetMasterAuthRequest], - cluster_service.Operation]: - r"""Return a callable for the set master auth method over gRPC. - - Sets master auth materials. Currently supports - changing the admin password or a specific cluster, - either via password generation or explicitly setting the - password. - - Returns: - Callable[[~.SetMasterAuthRequest], - ~.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 'set_master_auth' not in self._stubs: - self._stubs['set_master_auth'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetMasterAuth', - request_serializer=cluster_service.SetMasterAuthRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_master_auth'] - - @property - def delete_cluster(self) -> Callable[ - [cluster_service.DeleteClusterRequest], - cluster_service.Operation]: - r"""Return a callable for the delete cluster method over gRPC. - - Deletes the cluster, including the Kubernetes - endpoint and all worker nodes. - - Firewalls and routes that were configured during cluster - creation are also deleted. - - Other Google Compute Engine resources that might be in - use by the cluster, such as load balancer resources, are - not deleted if they weren't present when the cluster was - initially created. - - Returns: - Callable[[~.DeleteClusterRequest], - ~.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_cluster' not in self._stubs: - self._stubs['delete_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/DeleteCluster', - request_serializer=cluster_service.DeleteClusterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['delete_cluster'] - - @property - def list_operations(self) -> Callable[ - [cluster_service.ListOperationsRequest], - cluster_service.ListOperationsResponse]: - r"""Return a callable for the list operations method over gRPC. - - Lists all operations in a project in a specific zone - or all zones. - - Returns: - Callable[[~.ListOperationsRequest], - ~.ListOperationsResponse]: - 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_operations' not in self._stubs: - self._stubs['list_operations'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/ListOperations', - request_serializer=cluster_service.ListOperationsRequest.serialize, - response_deserializer=cluster_service.ListOperationsResponse.deserialize, - ) - return self._stubs['list_operations'] - - @property - def get_operation(self) -> Callable[ - [cluster_service.GetOperationRequest], - cluster_service.Operation]: - r"""Return a callable for the get operation method over gRPC. - - Gets the specified operation. - - Returns: - Callable[[~.GetOperationRequest], - ~.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 'get_operation' not in self._stubs: - self._stubs['get_operation'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/GetOperation', - request_serializer=cluster_service.GetOperationRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['get_operation'] - - @property - def cancel_operation(self) -> Callable[ - [cluster_service.CancelOperationRequest], - empty_pb2.Empty]: - r"""Return a callable for the cancel operation method over gRPC. - - Cancels the specified operation. - - Returns: - Callable[[~.CancelOperationRequest], - ~.Empty]: - 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 'cancel_operation' not in self._stubs: - self._stubs['cancel_operation'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/CancelOperation', - request_serializer=cluster_service.CancelOperationRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['cancel_operation'] - - @property - def get_server_config(self) -> Callable[ - [cluster_service.GetServerConfigRequest], - cluster_service.ServerConfig]: - r"""Return a callable for the get server config method over gRPC. - - Returns configuration info about the Google - Kubernetes Engine service. - - Returns: - Callable[[~.GetServerConfigRequest], - ~.ServerConfig]: - 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_server_config' not in self._stubs: - self._stubs['get_server_config'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/GetServerConfig', - request_serializer=cluster_service.GetServerConfigRequest.serialize, - response_deserializer=cluster_service.ServerConfig.deserialize, - ) - return self._stubs['get_server_config'] - - @property - def get_json_web_keys(self) -> Callable[ - [cluster_service.GetJSONWebKeysRequest], - cluster_service.GetJSONWebKeysResponse]: - r"""Return a callable for the get json web keys method over gRPC. - - Gets the public component of the cluster signing keys - in JSON Web Key format. - - Returns: - Callable[[~.GetJSONWebKeysRequest], - ~.GetJSONWebKeysResponse]: - 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_json_web_keys' not in self._stubs: - self._stubs['get_json_web_keys'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/GetJSONWebKeys', - request_serializer=cluster_service.GetJSONWebKeysRequest.serialize, - response_deserializer=cluster_service.GetJSONWebKeysResponse.deserialize, - ) - return self._stubs['get_json_web_keys'] - - @property - def list_node_pools(self) -> Callable[ - [cluster_service.ListNodePoolsRequest], - cluster_service.ListNodePoolsResponse]: - r"""Return a callable for the list node pools method over gRPC. - - Lists the node pools for a cluster. - - Returns: - Callable[[~.ListNodePoolsRequest], - ~.ListNodePoolsResponse]: - 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_node_pools' not in self._stubs: - self._stubs['list_node_pools'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/ListNodePools', - request_serializer=cluster_service.ListNodePoolsRequest.serialize, - response_deserializer=cluster_service.ListNodePoolsResponse.deserialize, - ) - return self._stubs['list_node_pools'] - - @property - def get_node_pool(self) -> Callable[ - [cluster_service.GetNodePoolRequest], - cluster_service.NodePool]: - r"""Return a callable for the get node pool method over gRPC. - - Retrieves the requested node pool. - - Returns: - Callable[[~.GetNodePoolRequest], - ~.NodePool]: - 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_node_pool' not in self._stubs: - self._stubs['get_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/GetNodePool', - request_serializer=cluster_service.GetNodePoolRequest.serialize, - response_deserializer=cluster_service.NodePool.deserialize, - ) - return self._stubs['get_node_pool'] - - @property - def create_node_pool(self) -> Callable[ - [cluster_service.CreateNodePoolRequest], - cluster_service.Operation]: - r"""Return a callable for the create node pool method over gRPC. - - Creates a node pool for a cluster. - - Returns: - Callable[[~.CreateNodePoolRequest], - ~.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_node_pool' not in self._stubs: - self._stubs['create_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/CreateNodePool', - request_serializer=cluster_service.CreateNodePoolRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['create_node_pool'] - - @property - def delete_node_pool(self) -> Callable[ - [cluster_service.DeleteNodePoolRequest], - cluster_service.Operation]: - r"""Return a callable for the delete node pool method over gRPC. - - Deletes a node pool from a cluster. - - Returns: - Callable[[~.DeleteNodePoolRequest], - ~.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_node_pool' not in self._stubs: - self._stubs['delete_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/DeleteNodePool', - request_serializer=cluster_service.DeleteNodePoolRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['delete_node_pool'] - - @property - def complete_node_pool_upgrade(self) -> Callable[ - [cluster_service.CompleteNodePoolUpgradeRequest], - empty_pb2.Empty]: - r"""Return a callable for the complete node pool upgrade method over gRPC. - - CompleteNodePoolUpgrade will signal an on-going node - pool upgrade to complete. - - Returns: - Callable[[~.CompleteNodePoolUpgradeRequest], - ~.Empty]: - 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 'complete_node_pool_upgrade' not in self._stubs: - self._stubs['complete_node_pool_upgrade'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/CompleteNodePoolUpgrade', - request_serializer=cluster_service.CompleteNodePoolUpgradeRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['complete_node_pool_upgrade'] - - @property - def rollback_node_pool_upgrade(self) -> Callable[ - [cluster_service.RollbackNodePoolUpgradeRequest], - cluster_service.Operation]: - r"""Return a callable for the rollback node pool upgrade method over gRPC. - - Rolls back a previously Aborted or Failed NodePool - upgrade. This makes no changes if the last upgrade - successfully completed. - - Returns: - Callable[[~.RollbackNodePoolUpgradeRequest], - ~.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 'rollback_node_pool_upgrade' not in self._stubs: - self._stubs['rollback_node_pool_upgrade'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/RollbackNodePoolUpgrade', - request_serializer=cluster_service.RollbackNodePoolUpgradeRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['rollback_node_pool_upgrade'] - - @property - def set_node_pool_management(self) -> Callable[ - [cluster_service.SetNodePoolManagementRequest], - cluster_service.Operation]: - r"""Return a callable for the set node pool management method over gRPC. - - Sets the NodeManagement options for a node pool. - - Returns: - Callable[[~.SetNodePoolManagementRequest], - ~.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 'set_node_pool_management' not in self._stubs: - self._stubs['set_node_pool_management'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetNodePoolManagement', - request_serializer=cluster_service.SetNodePoolManagementRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_node_pool_management'] - - @property - def set_labels(self) -> Callable[ - [cluster_service.SetLabelsRequest], - cluster_service.Operation]: - r"""Return a callable for the set labels method over gRPC. - - Sets labels on a cluster. - - Returns: - Callable[[~.SetLabelsRequest], - ~.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 'set_labels' not in self._stubs: - self._stubs['set_labels'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetLabels', - request_serializer=cluster_service.SetLabelsRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_labels'] - - @property - def set_legacy_abac(self) -> Callable[ - [cluster_service.SetLegacyAbacRequest], - cluster_service.Operation]: - r"""Return a callable for the set legacy abac method over gRPC. - - Enables or disables the ABAC authorization mechanism - on a cluster. - - Returns: - Callable[[~.SetLegacyAbacRequest], - ~.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 'set_legacy_abac' not in self._stubs: - self._stubs['set_legacy_abac'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetLegacyAbac', - request_serializer=cluster_service.SetLegacyAbacRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_legacy_abac'] - - @property - def start_ip_rotation(self) -> Callable[ - [cluster_service.StartIPRotationRequest], - cluster_service.Operation]: - r"""Return a callable for the start ip rotation method over gRPC. - - Starts master IP rotation. - - Returns: - Callable[[~.StartIPRotationRequest], - ~.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 'start_ip_rotation' not in self._stubs: - self._stubs['start_ip_rotation'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/StartIPRotation', - request_serializer=cluster_service.StartIPRotationRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['start_ip_rotation'] - - @property - def complete_ip_rotation(self) -> Callable[ - [cluster_service.CompleteIPRotationRequest], - cluster_service.Operation]: - r"""Return a callable for the complete ip rotation method over gRPC. - - Completes master IP rotation. - - Returns: - Callable[[~.CompleteIPRotationRequest], - ~.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 'complete_ip_rotation' not in self._stubs: - self._stubs['complete_ip_rotation'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/CompleteIPRotation', - request_serializer=cluster_service.CompleteIPRotationRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['complete_ip_rotation'] - - @property - def set_node_pool_size(self) -> Callable[ - [cluster_service.SetNodePoolSizeRequest], - cluster_service.Operation]: - r"""Return a callable for the set node pool size method over gRPC. - - Sets the size for a specific node pool. The new size will be - used for all replicas, including future replicas created by - modifying - [NodePool.locations][google.container.v1.NodePool.locations]. - - Returns: - Callable[[~.SetNodePoolSizeRequest], - ~.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 'set_node_pool_size' not in self._stubs: - self._stubs['set_node_pool_size'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetNodePoolSize', - request_serializer=cluster_service.SetNodePoolSizeRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_node_pool_size'] - - @property - def set_network_policy(self) -> Callable[ - [cluster_service.SetNetworkPolicyRequest], - cluster_service.Operation]: - r"""Return a callable for the set network policy method over gRPC. - - Enables or disables Network Policy for a cluster. - - Returns: - Callable[[~.SetNetworkPolicyRequest], - ~.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 'set_network_policy' not in self._stubs: - self._stubs['set_network_policy'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetNetworkPolicy', - request_serializer=cluster_service.SetNetworkPolicyRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_network_policy'] - - @property - def set_maintenance_policy(self) -> Callable[ - [cluster_service.SetMaintenancePolicyRequest], - cluster_service.Operation]: - r"""Return a callable for the set maintenance policy method over gRPC. - - Sets the maintenance policy for a cluster. - - Returns: - Callable[[~.SetMaintenancePolicyRequest], - ~.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 'set_maintenance_policy' not in self._stubs: - self._stubs['set_maintenance_policy'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetMaintenancePolicy', - request_serializer=cluster_service.SetMaintenancePolicyRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_maintenance_policy'] - - @property - def list_usable_subnetworks(self) -> Callable[ - [cluster_service.ListUsableSubnetworksRequest], - cluster_service.ListUsableSubnetworksResponse]: - r"""Return a callable for the list usable subnetworks method over gRPC. - - Lists subnetworks that are usable for creating - clusters in a project. - - Returns: - Callable[[~.ListUsableSubnetworksRequest], - ~.ListUsableSubnetworksResponse]: - 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_usable_subnetworks' not in self._stubs: - self._stubs['list_usable_subnetworks'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/ListUsableSubnetworks', - request_serializer=cluster_service.ListUsableSubnetworksRequest.serialize, - response_deserializer=cluster_service.ListUsableSubnetworksResponse.deserialize, - ) - return self._stubs['list_usable_subnetworks'] - - @property - def check_autopilot_compatibility(self) -> Callable[ - [cluster_service.CheckAutopilotCompatibilityRequest], - cluster_service.CheckAutopilotCompatibilityResponse]: - r"""Return a callable for the check autopilot compatibility method over gRPC. - - Checks the cluster compatibility with Autopilot mode, - and returns a list of compatibility issues. - - Returns: - Callable[[~.CheckAutopilotCompatibilityRequest], - ~.CheckAutopilotCompatibilityResponse]: - 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 'check_autopilot_compatibility' not in self._stubs: - self._stubs['check_autopilot_compatibility'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/CheckAutopilotCompatibility', - request_serializer=cluster_service.CheckAutopilotCompatibilityRequest.serialize, - response_deserializer=cluster_service.CheckAutopilotCompatibilityResponse.deserialize, - ) - return self._stubs['check_autopilot_compatibility'] - - def close(self): - self._logged_channel.close() - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ( - 'ClusterManagerGrpcTransport', -) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py deleted file mode 100644 index 4b6f040acce9..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py +++ /dev/null @@ -1,1522 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 inspect -import json -import pickle -import logging as std_logging -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 exceptions as core_exceptions -from google.api_core import retry_async as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.protobuf.json_format import MessageToJson -import google.protobuf.message - -import grpc # type: ignore -import proto # type: ignore -from grpc.experimental import aio # type: ignore - -from google.cloud.container_v1.types import cluster_service -from google.protobuf import empty_pb2 # type: ignore -from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO -from .grpc import ClusterManagerGrpcTransport - -try: - from google.api_core import client_logging # type: ignore - CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER -except ImportError: # pragma: NO COVER - CLIENT_LOGGING_SUPPORTED = False - -_LOGGER = std_logging.getLogger(__name__) - - -class _LoggingClientAIOInterceptor(grpc.aio.UnaryUnaryClientInterceptor): # pragma: NO COVER - async def intercept_unary_unary(self, continuation, client_call_details, request): - logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG) - if logging_enabled: # pragma: NO COVER - request_metadata = client_call_details.metadata - if isinstance(request, proto.Message): - request_payload = type(request).to_json(request) - elif isinstance(request, google.protobuf.message.Message): - request_payload = MessageToJson(request) - else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" - - request_metadata = { - key: value.decode("utf-8") if isinstance(value, bytes) else value - for key, value in request_metadata - } - grpc_request = { - "payload": request_payload, - "requestMethod": "grpc", - "metadata": dict(request_metadata), - } - _LOGGER.debug( - f"Sending request for {client_call_details.method}", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": str(client_call_details.method), - "request": grpc_request, - "metadata": grpc_request["metadata"], - }, - ) - response = await continuation(client_call_details, request) - if logging_enabled: # pragma: NO COVER - response_metadata = await response.trailing_metadata() - # Convert gRPC metadata `` to list of tuples - metadata = dict([(k, str(v)) for k, v in response_metadata]) if response_metadata else None - result = await response - if isinstance(result, proto.Message): - response_payload = type(result).to_json(result) - elif isinstance(result, google.protobuf.message.Message): - response_payload = MessageToJson(result) - else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" - grpc_response = { - "payload": response_payload, - "metadata": metadata, - "status": "OK", - } - _LOGGER.debug( - f"Received response to rpc {client_call_details.method}.", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": str(client_call_details.method), - "response": grpc_response, - "metadata": grpc_response["metadata"], - }, - ) - return response - - -class ClusterManagerGrpcAsyncIOTransport(ClusterManagerTransport): - """gRPC AsyncIO backend transport for ClusterManager. - - Google Kubernetes Engine Cluster Manager v1 - - 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 = 'container.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`. - 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 = 'container.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[Union[aio.Channel, Callable[..., 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 (default: 'container.googleapis.com'). - 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 a ``channel`` instance 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 a ``channel`` instance 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[Union[aio.Channel, Callable[..., aio.Channel]]]): - A ``Channel`` instance through which to make calls, or a Callable - that constructs and returns one. If set to None, ``self.create_channel`` - is used to create the channel. If a Callable is given, it will be called - with the same arguments as used in ``self.create_channel``. - 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 a ``channel`` instance 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 a ``channel`` instance 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] = {} - - 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 isinstance(channel, aio.Channel): - # Ignore credentials if a channel was passed. - credentials = None - self._ignore_credentials = True - # 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: - # initialize with the provided callable or the default channel - channel_init = channel or type(self).create_channel - self._grpc_channel = channel_init( - 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), - ], - ) - - self._interceptor = _LoggingClientAIOInterceptor() - self._grpc_channel._unary_unary_interceptors.append(self._interceptor) - self._logged_channel = self._grpc_channel - self._wrap_with_kind = "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters - # Wrap messages. This must be done after self._logged_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 list_clusters(self) -> Callable[ - [cluster_service.ListClustersRequest], - Awaitable[cluster_service.ListClustersResponse]]: - r"""Return a callable for the list clusters method over gRPC. - - Lists all clusters owned by a project in either the - specified zone or all zones. - - Returns: - Callable[[~.ListClustersRequest], - Awaitable[~.ListClustersResponse]]: - 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_clusters' not in self._stubs: - self._stubs['list_clusters'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/ListClusters', - request_serializer=cluster_service.ListClustersRequest.serialize, - response_deserializer=cluster_service.ListClustersResponse.deserialize, - ) - return self._stubs['list_clusters'] - - @property - def get_cluster(self) -> Callable[ - [cluster_service.GetClusterRequest], - Awaitable[cluster_service.Cluster]]: - r"""Return a callable for the get cluster method over gRPC. - - Gets the details of a specific cluster. - - Returns: - Callable[[~.GetClusterRequest], - Awaitable[~.Cluster]]: - 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_cluster' not in self._stubs: - self._stubs['get_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/GetCluster', - request_serializer=cluster_service.GetClusterRequest.serialize, - response_deserializer=cluster_service.Cluster.deserialize, - ) - return self._stubs['get_cluster'] - - @property - def create_cluster(self) -> Callable[ - [cluster_service.CreateClusterRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the create cluster method over gRPC. - - Creates a cluster, consisting of the specified number and type - of Google Compute Engine instances. - - By default, the cluster is created in the project's `default - network `__. - - One firewall is added for the cluster. After cluster creation, - the Kubelet creates routes for each node to allow the containers - on that node to communicate with all other instances in the - cluster. - - Finally, an entry is added to the project's global metadata - indicating which CIDR range the cluster is using. - - Returns: - Callable[[~.CreateClusterRequest], - 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_cluster' not in self._stubs: - self._stubs['create_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/CreateCluster', - request_serializer=cluster_service.CreateClusterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['create_cluster'] - - @property - def update_cluster(self) -> Callable[ - [cluster_service.UpdateClusterRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the update cluster method over gRPC. - - Updates the settings of a specific cluster. - - Returns: - Callable[[~.UpdateClusterRequest], - 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_cluster' not in self._stubs: - self._stubs['update_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/UpdateCluster', - request_serializer=cluster_service.UpdateClusterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['update_cluster'] - - @property - def update_node_pool(self) -> Callable[ - [cluster_service.UpdateNodePoolRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the update node pool method over gRPC. - - Updates the version and/or image type for the - specified node pool. - - Returns: - Callable[[~.UpdateNodePoolRequest], - 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_node_pool' not in self._stubs: - self._stubs['update_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/UpdateNodePool', - request_serializer=cluster_service.UpdateNodePoolRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['update_node_pool'] - - @property - def set_node_pool_autoscaling(self) -> Callable[ - [cluster_service.SetNodePoolAutoscalingRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set node pool autoscaling method over gRPC. - - Sets the autoscaling settings for the specified node - pool. - - Returns: - Callable[[~.SetNodePoolAutoscalingRequest], - 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 'set_node_pool_autoscaling' not in self._stubs: - self._stubs['set_node_pool_autoscaling'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetNodePoolAutoscaling', - request_serializer=cluster_service.SetNodePoolAutoscalingRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_node_pool_autoscaling'] - - @property - def set_logging_service(self) -> Callable[ - [cluster_service.SetLoggingServiceRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set logging service method over gRPC. - - Sets the logging service for a specific cluster. - - Returns: - Callable[[~.SetLoggingServiceRequest], - 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 'set_logging_service' not in self._stubs: - self._stubs['set_logging_service'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetLoggingService', - request_serializer=cluster_service.SetLoggingServiceRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_logging_service'] - - @property - def set_monitoring_service(self) -> Callable[ - [cluster_service.SetMonitoringServiceRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set monitoring service method over gRPC. - - Sets the monitoring service for a specific cluster. - - Returns: - Callable[[~.SetMonitoringServiceRequest], - 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 'set_monitoring_service' not in self._stubs: - self._stubs['set_monitoring_service'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetMonitoringService', - request_serializer=cluster_service.SetMonitoringServiceRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_monitoring_service'] - - @property - def set_addons_config(self) -> Callable[ - [cluster_service.SetAddonsConfigRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set addons config method over gRPC. - - Sets the addons for a specific cluster. - - Returns: - Callable[[~.SetAddonsConfigRequest], - 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 'set_addons_config' not in self._stubs: - self._stubs['set_addons_config'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetAddonsConfig', - request_serializer=cluster_service.SetAddonsConfigRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_addons_config'] - - @property - def set_locations(self) -> Callable[ - [cluster_service.SetLocationsRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set locations method over gRPC. - - Sets the locations for a specific cluster. Deprecated. Use - `projects.locations.clusters.update `__ - instead. - - Returns: - Callable[[~.SetLocationsRequest], - 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 'set_locations' not in self._stubs: - self._stubs['set_locations'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetLocations', - request_serializer=cluster_service.SetLocationsRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_locations'] - - @property - def update_master(self) -> Callable[ - [cluster_service.UpdateMasterRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the update master method over gRPC. - - Updates the master for a specific cluster. - - Returns: - Callable[[~.UpdateMasterRequest], - 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_master' not in self._stubs: - self._stubs['update_master'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/UpdateMaster', - request_serializer=cluster_service.UpdateMasterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['update_master'] - - @property - def set_master_auth(self) -> Callable[ - [cluster_service.SetMasterAuthRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set master auth method over gRPC. - - Sets master auth materials. Currently supports - changing the admin password or a specific cluster, - either via password generation or explicitly setting the - password. - - Returns: - Callable[[~.SetMasterAuthRequest], - 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 'set_master_auth' not in self._stubs: - self._stubs['set_master_auth'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetMasterAuth', - request_serializer=cluster_service.SetMasterAuthRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_master_auth'] - - @property - def delete_cluster(self) -> Callable[ - [cluster_service.DeleteClusterRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the delete cluster method over gRPC. - - Deletes the cluster, including the Kubernetes - endpoint and all worker nodes. - - Firewalls and routes that were configured during cluster - creation are also deleted. - - Other Google Compute Engine resources that might be in - use by the cluster, such as load balancer resources, are - not deleted if they weren't present when the cluster was - initially created. - - Returns: - Callable[[~.DeleteClusterRequest], - 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_cluster' not in self._stubs: - self._stubs['delete_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/DeleteCluster', - request_serializer=cluster_service.DeleteClusterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['delete_cluster'] - - @property - def list_operations(self) -> Callable[ - [cluster_service.ListOperationsRequest], - Awaitable[cluster_service.ListOperationsResponse]]: - r"""Return a callable for the list operations method over gRPC. - - Lists all operations in a project in a specific zone - or all zones. - - Returns: - Callable[[~.ListOperationsRequest], - Awaitable[~.ListOperationsResponse]]: - 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_operations' not in self._stubs: - self._stubs['list_operations'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/ListOperations', - request_serializer=cluster_service.ListOperationsRequest.serialize, - response_deserializer=cluster_service.ListOperationsResponse.deserialize, - ) - return self._stubs['list_operations'] - - @property - def get_operation(self) -> Callable[ - [cluster_service.GetOperationRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the get operation method over gRPC. - - Gets the specified operation. - - Returns: - Callable[[~.GetOperationRequest], - 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 'get_operation' not in self._stubs: - self._stubs['get_operation'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/GetOperation', - request_serializer=cluster_service.GetOperationRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['get_operation'] - - @property - def cancel_operation(self) -> Callable[ - [cluster_service.CancelOperationRequest], - Awaitable[empty_pb2.Empty]]: - r"""Return a callable for the cancel operation method over gRPC. - - Cancels the specified operation. - - Returns: - Callable[[~.CancelOperationRequest], - Awaitable[~.Empty]]: - 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 'cancel_operation' not in self._stubs: - self._stubs['cancel_operation'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/CancelOperation', - request_serializer=cluster_service.CancelOperationRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['cancel_operation'] - - @property - def get_server_config(self) -> Callable[ - [cluster_service.GetServerConfigRequest], - Awaitable[cluster_service.ServerConfig]]: - r"""Return a callable for the get server config method over gRPC. - - Returns configuration info about the Google - Kubernetes Engine service. - - Returns: - Callable[[~.GetServerConfigRequest], - Awaitable[~.ServerConfig]]: - 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_server_config' not in self._stubs: - self._stubs['get_server_config'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/GetServerConfig', - request_serializer=cluster_service.GetServerConfigRequest.serialize, - response_deserializer=cluster_service.ServerConfig.deserialize, - ) - return self._stubs['get_server_config'] - - @property - def get_json_web_keys(self) -> Callable[ - [cluster_service.GetJSONWebKeysRequest], - Awaitable[cluster_service.GetJSONWebKeysResponse]]: - r"""Return a callable for the get json web keys method over gRPC. - - Gets the public component of the cluster signing keys - in JSON Web Key format. - - Returns: - Callable[[~.GetJSONWebKeysRequest], - Awaitable[~.GetJSONWebKeysResponse]]: - 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_json_web_keys' not in self._stubs: - self._stubs['get_json_web_keys'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/GetJSONWebKeys', - request_serializer=cluster_service.GetJSONWebKeysRequest.serialize, - response_deserializer=cluster_service.GetJSONWebKeysResponse.deserialize, - ) - return self._stubs['get_json_web_keys'] - - @property - def list_node_pools(self) -> Callable[ - [cluster_service.ListNodePoolsRequest], - Awaitable[cluster_service.ListNodePoolsResponse]]: - r"""Return a callable for the list node pools method over gRPC. - - Lists the node pools for a cluster. - - Returns: - Callable[[~.ListNodePoolsRequest], - Awaitable[~.ListNodePoolsResponse]]: - 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_node_pools' not in self._stubs: - self._stubs['list_node_pools'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/ListNodePools', - request_serializer=cluster_service.ListNodePoolsRequest.serialize, - response_deserializer=cluster_service.ListNodePoolsResponse.deserialize, - ) - return self._stubs['list_node_pools'] - - @property - def get_node_pool(self) -> Callable[ - [cluster_service.GetNodePoolRequest], - Awaitable[cluster_service.NodePool]]: - r"""Return a callable for the get node pool method over gRPC. - - Retrieves the requested node pool. - - Returns: - Callable[[~.GetNodePoolRequest], - Awaitable[~.NodePool]]: - 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_node_pool' not in self._stubs: - self._stubs['get_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/GetNodePool', - request_serializer=cluster_service.GetNodePoolRequest.serialize, - response_deserializer=cluster_service.NodePool.deserialize, - ) - return self._stubs['get_node_pool'] - - @property - def create_node_pool(self) -> Callable[ - [cluster_service.CreateNodePoolRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the create node pool method over gRPC. - - Creates a node pool for a cluster. - - Returns: - Callable[[~.CreateNodePoolRequest], - 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_node_pool' not in self._stubs: - self._stubs['create_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/CreateNodePool', - request_serializer=cluster_service.CreateNodePoolRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['create_node_pool'] - - @property - def delete_node_pool(self) -> Callable[ - [cluster_service.DeleteNodePoolRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the delete node pool method over gRPC. - - Deletes a node pool from a cluster. - - Returns: - Callable[[~.DeleteNodePoolRequest], - 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_node_pool' not in self._stubs: - self._stubs['delete_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/DeleteNodePool', - request_serializer=cluster_service.DeleteNodePoolRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['delete_node_pool'] - - @property - def complete_node_pool_upgrade(self) -> Callable[ - [cluster_service.CompleteNodePoolUpgradeRequest], - Awaitable[empty_pb2.Empty]]: - r"""Return a callable for the complete node pool upgrade method over gRPC. - - CompleteNodePoolUpgrade will signal an on-going node - pool upgrade to complete. - - Returns: - Callable[[~.CompleteNodePoolUpgradeRequest], - Awaitable[~.Empty]]: - 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 'complete_node_pool_upgrade' not in self._stubs: - self._stubs['complete_node_pool_upgrade'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/CompleteNodePoolUpgrade', - request_serializer=cluster_service.CompleteNodePoolUpgradeRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['complete_node_pool_upgrade'] - - @property - def rollback_node_pool_upgrade(self) -> Callable[ - [cluster_service.RollbackNodePoolUpgradeRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the rollback node pool upgrade method over gRPC. - - Rolls back a previously Aborted or Failed NodePool - upgrade. This makes no changes if the last upgrade - successfully completed. - - Returns: - Callable[[~.RollbackNodePoolUpgradeRequest], - 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 'rollback_node_pool_upgrade' not in self._stubs: - self._stubs['rollback_node_pool_upgrade'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/RollbackNodePoolUpgrade', - request_serializer=cluster_service.RollbackNodePoolUpgradeRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['rollback_node_pool_upgrade'] - - @property - def set_node_pool_management(self) -> Callable[ - [cluster_service.SetNodePoolManagementRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set node pool management method over gRPC. - - Sets the NodeManagement options for a node pool. - - Returns: - Callable[[~.SetNodePoolManagementRequest], - 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 'set_node_pool_management' not in self._stubs: - self._stubs['set_node_pool_management'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetNodePoolManagement', - request_serializer=cluster_service.SetNodePoolManagementRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_node_pool_management'] - - @property - def set_labels(self) -> Callable[ - [cluster_service.SetLabelsRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set labels method over gRPC. - - Sets labels on a cluster. - - Returns: - Callable[[~.SetLabelsRequest], - 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 'set_labels' not in self._stubs: - self._stubs['set_labels'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetLabels', - request_serializer=cluster_service.SetLabelsRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_labels'] - - @property - def set_legacy_abac(self) -> Callable[ - [cluster_service.SetLegacyAbacRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set legacy abac method over gRPC. - - Enables or disables the ABAC authorization mechanism - on a cluster. - - Returns: - Callable[[~.SetLegacyAbacRequest], - 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 'set_legacy_abac' not in self._stubs: - self._stubs['set_legacy_abac'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetLegacyAbac', - request_serializer=cluster_service.SetLegacyAbacRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_legacy_abac'] - - @property - def start_ip_rotation(self) -> Callable[ - [cluster_service.StartIPRotationRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the start ip rotation method over gRPC. - - Starts master IP rotation. - - Returns: - Callable[[~.StartIPRotationRequest], - 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 'start_ip_rotation' not in self._stubs: - self._stubs['start_ip_rotation'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/StartIPRotation', - request_serializer=cluster_service.StartIPRotationRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['start_ip_rotation'] - - @property - def complete_ip_rotation(self) -> Callable[ - [cluster_service.CompleteIPRotationRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the complete ip rotation method over gRPC. - - Completes master IP rotation. - - Returns: - Callable[[~.CompleteIPRotationRequest], - 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 'complete_ip_rotation' not in self._stubs: - self._stubs['complete_ip_rotation'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/CompleteIPRotation', - request_serializer=cluster_service.CompleteIPRotationRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['complete_ip_rotation'] - - @property - def set_node_pool_size(self) -> Callable[ - [cluster_service.SetNodePoolSizeRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set node pool size method over gRPC. - - Sets the size for a specific node pool. The new size will be - used for all replicas, including future replicas created by - modifying - [NodePool.locations][google.container.v1.NodePool.locations]. - - Returns: - Callable[[~.SetNodePoolSizeRequest], - 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 'set_node_pool_size' not in self._stubs: - self._stubs['set_node_pool_size'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetNodePoolSize', - request_serializer=cluster_service.SetNodePoolSizeRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_node_pool_size'] - - @property - def set_network_policy(self) -> Callable[ - [cluster_service.SetNetworkPolicyRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set network policy method over gRPC. - - Enables or disables Network Policy for a cluster. - - Returns: - Callable[[~.SetNetworkPolicyRequest], - 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 'set_network_policy' not in self._stubs: - self._stubs['set_network_policy'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetNetworkPolicy', - request_serializer=cluster_service.SetNetworkPolicyRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_network_policy'] - - @property - def set_maintenance_policy(self) -> Callable[ - [cluster_service.SetMaintenancePolicyRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set maintenance policy method over gRPC. - - Sets the maintenance policy for a cluster. - - Returns: - Callable[[~.SetMaintenancePolicyRequest], - 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 'set_maintenance_policy' not in self._stubs: - self._stubs['set_maintenance_policy'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/SetMaintenancePolicy', - request_serializer=cluster_service.SetMaintenancePolicyRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_maintenance_policy'] - - @property - def list_usable_subnetworks(self) -> Callable[ - [cluster_service.ListUsableSubnetworksRequest], - Awaitable[cluster_service.ListUsableSubnetworksResponse]]: - r"""Return a callable for the list usable subnetworks method over gRPC. - - Lists subnetworks that are usable for creating - clusters in a project. - - Returns: - Callable[[~.ListUsableSubnetworksRequest], - Awaitable[~.ListUsableSubnetworksResponse]]: - 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_usable_subnetworks' not in self._stubs: - self._stubs['list_usable_subnetworks'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/ListUsableSubnetworks', - request_serializer=cluster_service.ListUsableSubnetworksRequest.serialize, - response_deserializer=cluster_service.ListUsableSubnetworksResponse.deserialize, - ) - return self._stubs['list_usable_subnetworks'] - - @property - def check_autopilot_compatibility(self) -> Callable[ - [cluster_service.CheckAutopilotCompatibilityRequest], - Awaitable[cluster_service.CheckAutopilotCompatibilityResponse]]: - r"""Return a callable for the check autopilot compatibility method over gRPC. - - Checks the cluster compatibility with Autopilot mode, - and returns a list of compatibility issues. - - Returns: - Callable[[~.CheckAutopilotCompatibilityRequest], - Awaitable[~.CheckAutopilotCompatibilityResponse]]: - 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 'check_autopilot_compatibility' not in self._stubs: - self._stubs['check_autopilot_compatibility'] = self._logged_channel.unary_unary( - '/google.container.v1.ClusterManager/CheckAutopilotCompatibility', - request_serializer=cluster_service.CheckAutopilotCompatibilityRequest.serialize, - response_deserializer=cluster_service.CheckAutopilotCompatibilityResponse.deserialize, - ) - return self._stubs['check_autopilot_compatibility'] - - def _prep_wrapped_messages(self, client_info): - """ Precompute the wrapped methods, overriding the base class method to use async wrappers.""" - self._wrapped_methods = { - self.list_clusters: self._wrap_method( - self.list_clusters, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_cluster: self._wrap_method( - self.get_cluster, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.create_cluster: self._wrap_method( - self.create_cluster, - default_timeout=45.0, - client_info=client_info, - ), - self.update_cluster: self._wrap_method( - self.update_cluster, - default_timeout=45.0, - client_info=client_info, - ), - self.update_node_pool: self._wrap_method( - self.update_node_pool, - default_timeout=45.0, - client_info=client_info, - ), - self.set_node_pool_autoscaling: self._wrap_method( - self.set_node_pool_autoscaling, - default_timeout=45.0, - client_info=client_info, - ), - self.set_logging_service: self._wrap_method( - self.set_logging_service, - default_timeout=45.0, - client_info=client_info, - ), - self.set_monitoring_service: self._wrap_method( - self.set_monitoring_service, - default_timeout=45.0, - client_info=client_info, - ), - self.set_addons_config: self._wrap_method( - self.set_addons_config, - default_timeout=45.0, - client_info=client_info, - ), - self.set_locations: self._wrap_method( - self.set_locations, - default_timeout=45.0, - client_info=client_info, - ), - self.update_master: self._wrap_method( - self.update_master, - default_timeout=45.0, - client_info=client_info, - ), - self.set_master_auth: self._wrap_method( - self.set_master_auth, - default_timeout=45.0, - client_info=client_info, - ), - self.delete_cluster: self._wrap_method( - self.delete_cluster, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.list_operations: self._wrap_method( - self.list_operations, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_operation: self._wrap_method( - self.get_operation, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.cancel_operation: self._wrap_method( - self.cancel_operation, - default_timeout=45.0, - client_info=client_info, - ), - self.get_server_config: self._wrap_method( - self.get_server_config, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_json_web_keys: self._wrap_method( - self.get_json_web_keys, - default_timeout=None, - client_info=client_info, - ), - self.list_node_pools: self._wrap_method( - self.list_node_pools, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_node_pool: self._wrap_method( - self.get_node_pool, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.create_node_pool: self._wrap_method( - self.create_node_pool, - default_timeout=45.0, - client_info=client_info, - ), - self.delete_node_pool: self._wrap_method( - self.delete_node_pool, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.complete_node_pool_upgrade: self._wrap_method( - self.complete_node_pool_upgrade, - default_timeout=None, - client_info=client_info, - ), - self.rollback_node_pool_upgrade: self._wrap_method( - self.rollback_node_pool_upgrade, - default_timeout=45.0, - client_info=client_info, - ), - self.set_node_pool_management: self._wrap_method( - self.set_node_pool_management, - default_timeout=45.0, - client_info=client_info, - ), - self.set_labels: self._wrap_method( - self.set_labels, - default_timeout=45.0, - client_info=client_info, - ), - self.set_legacy_abac: self._wrap_method( - self.set_legacy_abac, - default_timeout=45.0, - client_info=client_info, - ), - self.start_ip_rotation: self._wrap_method( - self.start_ip_rotation, - default_timeout=45.0, - client_info=client_info, - ), - self.complete_ip_rotation: self._wrap_method( - self.complete_ip_rotation, - default_timeout=45.0, - client_info=client_info, - ), - self.set_node_pool_size: self._wrap_method( - self.set_node_pool_size, - default_timeout=45.0, - client_info=client_info, - ), - self.set_network_policy: self._wrap_method( - self.set_network_policy, - default_timeout=45.0, - client_info=client_info, - ), - self.set_maintenance_policy: self._wrap_method( - self.set_maintenance_policy, - default_timeout=45.0, - client_info=client_info, - ), - self.list_usable_subnetworks: self._wrap_method( - self.list_usable_subnetworks, - default_timeout=None, - client_info=client_info, - ), - self.check_autopilot_compatibility: self._wrap_method( - self.check_autopilot_compatibility, - default_timeout=None, - client_info=client_info, - ), - } - - def _wrap_method(self, func, *args, **kwargs): - if self._wrap_with_kind: # pragma: NO COVER - kwargs["kind"] = self.kind - return gapic_v1.method_async.wrap_method(func, *args, **kwargs) - - def close(self): - return self._logged_channel.close() - - @property - def kind(self) -> str: - return "grpc_asyncio" - - -__all__ = ( - 'ClusterManagerGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest.py deleted file mode 100644 index e40e09a9aafa..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest.py +++ /dev/null @@ -1,5424 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 logging -import json # type: ignore - -from google.auth.transport.requests import AuthorizedSession # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.api_core import exceptions as core_exceptions -from google.api_core import retry as retries -from google.api_core import rest_helpers -from google.api_core import rest_streaming -from google.api_core import gapic_v1 - -from google.protobuf import json_format - -from requests import __version__ as requests_version -import dataclasses -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union -import warnings - - -from google.cloud.container_v1.types import cluster_service -from google.protobuf import empty_pb2 # type: ignore - - -from .rest_base import _BaseClusterManagerRestTransport -from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object, None] # type: ignore - -try: - from google.api_core import client_logging # type: ignore - CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER -except ImportError: # pragma: NO COVER - CLIENT_LOGGING_SUPPORTED = False - -_LOGGER = logging.getLogger(__name__) - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, - grpc_version=None, - rest_version=f"requests@{requests_version}", -) - - -class ClusterManagerRestInterceptor: - """Interceptor for ClusterManager. - - Interceptors are used to manipulate requests, request metadata, and responses - in arbitrary ways. - Example use cases include: - * Logging - * Verifying requests according to service or custom semantics - * Stripping extraneous information from responses - - These use cases and more can be enabled by injecting an - instance of a custom subclass when constructing the ClusterManagerRestTransport. - - .. code-block:: python - class MyCustomClusterManagerInterceptor(ClusterManagerRestInterceptor): - def pre_cancel_operation(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def pre_check_autopilot_compatibility(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_check_autopilot_compatibility(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_complete_ip_rotation(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_complete_ip_rotation(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_complete_node_pool_upgrade(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def pre_create_cluster(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_create_cluster(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_create_node_pool(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_create_node_pool(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_delete_cluster(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_delete_cluster(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_delete_node_pool(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_delete_node_pool(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_get_cluster(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_get_cluster(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_get_json_web_keys(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_get_json_web_keys(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_get_node_pool(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_get_node_pool(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_get_operation(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_get_operation(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_get_server_config(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_get_server_config(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_list_clusters(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_list_clusters(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_list_node_pools(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_list_node_pools(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_list_operations(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_list_operations(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_list_usable_subnetworks(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_list_usable_subnetworks(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_rollback_node_pool_upgrade(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_rollback_node_pool_upgrade(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_set_addons_config(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_set_addons_config(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_set_labels(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_set_labels(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_set_legacy_abac(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_set_legacy_abac(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_set_locations(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_set_locations(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_set_logging_service(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_set_logging_service(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_set_maintenance_policy(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_set_maintenance_policy(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_set_master_auth(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_set_master_auth(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_set_monitoring_service(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_set_monitoring_service(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_set_network_policy(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_set_network_policy(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_set_node_pool_autoscaling(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_set_node_pool_autoscaling(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_set_node_pool_management(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_set_node_pool_management(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_set_node_pool_size(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_set_node_pool_size(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_start_ip_rotation(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_start_ip_rotation(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_update_cluster(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_update_cluster(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_update_master(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_update_master(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_update_node_pool(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_update_node_pool(self, response): - logging.log(f"Received response: {response}") - return response - - transport = ClusterManagerRestTransport(interceptor=MyCustomClusterManagerInterceptor()) - client = ClusterManagerClient(transport=transport) - - - """ - def pre_cancel_operation(self, request: cluster_service.CancelOperationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for cancel_operation - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def pre_check_autopilot_compatibility(self, request: cluster_service.CheckAutopilotCompatibilityRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.CheckAutopilotCompatibilityRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for check_autopilot_compatibility - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_check_autopilot_compatibility(self, response: cluster_service.CheckAutopilotCompatibilityResponse) -> cluster_service.CheckAutopilotCompatibilityResponse: - """Post-rpc interceptor for check_autopilot_compatibility - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_complete_ip_rotation(self, request: cluster_service.CompleteIPRotationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.CompleteIPRotationRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for complete_ip_rotation - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_complete_ip_rotation(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for complete_ip_rotation - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_complete_node_pool_upgrade(self, request: cluster_service.CompleteNodePoolUpgradeRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.CompleteNodePoolUpgradeRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for complete_node_pool_upgrade - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def pre_create_cluster(self, request: cluster_service.CreateClusterRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.CreateClusterRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for create_cluster - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_create_cluster(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for create_cluster - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_create_node_pool(self, request: cluster_service.CreateNodePoolRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.CreateNodePoolRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for create_node_pool - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_create_node_pool(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for create_node_pool - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_delete_cluster(self, request: cluster_service.DeleteClusterRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.DeleteClusterRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for delete_cluster - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_delete_cluster(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for delete_cluster - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_delete_node_pool(self, request: cluster_service.DeleteNodePoolRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.DeleteNodePoolRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for delete_node_pool - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_delete_node_pool(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for delete_node_pool - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_get_cluster(self, request: cluster_service.GetClusterRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.GetClusterRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for get_cluster - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_get_cluster(self, response: cluster_service.Cluster) -> cluster_service.Cluster: - """Post-rpc interceptor for get_cluster - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_get_json_web_keys(self, request: cluster_service.GetJSONWebKeysRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.GetJSONWebKeysRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for get_json_web_keys - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_get_json_web_keys(self, response: cluster_service.GetJSONWebKeysResponse) -> cluster_service.GetJSONWebKeysResponse: - """Post-rpc interceptor for get_json_web_keys - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_get_node_pool(self, request: cluster_service.GetNodePoolRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.GetNodePoolRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for get_node_pool - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_get_node_pool(self, response: cluster_service.NodePool) -> cluster_service.NodePool: - """Post-rpc interceptor for get_node_pool - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_get_operation(self, request: cluster_service.GetOperationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for get_operation - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_get_operation(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for get_operation - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_get_server_config(self, request: cluster_service.GetServerConfigRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.GetServerConfigRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for get_server_config - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_get_server_config(self, response: cluster_service.ServerConfig) -> cluster_service.ServerConfig: - """Post-rpc interceptor for get_server_config - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_list_clusters(self, request: cluster_service.ListClustersRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.ListClustersRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for list_clusters - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_list_clusters(self, response: cluster_service.ListClustersResponse) -> cluster_service.ListClustersResponse: - """Post-rpc interceptor for list_clusters - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_list_node_pools(self, request: cluster_service.ListNodePoolsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.ListNodePoolsRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for list_node_pools - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_list_node_pools(self, response: cluster_service.ListNodePoolsResponse) -> cluster_service.ListNodePoolsResponse: - """Post-rpc interceptor for list_node_pools - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_list_operations(self, request: cluster_service.ListOperationsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for list_operations - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_list_operations(self, response: cluster_service.ListOperationsResponse) -> cluster_service.ListOperationsResponse: - """Post-rpc interceptor for list_operations - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_list_usable_subnetworks(self, request: cluster_service.ListUsableSubnetworksRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.ListUsableSubnetworksRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for list_usable_subnetworks - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_list_usable_subnetworks(self, response: cluster_service.ListUsableSubnetworksResponse) -> cluster_service.ListUsableSubnetworksResponse: - """Post-rpc interceptor for list_usable_subnetworks - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_rollback_node_pool_upgrade(self, request: cluster_service.RollbackNodePoolUpgradeRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.RollbackNodePoolUpgradeRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for rollback_node_pool_upgrade - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_rollback_node_pool_upgrade(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for rollback_node_pool_upgrade - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_set_addons_config(self, request: cluster_service.SetAddonsConfigRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetAddonsConfigRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for set_addons_config - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_set_addons_config(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for set_addons_config - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_set_labels(self, request: cluster_service.SetLabelsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetLabelsRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for set_labels - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_set_labels(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for set_labels - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_set_legacy_abac(self, request: cluster_service.SetLegacyAbacRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetLegacyAbacRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for set_legacy_abac - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_set_legacy_abac(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for set_legacy_abac - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_set_locations(self, request: cluster_service.SetLocationsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for set_locations - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_set_locations(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for set_locations - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_set_logging_service(self, request: cluster_service.SetLoggingServiceRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetLoggingServiceRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for set_logging_service - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_set_logging_service(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for set_logging_service - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_set_maintenance_policy(self, request: cluster_service.SetMaintenancePolicyRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetMaintenancePolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for set_maintenance_policy - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_set_maintenance_policy(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for set_maintenance_policy - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_set_master_auth(self, request: cluster_service.SetMasterAuthRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetMasterAuthRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for set_master_auth - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_set_master_auth(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for set_master_auth - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_set_monitoring_service(self, request: cluster_service.SetMonitoringServiceRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetMonitoringServiceRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for set_monitoring_service - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_set_monitoring_service(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for set_monitoring_service - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_set_network_policy(self, request: cluster_service.SetNetworkPolicyRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetNetworkPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for set_network_policy - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_set_network_policy(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for set_network_policy - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_set_node_pool_autoscaling(self, request: cluster_service.SetNodePoolAutoscalingRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetNodePoolAutoscalingRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for set_node_pool_autoscaling - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_set_node_pool_autoscaling(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for set_node_pool_autoscaling - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_set_node_pool_management(self, request: cluster_service.SetNodePoolManagementRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetNodePoolManagementRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for set_node_pool_management - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_set_node_pool_management(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for set_node_pool_management - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_set_node_pool_size(self, request: cluster_service.SetNodePoolSizeRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.SetNodePoolSizeRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for set_node_pool_size - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_set_node_pool_size(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for set_node_pool_size - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_start_ip_rotation(self, request: cluster_service.StartIPRotationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.StartIPRotationRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for start_ip_rotation - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_start_ip_rotation(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for start_ip_rotation - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_update_cluster(self, request: cluster_service.UpdateClusterRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.UpdateClusterRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for update_cluster - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_update_cluster(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for update_cluster - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_update_master(self, request: cluster_service.UpdateMasterRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.UpdateMasterRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for update_master - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_update_master(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for update_master - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - def pre_update_node_pool(self, request: cluster_service.UpdateNodePoolRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[cluster_service.UpdateNodePoolRequest, Sequence[Tuple[str, Union[str, bytes]]]]: - """Pre-rpc interceptor for update_node_pool - - Override in a subclass to manipulate the request or metadata - before they are sent to the ClusterManager server. - """ - return request, metadata - - def post_update_node_pool(self, response: cluster_service.Operation) -> cluster_service.Operation: - """Post-rpc interceptor for update_node_pool - - Override in a subclass to manipulate the response - after it is returned by the ClusterManager server but before - it is returned to user code. - """ - return response - - -@dataclasses.dataclass -class ClusterManagerRestStub: - _session: AuthorizedSession - _host: str - _interceptor: ClusterManagerRestInterceptor - - -class ClusterManagerRestTransport(_BaseClusterManagerRestTransport): - """REST backend synchronous transport for ClusterManager. - - Google Kubernetes Engine Cluster Manager v1 - - 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 JSON representations of protocol buffers over HTTP/1.1 - """ - - def __init__(self, *, - host: str = 'container.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = 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, - url_scheme: str = 'https', - interceptor: Optional[ClusterManagerRestInterceptor] = None, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to (default: 'container.googleapis.com'). - 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 ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client - certificate to configure mutual TLS HTTP channel. It is ignored - if ``channel`` 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 are developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - url_scheme: the protocol scheme for the API endpoint. Normally - "https", but for testing or local servers, - "http" can be specified. - """ - # Run the base constructor - # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. - # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the - # credentials object - super().__init__( - host=host, - credentials=credentials, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - url_scheme=url_scheme, - api_audience=api_audience - ) - self._session = AuthorizedSession( - self._credentials, default_host=self.DEFAULT_HOST) - if client_cert_source_for_mtls: - self._session.configure_mtls_channel(client_cert_source_for_mtls) - self._interceptor = interceptor or ClusterManagerRestInterceptor() - self._prep_wrapped_messages(client_info) - - class _CancelOperation(_BaseClusterManagerRestTransport._BaseCancelOperation, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.CancelOperation") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.CancelOperationRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ): - r"""Call the cancel operation method over HTTP. - - Args: - request (~.cluster_service.CancelOperationRequest): - The request object. CancelOperationRequest cancels a - single operation. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - - http_options = _BaseClusterManagerRestTransport._BaseCancelOperation._get_http_options() - - request, metadata = self._interceptor.pre_cancel_operation(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseCancelOperation._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseCancelOperation._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseCancelOperation._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = json_format.MessageToJson(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.CancelOperation", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "CancelOperation", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._CancelOperation._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - class _CheckAutopilotCompatibility(_BaseClusterManagerRestTransport._BaseCheckAutopilotCompatibility, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.CheckAutopilotCompatibility") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - return response - - def __call__(self, - request: cluster_service.CheckAutopilotCompatibilityRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.CheckAutopilotCompatibilityResponse: - r"""Call the check autopilot - compatibility method over HTTP. - - Args: - request (~.cluster_service.CheckAutopilotCompatibilityRequest): - The request object. CheckAutopilotCompatibilityRequest - requests getting the blockers for the - given operation in the cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.CheckAutopilotCompatibilityResponse: - CheckAutopilotCompatibilityResponse - has a list of compatibility issues. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseCheckAutopilotCompatibility._get_http_options() - - request, metadata = self._interceptor.pre_check_autopilot_compatibility(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseCheckAutopilotCompatibility._get_transcoded_request(http_options, request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseCheckAutopilotCompatibility._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.CheckAutopilotCompatibility", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "CheckAutopilotCompatibility", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._CheckAutopilotCompatibility._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.CheckAutopilotCompatibilityResponse() - pb_resp = cluster_service.CheckAutopilotCompatibilityResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_check_autopilot_compatibility(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.CheckAutopilotCompatibilityResponse.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.check_autopilot_compatibility", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "CheckAutopilotCompatibility", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _CompleteIPRotation(_BaseClusterManagerRestTransport._BaseCompleteIPRotation, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.CompleteIPRotation") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.CompleteIPRotationRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the complete ip rotation method over HTTP. - - Args: - request (~.cluster_service.CompleteIPRotationRequest): - The request object. CompleteIPRotationRequest moves the - cluster master back into single-IP mode. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseCompleteIPRotation._get_http_options() - - request, metadata = self._interceptor.pre_complete_ip_rotation(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseCompleteIPRotation._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseCompleteIPRotation._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseCompleteIPRotation._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.CompleteIPRotation", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "CompleteIPRotation", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._CompleteIPRotation._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_complete_ip_rotation(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.complete_ip_rotation", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "CompleteIPRotation", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _CompleteNodePoolUpgrade(_BaseClusterManagerRestTransport._BaseCompleteNodePoolUpgrade, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.CompleteNodePoolUpgrade") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.CompleteNodePoolUpgradeRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ): - r"""Call the complete node pool - upgrade method over HTTP. - - Args: - request (~.cluster_service.CompleteNodePoolUpgradeRequest): - The request object. CompleteNodePoolUpgradeRequest sets - the name of target node pool to complete - upgrade. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - - http_options = _BaseClusterManagerRestTransport._BaseCompleteNodePoolUpgrade._get_http_options() - - request, metadata = self._interceptor.pre_complete_node_pool_upgrade(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseCompleteNodePoolUpgrade._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseCompleteNodePoolUpgrade._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseCompleteNodePoolUpgrade._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = json_format.MessageToJson(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.CompleteNodePoolUpgrade", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "CompleteNodePoolUpgrade", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._CompleteNodePoolUpgrade._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - class _CreateCluster(_BaseClusterManagerRestTransport._BaseCreateCluster, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.CreateCluster") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.CreateClusterRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the create cluster method over HTTP. - - Args: - request (~.cluster_service.CreateClusterRequest): - The request object. CreateClusterRequest creates a - cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseCreateCluster._get_http_options() - - request, metadata = self._interceptor.pre_create_cluster(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseCreateCluster._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseCreateCluster._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseCreateCluster._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.CreateCluster", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "CreateCluster", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._CreateCluster._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_create_cluster(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.create_cluster", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "CreateCluster", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _CreateNodePool(_BaseClusterManagerRestTransport._BaseCreateNodePool, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.CreateNodePool") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.CreateNodePoolRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the create node pool method over HTTP. - - Args: - request (~.cluster_service.CreateNodePoolRequest): - The request object. CreateNodePoolRequest creates a node - pool for a cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseCreateNodePool._get_http_options() - - request, metadata = self._interceptor.pre_create_node_pool(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseCreateNodePool._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseCreateNodePool._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseCreateNodePool._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.CreateNodePool", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "CreateNodePool", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._CreateNodePool._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_create_node_pool(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.create_node_pool", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "CreateNodePool", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _DeleteCluster(_BaseClusterManagerRestTransport._BaseDeleteCluster, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.DeleteCluster") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - return response - - def __call__(self, - request: cluster_service.DeleteClusterRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the delete cluster method over HTTP. - - Args: - request (~.cluster_service.DeleteClusterRequest): - The request object. DeleteClusterRequest deletes a - cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseDeleteCluster._get_http_options() - - request, metadata = self._interceptor.pre_delete_cluster(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseDeleteCluster._get_transcoded_request(http_options, request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseDeleteCluster._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.DeleteCluster", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "DeleteCluster", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._DeleteCluster._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_delete_cluster(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.delete_cluster", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "DeleteCluster", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _DeleteNodePool(_BaseClusterManagerRestTransport._BaseDeleteNodePool, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.DeleteNodePool") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - return response - - def __call__(self, - request: cluster_service.DeleteNodePoolRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the delete node pool method over HTTP. - - Args: - request (~.cluster_service.DeleteNodePoolRequest): - The request object. DeleteNodePoolRequest deletes a node - pool for a cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseDeleteNodePool._get_http_options() - - request, metadata = self._interceptor.pre_delete_node_pool(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseDeleteNodePool._get_transcoded_request(http_options, request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseDeleteNodePool._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.DeleteNodePool", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "DeleteNodePool", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._DeleteNodePool._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_delete_node_pool(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.delete_node_pool", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "DeleteNodePool", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _GetCluster(_BaseClusterManagerRestTransport._BaseGetCluster, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.GetCluster") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - return response - - def __call__(self, - request: cluster_service.GetClusterRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Cluster: - r"""Call the get cluster method over HTTP. - - Args: - request (~.cluster_service.GetClusterRequest): - The request object. GetClusterRequest gets the settings - of a cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Cluster: - A Google Kubernetes Engine cluster. - """ - - http_options = _BaseClusterManagerRestTransport._BaseGetCluster._get_http_options() - - request, metadata = self._interceptor.pre_get_cluster(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseGetCluster._get_transcoded_request(http_options, request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseGetCluster._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.GetCluster", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "GetCluster", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._GetCluster._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Cluster() - pb_resp = cluster_service.Cluster.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_get_cluster(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Cluster.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.get_cluster", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "GetCluster", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _GetJSONWebKeys(_BaseClusterManagerRestTransport._BaseGetJSONWebKeys, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.GetJSONWebKeys") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - return response - - def __call__(self, - request: cluster_service.GetJSONWebKeysRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.GetJSONWebKeysResponse: - r"""Call the get json web keys method over HTTP. - - Args: - request (~.cluster_service.GetJSONWebKeysRequest): - The request object. GetJSONWebKeysRequest gets the public component of the - keys used by the cluster to sign token requests. This - will be the jwks_uri for the discover document returned - by getOpenIDConfig. See the OpenID Connect Discovery 1.0 - specification for details. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.GetJSONWebKeysResponse: - GetJSONWebKeysResponse is a valid - JSON Web Key Set as specififed in rfc - 7517 - - """ - - http_options = _BaseClusterManagerRestTransport._BaseGetJSONWebKeys._get_http_options() - - request, metadata = self._interceptor.pre_get_json_web_keys(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseGetJSONWebKeys._get_transcoded_request(http_options, request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseGetJSONWebKeys._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.GetJSONWebKeys", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "GetJSONWebKeys", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._GetJSONWebKeys._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.GetJSONWebKeysResponse() - pb_resp = cluster_service.GetJSONWebKeysResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_get_json_web_keys(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.GetJSONWebKeysResponse.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.get_json_web_keys", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "GetJSONWebKeys", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _GetNodePool(_BaseClusterManagerRestTransport._BaseGetNodePool, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.GetNodePool") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - return response - - def __call__(self, - request: cluster_service.GetNodePoolRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.NodePool: - r"""Call the get node pool method over HTTP. - - Args: - request (~.cluster_service.GetNodePoolRequest): - The request object. GetNodePoolRequest retrieves a node - pool for a cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.NodePool: - NodePool contains the name and - configuration for a cluster's node pool. - Node pools are a set of nodes (i.e. - VM's), with a common configuration and - specification, under the control of the - cluster master. They may have a set of - Kubernetes labels applied to them, which - may be used to reference them during pod - scheduling. They may also be resized up - or down, to accommodate the workload. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseGetNodePool._get_http_options() - - request, metadata = self._interceptor.pre_get_node_pool(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseGetNodePool._get_transcoded_request(http_options, request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseGetNodePool._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.GetNodePool", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "GetNodePool", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._GetNodePool._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.NodePool() - pb_resp = cluster_service.NodePool.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_get_node_pool(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.NodePool.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.get_node_pool", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "GetNodePool", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _GetOperation(_BaseClusterManagerRestTransport._BaseGetOperation, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.GetOperation") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - return response - - def __call__(self, - request: cluster_service.GetOperationRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the get operation method over HTTP. - - Args: - request (~.cluster_service.GetOperationRequest): - The request object. GetOperationRequest gets a single - operation. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseGetOperation._get_http_options() - - request, metadata = self._interceptor.pre_get_operation(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseGetOperation._get_transcoded_request(http_options, request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseGetOperation._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.GetOperation", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "GetOperation", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._GetOperation._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_get_operation(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.get_operation", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "GetOperation", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _GetServerConfig(_BaseClusterManagerRestTransport._BaseGetServerConfig, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.GetServerConfig") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - return response - - def __call__(self, - request: cluster_service.GetServerConfigRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.ServerConfig: - r"""Call the get server config method over HTTP. - - Args: - request (~.cluster_service.GetServerConfigRequest): - The request object. Gets the current Kubernetes Engine - service configuration. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.ServerConfig: - Kubernetes Engine service - configuration. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseGetServerConfig._get_http_options() - - request, metadata = self._interceptor.pre_get_server_config(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseGetServerConfig._get_transcoded_request(http_options, request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseGetServerConfig._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.GetServerConfig", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "GetServerConfig", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._GetServerConfig._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.ServerConfig() - pb_resp = cluster_service.ServerConfig.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_get_server_config(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.ServerConfig.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.get_server_config", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "GetServerConfig", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _ListClusters(_BaseClusterManagerRestTransport._BaseListClusters, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.ListClusters") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - return response - - def __call__(self, - request: cluster_service.ListClustersRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.ListClustersResponse: - r"""Call the list clusters method over HTTP. - - Args: - request (~.cluster_service.ListClustersRequest): - The request object. ListClustersRequest lists clusters. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.ListClustersResponse: - ListClustersResponse is the result of - ListClustersRequest. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseListClusters._get_http_options() - - request, metadata = self._interceptor.pre_list_clusters(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseListClusters._get_transcoded_request(http_options, request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseListClusters._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.ListClusters", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "ListClusters", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._ListClusters._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.ListClustersResponse() - pb_resp = cluster_service.ListClustersResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_list_clusters(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.ListClustersResponse.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.list_clusters", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "ListClusters", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _ListNodePools(_BaseClusterManagerRestTransport._BaseListNodePools, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.ListNodePools") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - return response - - def __call__(self, - request: cluster_service.ListNodePoolsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.ListNodePoolsResponse: - r"""Call the list node pools method over HTTP. - - Args: - request (~.cluster_service.ListNodePoolsRequest): - The request object. ListNodePoolsRequest lists the node - pool(s) for a cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.ListNodePoolsResponse: - ListNodePoolsResponse is the result - of ListNodePoolsRequest. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseListNodePools._get_http_options() - - request, metadata = self._interceptor.pre_list_node_pools(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseListNodePools._get_transcoded_request(http_options, request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseListNodePools._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.ListNodePools", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "ListNodePools", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._ListNodePools._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.ListNodePoolsResponse() - pb_resp = cluster_service.ListNodePoolsResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_list_node_pools(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.ListNodePoolsResponse.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.list_node_pools", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "ListNodePools", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _ListOperations(_BaseClusterManagerRestTransport._BaseListOperations, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.ListOperations") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - return response - - def __call__(self, - request: cluster_service.ListOperationsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.ListOperationsResponse: - r"""Call the list operations method over HTTP. - - Args: - request (~.cluster_service.ListOperationsRequest): - The request object. ListOperationsRequest lists - operations. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.ListOperationsResponse: - ListOperationsResponse is the result - of ListOperationsRequest. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseListOperations._get_http_options() - - request, metadata = self._interceptor.pre_list_operations(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseListOperations._get_transcoded_request(http_options, request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseListOperations._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.ListOperations", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "ListOperations", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._ListOperations._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.ListOperationsResponse() - pb_resp = cluster_service.ListOperationsResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_list_operations(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.ListOperationsResponse.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.list_operations", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "ListOperations", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _ListUsableSubnetworks(_BaseClusterManagerRestTransport._BaseListUsableSubnetworks, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.ListUsableSubnetworks") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - return response - - def __call__(self, - request: cluster_service.ListUsableSubnetworksRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.ListUsableSubnetworksResponse: - r"""Call the list usable subnetworks method over HTTP. - - Args: - request (~.cluster_service.ListUsableSubnetworksRequest): - The request object. ListUsableSubnetworksRequest requests - the list of usable subnetworks available - to a user for creating clusters. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.ListUsableSubnetworksResponse: - ListUsableSubnetworksResponse is the - response of - ListUsableSubnetworksRequest. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseListUsableSubnetworks._get_http_options() - - request, metadata = self._interceptor.pre_list_usable_subnetworks(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseListUsableSubnetworks._get_transcoded_request(http_options, request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseListUsableSubnetworks._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.ListUsableSubnetworks", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "ListUsableSubnetworks", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._ListUsableSubnetworks._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.ListUsableSubnetworksResponse() - pb_resp = cluster_service.ListUsableSubnetworksResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_list_usable_subnetworks(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.ListUsableSubnetworksResponse.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.list_usable_subnetworks", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "ListUsableSubnetworks", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _RollbackNodePoolUpgrade(_BaseClusterManagerRestTransport._BaseRollbackNodePoolUpgrade, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.RollbackNodePoolUpgrade") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.RollbackNodePoolUpgradeRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the rollback node pool - upgrade method over HTTP. - - Args: - request (~.cluster_service.RollbackNodePoolUpgradeRequest): - The request object. RollbackNodePoolUpgradeRequest - rollbacks the previously Aborted or - Failed NodePool upgrade. This will be an - no-op if the last upgrade successfully - completed. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseRollbackNodePoolUpgrade._get_http_options() - - request, metadata = self._interceptor.pre_rollback_node_pool_upgrade(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseRollbackNodePoolUpgrade._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseRollbackNodePoolUpgrade._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseRollbackNodePoolUpgrade._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.RollbackNodePoolUpgrade", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "RollbackNodePoolUpgrade", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._RollbackNodePoolUpgrade._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_rollback_node_pool_upgrade(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.rollback_node_pool_upgrade", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "RollbackNodePoolUpgrade", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _SetAddonsConfig(_BaseClusterManagerRestTransport._BaseSetAddonsConfig, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.SetAddonsConfig") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.SetAddonsConfigRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the set addons config method over HTTP. - - Args: - request (~.cluster_service.SetAddonsConfigRequest): - The request object. SetAddonsConfigRequest sets the - addons associated with the cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseSetAddonsConfig._get_http_options() - - request, metadata = self._interceptor.pre_set_addons_config(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseSetAddonsConfig._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseSetAddonsConfig._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseSetAddonsConfig._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.SetAddonsConfig", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetAddonsConfig", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._SetAddonsConfig._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_set_addons_config(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.set_addons_config", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetAddonsConfig", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _SetLabels(_BaseClusterManagerRestTransport._BaseSetLabels, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.SetLabels") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.SetLabelsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the set labels method over HTTP. - - Args: - request (~.cluster_service.SetLabelsRequest): - The request object. SetLabelsRequest sets the Google - Cloud Platform labels on a Google - Container Engine cluster, which will in - turn set them for Google Compute Engine - resources used by that cluster - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseSetLabels._get_http_options() - - request, metadata = self._interceptor.pre_set_labels(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseSetLabels._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseSetLabels._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseSetLabels._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.SetLabels", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetLabels", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._SetLabels._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_set_labels(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.set_labels", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetLabels", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _SetLegacyAbac(_BaseClusterManagerRestTransport._BaseSetLegacyAbac, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.SetLegacyAbac") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.SetLegacyAbacRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the set legacy abac method over HTTP. - - Args: - request (~.cluster_service.SetLegacyAbacRequest): - The request object. SetLegacyAbacRequest enables or - disables the ABAC authorization - mechanism for a cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseSetLegacyAbac._get_http_options() - - request, metadata = self._interceptor.pre_set_legacy_abac(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseSetLegacyAbac._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseSetLegacyAbac._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseSetLegacyAbac._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.SetLegacyAbac", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetLegacyAbac", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._SetLegacyAbac._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_set_legacy_abac(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.set_legacy_abac", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetLegacyAbac", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _SetLocations(_BaseClusterManagerRestTransport._BaseSetLocations, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.SetLocations") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.SetLocationsRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the set locations method over HTTP. - - Args: - request (~.cluster_service.SetLocationsRequest): - The request object. SetLocationsRequest sets the - locations of the cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseSetLocations._get_http_options() - - request, metadata = self._interceptor.pre_set_locations(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseSetLocations._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseSetLocations._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseSetLocations._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.SetLocations", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetLocations", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._SetLocations._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_set_locations(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.set_locations", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetLocations", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _SetLoggingService(_BaseClusterManagerRestTransport._BaseSetLoggingService, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.SetLoggingService") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.SetLoggingServiceRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the set logging service method over HTTP. - - Args: - request (~.cluster_service.SetLoggingServiceRequest): - The request object. SetLoggingServiceRequest sets the - logging service of a cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseSetLoggingService._get_http_options() - - request, metadata = self._interceptor.pre_set_logging_service(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseSetLoggingService._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseSetLoggingService._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseSetLoggingService._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.SetLoggingService", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetLoggingService", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._SetLoggingService._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_set_logging_service(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.set_logging_service", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetLoggingService", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _SetMaintenancePolicy(_BaseClusterManagerRestTransport._BaseSetMaintenancePolicy, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.SetMaintenancePolicy") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.SetMaintenancePolicyRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the set maintenance policy method over HTTP. - - Args: - request (~.cluster_service.SetMaintenancePolicyRequest): - The request object. SetMaintenancePolicyRequest sets the - maintenance policy for a cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseSetMaintenancePolicy._get_http_options() - - request, metadata = self._interceptor.pre_set_maintenance_policy(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseSetMaintenancePolicy._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseSetMaintenancePolicy._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseSetMaintenancePolicy._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.SetMaintenancePolicy", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetMaintenancePolicy", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._SetMaintenancePolicy._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_set_maintenance_policy(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.set_maintenance_policy", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetMaintenancePolicy", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _SetMasterAuth(_BaseClusterManagerRestTransport._BaseSetMasterAuth, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.SetMasterAuth") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.SetMasterAuthRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the set master auth method over HTTP. - - Args: - request (~.cluster_service.SetMasterAuthRequest): - The request object. SetMasterAuthRequest updates the - admin password of a cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseSetMasterAuth._get_http_options() - - request, metadata = self._interceptor.pre_set_master_auth(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseSetMasterAuth._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseSetMasterAuth._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseSetMasterAuth._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.SetMasterAuth", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetMasterAuth", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._SetMasterAuth._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_set_master_auth(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.set_master_auth", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetMasterAuth", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _SetMonitoringService(_BaseClusterManagerRestTransport._BaseSetMonitoringService, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.SetMonitoringService") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.SetMonitoringServiceRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the set monitoring service method over HTTP. - - Args: - request (~.cluster_service.SetMonitoringServiceRequest): - The request object. SetMonitoringServiceRequest sets the - monitoring service of a cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseSetMonitoringService._get_http_options() - - request, metadata = self._interceptor.pre_set_monitoring_service(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseSetMonitoringService._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseSetMonitoringService._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseSetMonitoringService._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.SetMonitoringService", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetMonitoringService", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._SetMonitoringService._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_set_monitoring_service(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.set_monitoring_service", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetMonitoringService", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _SetNetworkPolicy(_BaseClusterManagerRestTransport._BaseSetNetworkPolicy, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.SetNetworkPolicy") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.SetNetworkPolicyRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the set network policy method over HTTP. - - Args: - request (~.cluster_service.SetNetworkPolicyRequest): - The request object. SetNetworkPolicyRequest - enables/disables network policy for a - cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseSetNetworkPolicy._get_http_options() - - request, metadata = self._interceptor.pre_set_network_policy(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseSetNetworkPolicy._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseSetNetworkPolicy._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseSetNetworkPolicy._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.SetNetworkPolicy", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetNetworkPolicy", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._SetNetworkPolicy._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_set_network_policy(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.set_network_policy", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetNetworkPolicy", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _SetNodePoolAutoscaling(_BaseClusterManagerRestTransport._BaseSetNodePoolAutoscaling, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.SetNodePoolAutoscaling") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.SetNodePoolAutoscalingRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the set node pool autoscaling method over HTTP. - - Args: - request (~.cluster_service.SetNodePoolAutoscalingRequest): - The request object. SetNodePoolAutoscalingRequest sets - the autoscaler settings of a node pool. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseSetNodePoolAutoscaling._get_http_options() - - request, metadata = self._interceptor.pre_set_node_pool_autoscaling(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseSetNodePoolAutoscaling._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseSetNodePoolAutoscaling._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseSetNodePoolAutoscaling._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.SetNodePoolAutoscaling", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetNodePoolAutoscaling", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._SetNodePoolAutoscaling._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_set_node_pool_autoscaling(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.set_node_pool_autoscaling", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetNodePoolAutoscaling", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _SetNodePoolManagement(_BaseClusterManagerRestTransport._BaseSetNodePoolManagement, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.SetNodePoolManagement") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.SetNodePoolManagementRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the set node pool management method over HTTP. - - Args: - request (~.cluster_service.SetNodePoolManagementRequest): - The request object. SetNodePoolManagementRequest sets the - node management properties of a node - pool. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseSetNodePoolManagement._get_http_options() - - request, metadata = self._interceptor.pre_set_node_pool_management(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseSetNodePoolManagement._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseSetNodePoolManagement._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseSetNodePoolManagement._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.SetNodePoolManagement", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetNodePoolManagement", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._SetNodePoolManagement._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_set_node_pool_management(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.set_node_pool_management", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetNodePoolManagement", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _SetNodePoolSize(_BaseClusterManagerRestTransport._BaseSetNodePoolSize, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.SetNodePoolSize") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.SetNodePoolSizeRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the set node pool size method over HTTP. - - Args: - request (~.cluster_service.SetNodePoolSizeRequest): - The request object. SetNodePoolSizeRequest sets the size - of a node pool. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseSetNodePoolSize._get_http_options() - - request, metadata = self._interceptor.pre_set_node_pool_size(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseSetNodePoolSize._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseSetNodePoolSize._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseSetNodePoolSize._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.SetNodePoolSize", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetNodePoolSize", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._SetNodePoolSize._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_set_node_pool_size(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.set_node_pool_size", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "SetNodePoolSize", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _StartIPRotation(_BaseClusterManagerRestTransport._BaseStartIPRotation, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.StartIPRotation") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.StartIPRotationRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the start ip rotation method over HTTP. - - Args: - request (~.cluster_service.StartIPRotationRequest): - The request object. StartIPRotationRequest creates a new - IP for the cluster and then performs a - node upgrade on each node pool to point - to the new IP. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseStartIPRotation._get_http_options() - - request, metadata = self._interceptor.pre_start_ip_rotation(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseStartIPRotation._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseStartIPRotation._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseStartIPRotation._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.StartIPRotation", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "StartIPRotation", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._StartIPRotation._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_start_ip_rotation(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.start_ip_rotation", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "StartIPRotation", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _UpdateCluster(_BaseClusterManagerRestTransport._BaseUpdateCluster, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.UpdateCluster") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.UpdateClusterRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the update cluster method over HTTP. - - Args: - request (~.cluster_service.UpdateClusterRequest): - The request object. UpdateClusterRequest updates the - settings of a cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseUpdateCluster._get_http_options() - - request, metadata = self._interceptor.pre_update_cluster(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseUpdateCluster._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseUpdateCluster._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseUpdateCluster._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.UpdateCluster", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "UpdateCluster", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._UpdateCluster._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_update_cluster(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.update_cluster", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "UpdateCluster", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _UpdateMaster(_BaseClusterManagerRestTransport._BaseUpdateMaster, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.UpdateMaster") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.UpdateMasterRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the update master method over HTTP. - - Args: - request (~.cluster_service.UpdateMasterRequest): - The request object. UpdateMasterRequest updates the - master of the cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseUpdateMaster._get_http_options() - - request, metadata = self._interceptor.pre_update_master(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseUpdateMaster._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseUpdateMaster._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseUpdateMaster._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.UpdateMaster", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "UpdateMaster", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._UpdateMaster._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_update_master(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.update_master", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "UpdateMaster", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - class _UpdateNodePool(_BaseClusterManagerRestTransport._BaseUpdateNodePool, ClusterManagerRestStub): - def __hash__(self): - return hash("ClusterManagerRestTransport.UpdateNodePool") - - @staticmethod - def _get_response( - host, - metadata, - query_params, - session, - timeout, - transcoded_request, - body=None): - - uri = transcoded_request['uri'] - method = transcoded_request['method'] - headers = dict(metadata) - headers['Content-Type'] = 'application/json' - response = getattr(session, method)( - "{host}{uri}".format(host=host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - return response - - def __call__(self, - request: cluster_service.UpdateNodePoolRequest, *, - retry: OptionalRetry=gapic_v1.method.DEFAULT, - timeout: Optional[float]=None, - metadata: Sequence[Tuple[str, Union[str, bytes]]]=(), - ) -> cluster_service.Operation: - r"""Call the update node pool method over HTTP. - - Args: - request (~.cluster_service.UpdateNodePoolRequest): - The request object. UpdateNodePoolRequests update a node - pool's image and/or version. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - ~.cluster_service.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - - http_options = _BaseClusterManagerRestTransport._BaseUpdateNodePool._get_http_options() - - request, metadata = self._interceptor.pre_update_node_pool(request, metadata) - transcoded_request = _BaseClusterManagerRestTransport._BaseUpdateNodePool._get_transcoded_request(http_options, request) - - body = _BaseClusterManagerRestTransport._BaseUpdateNodePool._get_request_body_json(transcoded_request) - - # Jsonify the query params - query_params = _BaseClusterManagerRestTransport._BaseUpdateNodePool._get_query_params_json(transcoded_request) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri']) - method = transcoded_request['method'] - try: - request_payload = type(request).to_json(request) - except: - request_payload = None - http_request = { - "payload": request_payload, - "requestMethod": method, - "requestUrl": request_url, - "headers": dict(metadata), - } - _LOGGER.debug( - f"Sending request for google.container_v1.ClusterManagerClient.UpdateNodePool", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "UpdateNodePool", - "httpRequest": http_request, - "metadata": http_request["headers"], - }, - ) - - # Send the request - response = ClusterManagerRestTransport._UpdateNodePool._get_response(self._host, metadata, query_params, self._session, timeout, transcoded_request, body) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = cluster_service.Operation() - pb_resp = cluster_service.Operation.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - - resp = self._interceptor.post_update_node_pool(resp) - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER - try: - response_payload = cluster_service.Operation.to_json(response) - except: - response_payload = None - http_response = { - "payload": response_payload, - "headers": dict(response.headers), - "status": response.status_code, - } - _LOGGER.debug( - "Received response for google.container_v1.ClusterManagerClient.update_node_pool", - extra = { - "serviceName": "google.container.v1.ClusterManager", - "rpcName": "UpdateNodePool", - "metadata": http_response["headers"], - "httpResponse": http_response, - }, - ) - return resp - - @property - def cancel_operation(self) -> Callable[ - [cluster_service.CancelOperationRequest], - empty_pb2.Empty]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._CancelOperation(self._session, self._host, self._interceptor) # type: ignore - - @property - def check_autopilot_compatibility(self) -> Callable[ - [cluster_service.CheckAutopilotCompatibilityRequest], - cluster_service.CheckAutopilotCompatibilityResponse]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._CheckAutopilotCompatibility(self._session, self._host, self._interceptor) # type: ignore - - @property - def complete_ip_rotation(self) -> Callable[ - [cluster_service.CompleteIPRotationRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._CompleteIPRotation(self._session, self._host, self._interceptor) # type: ignore - - @property - def complete_node_pool_upgrade(self) -> Callable[ - [cluster_service.CompleteNodePoolUpgradeRequest], - empty_pb2.Empty]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._CompleteNodePoolUpgrade(self._session, self._host, self._interceptor) # type: ignore - - @property - def create_cluster(self) -> Callable[ - [cluster_service.CreateClusterRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._CreateCluster(self._session, self._host, self._interceptor) # type: ignore - - @property - def create_node_pool(self) -> Callable[ - [cluster_service.CreateNodePoolRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._CreateNodePool(self._session, self._host, self._interceptor) # type: ignore - - @property - def delete_cluster(self) -> Callable[ - [cluster_service.DeleteClusterRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._DeleteCluster(self._session, self._host, self._interceptor) # type: ignore - - @property - def delete_node_pool(self) -> Callable[ - [cluster_service.DeleteNodePoolRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._DeleteNodePool(self._session, self._host, self._interceptor) # type: ignore - - @property - def get_cluster(self) -> Callable[ - [cluster_service.GetClusterRequest], - cluster_service.Cluster]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._GetCluster(self._session, self._host, self._interceptor) # type: ignore - - @property - def get_json_web_keys(self) -> Callable[ - [cluster_service.GetJSONWebKeysRequest], - cluster_service.GetJSONWebKeysResponse]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._GetJSONWebKeys(self._session, self._host, self._interceptor) # type: ignore - - @property - def get_node_pool(self) -> Callable[ - [cluster_service.GetNodePoolRequest], - cluster_service.NodePool]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._GetNodePool(self._session, self._host, self._interceptor) # type: ignore - - @property - def get_operation(self) -> Callable[ - [cluster_service.GetOperationRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._GetOperation(self._session, self._host, self._interceptor) # type: ignore - - @property - def get_server_config(self) -> Callable[ - [cluster_service.GetServerConfigRequest], - cluster_service.ServerConfig]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._GetServerConfig(self._session, self._host, self._interceptor) # type: ignore - - @property - def list_clusters(self) -> Callable[ - [cluster_service.ListClustersRequest], - cluster_service.ListClustersResponse]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._ListClusters(self._session, self._host, self._interceptor) # type: ignore - - @property - def list_node_pools(self) -> Callable[ - [cluster_service.ListNodePoolsRequest], - cluster_service.ListNodePoolsResponse]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._ListNodePools(self._session, self._host, self._interceptor) # type: ignore - - @property - def list_operations(self) -> Callable[ - [cluster_service.ListOperationsRequest], - cluster_service.ListOperationsResponse]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._ListOperations(self._session, self._host, self._interceptor) # type: ignore - - @property - def list_usable_subnetworks(self) -> Callable[ - [cluster_service.ListUsableSubnetworksRequest], - cluster_service.ListUsableSubnetworksResponse]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._ListUsableSubnetworks(self._session, self._host, self._interceptor) # type: ignore - - @property - def rollback_node_pool_upgrade(self) -> Callable[ - [cluster_service.RollbackNodePoolUpgradeRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._RollbackNodePoolUpgrade(self._session, self._host, self._interceptor) # type: ignore - - @property - def set_addons_config(self) -> Callable[ - [cluster_service.SetAddonsConfigRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._SetAddonsConfig(self._session, self._host, self._interceptor) # type: ignore - - @property - def set_labels(self) -> Callable[ - [cluster_service.SetLabelsRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._SetLabels(self._session, self._host, self._interceptor) # type: ignore - - @property - def set_legacy_abac(self) -> Callable[ - [cluster_service.SetLegacyAbacRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._SetLegacyAbac(self._session, self._host, self._interceptor) # type: ignore - - @property - def set_locations(self) -> Callable[ - [cluster_service.SetLocationsRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._SetLocations(self._session, self._host, self._interceptor) # type: ignore - - @property - def set_logging_service(self) -> Callable[ - [cluster_service.SetLoggingServiceRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._SetLoggingService(self._session, self._host, self._interceptor) # type: ignore - - @property - def set_maintenance_policy(self) -> Callable[ - [cluster_service.SetMaintenancePolicyRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._SetMaintenancePolicy(self._session, self._host, self._interceptor) # type: ignore - - @property - def set_master_auth(self) -> Callable[ - [cluster_service.SetMasterAuthRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._SetMasterAuth(self._session, self._host, self._interceptor) # type: ignore - - @property - def set_monitoring_service(self) -> Callable[ - [cluster_service.SetMonitoringServiceRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._SetMonitoringService(self._session, self._host, self._interceptor) # type: ignore - - @property - def set_network_policy(self) -> Callable[ - [cluster_service.SetNetworkPolicyRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._SetNetworkPolicy(self._session, self._host, self._interceptor) # type: ignore - - @property - def set_node_pool_autoscaling(self) -> Callable[ - [cluster_service.SetNodePoolAutoscalingRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._SetNodePoolAutoscaling(self._session, self._host, self._interceptor) # type: ignore - - @property - def set_node_pool_management(self) -> Callable[ - [cluster_service.SetNodePoolManagementRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._SetNodePoolManagement(self._session, self._host, self._interceptor) # type: ignore - - @property - def set_node_pool_size(self) -> Callable[ - [cluster_service.SetNodePoolSizeRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._SetNodePoolSize(self._session, self._host, self._interceptor) # type: ignore - - @property - def start_ip_rotation(self) -> Callable[ - [cluster_service.StartIPRotationRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._StartIPRotation(self._session, self._host, self._interceptor) # type: ignore - - @property - def update_cluster(self) -> Callable[ - [cluster_service.UpdateClusterRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._UpdateCluster(self._session, self._host, self._interceptor) # type: ignore - - @property - def update_master(self) -> Callable[ - [cluster_service.UpdateMasterRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._UpdateMaster(self._session, self._host, self._interceptor) # type: ignore - - @property - def update_node_pool(self) -> Callable[ - [cluster_service.UpdateNodePoolRequest], - cluster_service.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._UpdateNodePool(self._session, self._host, self._interceptor) # type: ignore - - @property - def kind(self) -> str: - return "rest" - - def close(self): - self._session.close() - - -__all__=( - 'ClusterManagerRestTransport', -) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest_base.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest_base.py deleted file mode 100644 index 4de83d8cbb75..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/services/cluster_manager/transports/rest_base.py +++ /dev/null @@ -1,1575 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 json # type: ignore -from google.api_core import path_template -from google.api_core import gapic_v1 - -from google.protobuf import json_format -from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO - -import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union - - -from google.cloud.container_v1.types import cluster_service -from google.protobuf import empty_pb2 # type: ignore - - -class _BaseClusterManagerRestTransport(ClusterManagerTransport): - """Base REST backend transport for ClusterManager. - - Note: This class is not meant to be used directly. Use its sync and - async sub-classes instead. - - 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 JSON representations of protocol buffers over HTTP/1.1 - """ - - def __init__(self, *, - host: str = 'container.googleapis.com', - credentials: Optional[Any] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - url_scheme: str = 'https', - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - Args: - host (Optional[str]): - The hostname to connect to (default: 'container.googleapis.com'). - credentials (Optional[Any]): 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. - 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 are developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - url_scheme: the protocol scheme for the API endpoint. Normally - "https", but for testing or local servers, - "http" can be specified. - """ - # Run the base constructor - maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) - if maybe_url_match is None: - raise ValueError(f"Unexpected hostname structure: {host}") # pragma: NO COVER - - url_match_items = maybe_url_match.groupdict() - - host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host - - super().__init__( - host=host, - credentials=credentials, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience - ) - - class _BaseCancelOperation: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/operations/*}:cancel', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/operations/{operation_id}:cancel', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.CancelOperationRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseCheckAutopilotCompatibility: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'get', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:checkAutopilotCompatibility', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.CheckAutopilotCompatibilityRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseCompleteIPRotation: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:completeIpRotation', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:completeIpRotation', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.CompleteIPRotationRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseCompleteNodePoolUpgrade: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:completeUpgrade', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.CompleteNodePoolUpgradeRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseCreateCluster: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{parent=projects/*/locations/*}/clusters', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.CreateClusterRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseCreateCluster._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseCreateNodePool: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{parent=projects/*/locations/*/clusters/*}/nodePools', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.CreateNodePoolRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseCreateNodePool._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseDeleteCluster: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'delete', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}', - }, - { - 'method': 'delete', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.DeleteClusterRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseDeleteNodePool: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'delete', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}', - }, - { - 'method': 'delete', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.DeleteNodePoolRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseGetCluster: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'get', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}', - }, - { - 'method': 'get', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.GetClusterRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseGetJSONWebKeys: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'get', - 'uri': '/v1/{parent=projects/*/locations/*/clusters/*}/jwks', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.GetJSONWebKeysRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseGetNodePool: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'get', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}', - }, - { - 'method': 'get', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.GetNodePoolRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseGetOperation: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'get', - 'uri': '/v1/{name=projects/*/locations/*/operations/*}', - }, - { - 'method': 'get', - 'uri': '/v1/projects/{project_id}/zones/{zone}/operations/{operation_id}', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.GetOperationRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseGetServerConfig: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'get', - 'uri': '/v1/{name=projects/*/locations/*}/serverConfig', - }, - { - 'method': 'get', - 'uri': '/v1/projects/{project_id}/zones/{zone}/serverconfig', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.GetServerConfigRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseListClusters: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'get', - 'uri': '/v1/{parent=projects/*/locations/*}/clusters', - }, - { - 'method': 'get', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.ListClustersRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseListNodePools: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'get', - 'uri': '/v1/{parent=projects/*/locations/*/clusters/*}/nodePools', - }, - { - 'method': 'get', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.ListNodePoolsRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseListOperations: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'get', - 'uri': '/v1/{parent=projects/*/locations/*}/operations', - }, - { - 'method': 'get', - 'uri': '/v1/projects/{project_id}/zones/{zone}/operations', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.ListOperationsRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseListUsableSubnetworks: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'get', - 'uri': '/v1/{parent=projects/*}/aggregated/usableSubnetworks', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.ListUsableSubnetworksRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseRollbackNodePoolUpgrade: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:rollback', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}:rollback', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.RollbackNodePoolUpgradeRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseSetAddonsConfig: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setAddons', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/addons', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.SetAddonsConfigRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseSetAddonsConfig._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseSetLabels: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setResourceLabels', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/resourceLabels', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.SetLabelsRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseSetLabels._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseSetLegacyAbac: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setLegacyAbac', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/legacyAbac', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.SetLegacyAbacRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseSetLegacyAbac._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseSetLocations: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setLocations', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/locations', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.SetLocationsRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseSetLocations._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseSetLoggingService: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setLogging', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/logging', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.SetLoggingServiceRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseSetLoggingService._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseSetMaintenancePolicy: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setMaintenancePolicy', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMaintenancePolicy', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.SetMaintenancePolicyRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseSetMaintenancePolicy._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseSetMasterAuth: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setMasterAuth', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setMasterAuth', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.SetMasterAuthRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseSetMasterAuth._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseSetMonitoringService: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setMonitoring', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/monitoring', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.SetMonitoringServiceRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseSetMonitoringService._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseSetNetworkPolicy: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:setNetworkPolicy', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:setNetworkPolicy', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.SetNetworkPolicyRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseSetNetworkPolicy._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseSetNodePoolAutoscaling: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setAutoscaling', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/autoscaling', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.SetNodePoolAutoscalingRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseSetNodePoolAutoscaling._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseSetNodePoolManagement: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setManagement', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setManagement', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.SetNodePoolManagementRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseSetNodePoolManagement._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseSetNodePoolSize: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:setSize', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/setSize', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.SetNodePoolSizeRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseSetNodePoolSize._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseStartIPRotation: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:startIpRotation', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}:startIpRotation', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.StartIPRotationRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseUpdateCluster: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'put', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}', - 'body': '*', - }, - { - 'method': 'put', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.UpdateClusterRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseUpdateCluster._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseUpdateMaster: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'post', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*}:updateMaster', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/master', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.UpdateMasterRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseUpdateMaster._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - class _BaseUpdateNodePool: - def __hash__(self): # pragma: NO COVER - return NotImplementedError("__hash__ must be implemented.") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return {k: v for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() if k not in message_dict} - - @staticmethod - def _get_http_options(): - http_options: List[Dict[str, str]] = [{ - 'method': 'put', - 'uri': '/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}', - 'body': '*', - }, - { - 'method': 'post', - 'uri': '/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}/nodePools/{node_pool_id}/update', - 'body': '*', - }, - ] - return http_options - - @staticmethod - def _get_transcoded_request(http_options, request): - pb_request = cluster_service.UpdateNodePoolRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - return transcoded_request - - @staticmethod - def _get_request_body_json(transcoded_request): - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request['body'], - use_integers_for_enums=True - ) - return body - @staticmethod - def _get_query_params_json(transcoded_request): - query_params = json.loads(json_format.MessageToJson( - transcoded_request['query_params'], - use_integers_for_enums=True, - )) - query_params.update(_BaseClusterManagerRestTransport._BaseUpdateNodePool._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - return query_params - - -__all__=( - '_BaseClusterManagerRestTransport', -) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/__init__.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/__init__.py deleted file mode 100644 index 8478fdfc33d8..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/__init__.py +++ /dev/null @@ -1,380 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 .cluster_service import ( - AcceleratorConfig, - AdditionalNodeNetworkConfig, - AdditionalPodNetworkConfig, - AdditionalPodRangesConfig, - AddonsConfig, - AdvancedDatapathObservabilityConfig, - AdvancedMachineFeatures, - AuthenticatorGroupsConfig, - Autopilot, - AutopilotCompatibilityIssue, - AutoprovisioningNodePoolDefaults, - AutoUpgradeOptions, - BestEffortProvisioning, - BinaryAuthorization, - BlueGreenSettings, - CancelOperationRequest, - CheckAutopilotCompatibilityRequest, - CheckAutopilotCompatibilityResponse, - ClientCertificateConfig, - CloudRunConfig, - Cluster, - ClusterAutoscaling, - ClusterUpdate, - CompleteIPRotationRequest, - CompleteNodePoolUpgradeRequest, - CompliancePostureConfig, - ConfidentialNodes, - ConfigConnectorConfig, - ContainerdConfig, - ControlPlaneEndpointsConfig, - CostManagementConfig, - CreateClusterRequest, - CreateNodePoolRequest, - DailyMaintenanceWindow, - DatabaseEncryption, - DefaultSnatStatus, - DeleteClusterRequest, - DeleteNodePoolRequest, - DesiredEnterpriseConfig, - DnsCacheConfig, - DNSConfig, - EnterpriseConfig, - EphemeralStorageLocalSsdConfig, - FastSocket, - Fleet, - GatewayAPIConfig, - GcePersistentDiskCsiDriverConfig, - GcfsConfig, - GcpFilestoreCsiDriverConfig, - GcsFuseCsiDriverConfig, - GetClusterRequest, - GetJSONWebKeysRequest, - GetJSONWebKeysResponse, - GetNodePoolRequest, - GetOpenIDConfigRequest, - GetOpenIDConfigResponse, - GetOperationRequest, - GetServerConfigRequest, - GkeBackupAgentConfig, - GPUDriverInstallationConfig, - GPUSharingConfig, - HorizontalPodAutoscaling, - HttpLoadBalancing, - IdentityServiceConfig, - ILBSubsettingConfig, - IntraNodeVisibilityConfig, - IPAllocationPolicy, - Jwk, - K8sBetaAPIConfig, - KubernetesDashboard, - LegacyAbac, - LinuxNodeConfig, - ListClustersRequest, - ListClustersResponse, - ListNodePoolsRequest, - ListNodePoolsResponse, - ListOperationsRequest, - ListOperationsResponse, - ListUsableSubnetworksRequest, - ListUsableSubnetworksResponse, - LocalNvmeSsdBlockConfig, - LoggingComponentConfig, - LoggingConfig, - LoggingVariantConfig, - MaintenanceExclusionOptions, - MaintenancePolicy, - MaintenanceWindow, - ManagedPrometheusConfig, - MasterAuth, - MasterAuthorizedNetworksConfig, - MaxPodsConstraint, - MeshCertificates, - MonitoringComponentConfig, - MonitoringConfig, - NetworkConfig, - NetworkPolicy, - NetworkPolicyConfig, - NetworkTags, - NodeConfig, - NodeConfigDefaults, - NodeKubeletConfig, - NodeLabels, - NodeManagement, - NodeNetworkConfig, - NodePool, - NodePoolAutoConfig, - NodePoolAutoscaling, - NodePoolDefaults, - NodePoolLoggingConfig, - NodeTaint, - NodeTaints, - NotificationConfig, - Operation, - OperationProgress, - ParallelstoreCsiDriverConfig, - PodCIDROverprovisionConfig, - PrivateClusterConfig, - PrivateClusterMasterGlobalAccessConfig, - RangeInfo, - RayClusterLoggingConfig, - RayClusterMonitoringConfig, - RayOperatorConfig, - RBACBindingConfig, - RecurringTimeWindow, - ReleaseChannel, - ReservationAffinity, - ResourceLabels, - ResourceLimit, - ResourceManagerTags, - ResourceUsageExportConfig, - RollbackNodePoolUpgradeRequest, - SandboxConfig, - SecondaryBootDisk, - SecondaryBootDiskUpdateStrategy, - SecretManagerConfig, - SecurityBulletinEvent, - SecurityPostureConfig, - ServerConfig, - ServiceExternalIPsConfig, - SetAddonsConfigRequest, - SetLabelsRequest, - SetLegacyAbacRequest, - SetLocationsRequest, - SetLoggingServiceRequest, - SetMaintenancePolicyRequest, - SetMasterAuthRequest, - SetMonitoringServiceRequest, - SetNetworkPolicyRequest, - SetNodePoolAutoscalingRequest, - SetNodePoolManagementRequest, - SetNodePoolSizeRequest, - ShieldedInstanceConfig, - ShieldedNodes, - SoleTenantConfig, - StartIPRotationRequest, - StatefulHAConfig, - StatusCondition, - TimeWindow, - UpdateClusterRequest, - UpdateMasterRequest, - UpdateNodePoolRequest, - UpgradeAvailableEvent, - UpgradeEvent, - UpgradeInfoEvent, - UsableSubnetwork, - UsableSubnetworkSecondaryRange, - UserManagedKeysConfig, - VerticalPodAutoscaling, - VirtualNIC, - WindowsNodeConfig, - WorkloadIdentityConfig, - WorkloadMetadataConfig, - WorkloadPolicyConfig, - DatapathProvider, - InTransitEncryptionConfig, - IPv6AccessType, - NodePoolUpdateStrategy, - PrivateIPv6GoogleAccess, - StackType, - UpgradeResourceType, -) - -__all__ = ( - 'AcceleratorConfig', - 'AdditionalNodeNetworkConfig', - 'AdditionalPodNetworkConfig', - 'AdditionalPodRangesConfig', - 'AddonsConfig', - 'AdvancedDatapathObservabilityConfig', - 'AdvancedMachineFeatures', - 'AuthenticatorGroupsConfig', - 'Autopilot', - 'AutopilotCompatibilityIssue', - 'AutoprovisioningNodePoolDefaults', - 'AutoUpgradeOptions', - 'BestEffortProvisioning', - 'BinaryAuthorization', - 'BlueGreenSettings', - 'CancelOperationRequest', - 'CheckAutopilotCompatibilityRequest', - 'CheckAutopilotCompatibilityResponse', - 'ClientCertificateConfig', - 'CloudRunConfig', - 'Cluster', - 'ClusterAutoscaling', - 'ClusterUpdate', - 'CompleteIPRotationRequest', - 'CompleteNodePoolUpgradeRequest', - 'CompliancePostureConfig', - 'ConfidentialNodes', - 'ConfigConnectorConfig', - 'ContainerdConfig', - 'ControlPlaneEndpointsConfig', - 'CostManagementConfig', - 'CreateClusterRequest', - 'CreateNodePoolRequest', - 'DailyMaintenanceWindow', - 'DatabaseEncryption', - 'DefaultSnatStatus', - 'DeleteClusterRequest', - 'DeleteNodePoolRequest', - 'DesiredEnterpriseConfig', - 'DnsCacheConfig', - 'DNSConfig', - 'EnterpriseConfig', - 'EphemeralStorageLocalSsdConfig', - 'FastSocket', - 'Fleet', - 'GatewayAPIConfig', - 'GcePersistentDiskCsiDriverConfig', - 'GcfsConfig', - 'GcpFilestoreCsiDriverConfig', - 'GcsFuseCsiDriverConfig', - 'GetClusterRequest', - 'GetJSONWebKeysRequest', - 'GetJSONWebKeysResponse', - 'GetNodePoolRequest', - 'GetOpenIDConfigRequest', - 'GetOpenIDConfigResponse', - 'GetOperationRequest', - 'GetServerConfigRequest', - 'GkeBackupAgentConfig', - 'GPUDriverInstallationConfig', - 'GPUSharingConfig', - 'HorizontalPodAutoscaling', - 'HttpLoadBalancing', - 'IdentityServiceConfig', - 'ILBSubsettingConfig', - 'IntraNodeVisibilityConfig', - 'IPAllocationPolicy', - 'Jwk', - 'K8sBetaAPIConfig', - 'KubernetesDashboard', - 'LegacyAbac', - 'LinuxNodeConfig', - 'ListClustersRequest', - 'ListClustersResponse', - 'ListNodePoolsRequest', - 'ListNodePoolsResponse', - 'ListOperationsRequest', - 'ListOperationsResponse', - 'ListUsableSubnetworksRequest', - 'ListUsableSubnetworksResponse', - 'LocalNvmeSsdBlockConfig', - 'LoggingComponentConfig', - 'LoggingConfig', - 'LoggingVariantConfig', - 'MaintenanceExclusionOptions', - 'MaintenancePolicy', - 'MaintenanceWindow', - 'ManagedPrometheusConfig', - 'MasterAuth', - 'MasterAuthorizedNetworksConfig', - 'MaxPodsConstraint', - 'MeshCertificates', - 'MonitoringComponentConfig', - 'MonitoringConfig', - 'NetworkConfig', - 'NetworkPolicy', - 'NetworkPolicyConfig', - 'NetworkTags', - 'NodeConfig', - 'NodeConfigDefaults', - 'NodeKubeletConfig', - 'NodeLabels', - 'NodeManagement', - 'NodeNetworkConfig', - 'NodePool', - 'NodePoolAutoConfig', - 'NodePoolAutoscaling', - 'NodePoolDefaults', - 'NodePoolLoggingConfig', - 'NodeTaint', - 'NodeTaints', - 'NotificationConfig', - 'Operation', - 'OperationProgress', - 'ParallelstoreCsiDriverConfig', - 'PodCIDROverprovisionConfig', - 'PrivateClusterConfig', - 'PrivateClusterMasterGlobalAccessConfig', - 'RangeInfo', - 'RayClusterLoggingConfig', - 'RayClusterMonitoringConfig', - 'RayOperatorConfig', - 'RBACBindingConfig', - 'RecurringTimeWindow', - 'ReleaseChannel', - 'ReservationAffinity', - 'ResourceLabels', - 'ResourceLimit', - 'ResourceManagerTags', - 'ResourceUsageExportConfig', - 'RollbackNodePoolUpgradeRequest', - 'SandboxConfig', - 'SecondaryBootDisk', - 'SecondaryBootDiskUpdateStrategy', - 'SecretManagerConfig', - 'SecurityBulletinEvent', - 'SecurityPostureConfig', - 'ServerConfig', - 'ServiceExternalIPsConfig', - 'SetAddonsConfigRequest', - 'SetLabelsRequest', - 'SetLegacyAbacRequest', - 'SetLocationsRequest', - 'SetLoggingServiceRequest', - 'SetMaintenancePolicyRequest', - 'SetMasterAuthRequest', - 'SetMonitoringServiceRequest', - 'SetNetworkPolicyRequest', - 'SetNodePoolAutoscalingRequest', - 'SetNodePoolManagementRequest', - 'SetNodePoolSizeRequest', - 'ShieldedInstanceConfig', - 'ShieldedNodes', - 'SoleTenantConfig', - 'StartIPRotationRequest', - 'StatefulHAConfig', - 'StatusCondition', - 'TimeWindow', - 'UpdateClusterRequest', - 'UpdateMasterRequest', - 'UpdateNodePoolRequest', - 'UpgradeAvailableEvent', - 'UpgradeEvent', - 'UpgradeInfoEvent', - 'UsableSubnetwork', - 'UsableSubnetworkSecondaryRange', - 'UserManagedKeysConfig', - 'VerticalPodAutoscaling', - 'VirtualNIC', - 'WindowsNodeConfig', - 'WorkloadIdentityConfig', - 'WorkloadMetadataConfig', - 'WorkloadPolicyConfig', - 'DatapathProvider', - 'InTransitEncryptionConfig', - 'IPv6AccessType', - 'NodePoolUpdateStrategy', - 'PrivateIPv6GoogleAccess', - 'StackType', - 'UpgradeResourceType', -) diff --git a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/cluster_service.py b/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/cluster_service.py deleted file mode 100644 index 5f322137e8f9..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/google/cloud/container_v1/types/cluster_service.py +++ /dev/null @@ -1,10586 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 __future__ import annotations - -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 -from google.rpc import code_pb2 # type: ignore -from google.rpc import status_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.container.v1', - manifest={ - 'PrivateIPv6GoogleAccess', - 'UpgradeResourceType', - 'DatapathProvider', - 'NodePoolUpdateStrategy', - 'StackType', - 'IPv6AccessType', - 'InTransitEncryptionConfig', - 'LinuxNodeConfig', - 'WindowsNodeConfig', - 'NodeKubeletConfig', - 'NodeConfig', - 'AdvancedMachineFeatures', - 'NodeNetworkConfig', - 'AdditionalNodeNetworkConfig', - 'AdditionalPodNetworkConfig', - 'ShieldedInstanceConfig', - 'SandboxConfig', - 'GcfsConfig', - 'ReservationAffinity', - 'SoleTenantConfig', - 'ContainerdConfig', - 'NodeTaint', - 'NodeTaints', - 'NodeLabels', - 'ResourceLabels', - 'NetworkTags', - 'MasterAuth', - 'ClientCertificateConfig', - 'AddonsConfig', - 'HttpLoadBalancing', - 'HorizontalPodAutoscaling', - 'KubernetesDashboard', - 'NetworkPolicyConfig', - 'DnsCacheConfig', - 'PrivateClusterMasterGlobalAccessConfig', - 'PrivateClusterConfig', - 'AuthenticatorGroupsConfig', - 'CloudRunConfig', - 'ConfigConnectorConfig', - 'GcePersistentDiskCsiDriverConfig', - 'GcpFilestoreCsiDriverConfig', - 'GcsFuseCsiDriverConfig', - 'ParallelstoreCsiDriverConfig', - 'RayOperatorConfig', - 'GkeBackupAgentConfig', - 'StatefulHAConfig', - 'MasterAuthorizedNetworksConfig', - 'LegacyAbac', - 'NetworkPolicy', - 'BinaryAuthorization', - 'PodCIDROverprovisionConfig', - 'IPAllocationPolicy', - 'Cluster', - 'RBACBindingConfig', - 'UserManagedKeysConfig', - 'CompliancePostureConfig', - 'K8sBetaAPIConfig', - 'SecurityPostureConfig', - 'NodePoolAutoConfig', - 'NodePoolDefaults', - 'NodeConfigDefaults', - 'ClusterUpdate', - 'AdditionalPodRangesConfig', - 'RangeInfo', - 'DesiredEnterpriseConfig', - 'Operation', - 'OperationProgress', - 'CreateClusterRequest', - 'GetClusterRequest', - 'UpdateClusterRequest', - 'UpdateNodePoolRequest', - 'SetNodePoolAutoscalingRequest', - 'SetLoggingServiceRequest', - 'SetMonitoringServiceRequest', - 'SetAddonsConfigRequest', - 'SetLocationsRequest', - 'UpdateMasterRequest', - 'SetMasterAuthRequest', - 'DeleteClusterRequest', - 'ListClustersRequest', - 'ListClustersResponse', - 'GetOperationRequest', - 'ListOperationsRequest', - 'CancelOperationRequest', - 'ListOperationsResponse', - 'GetServerConfigRequest', - 'ServerConfig', - 'CreateNodePoolRequest', - 'DeleteNodePoolRequest', - 'ListNodePoolsRequest', - 'GetNodePoolRequest', - 'BlueGreenSettings', - 'NodePool', - 'NodeManagement', - 'BestEffortProvisioning', - 'AutoUpgradeOptions', - 'MaintenancePolicy', - 'MaintenanceWindow', - 'TimeWindow', - 'MaintenanceExclusionOptions', - 'RecurringTimeWindow', - 'DailyMaintenanceWindow', - 'SetNodePoolManagementRequest', - 'SetNodePoolSizeRequest', - 'CompleteNodePoolUpgradeRequest', - 'RollbackNodePoolUpgradeRequest', - 'ListNodePoolsResponse', - 'ClusterAutoscaling', - 'AutoprovisioningNodePoolDefaults', - 'ResourceLimit', - 'NodePoolAutoscaling', - 'SetLabelsRequest', - 'SetLegacyAbacRequest', - 'StartIPRotationRequest', - 'CompleteIPRotationRequest', - 'AcceleratorConfig', - 'GPUSharingConfig', - 'GPUDriverInstallationConfig', - 'WorkloadMetadataConfig', - 'SetNetworkPolicyRequest', - 'SetMaintenancePolicyRequest', - 'StatusCondition', - 'NetworkConfig', - 'GatewayAPIConfig', - 'ServiceExternalIPsConfig', - 'GetOpenIDConfigRequest', - 'GetOpenIDConfigResponse', - 'GetJSONWebKeysRequest', - 'Jwk', - 'GetJSONWebKeysResponse', - 'CheckAutopilotCompatibilityRequest', - 'AutopilotCompatibilityIssue', - 'CheckAutopilotCompatibilityResponse', - 'ReleaseChannel', - 'CostManagementConfig', - 'IntraNodeVisibilityConfig', - 'ILBSubsettingConfig', - 'DNSConfig', - 'MaxPodsConstraint', - 'WorkloadIdentityConfig', - 'IdentityServiceConfig', - 'MeshCertificates', - 'DatabaseEncryption', - 'ListUsableSubnetworksRequest', - 'ListUsableSubnetworksResponse', - 'UsableSubnetworkSecondaryRange', - 'UsableSubnetwork', - 'ResourceUsageExportConfig', - 'VerticalPodAutoscaling', - 'DefaultSnatStatus', - 'ShieldedNodes', - 'VirtualNIC', - 'FastSocket', - 'NotificationConfig', - 'ConfidentialNodes', - 'UpgradeEvent', - 'UpgradeInfoEvent', - 'UpgradeAvailableEvent', - 'SecurityBulletinEvent', - 'Autopilot', - 'WorkloadPolicyConfig', - 'LoggingConfig', - 'LoggingComponentConfig', - 'RayClusterLoggingConfig', - 'MonitoringConfig', - 'AdvancedDatapathObservabilityConfig', - 'RayClusterMonitoringConfig', - 'NodePoolLoggingConfig', - 'LoggingVariantConfig', - 'MonitoringComponentConfig', - 'ManagedPrometheusConfig', - 'Fleet', - 'ControlPlaneEndpointsConfig', - 'LocalNvmeSsdBlockConfig', - 'EphemeralStorageLocalSsdConfig', - 'ResourceManagerTags', - 'EnterpriseConfig', - 'SecretManagerConfig', - 'SecondaryBootDisk', - 'SecondaryBootDiskUpdateStrategy', - }, -) - - -class PrivateIPv6GoogleAccess(proto.Enum): - r"""PrivateIPv6GoogleAccess controls whether and how the pods can - communicate with Google Services through gRPC over IPv6. - - Values: - PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED (0): - Default value. Same as DISABLED - PRIVATE_IPV6_GOOGLE_ACCESS_DISABLED (1): - No private access to or from Google Services - PRIVATE_IPV6_GOOGLE_ACCESS_TO_GOOGLE (2): - Enables private IPv6 access to Google - Services from GKE - PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL (3): - Enables private IPv6 access to and from - Google Services - """ - PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED = 0 - PRIVATE_IPV6_GOOGLE_ACCESS_DISABLED = 1 - PRIVATE_IPV6_GOOGLE_ACCESS_TO_GOOGLE = 2 - PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL = 3 - - -class UpgradeResourceType(proto.Enum): - r"""UpgradeResourceType is the resource type that is upgrading. - It is used in upgrade notifications. - - Values: - UPGRADE_RESOURCE_TYPE_UNSPECIFIED (0): - Default value. This shouldn't be used. - MASTER (1): - Master / control plane - NODE_POOL (2): - Node pool - """ - UPGRADE_RESOURCE_TYPE_UNSPECIFIED = 0 - MASTER = 1 - NODE_POOL = 2 - - -class DatapathProvider(proto.Enum): - r"""The datapath provider selects the implementation of the - Kubernetes networking model for service resolution and network - policy enforcement. - - Values: - DATAPATH_PROVIDER_UNSPECIFIED (0): - Default value. - LEGACY_DATAPATH (1): - Use the IPTables implementation based on - kube-proxy. - ADVANCED_DATAPATH (2): - Use the eBPF based GKE Dataplane V2 with additional - features. See the `GKE Dataplane V2 - documentation `__ - for more. - """ - DATAPATH_PROVIDER_UNSPECIFIED = 0 - LEGACY_DATAPATH = 1 - ADVANCED_DATAPATH = 2 - - -class NodePoolUpdateStrategy(proto.Enum): - r"""Strategy used for node pool update. - - Values: - NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED (0): - Default value if unset. GKE internally - defaults the update strategy to SURGE for - unspecified strategies. - BLUE_GREEN (2): - blue-green upgrade. - SURGE (3): - SURGE is the traditional way of upgrade a node pool. - max_surge and max_unavailable determines the level of - upgrade parallelism. - """ - NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED = 0 - BLUE_GREEN = 2 - SURGE = 3 - - -class StackType(proto.Enum): - r"""Possible values for IP stack type - - Values: - STACK_TYPE_UNSPECIFIED (0): - Default value, will be defaulted as IPV4 only - IPV4 (1): - Cluster is IPV4 only - IPV4_IPV6 (2): - Cluster can use both IPv4 and IPv6 - """ - STACK_TYPE_UNSPECIFIED = 0 - IPV4 = 1 - IPV4_IPV6 = 2 - - -class IPv6AccessType(proto.Enum): - r"""Possible values for IPv6 access type - - Values: - IPV6_ACCESS_TYPE_UNSPECIFIED (0): - Default value, will be defaulted as type - external. - INTERNAL (1): - Access type internal (all v6 addresses are - internal IPs) - EXTERNAL (2): - Access type external (all v6 addresses are - external IPs) - """ - IPV6_ACCESS_TYPE_UNSPECIFIED = 0 - INTERNAL = 1 - EXTERNAL = 2 - - -class InTransitEncryptionConfig(proto.Enum): - r"""Options for in-transit encryption. - - Values: - IN_TRANSIT_ENCRYPTION_CONFIG_UNSPECIFIED (0): - Unspecified, will be inferred as default - - IN_TRANSIT_ENCRYPTION_UNSPECIFIED. - IN_TRANSIT_ENCRYPTION_DISABLED (1): - In-transit encryption is disabled. - IN_TRANSIT_ENCRYPTION_INTER_NODE_TRANSPARENT (2): - Data in-transit is encrypted using inter-node - transparent encryption. - """ - IN_TRANSIT_ENCRYPTION_CONFIG_UNSPECIFIED = 0 - IN_TRANSIT_ENCRYPTION_DISABLED = 1 - IN_TRANSIT_ENCRYPTION_INTER_NODE_TRANSPARENT = 2 - - -class LinuxNodeConfig(proto.Message): - r"""Parameters that can be configured on Linux nodes. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - sysctls (MutableMapping[str, str]): - The Linux kernel parameters to be applied to the nodes and - all pods running on the nodes. - - The following parameters are supported. - - net.core.busy_poll net.core.busy_read - net.core.netdev_max_backlog net.core.rmem_max - net.core.wmem_default net.core.wmem_max net.core.optmem_max - net.core.somaxconn net.ipv4.tcp_rmem net.ipv4.tcp_wmem - net.ipv4.tcp_tw_reuse kernel.shmmni kernel.shmmax - kernel.shmall - cgroup_mode (google.cloud.container_v1.types.LinuxNodeConfig.CgroupMode): - cgroup_mode specifies the cgroup mode to be used on the - node. - hugepages (google.cloud.container_v1.types.LinuxNodeConfig.HugepagesConfig): - Optional. Amounts for 2M and 1G hugepages - - This field is a member of `oneof`_ ``_hugepages``. - """ - class CgroupMode(proto.Enum): - r"""Possible cgroup modes that can be used. - - Values: - CGROUP_MODE_UNSPECIFIED (0): - CGROUP_MODE_UNSPECIFIED is when unspecified cgroup - configuration is used. The default for the GKE node OS image - will be used. - CGROUP_MODE_V1 (1): - CGROUP_MODE_V1 specifies to use cgroupv1 for the cgroup - configuration on the node image. - CGROUP_MODE_V2 (2): - CGROUP_MODE_V2 specifies to use cgroupv2 for the cgroup - configuration on the node image. - """ - CGROUP_MODE_UNSPECIFIED = 0 - CGROUP_MODE_V1 = 1 - CGROUP_MODE_V2 = 2 - - class HugepagesConfig(proto.Message): - r"""Hugepages amount in both 2m and 1g size - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - hugepage_size2m (int): - Optional. Amount of 2M hugepages - - This field is a member of `oneof`_ ``_hugepage_size2m``. - hugepage_size1g (int): - Optional. Amount of 1G hugepages - - This field is a member of `oneof`_ ``_hugepage_size1g``. - """ - - hugepage_size2m: int = proto.Field( - proto.INT32, - number=1, - optional=True, - ) - hugepage_size1g: int = proto.Field( - proto.INT32, - number=2, - optional=True, - ) - - sysctls: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=1, - ) - cgroup_mode: CgroupMode = proto.Field( - proto.ENUM, - number=2, - enum=CgroupMode, - ) - hugepages: HugepagesConfig = proto.Field( - proto.MESSAGE, - number=3, - optional=True, - message=HugepagesConfig, - ) - - -class WindowsNodeConfig(proto.Message): - r"""Parameters that can be configured on Windows nodes. - Windows Node Config that define the parameters that will be used - to configure the Windows node pool settings - - Attributes: - os_version (google.cloud.container_v1.types.WindowsNodeConfig.OSVersion): - OSVersion specifies the Windows node config - to be used on the node - """ - class OSVersion(proto.Enum): - r"""Possible OS version that can be used. - - Values: - OS_VERSION_UNSPECIFIED (0): - When OSVersion is not specified - OS_VERSION_LTSC2019 (1): - LTSC2019 specifies to use LTSC2019 as the - Windows Servercore Base Image - OS_VERSION_LTSC2022 (2): - LTSC2022 specifies to use LTSC2022 as the - Windows Servercore Base Image - """ - OS_VERSION_UNSPECIFIED = 0 - OS_VERSION_LTSC2019 = 1 - OS_VERSION_LTSC2022 = 2 - - os_version: OSVersion = proto.Field( - proto.ENUM, - number=1, - enum=OSVersion, - ) - - -class NodeKubeletConfig(proto.Message): - r"""Node kubelet configs. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - cpu_manager_policy (str): - Control the CPU management policy on the node. See - https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/ - - The following values are allowed. - - - "none": the default, which represents the existing - scheduling behavior. - - "static": allows pods with certain resource - characteristics to be granted increased CPU affinity and - exclusivity on the node. The default value is 'none' if - unspecified. - cpu_cfs_quota (google.protobuf.wrappers_pb2.BoolValue): - Enable CPU CFS quota enforcement for - containers that specify CPU limits. - This option is enabled by default which makes - kubelet use CFS quota - (https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt) - to enforce container CPU limits. Otherwise, CPU - limits will not be enforced at all. - - Disable this option to mitigate CPU throttling - problems while still having your pods to be in - Guaranteed QoS class by specifying the CPU - limits. - - The default value is 'true' if unspecified. - cpu_cfs_quota_period (str): - Set the CPU CFS quota period value 'cpu.cfs_period_us'. - - The string must be a sequence of decimal numbers, each with - optional fraction and a unit suffix, such as "300ms". Valid - time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". - The value must be a positive duration. - pod_pids_limit (int): - Set the Pod PID limits. See - https://kubernetes.io/docs/concepts/policy/pid-limiting/#pod-pid-limits - - Controls the maximum number of processes allowed - to run in a pod. The value must be greater than - or equal to 1024 and less than 4194304. - insecure_kubelet_readonly_port_enabled (bool): - Enable or disable Kubelet read only port. - - This field is a member of `oneof`_ ``_insecure_kubelet_readonly_port_enabled``. - """ - - cpu_manager_policy: str = proto.Field( - proto.STRING, - number=1, - ) - cpu_cfs_quota: wrappers_pb2.BoolValue = proto.Field( - proto.MESSAGE, - number=2, - message=wrappers_pb2.BoolValue, - ) - cpu_cfs_quota_period: str = proto.Field( - proto.STRING, - number=3, - ) - pod_pids_limit: int = proto.Field( - proto.INT64, - number=4, - ) - insecure_kubelet_readonly_port_enabled: bool = proto.Field( - proto.BOOL, - number=7, - optional=True, - ) - - -class NodeConfig(proto.Message): - r"""Parameters that describe the nodes in a cluster. - - GKE Autopilot clusters do not recognize parameters in - ``NodeConfig``. Use - [AutoprovisioningNodePoolDefaults][google.container.v1.AutoprovisioningNodePoolDefaults] - instead. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - machine_type (str): - The name of a Google Compute Engine `machine - type `__ - - If unspecified, the default machine type is ``e2-medium``. - disk_size_gb (int): - Size of the disk attached to each node, - specified in GB. The smallest allowed disk size - is 10GB. - - If unspecified, the default disk size is 100GB. - oauth_scopes (MutableSequence[str]): - The set of Google API scopes to be made available on all of - the node VMs under the "default" service account. - - The following scopes are recommended, but not required, and - by default are not included: - - - ``https://www.googleapis.com/auth/compute`` is required - for mounting persistent storage on your nodes. - - ``https://www.googleapis.com/auth/devstorage.read_only`` - is required for communicating with **gcr.io** (the - `Google Container - Registry `__). - - If unspecified, no scopes are added, unless Cloud Logging or - Cloud Monitoring are enabled, in which case their required - scopes will be added. - service_account (str): - The Google Cloud Platform Service Account to - be used by the node VMs. Specify the email - address of the Service Account; otherwise, if no - Service Account is specified, the "default" - service account is used. - metadata (MutableMapping[str, str]): - The metadata key/value pairs assigned to instances in the - cluster. - - Keys must conform to the regexp ``[a-zA-Z0-9-_]+`` and be - less than 128 bytes in length. These are reflected as part - of a URL in the metadata server. Additionally, to avoid - ambiguity, keys must not conflict with any other metadata - keys for the project or be one of the reserved keys: - - - "cluster-location" - - "cluster-name" - - "cluster-uid" - - "configure-sh" - - "containerd-configure-sh" - - "enable-os-login" - - "gci-ensure-gke-docker" - - "gci-metrics-enabled" - - "gci-update-strategy" - - "instance-template" - - "kube-env" - - "startup-script" - - "user-data" - - "disable-address-manager" - - "windows-startup-script-ps1" - - "common-psm1" - - "k8s-node-setup-psm1" - - "install-ssh-psm1" - - "user-profile-psm1" - - Values are free-form strings, and only have meaning as - interpreted by the image running in the instance. The only - restriction placed on them is that each value's size must be - less than or equal to 32 KB. - - The total size of all keys and values must be less than 512 - KB. - image_type (str): - The image type to use for this node. Note - that for a given image type, the latest version - of it will be used. Please see - https://cloud.google.com/kubernetes-engine/docs/concepts/node-images - for available image types. - labels (MutableMapping[str, str]): - The map of Kubernetes labels (key/value - pairs) to be applied to each node. These will - added in addition to any default label(s) that - Kubernetes may apply to the node. - In case of conflict in label keys, the applied - set may differ depending on the Kubernetes - version -- it's best to assume the behavior is - undefined and conflicts should be avoided. - For more information, including usage and the - valid values, see: - - https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ - local_ssd_count (int): - The number of local SSD disks to be attached - to the node. - The limit for this value is dependent upon the - maximum number of disks available on a machine - per zone. See: - - https://cloud.google.com/compute/docs/disks/local-ssd - for more information. - tags (MutableSequence[str]): - The list of instance tags applied to all - nodes. Tags are used to identify valid sources - or targets for network firewalls and are - specified by the client during cluster or node - pool creation. Each tag within the list must - comply with RFC1035. - preemptible (bool): - Whether the nodes are created as preemptible - VM instances. See: - https://cloud.google.com/compute/docs/instances/preemptible - for more information about preemptible VM - instances. - accelerators (MutableSequence[google.cloud.container_v1.types.AcceleratorConfig]): - A list of hardware accelerators to be - attached to each node. See - https://cloud.google.com/compute/docs/gpus for - more information about support for GPUs. - disk_type (str): - Type of the disk attached to each node (e.g. - 'pd-standard', 'pd-ssd' or 'pd-balanced') - - If unspecified, the default disk type is - 'pd-standard' - min_cpu_platform (str): - Minimum CPU platform to be used by this instance. The - instance may be scheduled on the specified or newer CPU - platform. Applicable values are the friendly names of CPU - platforms, such as ``minCpuPlatform: "Intel Haswell"`` or - ``minCpuPlatform: "Intel Sandy Bridge"``. For more - information, read `how to specify min CPU - platform `__ - workload_metadata_config (google.cloud.container_v1.types.WorkloadMetadataConfig): - The workload metadata configuration for this - node. - taints (MutableSequence[google.cloud.container_v1.types.NodeTaint]): - List of kubernetes taints to be applied to - each node. - For more information, including usage and the - valid values, see: - - https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ - sandbox_config (google.cloud.container_v1.types.SandboxConfig): - Sandbox configuration for this node. - node_group (str): - Setting this field will assign instances of this pool to run - on the specified node group. This is useful for running - workloads on `sole tenant - nodes `__. - reservation_affinity (google.cloud.container_v1.types.ReservationAffinity): - The optional reservation affinity. Setting this field will - apply the specified `Zonal Compute - Reservation `__ - to this node pool. - shielded_instance_config (google.cloud.container_v1.types.ShieldedInstanceConfig): - Shielded Instance options. - linux_node_config (google.cloud.container_v1.types.LinuxNodeConfig): - Parameters that can be configured on Linux - nodes. - kubelet_config (google.cloud.container_v1.types.NodeKubeletConfig): - Node kubelet configs. - boot_disk_kms_key (str): - The Customer Managed Encryption Key used to encrypt the boot - disk attached to each node in the node pool. This should be - of the form - projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. - For more information about protecting resources with Cloud - KMS Keys please see: - https://cloud.google.com/compute/docs/disks/customer-managed-encryption - gcfs_config (google.cloud.container_v1.types.GcfsConfig): - Google Container File System (image - streaming) configs. - advanced_machine_features (google.cloud.container_v1.types.AdvancedMachineFeatures): - Advanced features for the Compute Engine VM. - gvnic (google.cloud.container_v1.types.VirtualNIC): - Enable or disable gvnic in the node pool. - spot (bool): - Spot flag for enabling Spot VM, which is a - rebrand of the existing preemptible flag. - confidential_nodes (google.cloud.container_v1.types.ConfidentialNodes): - Confidential nodes config. - All the nodes in the node pool will be - Confidential VM once enabled. - fast_socket (google.cloud.container_v1.types.FastSocket): - Enable or disable NCCL fast socket for the - node pool. - - This field is a member of `oneof`_ ``_fast_socket``. - resource_labels (MutableMapping[str, str]): - The resource labels for the node pool to use - to annotate any related Google Compute Engine - resources. - logging_config (google.cloud.container_v1.types.NodePoolLoggingConfig): - Logging configuration. - windows_node_config (google.cloud.container_v1.types.WindowsNodeConfig): - Parameters that can be configured on Windows - nodes. - local_nvme_ssd_block_config (google.cloud.container_v1.types.LocalNvmeSsdBlockConfig): - Parameters for using raw-block Local NVMe - SSDs. - ephemeral_storage_local_ssd_config (google.cloud.container_v1.types.EphemeralStorageLocalSsdConfig): - Parameters for the node ephemeral storage - using Local SSDs. If unspecified, ephemeral - storage is backed by the boot disk. - sole_tenant_config (google.cloud.container_v1.types.SoleTenantConfig): - Parameters for node pools to be backed by - shared sole tenant node groups. - containerd_config (google.cloud.container_v1.types.ContainerdConfig): - Parameters for containerd customization. - resource_manager_tags (google.cloud.container_v1.types.ResourceManagerTags): - A map of resource manager tag keys and values - to be attached to the nodes. - enable_confidential_storage (bool): - Optional. Reserved for future use. - secondary_boot_disks (MutableSequence[google.cloud.container_v1.types.SecondaryBootDisk]): - List of secondary boot disks attached to the - nodes. - storage_pools (MutableSequence[str]): - List of Storage Pools where boot disks are - provisioned. - secondary_boot_disk_update_strategy (google.cloud.container_v1.types.SecondaryBootDiskUpdateStrategy): - Secondary boot disk update strategy. - - This field is a member of `oneof`_ ``_secondary_boot_disk_update_strategy``. - local_ssd_encryption_mode (google.cloud.container_v1.types.NodeConfig.LocalSsdEncryptionMode): - Specifies which method should be used for - encrypting the Local SSDs attahced to the node. - - This field is a member of `oneof`_ ``_local_ssd_encryption_mode``. - effective_cgroup_mode (google.cloud.container_v1.types.NodeConfig.EffectiveCgroupMode): - Output only. effective_cgroup_mode is the cgroup mode - actually used by the node pool. It is determined by the - cgroup mode specified in the LinuxNodeConfig or the default - cgroup mode based on the cluster creation version. - """ - class LocalSsdEncryptionMode(proto.Enum): - r"""LocalSsdEncryptionMode specifies the method used for - encrypting the Local SSDs attached to the node. - - Values: - LOCAL_SSD_ENCRYPTION_MODE_UNSPECIFIED (0): - The given node will be encrypted using keys - managed by Google infrastructure and the keys - will be deleted when the node is deleted. - STANDARD_ENCRYPTION (1): - The given node will be encrypted using keys - managed by Google infrastructure and the keys - will be deleted when the node is deleted. - EPHEMERAL_KEY_ENCRYPTION (2): - The given node will opt-in for using - ephemeral key for encryption of Local SSDs. - The Local SSDs will not be able to recover data - in case of node crash. - """ - LOCAL_SSD_ENCRYPTION_MODE_UNSPECIFIED = 0 - STANDARD_ENCRYPTION = 1 - EPHEMERAL_KEY_ENCRYPTION = 2 - - class EffectiveCgroupMode(proto.Enum): - r"""Possible effective cgroup modes for the node. - - Values: - EFFECTIVE_CGROUP_MODE_UNSPECIFIED (0): - EFFECTIVE_CGROUP_MODE_UNSPECIFIED means the cgroup - configuration for the node pool is unspecified, i.e. the - node pool is a Windows node pool. - EFFECTIVE_CGROUP_MODE_V1 (1): - CGROUP_MODE_V1 means the node pool is configured to use - cgroupv1 for the cgroup configuration. - EFFECTIVE_CGROUP_MODE_V2 (2): - CGROUP_MODE_V2 means the node pool is configured to use - cgroupv2 for the cgroup configuration. - """ - EFFECTIVE_CGROUP_MODE_UNSPECIFIED = 0 - EFFECTIVE_CGROUP_MODE_V1 = 1 - EFFECTIVE_CGROUP_MODE_V2 = 2 - - machine_type: str = proto.Field( - proto.STRING, - number=1, - ) - disk_size_gb: int = proto.Field( - proto.INT32, - number=2, - ) - oauth_scopes: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - service_account: str = proto.Field( - proto.STRING, - number=9, - ) - metadata: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - image_type: str = proto.Field( - proto.STRING, - number=5, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=6, - ) - local_ssd_count: int = proto.Field( - proto.INT32, - number=7, - ) - tags: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=8, - ) - preemptible: bool = proto.Field( - proto.BOOL, - number=10, - ) - accelerators: MutableSequence['AcceleratorConfig'] = proto.RepeatedField( - proto.MESSAGE, - number=11, - message='AcceleratorConfig', - ) - disk_type: str = proto.Field( - proto.STRING, - number=12, - ) - min_cpu_platform: str = proto.Field( - proto.STRING, - number=13, - ) - workload_metadata_config: 'WorkloadMetadataConfig' = proto.Field( - proto.MESSAGE, - number=14, - message='WorkloadMetadataConfig', - ) - taints: MutableSequence['NodeTaint'] = proto.RepeatedField( - proto.MESSAGE, - number=15, - message='NodeTaint', - ) - sandbox_config: 'SandboxConfig' = proto.Field( - proto.MESSAGE, - number=17, - message='SandboxConfig', - ) - node_group: str = proto.Field( - proto.STRING, - number=18, - ) - reservation_affinity: 'ReservationAffinity' = proto.Field( - proto.MESSAGE, - number=19, - message='ReservationAffinity', - ) - shielded_instance_config: 'ShieldedInstanceConfig' = proto.Field( - proto.MESSAGE, - number=20, - message='ShieldedInstanceConfig', - ) - linux_node_config: 'LinuxNodeConfig' = proto.Field( - proto.MESSAGE, - number=21, - message='LinuxNodeConfig', - ) - kubelet_config: 'NodeKubeletConfig' = proto.Field( - proto.MESSAGE, - number=22, - message='NodeKubeletConfig', - ) - boot_disk_kms_key: str = proto.Field( - proto.STRING, - number=23, - ) - gcfs_config: 'GcfsConfig' = proto.Field( - proto.MESSAGE, - number=25, - message='GcfsConfig', - ) - advanced_machine_features: 'AdvancedMachineFeatures' = proto.Field( - proto.MESSAGE, - number=26, - message='AdvancedMachineFeatures', - ) - gvnic: 'VirtualNIC' = proto.Field( - proto.MESSAGE, - number=29, - message='VirtualNIC', - ) - spot: bool = proto.Field( - proto.BOOL, - number=32, - ) - confidential_nodes: 'ConfidentialNodes' = proto.Field( - proto.MESSAGE, - number=35, - message='ConfidentialNodes', - ) - fast_socket: 'FastSocket' = proto.Field( - proto.MESSAGE, - number=36, - optional=True, - message='FastSocket', - ) - resource_labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=37, - ) - logging_config: 'NodePoolLoggingConfig' = proto.Field( - proto.MESSAGE, - number=38, - message='NodePoolLoggingConfig', - ) - windows_node_config: 'WindowsNodeConfig' = proto.Field( - proto.MESSAGE, - number=39, - message='WindowsNodeConfig', - ) - local_nvme_ssd_block_config: 'LocalNvmeSsdBlockConfig' = proto.Field( - proto.MESSAGE, - number=40, - message='LocalNvmeSsdBlockConfig', - ) - ephemeral_storage_local_ssd_config: 'EphemeralStorageLocalSsdConfig' = proto.Field( - proto.MESSAGE, - number=41, - message='EphemeralStorageLocalSsdConfig', - ) - sole_tenant_config: 'SoleTenantConfig' = proto.Field( - proto.MESSAGE, - number=42, - message='SoleTenantConfig', - ) - containerd_config: 'ContainerdConfig' = proto.Field( - proto.MESSAGE, - number=43, - message='ContainerdConfig', - ) - resource_manager_tags: 'ResourceManagerTags' = proto.Field( - proto.MESSAGE, - number=45, - message='ResourceManagerTags', - ) - enable_confidential_storage: bool = proto.Field( - proto.BOOL, - number=46, - ) - secondary_boot_disks: MutableSequence['SecondaryBootDisk'] = proto.RepeatedField( - proto.MESSAGE, - number=48, - message='SecondaryBootDisk', - ) - storage_pools: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=49, - ) - secondary_boot_disk_update_strategy: 'SecondaryBootDiskUpdateStrategy' = proto.Field( - proto.MESSAGE, - number=50, - optional=True, - message='SecondaryBootDiskUpdateStrategy', - ) - local_ssd_encryption_mode: LocalSsdEncryptionMode = proto.Field( - proto.ENUM, - number=54, - optional=True, - enum=LocalSsdEncryptionMode, - ) - effective_cgroup_mode: EffectiveCgroupMode = proto.Field( - proto.ENUM, - number=55, - enum=EffectiveCgroupMode, - ) - - -class AdvancedMachineFeatures(proto.Message): - r"""Specifies options for controlling advanced machine features. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - threads_per_core (int): - The number of threads per physical core. To - disable simultaneous multithreading (SMT) set - this to 1. If unset, the maximum number of - threads supported per core by the underlying - processor is assumed. - - This field is a member of `oneof`_ ``_threads_per_core``. - enable_nested_virtualization (bool): - Whether or not to enable nested - virtualization (defaults to false). - - This field is a member of `oneof`_ ``_enable_nested_virtualization``. - """ - - threads_per_core: int = proto.Field( - proto.INT64, - number=1, - optional=True, - ) - enable_nested_virtualization: bool = proto.Field( - proto.BOOL, - number=2, - optional=True, - ) - - -class NodeNetworkConfig(proto.Message): - r"""Parameters for node pool-level network config. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - create_pod_range (bool): - Input only. Whether to create a new range for pod IPs in - this node pool. Defaults are provided for ``pod_range`` and - ``pod_ipv4_cidr_block`` if they are not specified. - - If neither ``create_pod_range`` or ``pod_range`` are - specified, the cluster-level default - (``ip_allocation_policy.cluster_ipv4_cidr_block``) is used. - - Only applicable if ``ip_allocation_policy.use_ip_aliases`` - is true. - - This field cannot be changed after the node pool has been - created. - pod_range (str): - The ID of the secondary range for pod IPs. If - ``create_pod_range`` is true, this ID is used for the new - range. If ``create_pod_range`` is false, uses an existing - secondary range with this ID. - - Only applicable if ``ip_allocation_policy.use_ip_aliases`` - is true. - - This field cannot be changed after the node pool has been - created. - pod_ipv4_cidr_block (str): - The IP address range for pod IPs in this node pool. - - Only applicable if ``create_pod_range`` is true. - - Set to blank to have a range chosen with the default size. - - Set to /netmask (e.g. ``/14``) to have a range chosen with a - specific netmask. - - Set to a - `CIDR `__ - notation (e.g. ``10.96.0.0/14``) to pick a specific range to - use. - - Only applicable if ``ip_allocation_policy.use_ip_aliases`` - is true. - - This field cannot be changed after the node pool has been - created. - enable_private_nodes (bool): - Whether nodes have internal IP addresses only. If - enable_private_nodes is not specified, then the value is - derived from - [Cluster.NetworkConfig.default_enable_private_nodes][] - - This field is a member of `oneof`_ ``_enable_private_nodes``. - network_performance_config (google.cloud.container_v1.types.NodeNetworkConfig.NetworkPerformanceConfig): - Network bandwidth tier configuration. - - This field is a member of `oneof`_ ``_network_performance_config``. - pod_cidr_overprovision_config (google.cloud.container_v1.types.PodCIDROverprovisionConfig): - [PRIVATE FIELD] Pod CIDR size overprovisioning config for - the nodepool. - - Pod CIDR size per node depends on max_pods_per_node. By - default, the value of max_pods_per_node is rounded off to - next power of 2 and we then double that to get the size of - pod CIDR block per node. Example: max_pods_per_node of 30 - would result in 64 IPs (/26). - - This config can disable the doubling of IPs (we still round - off to next power of 2) Example: max_pods_per_node of 30 - will result in 32 IPs (/27) when overprovisioning is - disabled. - additional_node_network_configs (MutableSequence[google.cloud.container_v1.types.AdditionalNodeNetworkConfig]): - We specify the additional node networks for - this node pool using this list. Each node - network corresponds to an additional interface - additional_pod_network_configs (MutableSequence[google.cloud.container_v1.types.AdditionalPodNetworkConfig]): - We specify the additional pod networks for - this node pool using this list. Each pod network - corresponds to an additional alias IP range for - the node - pod_ipv4_range_utilization (float): - Output only. The utilization of the IPv4 range for the pod. - The ratio is Usage/[Total number of IPs in the secondary - range], Usage=numNodes\ *numZones*\ podIPsPerNode. - """ - - class NetworkPerformanceConfig(proto.Message): - r"""Configuration of all network bandwidth tiers - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - total_egress_bandwidth_tier (google.cloud.container_v1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier): - Specifies the total network bandwidth tier - for the NodePool. - - This field is a member of `oneof`_ ``_total_egress_bandwidth_tier``. - """ - class Tier(proto.Enum): - r"""Node network tier - - Values: - TIER_UNSPECIFIED (0): - Default value - TIER_1 (1): - Higher bandwidth, actual values based on VM - size. - """ - TIER_UNSPECIFIED = 0 - TIER_1 = 1 - - total_egress_bandwidth_tier: 'NodeNetworkConfig.NetworkPerformanceConfig.Tier' = proto.Field( - proto.ENUM, - number=1, - optional=True, - enum='NodeNetworkConfig.NetworkPerformanceConfig.Tier', - ) - - create_pod_range: bool = proto.Field( - proto.BOOL, - number=4, - ) - pod_range: str = proto.Field( - proto.STRING, - number=5, - ) - pod_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=6, - ) - enable_private_nodes: bool = proto.Field( - proto.BOOL, - number=9, - optional=True, - ) - network_performance_config: NetworkPerformanceConfig = proto.Field( - proto.MESSAGE, - number=11, - optional=True, - message=NetworkPerformanceConfig, - ) - pod_cidr_overprovision_config: 'PodCIDROverprovisionConfig' = proto.Field( - proto.MESSAGE, - number=13, - message='PodCIDROverprovisionConfig', - ) - additional_node_network_configs: MutableSequence['AdditionalNodeNetworkConfig'] = proto.RepeatedField( - proto.MESSAGE, - number=14, - message='AdditionalNodeNetworkConfig', - ) - additional_pod_network_configs: MutableSequence['AdditionalPodNetworkConfig'] = proto.RepeatedField( - proto.MESSAGE, - number=15, - message='AdditionalPodNetworkConfig', - ) - pod_ipv4_range_utilization: float = proto.Field( - proto.DOUBLE, - number=16, - ) - - -class AdditionalNodeNetworkConfig(proto.Message): - r"""AdditionalNodeNetworkConfig is the configuration for - additional node networks within the NodeNetworkConfig message - - Attributes: - network (str): - Name of the VPC where the additional - interface belongs - subnetwork (str): - Name of the subnetwork where the additional - interface belongs - """ - - network: str = proto.Field( - proto.STRING, - number=1, - ) - subnetwork: str = proto.Field( - proto.STRING, - number=2, - ) - - -class AdditionalPodNetworkConfig(proto.Message): - r"""AdditionalPodNetworkConfig is the configuration for - additional pod networks within the NodeNetworkConfig message - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - subnetwork (str): - Name of the subnetwork where the additional - pod network belongs. - secondary_pod_range (str): - The name of the secondary range on the subnet - which provides IP address for this pod range. - max_pods_per_node (google.cloud.container_v1.types.MaxPodsConstraint): - The maximum number of pods per node which use - this pod network. - - This field is a member of `oneof`_ ``_max_pods_per_node``. - """ - - subnetwork: str = proto.Field( - proto.STRING, - number=1, - ) - secondary_pod_range: str = proto.Field( - proto.STRING, - number=2, - ) - max_pods_per_node: 'MaxPodsConstraint' = proto.Field( - proto.MESSAGE, - number=3, - optional=True, - message='MaxPodsConstraint', - ) - - -class ShieldedInstanceConfig(proto.Message): - r"""A set of Shielded Instance options. - - Attributes: - enable_secure_boot (bool): - Defines whether the instance has Secure Boot - enabled. - Secure Boot helps ensure that the system only - runs authentic software by verifying the digital - signature of all boot components, and halting - the boot process if signature verification - fails. - enable_integrity_monitoring (bool): - Defines whether the instance has integrity - monitoring enabled. - Enables monitoring and attestation of the boot - integrity of the instance. The attestation is - performed against the integrity policy baseline. - This baseline is initially derived from the - implicitly trusted boot image when the instance - is created. - """ - - enable_secure_boot: bool = proto.Field( - proto.BOOL, - number=1, - ) - enable_integrity_monitoring: bool = proto.Field( - proto.BOOL, - number=2, - ) - - -class SandboxConfig(proto.Message): - r"""SandboxConfig contains configurations of the sandbox to use - for the node. - - Attributes: - type_ (google.cloud.container_v1.types.SandboxConfig.Type): - Type of the sandbox to use for the node. - """ - class Type(proto.Enum): - r"""Possible types of sandboxes. - - Values: - UNSPECIFIED (0): - Default value. This should not be used. - GVISOR (1): - Run sandbox using gvisor. - """ - UNSPECIFIED = 0 - GVISOR = 1 - - type_: Type = proto.Field( - proto.ENUM, - number=2, - enum=Type, - ) - - -class GcfsConfig(proto.Message): - r"""GcfsConfig contains configurations of Google Container File - System (image streaming). - - Attributes: - enabled (bool): - Whether to use GCFS. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class ReservationAffinity(proto.Message): - r"""`ReservationAffinity `__ - is the configuration of desired reservation which instances could - take capacity from. - - Attributes: - consume_reservation_type (google.cloud.container_v1.types.ReservationAffinity.Type): - Corresponds to the type of reservation - consumption. - key (str): - Corresponds to the label key of a reservation resource. To - target a SPECIFIC_RESERVATION by name, specify - "compute.googleapis.com/reservation-name" as the key and - specify the name of your reservation as its value. - values (MutableSequence[str]): - Corresponds to the label value(s) of - reservation resource(s). - """ - class Type(proto.Enum): - r"""Indicates whether to consume capacity from a reservation or - not. - - Values: - UNSPECIFIED (0): - Default value. This should not be used. - NO_RESERVATION (1): - Do not consume from any reserved capacity. - ANY_RESERVATION (2): - Consume any reservation available. - SPECIFIC_RESERVATION (3): - Must consume from a specific reservation. - Must specify key value fields for specifying the - reservations. - """ - UNSPECIFIED = 0 - NO_RESERVATION = 1 - ANY_RESERVATION = 2 - SPECIFIC_RESERVATION = 3 - - consume_reservation_type: Type = proto.Field( - proto.ENUM, - number=1, - enum=Type, - ) - key: str = proto.Field( - proto.STRING, - number=2, - ) - values: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class SoleTenantConfig(proto.Message): - r"""SoleTenantConfig contains the NodeAffinities to specify what - shared sole tenant node groups should back the node pool. - - Attributes: - node_affinities (MutableSequence[google.cloud.container_v1.types.SoleTenantConfig.NodeAffinity]): - NodeAffinities used to match to a shared sole - tenant node group. - """ - - class NodeAffinity(proto.Message): - r"""Specifies the NodeAffinity key, values, and affinity operator - according to `shared sole tenant node group - affinities `__. - - Attributes: - key (str): - Key for NodeAffinity. - operator (google.cloud.container_v1.types.SoleTenantConfig.NodeAffinity.Operator): - Operator for NodeAffinity. - values (MutableSequence[str]): - Values for NodeAffinity. - """ - class Operator(proto.Enum): - r"""Operator allows user to specify affinity or anti-affinity for - the given key values. - - Values: - OPERATOR_UNSPECIFIED (0): - Invalid or unspecified affinity operator. - IN (1): - Affinity operator. - NOT_IN (2): - Anti-affinity operator. - """ - OPERATOR_UNSPECIFIED = 0 - IN = 1 - NOT_IN = 2 - - key: str = proto.Field( - proto.STRING, - number=1, - ) - operator: 'SoleTenantConfig.NodeAffinity.Operator' = proto.Field( - proto.ENUM, - number=2, - enum='SoleTenantConfig.NodeAffinity.Operator', - ) - values: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - node_affinities: MutableSequence[NodeAffinity] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=NodeAffinity, - ) - - -class ContainerdConfig(proto.Message): - r"""ContainerdConfig contains configuration to customize - containerd. - - Attributes: - private_registry_access_config (google.cloud.container_v1.types.ContainerdConfig.PrivateRegistryAccessConfig): - PrivateRegistryAccessConfig is used to - configure access configuration for private - container registries. - """ - - class PrivateRegistryAccessConfig(proto.Message): - r"""PrivateRegistryAccessConfig contains access configuration for - private container registries. - - Attributes: - enabled (bool): - Private registry access is enabled. - certificate_authority_domain_config (MutableSequence[google.cloud.container_v1.types.ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig]): - Private registry access configuration. - """ - - class CertificateAuthorityDomainConfig(proto.Message): - r"""CertificateAuthorityDomainConfig configures one or more fully - qualified domain names (FQDN) to a specific certificate. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - fqdns (MutableSequence[str]): - List of fully qualified domain names (FQDN). - Specifying port is supported. - Wilcards are NOT supported. - Examples: - - - my.customdomain.com - - 10.0.1.2:5000 - gcp_secret_manager_certificate_config (google.cloud.container_v1.types.ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig.GCPSecretManagerCertificateConfig): - Google Secret Manager (GCP) certificate - configuration. - - This field is a member of `oneof`_ ``certificate_config``. - """ - - class GCPSecretManagerCertificateConfig(proto.Message): - r"""GCPSecretManagerCertificateConfig configures a secret from `Google - Secret Manager `__. - - Attributes: - secret_uri (str): - Secret URI, in the form - "projects/$PROJECT_ID/secrets/$SECRET_NAME/versions/$VERSION". - Version can be fixed (e.g. "2") or "latest". - """ - - secret_uri: str = proto.Field( - proto.STRING, - number=1, - ) - - fqdns: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - gcp_secret_manager_certificate_config: 'ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig.GCPSecretManagerCertificateConfig' = proto.Field( - proto.MESSAGE, - number=2, - oneof='certificate_config', - message='ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig.GCPSecretManagerCertificateConfig', - ) - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - certificate_authority_domain_config: MutableSequence['ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig', - ) - - private_registry_access_config: PrivateRegistryAccessConfig = proto.Field( - proto.MESSAGE, - number=1, - message=PrivateRegistryAccessConfig, - ) - - -class NodeTaint(proto.Message): - r"""Kubernetes taint is composed of three fields: key, value, and - effect. Effect can only be one of three types: NoSchedule, - PreferNoSchedule or NoExecute. - - See - `here `__ - for more information, including usage and the valid values. - - Attributes: - key (str): - Key for taint. - value (str): - Value for taint. - effect (google.cloud.container_v1.types.NodeTaint.Effect): - Effect for taint. - """ - class Effect(proto.Enum): - r"""Possible values for Effect in taint. - - Values: - EFFECT_UNSPECIFIED (0): - Not set - NO_SCHEDULE (1): - NoSchedule - PREFER_NO_SCHEDULE (2): - PreferNoSchedule - NO_EXECUTE (3): - NoExecute - """ - EFFECT_UNSPECIFIED = 0 - NO_SCHEDULE = 1 - PREFER_NO_SCHEDULE = 2 - NO_EXECUTE = 3 - - key: str = proto.Field( - proto.STRING, - number=1, - ) - value: str = proto.Field( - proto.STRING, - number=2, - ) - effect: Effect = proto.Field( - proto.ENUM, - number=3, - enum=Effect, - ) - - -class NodeTaints(proto.Message): - r"""Collection of Kubernetes `node - taints `__. - - Attributes: - taints (MutableSequence[google.cloud.container_v1.types.NodeTaint]): - List of node taints. - """ - - taints: MutableSequence['NodeTaint'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='NodeTaint', - ) - - -class NodeLabels(proto.Message): - r"""Collection of node-level `Kubernetes - labels `__. - - Attributes: - labels (MutableMapping[str, str]): - Map of node label keys and node label values. - """ - - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=1, - ) - - -class ResourceLabels(proto.Message): - r"""Collection of `GCP - labels `__. - - Attributes: - labels (MutableMapping[str, str]): - Map of node label keys and node label values. - """ - - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=1, - ) - - -class NetworkTags(proto.Message): - r"""Collection of Compute Engine network tags that can be applied - to a node's underlying VM instance. - - Attributes: - tags (MutableSequence[str]): - List of network tags. - """ - - tags: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - - -class MasterAuth(proto.Message): - r"""The authentication information for accessing the master - endpoint. Authentication can be done using HTTP basic auth or - using client certificates. - - Attributes: - username (str): - The username to use for HTTP basic - authentication to the master endpoint. For - clusters v1.6.0 and later, basic authentication - can be disabled by leaving username unspecified - (or setting it to the empty string). - - Warning: basic authentication is deprecated, and - will be removed in GKE control plane versions - 1.19 and newer. For a list of recommended - authentication methods, see: - - https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication - password (str): - The password to use for HTTP basic - authentication to the master endpoint. Because - the master endpoint is open to the Internet, you - should create a strong password. If a password - is provided for cluster creation, username must - be non-empty. - - Warning: basic authentication is deprecated, and - will be removed in GKE control plane versions - 1.19 and newer. For a list of recommended - authentication methods, see: - - https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication - client_certificate_config (google.cloud.container_v1.types.ClientCertificateConfig): - Configuration for client certificate - authentication on the cluster. For clusters - before v1.12, if no configuration is specified, - a client certificate is issued. - cluster_ca_certificate (str): - Output only. Base64-encoded public - certificate that is the root of trust for the - cluster. - client_certificate (str): - Output only. Base64-encoded public certificate used by - clients to authenticate to the cluster endpoint. Issued only - if client_certificate_config is set. - client_key (str): - Output only. Base64-encoded private key used - by clients to authenticate to the cluster - endpoint. - """ - - username: str = proto.Field( - proto.STRING, - number=1, - ) - password: str = proto.Field( - proto.STRING, - number=2, - ) - client_certificate_config: 'ClientCertificateConfig' = proto.Field( - proto.MESSAGE, - number=3, - message='ClientCertificateConfig', - ) - cluster_ca_certificate: str = proto.Field( - proto.STRING, - number=100, - ) - client_certificate: str = proto.Field( - proto.STRING, - number=101, - ) - client_key: str = proto.Field( - proto.STRING, - number=102, - ) - - -class ClientCertificateConfig(proto.Message): - r"""Configuration for client certificates on the cluster. - - Attributes: - issue_client_certificate (bool): - Issue a client certificate. - """ - - issue_client_certificate: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class AddonsConfig(proto.Message): - r"""Configuration for the addons that can be automatically spun - up in the cluster, enabling additional functionality. - - Attributes: - http_load_balancing (google.cloud.container_v1.types.HttpLoadBalancing): - Configuration for the HTTP (L7) load - balancing controller addon, which makes it easy - to set up HTTP load balancers for services in a - cluster. - horizontal_pod_autoscaling (google.cloud.container_v1.types.HorizontalPodAutoscaling): - Configuration for the horizontal pod - autoscaling feature, which increases or - decreases the number of replica pods a - replication controller has based on the resource - usage of the existing pods. - kubernetes_dashboard (google.cloud.container_v1.types.KubernetesDashboard): - Configuration for the Kubernetes Dashboard. - This addon is deprecated, and will be disabled - in 1.15. It is recommended to use the Cloud - Console to manage and monitor your Kubernetes - clusters, workloads and applications. For more - information, see: - - https://cloud.google.com/kubernetes-engine/docs/concepts/dashboards - network_policy_config (google.cloud.container_v1.types.NetworkPolicyConfig): - Configuration for NetworkPolicy. This only - tracks whether the addon is enabled or not on - the Master, it does not track whether network - policy is enabled for the nodes. - cloud_run_config (google.cloud.container_v1.types.CloudRunConfig): - Configuration for the Cloud Run addon, which - allows the user to use a managed Knative - service. - dns_cache_config (google.cloud.container_v1.types.DnsCacheConfig): - Configuration for NodeLocalDNS, a dns cache - running on cluster nodes - config_connector_config (google.cloud.container_v1.types.ConfigConnectorConfig): - Configuration for the ConfigConnector add-on, - a Kubernetes extension to manage hosted GCP - services through the Kubernetes API - gce_persistent_disk_csi_driver_config (google.cloud.container_v1.types.GcePersistentDiskCsiDriverConfig): - Configuration for the Compute Engine - Persistent Disk CSI driver. - gcp_filestore_csi_driver_config (google.cloud.container_v1.types.GcpFilestoreCsiDriverConfig): - Configuration for the GCP Filestore CSI - driver. - gke_backup_agent_config (google.cloud.container_v1.types.GkeBackupAgentConfig): - Configuration for the Backup for GKE agent - addon. - gcs_fuse_csi_driver_config (google.cloud.container_v1.types.GcsFuseCsiDriverConfig): - Configuration for the Cloud Storage Fuse CSI - driver. - stateful_ha_config (google.cloud.container_v1.types.StatefulHAConfig): - Optional. Configuration for the StatefulHA - add-on. - parallelstore_csi_driver_config (google.cloud.container_v1.types.ParallelstoreCsiDriverConfig): - Configuration for the Cloud Storage - Parallelstore CSI driver. - ray_operator_config (google.cloud.container_v1.types.RayOperatorConfig): - Optional. Configuration for Ray Operator - addon. - """ - - http_load_balancing: 'HttpLoadBalancing' = proto.Field( - proto.MESSAGE, - number=1, - message='HttpLoadBalancing', - ) - horizontal_pod_autoscaling: 'HorizontalPodAutoscaling' = proto.Field( - proto.MESSAGE, - number=2, - message='HorizontalPodAutoscaling', - ) - kubernetes_dashboard: 'KubernetesDashboard' = proto.Field( - proto.MESSAGE, - number=3, - message='KubernetesDashboard', - ) - network_policy_config: 'NetworkPolicyConfig' = proto.Field( - proto.MESSAGE, - number=4, - message='NetworkPolicyConfig', - ) - cloud_run_config: 'CloudRunConfig' = proto.Field( - proto.MESSAGE, - number=7, - message='CloudRunConfig', - ) - dns_cache_config: 'DnsCacheConfig' = proto.Field( - proto.MESSAGE, - number=8, - message='DnsCacheConfig', - ) - config_connector_config: 'ConfigConnectorConfig' = proto.Field( - proto.MESSAGE, - number=10, - message='ConfigConnectorConfig', - ) - gce_persistent_disk_csi_driver_config: 'GcePersistentDiskCsiDriverConfig' = proto.Field( - proto.MESSAGE, - number=11, - message='GcePersistentDiskCsiDriverConfig', - ) - gcp_filestore_csi_driver_config: 'GcpFilestoreCsiDriverConfig' = proto.Field( - proto.MESSAGE, - number=14, - message='GcpFilestoreCsiDriverConfig', - ) - gke_backup_agent_config: 'GkeBackupAgentConfig' = proto.Field( - proto.MESSAGE, - number=16, - message='GkeBackupAgentConfig', - ) - gcs_fuse_csi_driver_config: 'GcsFuseCsiDriverConfig' = proto.Field( - proto.MESSAGE, - number=17, - message='GcsFuseCsiDriverConfig', - ) - stateful_ha_config: 'StatefulHAConfig' = proto.Field( - proto.MESSAGE, - number=18, - message='StatefulHAConfig', - ) - parallelstore_csi_driver_config: 'ParallelstoreCsiDriverConfig' = proto.Field( - proto.MESSAGE, - number=19, - message='ParallelstoreCsiDriverConfig', - ) - ray_operator_config: 'RayOperatorConfig' = proto.Field( - proto.MESSAGE, - number=21, - message='RayOperatorConfig', - ) - - -class HttpLoadBalancing(proto.Message): - r"""Configuration options for the HTTP (L7) load balancing - controller addon, which makes it easy to set up HTTP load - balancers for services in a cluster. - - Attributes: - disabled (bool): - Whether the HTTP Load Balancing controller is - enabled in the cluster. When enabled, it runs a - small pod in the cluster that manages the load - balancers. - """ - - disabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class HorizontalPodAutoscaling(proto.Message): - r"""Configuration options for the horizontal pod autoscaling - feature, which increases or decreases the number of replica pods - a replication controller has based on the resource usage of the - existing pods. - - Attributes: - disabled (bool): - Whether the Horizontal Pod Autoscaling - feature is enabled in the cluster. When enabled, - it ensures that metrics are collected into - Stackdriver Monitoring. - """ - - disabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class KubernetesDashboard(proto.Message): - r"""Configuration for the Kubernetes Dashboard. - - Attributes: - disabled (bool): - Whether the Kubernetes Dashboard is enabled - for this cluster. - """ - - disabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class NetworkPolicyConfig(proto.Message): - r"""Configuration for NetworkPolicy. This only tracks whether the - addon is enabled or not on the Master, it does not track whether - network policy is enabled for the nodes. - - Attributes: - disabled (bool): - Whether NetworkPolicy is enabled for this - cluster. - """ - - disabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class DnsCacheConfig(proto.Message): - r"""Configuration for NodeLocal DNSCache - - Attributes: - enabled (bool): - Whether NodeLocal DNSCache is enabled for - this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class PrivateClusterMasterGlobalAccessConfig(proto.Message): - r"""Configuration for controlling master global access settings. - - Attributes: - enabled (bool): - Whenever master is accessible globally or - not. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class PrivateClusterConfig(proto.Message): - r"""Configuration options for private clusters. - - Attributes: - enable_private_nodes (bool): - Whether nodes have internal IP addresses only. If enabled, - all nodes are given only RFC 1918 private addresses and - communicate with the master via private networking. - - Deprecated: Use - [NetworkConfig.default_enable_private_nodes][google.container.v1.NetworkConfig.default_enable_private_nodes] - instead. - enable_private_endpoint (bool): - Whether the master's internal IP address is used as the - cluster endpoint. - - Deprecated: Use - [ControlPlaneEndpointsConfig.IPEndpointsConfig.enable_public_endpoint][google.container.v1.ControlPlaneEndpointsConfig.IPEndpointsConfig.enable_public_endpoint] - instead. Note that the value of enable_public_endpoint is - reversed: if enable_private_endpoint is false, then - enable_public_endpoint will be true. - master_ipv4_cidr_block (str): - The IP range in CIDR notation to use for the - hosted master network. This range will be used - for assigning internal IP addresses to the - master or set of masters, as well as the ILB - VIP. This range must not overlap with any other - ranges in use within the cluster's network. - private_endpoint (str): - Output only. The internal IP address of this cluster's - master endpoint. - - Deprecated: Use - [ControlPlaneEndpointsConfig.IPEndpointsConfig.private_endpoint][google.container.v1.ControlPlaneEndpointsConfig.IPEndpointsConfig.private_endpoint] - instead. - public_endpoint (str): - Output only. The external IP address of this cluster's - master endpoint. - - Deprecated:Use - [ControlPlaneEndpointsConfig.IPEndpointsConfig.public_endpoint][google.container.v1.ControlPlaneEndpointsConfig.IPEndpointsConfig.public_endpoint] - instead. - peering_name (str): - Output only. The peering name in the customer - VPC used by this cluster. - master_global_access_config (google.cloud.container_v1.types.PrivateClusterMasterGlobalAccessConfig): - Controls master global access settings. - - Deprecated: Use - [ControlPlaneEndpointsConfig.IPEndpointsConfig.enable_global_access][] - instead. - private_endpoint_subnetwork (str): - Subnet to provision the master's private endpoint during - cluster creation. Specified in - projects/\ */regions/*/subnetworks/\* format. - - Deprecated: Use - [ControlPlaneEndpointsConfig.IPEndpointsConfig.private_endpoint_subnetwork][google.container.v1.ControlPlaneEndpointsConfig.IPEndpointsConfig.private_endpoint_subnetwork] - instead. - """ - - enable_private_nodes: bool = proto.Field( - proto.BOOL, - number=1, - ) - enable_private_endpoint: bool = proto.Field( - proto.BOOL, - number=2, - ) - master_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=3, - ) - private_endpoint: str = proto.Field( - proto.STRING, - number=4, - ) - public_endpoint: str = proto.Field( - proto.STRING, - number=5, - ) - peering_name: str = proto.Field( - proto.STRING, - number=7, - ) - master_global_access_config: 'PrivateClusterMasterGlobalAccessConfig' = proto.Field( - proto.MESSAGE, - number=8, - message='PrivateClusterMasterGlobalAccessConfig', - ) - private_endpoint_subnetwork: str = proto.Field( - proto.STRING, - number=10, - ) - - -class AuthenticatorGroupsConfig(proto.Message): - r"""Configuration for returning group information from - authenticators. - - Attributes: - enabled (bool): - Whether this cluster should return group - membership lookups during authentication using a - group of security groups. - security_group (str): - The name of the security group-of-groups to - be used. Only relevant if enabled = true. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - security_group: str = proto.Field( - proto.STRING, - number=2, - ) - - -class CloudRunConfig(proto.Message): - r"""Configuration options for the Cloud Run feature. - - Attributes: - disabled (bool): - Whether Cloud Run addon is enabled for this - cluster. - load_balancer_type (google.cloud.container_v1.types.CloudRunConfig.LoadBalancerType): - Which load balancer type is installed for - Cloud Run. - """ - class LoadBalancerType(proto.Enum): - r"""Load balancer type of ingress service of Cloud Run. - - Values: - LOAD_BALANCER_TYPE_UNSPECIFIED (0): - Load balancer type for Cloud Run is - unspecified. - LOAD_BALANCER_TYPE_EXTERNAL (1): - Install external load balancer for Cloud Run. - LOAD_BALANCER_TYPE_INTERNAL (2): - Install internal load balancer for Cloud Run. - """ - LOAD_BALANCER_TYPE_UNSPECIFIED = 0 - LOAD_BALANCER_TYPE_EXTERNAL = 1 - LOAD_BALANCER_TYPE_INTERNAL = 2 - - disabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - load_balancer_type: LoadBalancerType = proto.Field( - proto.ENUM, - number=3, - enum=LoadBalancerType, - ) - - -class ConfigConnectorConfig(proto.Message): - r"""Configuration options for the Config Connector add-on. - - Attributes: - enabled (bool): - Whether Cloud Connector is enabled for this - cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class GcePersistentDiskCsiDriverConfig(proto.Message): - r"""Configuration for the Compute Engine PD CSI driver. - - Attributes: - enabled (bool): - Whether the Compute Engine PD CSI driver is - enabled for this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class GcpFilestoreCsiDriverConfig(proto.Message): - r"""Configuration for the GCP Filestore CSI driver. - - Attributes: - enabled (bool): - Whether the GCP Filestore CSI driver is - enabled for this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class GcsFuseCsiDriverConfig(proto.Message): - r"""Configuration for the Cloud Storage Fuse CSI driver. - - Attributes: - enabled (bool): - Whether the Cloud Storage Fuse CSI driver is - enabled for this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class ParallelstoreCsiDriverConfig(proto.Message): - r"""Configuration for the Cloud Storage Parallelstore CSI driver. - - Attributes: - enabled (bool): - Whether the Cloud Storage Parallelstore CSI - driver is enabled for this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class RayOperatorConfig(proto.Message): - r"""Configuration options for the Ray Operator add-on. - - Attributes: - enabled (bool): - Whether the Ray Operator addon is enabled for - this cluster. - ray_cluster_logging_config (google.cloud.container_v1.types.RayClusterLoggingConfig): - Optional. Logging configuration for Ray - clusters. - ray_cluster_monitoring_config (google.cloud.container_v1.types.RayClusterMonitoringConfig): - Optional. Monitoring configuration for Ray - clusters. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - ray_cluster_logging_config: 'RayClusterLoggingConfig' = proto.Field( - proto.MESSAGE, - number=2, - message='RayClusterLoggingConfig', - ) - ray_cluster_monitoring_config: 'RayClusterMonitoringConfig' = proto.Field( - proto.MESSAGE, - number=3, - message='RayClusterMonitoringConfig', - ) - - -class GkeBackupAgentConfig(proto.Message): - r"""Configuration for the Backup for GKE Agent. - - Attributes: - enabled (bool): - Whether the Backup for GKE agent is enabled - for this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class StatefulHAConfig(proto.Message): - r"""Configuration for the Stateful HA add-on. - - Attributes: - enabled (bool): - Whether the Stateful HA add-on is enabled for - this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class MasterAuthorizedNetworksConfig(proto.Message): - r"""Configuration options for the master authorized networks - feature. Enabled master authorized networks will disallow all - external traffic to access Kubernetes master through HTTPS - except traffic from the given CIDR blocks, Google Compute Engine - Public IPs and Google Prod IPs. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - enabled (bool): - Whether or not master authorized networks is - enabled. - cidr_blocks (MutableSequence[google.cloud.container_v1.types.MasterAuthorizedNetworksConfig.CidrBlock]): - cidr_blocks define up to 50 external networks that could - access Kubernetes master through HTTPS. - gcp_public_cidrs_access_enabled (bool): - Whether master is accessbile via Google - Compute Engine Public IP addresses. - - This field is a member of `oneof`_ ``_gcp_public_cidrs_access_enabled``. - private_endpoint_enforcement_enabled (bool): - Whether master authorized networks is - enforced on private endpoint or not. - - This field is a member of `oneof`_ ``_private_endpoint_enforcement_enabled``. - """ - - class CidrBlock(proto.Message): - r"""CidrBlock contains an optional name and one CIDR block. - - Attributes: - display_name (str): - display_name is an optional field for users to identify CIDR - blocks. - cidr_block (str): - cidr_block must be specified in CIDR notation. - """ - - display_name: str = proto.Field( - proto.STRING, - number=1, - ) - cidr_block: str = proto.Field( - proto.STRING, - number=2, - ) - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - cidr_blocks: MutableSequence[CidrBlock] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message=CidrBlock, - ) - gcp_public_cidrs_access_enabled: bool = proto.Field( - proto.BOOL, - number=3, - optional=True, - ) - private_endpoint_enforcement_enabled: bool = proto.Field( - proto.BOOL, - number=5, - optional=True, - ) - - -class LegacyAbac(proto.Message): - r"""Configuration for the legacy Attribute Based Access Control - authorization mode. - - Attributes: - enabled (bool): - Whether the ABAC authorizer is enabled for - this cluster. When enabled, identities in the - system, including service accounts, nodes, and - controllers, will have statically granted - permissions beyond those provided by the RBAC - configuration or IAM. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class NetworkPolicy(proto.Message): - r"""Configuration options for the NetworkPolicy feature. - https://kubernetes.io/docs/concepts/services-networking/networkpolicies/ - - Attributes: - provider (google.cloud.container_v1.types.NetworkPolicy.Provider): - The selected network policy provider. - enabled (bool): - Whether network policy is enabled on the - cluster. - """ - class Provider(proto.Enum): - r"""Allowed Network Policy providers. - - Values: - PROVIDER_UNSPECIFIED (0): - Not set - CALICO (1): - Tigera (Calico Felix). - """ - PROVIDER_UNSPECIFIED = 0 - CALICO = 1 - - provider: Provider = proto.Field( - proto.ENUM, - number=1, - enum=Provider, - ) - enabled: bool = proto.Field( - proto.BOOL, - number=2, - ) - - -class BinaryAuthorization(proto.Message): - r"""Configuration for Binary Authorization. - - Attributes: - enabled (bool): - This field is deprecated. Leave this unset and instead - configure BinaryAuthorization using evaluation_mode. If - evaluation_mode is set to anything other than - EVALUATION_MODE_UNSPECIFIED, this field is ignored. - evaluation_mode (google.cloud.container_v1.types.BinaryAuthorization.EvaluationMode): - Mode of operation for binauthz policy - evaluation. If unspecified, defaults to - DISABLED. - """ - class EvaluationMode(proto.Enum): - r"""Binary Authorization mode of operation. - - Values: - EVALUATION_MODE_UNSPECIFIED (0): - Default value - DISABLED (1): - Disable BinaryAuthorization - PROJECT_SINGLETON_POLICY_ENFORCE (2): - Enforce Kubernetes admission requests with - BinaryAuthorization using the project's - singleton policy. This is equivalent to setting - the enabled boolean to true. - """ - EVALUATION_MODE_UNSPECIFIED = 0 - DISABLED = 1 - PROJECT_SINGLETON_POLICY_ENFORCE = 2 - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - evaluation_mode: EvaluationMode = proto.Field( - proto.ENUM, - number=2, - enum=EvaluationMode, - ) - - -class PodCIDROverprovisionConfig(proto.Message): - r"""[PRIVATE FIELD] Config for pod CIDR size overprovisioning. - - Attributes: - disable (bool): - Whether Pod CIDR overprovisioning is - disabled. Note: Pod CIDR overprovisioning is - enabled by default. - """ - - disable: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class IPAllocationPolicy(proto.Message): - r"""Configuration for controlling how IPs are allocated in the - cluster. - - Attributes: - use_ip_aliases (bool): - Whether alias IPs will be used for pod IPs in the cluster. - This is used in conjunction with use_routes. It cannot be - true if use_routes is true. If both use_ip_aliases and - use_routes are false, then the server picks the default IP - allocation mode - create_subnetwork (bool): - Whether a new subnetwork will be created automatically for - the cluster. - - This field is only applicable when ``use_ip_aliases`` is - true. - subnetwork_name (str): - A custom subnetwork name to be used if ``create_subnetwork`` - is true. If this field is empty, then an automatic name will - be chosen for the new subnetwork. - cluster_ipv4_cidr (str): - This field is deprecated, use cluster_ipv4_cidr_block. - node_ipv4_cidr (str): - This field is deprecated, use node_ipv4_cidr_block. - services_ipv4_cidr (str): - This field is deprecated, use services_ipv4_cidr_block. - cluster_secondary_range_name (str): - The name of the secondary range to be used for the cluster - CIDR block. The secondary range will be used for pod IP - addresses. This must be an existing secondary range - associated with the cluster subnetwork. - - This field is only applicable with use_ip_aliases is true - and create_subnetwork is false. - services_secondary_range_name (str): - The name of the secondary range to be used as for the - services CIDR block. The secondary range will be used for - service ClusterIPs. This must be an existing secondary range - associated with the cluster subnetwork. - - This field is only applicable with use_ip_aliases is true - and create_subnetwork is false. - cluster_ipv4_cidr_block (str): - The IP address range for the cluster pod IPs. If this field - is set, then ``cluster.cluster_ipv4_cidr`` must be left - blank. - - This field is only applicable when ``use_ip_aliases`` is - true. - - Set to blank to have a range chosen with the default size. - - Set to /netmask (e.g. ``/14``) to have a range chosen with a - specific netmask. - - Set to a - `CIDR `__ - notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private - networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, - ``192.168.0.0/16``) to pick a specific range to use. - node_ipv4_cidr_block (str): - The IP address range of the instance IPs in this cluster. - - This is applicable only if ``create_subnetwork`` is true. - - Set to blank to have a range chosen with the default size. - - Set to /netmask (e.g. ``/14``) to have a range chosen with a - specific netmask. - - Set to a - `CIDR `__ - notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private - networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, - ``192.168.0.0/16``) to pick a specific range to use. - services_ipv4_cidr_block (str): - The IP address range of the services IPs in this cluster. If - blank, a range will be automatically chosen with the default - size. - - This field is only applicable when ``use_ip_aliases`` is - true. - - Set to blank to have a range chosen with the default size. - - Set to /netmask (e.g. ``/14``) to have a range chosen with a - specific netmask. - - Set to a - `CIDR `__ - notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private - networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, - ``192.168.0.0/16``) to pick a specific range to use. - tpu_ipv4_cidr_block (str): - The IP address range of the Cloud TPUs in this cluster. If - unspecified, a range will be automatically chosen with the - default size. - - This field is only applicable when ``use_ip_aliases`` is - true. - - If unspecified, the range will use the default size. - - Set to /netmask (e.g. ``/14``) to have a range chosen with a - specific netmask. - - Set to a - `CIDR `__ - notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private - networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, - ``192.168.0.0/16``) to pick a specific range to use. - use_routes (bool): - Whether routes will be used for pod IPs in the cluster. This - is used in conjunction with use_ip_aliases. It cannot be - true if use_ip_aliases is true. If both use_ip_aliases and - use_routes are false, then the server picks the default IP - allocation mode - stack_type (google.cloud.container_v1.types.StackType): - The IP stack type of the cluster - ipv6_access_type (google.cloud.container_v1.types.IPv6AccessType): - The ipv6 access type (internal or external) when - create_subnetwork is true - pod_cidr_overprovision_config (google.cloud.container_v1.types.PodCIDROverprovisionConfig): - [PRIVATE FIELD] Pod CIDR size overprovisioning config for - the cluster. - - Pod CIDR size per node depends on max_pods_per_node. By - default, the value of max_pods_per_node is doubled and then - rounded off to next power of 2 to get the size of pod CIDR - block per node. Example: max_pods_per_node of 30 would - result in 64 IPs (/26). - - This config can disable the doubling of IPs (we still round - off to next power of 2) Example: max_pods_per_node of 30 - will result in 32 IPs (/27) when overprovisioning is - disabled. - subnet_ipv6_cidr_block (str): - Output only. The subnet's IPv6 CIDR block - used by nodes and pods. - services_ipv6_cidr_block (str): - Output only. The services IPv6 CIDR block for - the cluster. - additional_pod_ranges_config (google.cloud.container_v1.types.AdditionalPodRangesConfig): - Output only. The additional pod ranges that - are added to the cluster. These pod ranges can - be used by new node pools to allocate pod IPs - automatically. Once the range is removed it will - not show up in IPAllocationPolicy. - default_pod_ipv4_range_utilization (float): - Output only. The utilization of the cluster default IPv4 - range for the pod. The ratio is Usage/[Total number of IPs - in the secondary range], - Usage=numNodes\ *numZones*\ podIPsPerNode. - """ - - use_ip_aliases: bool = proto.Field( - proto.BOOL, - number=1, - ) - create_subnetwork: bool = proto.Field( - proto.BOOL, - number=2, - ) - subnetwork_name: str = proto.Field( - proto.STRING, - number=3, - ) - cluster_ipv4_cidr: str = proto.Field( - proto.STRING, - number=4, - ) - node_ipv4_cidr: str = proto.Field( - proto.STRING, - number=5, - ) - services_ipv4_cidr: str = proto.Field( - proto.STRING, - number=6, - ) - cluster_secondary_range_name: str = proto.Field( - proto.STRING, - number=7, - ) - services_secondary_range_name: str = proto.Field( - proto.STRING, - number=8, - ) - cluster_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=9, - ) - node_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=10, - ) - services_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=11, - ) - tpu_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=13, - ) - use_routes: bool = proto.Field( - proto.BOOL, - number=15, - ) - stack_type: 'StackType' = proto.Field( - proto.ENUM, - number=16, - enum='StackType', - ) - ipv6_access_type: 'IPv6AccessType' = proto.Field( - proto.ENUM, - number=17, - enum='IPv6AccessType', - ) - pod_cidr_overprovision_config: 'PodCIDROverprovisionConfig' = proto.Field( - proto.MESSAGE, - number=21, - message='PodCIDROverprovisionConfig', - ) - subnet_ipv6_cidr_block: str = proto.Field( - proto.STRING, - number=22, - ) - services_ipv6_cidr_block: str = proto.Field( - proto.STRING, - number=23, - ) - additional_pod_ranges_config: 'AdditionalPodRangesConfig' = proto.Field( - proto.MESSAGE, - number=24, - message='AdditionalPodRangesConfig', - ) - default_pod_ipv4_range_utilization: float = proto.Field( - proto.DOUBLE, - number=25, - ) - - -class Cluster(proto.Message): - r"""A Google Kubernetes Engine cluster. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - name (str): - The name of this cluster. The name must be unique within - this project and location (e.g. zone or region), and can be - up to 40 characters with the following restrictions: - - - Lowercase letters, numbers, and hyphens only. - - Must start with a letter. - - Must end with a number or a letter. - description (str): - An optional description of this cluster. - initial_node_count (int): - The number of nodes to create in this cluster. You must - ensure that your Compute Engine `resource - quota `__ is - sufficient for this number of instances. You must also have - available firewall and routes quota. For requests, this - field should only be used in lieu of a "node_pool" object, - since this configuration (along with the "node_config") will - be used to create a "NodePool" object with an auto-generated - name. Do not use this and a node_pool at the same time. - - This field is deprecated, use node_pool.initial_node_count - instead. - node_config (google.cloud.container_v1.types.NodeConfig): - Parameters used in creating the cluster's nodes. For - requests, this field should only be used in lieu of a - "node_pool" object, since this configuration (along with the - "initial_node_count") will be used to create a "NodePool" - object with an auto-generated name. Do not use this and a - node_pool at the same time. For responses, this field will - be populated with the node configuration of the first node - pool. (For configuration of each node pool, see - ``node_pool.config``) - - If unspecified, the defaults are used. This field is - deprecated, use node_pool.config instead. - master_auth (google.cloud.container_v1.types.MasterAuth): - The authentication information for accessing the master - endpoint. If unspecified, the defaults are used: For - clusters before v1.12, if master_auth is unspecified, - ``username`` will be set to "admin", a random password will - be generated, and a client certificate will be issued. - logging_service (str): - The logging service the cluster should use to write logs. - Currently available options: - - - ``logging.googleapis.com/kubernetes`` - The Cloud Logging - service with a Kubernetes-native resource model - - ``logging.googleapis.com`` - The legacy Cloud Logging - service (no longer available as of GKE 1.15). - - ``none`` - no logs will be exported from the cluster. - - If left as an empty - string,\ ``logging.googleapis.com/kubernetes`` will be used - for GKE 1.14+ or ``logging.googleapis.com`` for earlier - versions. - monitoring_service (str): - The monitoring service the cluster should use to write - metrics. Currently available options: - - - "monitoring.googleapis.com/kubernetes" - The Cloud - Monitoring service with a Kubernetes-native resource - model - - ``monitoring.googleapis.com`` - The legacy Cloud - Monitoring service (no longer available as of GKE 1.15). - - ``none`` - No metrics will be exported from the cluster. - - If left as an empty - string,\ ``monitoring.googleapis.com/kubernetes`` will be - used for GKE 1.14+ or ``monitoring.googleapis.com`` for - earlier versions. - network (str): - The name of the Google Compute Engine - `network `__ - to which the cluster is connected. If left unspecified, the - ``default`` network will be used. - cluster_ipv4_cidr (str): - The IP address range of the container pods in this cluster, - in - `CIDR `__ - notation (e.g. ``10.96.0.0/14``). Leave blank to have one - automatically chosen or specify a ``/14`` block in - ``10.0.0.0/8``. - addons_config (google.cloud.container_v1.types.AddonsConfig): - Configurations for the various addons - available to run in the cluster. - subnetwork (str): - The name of the Google Compute Engine - `subnetwork `__ - to which the cluster is connected. - node_pools (MutableSequence[google.cloud.container_v1.types.NodePool]): - The node pools associated with this cluster. This field - should not be set if "node_config" or "initial_node_count" - are specified. - locations (MutableSequence[str]): - The list of Google Compute Engine - `zones `__ - in which the cluster's nodes should be located. - - This field provides a default value if - `NodePool.Locations `__ - are not specified during node pool creation. - - Warning: changing cluster locations will update the - `NodePool.Locations `__ - of all node pools and will result in nodes being added - and/or removed. - enable_kubernetes_alpha (bool): - Kubernetes alpha features are enabled on this - cluster. This includes alpha API groups (e.g. - v1alpha1) and features that may not be - production ready in the kubernetes version of - the master and nodes. The cluster has no SLA for - uptime and master/node upgrades are disabled. - Alpha enabled clusters are automatically deleted - thirty days after creation. - resource_labels (MutableMapping[str, str]): - The resource labels for the cluster to use to - annotate any related Google Compute Engine - resources. - label_fingerprint (str): - The fingerprint of the set of labels for this - cluster. - legacy_abac (google.cloud.container_v1.types.LegacyAbac): - Configuration for the legacy ABAC - authorization mode. - network_policy (google.cloud.container_v1.types.NetworkPolicy): - Configuration options for the NetworkPolicy - feature. - ip_allocation_policy (google.cloud.container_v1.types.IPAllocationPolicy): - Configuration for cluster IP allocation. - master_authorized_networks_config (google.cloud.container_v1.types.MasterAuthorizedNetworksConfig): - The configuration options for master authorized networks - feature. - - Deprecated: Use - [ControlPlaneEndpointsConfig.IPEndpointsConfig.authorized_networks_config][google.container.v1.ControlPlaneEndpointsConfig.IPEndpointsConfig.authorized_networks_config] - instead. - maintenance_policy (google.cloud.container_v1.types.MaintenancePolicy): - Configure the maintenance policy for this - cluster. - binary_authorization (google.cloud.container_v1.types.BinaryAuthorization): - Configuration for Binary Authorization. - autoscaling (google.cloud.container_v1.types.ClusterAutoscaling): - Cluster-level autoscaling configuration. - network_config (google.cloud.container_v1.types.NetworkConfig): - Configuration for cluster networking. - default_max_pods_constraint (google.cloud.container_v1.types.MaxPodsConstraint): - The default constraint on the maximum number - of pods that can be run simultaneously on a node - in the node pool of this cluster. Only honored - if cluster created with IP Alias support. - resource_usage_export_config (google.cloud.container_v1.types.ResourceUsageExportConfig): - Configuration for exporting resource usages. - Resource usage export is disabled when this - config is unspecified. - authenticator_groups_config (google.cloud.container_v1.types.AuthenticatorGroupsConfig): - Configuration controlling RBAC group - membership information. - private_cluster_config (google.cloud.container_v1.types.PrivateClusterConfig): - Configuration for private cluster. - database_encryption (google.cloud.container_v1.types.DatabaseEncryption): - Configuration of etcd encryption. - vertical_pod_autoscaling (google.cloud.container_v1.types.VerticalPodAutoscaling): - Cluster-level Vertical Pod Autoscaling - configuration. - shielded_nodes (google.cloud.container_v1.types.ShieldedNodes): - Shielded Nodes configuration. - release_channel (google.cloud.container_v1.types.ReleaseChannel): - Release channel configuration. If left - unspecified on cluster creation and a version is - specified, the cluster is enrolled in the most - mature release channel where the version is - available (first checking STABLE, then REGULAR, - and finally RAPID). Otherwise, if no release - channel configuration and no version is - specified, the cluster is enrolled in the - REGULAR channel with its default version. - workload_identity_config (google.cloud.container_v1.types.WorkloadIdentityConfig): - Configuration for the use of Kubernetes - Service Accounts in GCP IAM policies. - mesh_certificates (google.cloud.container_v1.types.MeshCertificates): - Configuration for issuance of mTLS keys and - certificates to Kubernetes pods. - cost_management_config (google.cloud.container_v1.types.CostManagementConfig): - Configuration for the fine-grained cost - management feature. - notification_config (google.cloud.container_v1.types.NotificationConfig): - Notification configuration of the cluster. - confidential_nodes (google.cloud.container_v1.types.ConfidentialNodes): - Configuration of Confidential Nodes. - All the nodes in the cluster will be - Confidential VM once enabled. - identity_service_config (google.cloud.container_v1.types.IdentityServiceConfig): - Configuration for Identity Service component. - self_link (str): - Output only. Server-defined URL for the - resource. - zone (str): - Output only. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field is deprecated, use - location instead. - endpoint (str): - Output only. The IP address of this cluster's master - endpoint. The endpoint can be accessed from the internet at - ``https://username:password@endpoint/``. - - See the ``masterAuth`` property of this resource for - username and password information. - initial_cluster_version (str): - The initial Kubernetes version for this - cluster. Valid versions are those found in - validMasterVersions returned by getServerConfig. - The version can be upgraded over time; such - upgrades are reflected in currentMasterVersion - and currentNodeVersion. - - Users may specify either explicit versions - offered by Kubernetes Engine or version aliases, - which have the following behavior: - - - "latest": picks the highest valid Kubernetes - version - - "1.X": picks the highest valid patch+gke.N - patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N patch - in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit Kubernetes - version - - "","-": picks the default Kubernetes version - current_master_version (str): - Output only. The current software version of - the master endpoint. - current_node_version (str): - Output only. Deprecated, use - `NodePools.version `__ - instead. The current version of the node software - components. If they are currently at multiple versions - because they're in the process of being upgraded, this - reflects the minimum version of all nodes. - create_time (str): - Output only. The time the cluster was created, in - `RFC3339 `__ text - format. - status (google.cloud.container_v1.types.Cluster.Status): - Output only. The current status of this - cluster. - status_message (str): - Output only. Deprecated. Use conditions - instead. Additional information about the - current status of this cluster, if available. - node_ipv4_cidr_size (int): - Output only. The size of the address space on each node for - hosting containers. This is provisioned from within the - ``container_ipv4_cidr`` range. This field will only be set - when cluster is in route-based network mode. - services_ipv4_cidr (str): - Output only. The IP address range of the Kubernetes services - in this cluster, in - `CIDR `__ - notation (e.g. ``1.2.3.4/29``). Service addresses are - typically put in the last ``/16`` from the container CIDR. - instance_group_urls (MutableSequence[str]): - Output only. Deprecated. Use node_pools.instance_group_urls. - current_node_count (int): - Output only. The number of nodes currently in - the cluster. Deprecated. Call Kubernetes API - directly to retrieve node information. - expire_time (str): - Output only. The time the cluster will be automatically - deleted in - `RFC3339 `__ text - format. - location (str): - Output only. The name of the Google Compute Engine - `zone `__ - or - `region `__ - in which the cluster resides. - enable_tpu (bool): - Enable the ability to use Cloud TPUs in this - cluster. - tpu_ipv4_cidr_block (str): - Output only. The IP address range of the Cloud TPUs in this - cluster, in - `CIDR `__ - notation (e.g. ``1.2.3.4/29``). - conditions (MutableSequence[google.cloud.container_v1.types.StatusCondition]): - Which conditions caused the current cluster - state. - autopilot (google.cloud.container_v1.types.Autopilot): - Autopilot configuration for the cluster. - id (str): - Output only. Unique id for the cluster. - node_pool_defaults (google.cloud.container_v1.types.NodePoolDefaults): - Default NodePool settings for the entire - cluster. These settings are overridden if - specified on the specific NodePool object. - - This field is a member of `oneof`_ ``_node_pool_defaults``. - logging_config (google.cloud.container_v1.types.LoggingConfig): - Logging configuration for the cluster. - monitoring_config (google.cloud.container_v1.types.MonitoringConfig): - Monitoring configuration for the cluster. - node_pool_auto_config (google.cloud.container_v1.types.NodePoolAutoConfig): - Node pool configs that apply to all - auto-provisioned node pools in autopilot - clusters and node auto-provisioning enabled - clusters. - etag (str): - This checksum is computed by the server based - on the value of cluster fields, and may be sent - on update requests to ensure the client has an - up-to-date value before proceeding. - fleet (google.cloud.container_v1.types.Fleet): - Fleet information for the cluster. - security_posture_config (google.cloud.container_v1.types.SecurityPostureConfig): - Enable/Disable Security Posture API features - for the cluster. - control_plane_endpoints_config (google.cloud.container_v1.types.ControlPlaneEndpointsConfig): - Configuration for all cluster's control plane - endpoints. - enable_k8s_beta_apis (google.cloud.container_v1.types.K8sBetaAPIConfig): - Beta APIs Config - enterprise_config (google.cloud.container_v1.types.EnterpriseConfig): - GKE Enterprise Configuration. - secret_manager_config (google.cloud.container_v1.types.SecretManagerConfig): - Secret CSI driver configuration. - compliance_posture_config (google.cloud.container_v1.types.CompliancePostureConfig): - Enable/Disable Compliance Posture features - for the cluster. - satisfies_pzs (bool): - Output only. Reserved for future use. - - This field is a member of `oneof`_ ``_satisfies_pzs``. - satisfies_pzi (bool): - Output only. Reserved for future use. - - This field is a member of `oneof`_ ``_satisfies_pzi``. - user_managed_keys_config (google.cloud.container_v1.types.UserManagedKeysConfig): - The Custom keys configuration for the - cluster. - - This field is a member of `oneof`_ ``_user_managed_keys_config``. - rbac_binding_config (google.cloud.container_v1.types.RBACBindingConfig): - RBACBindingConfig allows user to restrict - ClusterRoleBindings an RoleBindings that can be - created. - - This field is a member of `oneof`_ ``_rbac_binding_config``. - """ - class Status(proto.Enum): - r"""The current status of the cluster. - - Values: - STATUS_UNSPECIFIED (0): - Not set. - PROVISIONING (1): - The PROVISIONING state indicates the cluster - is being created. - RUNNING (2): - The RUNNING state indicates the cluster has - been created and is fully usable. - RECONCILING (3): - The RECONCILING state indicates that some work is actively - being done on the cluster, such as upgrading the master or - node software. Details can be found in the ``statusMessage`` - field. - STOPPING (4): - The STOPPING state indicates the cluster is - being deleted. - ERROR (5): - The ERROR state indicates the cluster is unusable. It will - be automatically deleted. Details can be found in the - ``statusMessage`` field. - DEGRADED (6): - The DEGRADED state indicates the cluster requires user - action to restore full functionality. Details can be found - in the ``statusMessage`` field. - """ - STATUS_UNSPECIFIED = 0 - PROVISIONING = 1 - RUNNING = 2 - RECONCILING = 3 - STOPPING = 4 - ERROR = 5 - DEGRADED = 6 - - name: str = proto.Field( - proto.STRING, - number=1, - ) - description: str = proto.Field( - proto.STRING, - number=2, - ) - initial_node_count: int = proto.Field( - proto.INT32, - number=3, - ) - node_config: 'NodeConfig' = proto.Field( - proto.MESSAGE, - number=4, - message='NodeConfig', - ) - master_auth: 'MasterAuth' = proto.Field( - proto.MESSAGE, - number=5, - message='MasterAuth', - ) - logging_service: str = proto.Field( - proto.STRING, - number=6, - ) - monitoring_service: str = proto.Field( - proto.STRING, - number=7, - ) - network: str = proto.Field( - proto.STRING, - number=8, - ) - cluster_ipv4_cidr: str = proto.Field( - proto.STRING, - number=9, - ) - addons_config: 'AddonsConfig' = proto.Field( - proto.MESSAGE, - number=10, - message='AddonsConfig', - ) - subnetwork: str = proto.Field( - proto.STRING, - number=11, - ) - node_pools: MutableSequence['NodePool'] = proto.RepeatedField( - proto.MESSAGE, - number=12, - message='NodePool', - ) - locations: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=13, - ) - enable_kubernetes_alpha: bool = proto.Field( - proto.BOOL, - number=14, - ) - resource_labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=15, - ) - label_fingerprint: str = proto.Field( - proto.STRING, - number=16, - ) - legacy_abac: 'LegacyAbac' = proto.Field( - proto.MESSAGE, - number=18, - message='LegacyAbac', - ) - network_policy: 'NetworkPolicy' = proto.Field( - proto.MESSAGE, - number=19, - message='NetworkPolicy', - ) - ip_allocation_policy: 'IPAllocationPolicy' = proto.Field( - proto.MESSAGE, - number=20, - message='IPAllocationPolicy', - ) - master_authorized_networks_config: 'MasterAuthorizedNetworksConfig' = proto.Field( - proto.MESSAGE, - number=22, - message='MasterAuthorizedNetworksConfig', - ) - maintenance_policy: 'MaintenancePolicy' = proto.Field( - proto.MESSAGE, - number=23, - message='MaintenancePolicy', - ) - binary_authorization: 'BinaryAuthorization' = proto.Field( - proto.MESSAGE, - number=24, - message='BinaryAuthorization', - ) - autoscaling: 'ClusterAutoscaling' = proto.Field( - proto.MESSAGE, - number=26, - message='ClusterAutoscaling', - ) - network_config: 'NetworkConfig' = proto.Field( - proto.MESSAGE, - number=27, - message='NetworkConfig', - ) - default_max_pods_constraint: 'MaxPodsConstraint' = proto.Field( - proto.MESSAGE, - number=30, - message='MaxPodsConstraint', - ) - resource_usage_export_config: 'ResourceUsageExportConfig' = proto.Field( - proto.MESSAGE, - number=33, - message='ResourceUsageExportConfig', - ) - authenticator_groups_config: 'AuthenticatorGroupsConfig' = proto.Field( - proto.MESSAGE, - number=34, - message='AuthenticatorGroupsConfig', - ) - private_cluster_config: 'PrivateClusterConfig' = proto.Field( - proto.MESSAGE, - number=37, - message='PrivateClusterConfig', - ) - database_encryption: 'DatabaseEncryption' = proto.Field( - proto.MESSAGE, - number=38, - message='DatabaseEncryption', - ) - vertical_pod_autoscaling: 'VerticalPodAutoscaling' = proto.Field( - proto.MESSAGE, - number=39, - message='VerticalPodAutoscaling', - ) - shielded_nodes: 'ShieldedNodes' = proto.Field( - proto.MESSAGE, - number=40, - message='ShieldedNodes', - ) - release_channel: 'ReleaseChannel' = proto.Field( - proto.MESSAGE, - number=41, - message='ReleaseChannel', - ) - workload_identity_config: 'WorkloadIdentityConfig' = proto.Field( - proto.MESSAGE, - number=43, - message='WorkloadIdentityConfig', - ) - mesh_certificates: 'MeshCertificates' = proto.Field( - proto.MESSAGE, - number=67, - message='MeshCertificates', - ) - cost_management_config: 'CostManagementConfig' = proto.Field( - proto.MESSAGE, - number=45, - message='CostManagementConfig', - ) - notification_config: 'NotificationConfig' = proto.Field( - proto.MESSAGE, - number=49, - message='NotificationConfig', - ) - confidential_nodes: 'ConfidentialNodes' = proto.Field( - proto.MESSAGE, - number=50, - message='ConfidentialNodes', - ) - identity_service_config: 'IdentityServiceConfig' = proto.Field( - proto.MESSAGE, - number=54, - message='IdentityServiceConfig', - ) - self_link: str = proto.Field( - proto.STRING, - number=100, - ) - zone: str = proto.Field( - proto.STRING, - number=101, - ) - endpoint: str = proto.Field( - proto.STRING, - number=102, - ) - initial_cluster_version: str = proto.Field( - proto.STRING, - number=103, - ) - current_master_version: str = proto.Field( - proto.STRING, - number=104, - ) - current_node_version: str = proto.Field( - proto.STRING, - number=105, - ) - create_time: str = proto.Field( - proto.STRING, - number=106, - ) - status: Status = proto.Field( - proto.ENUM, - number=107, - enum=Status, - ) - status_message: str = proto.Field( - proto.STRING, - number=108, - ) - node_ipv4_cidr_size: int = proto.Field( - proto.INT32, - number=109, - ) - services_ipv4_cidr: str = proto.Field( - proto.STRING, - number=110, - ) - instance_group_urls: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=111, - ) - current_node_count: int = proto.Field( - proto.INT32, - number=112, - ) - expire_time: str = proto.Field( - proto.STRING, - number=113, - ) - location: str = proto.Field( - proto.STRING, - number=114, - ) - enable_tpu: bool = proto.Field( - proto.BOOL, - number=115, - ) - tpu_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=116, - ) - conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( - proto.MESSAGE, - number=118, - message='StatusCondition', - ) - autopilot: 'Autopilot' = proto.Field( - proto.MESSAGE, - number=128, - message='Autopilot', - ) - id: str = proto.Field( - proto.STRING, - number=129, - ) - node_pool_defaults: 'NodePoolDefaults' = proto.Field( - proto.MESSAGE, - number=131, - optional=True, - message='NodePoolDefaults', - ) - logging_config: 'LoggingConfig' = proto.Field( - proto.MESSAGE, - number=132, - message='LoggingConfig', - ) - monitoring_config: 'MonitoringConfig' = proto.Field( - proto.MESSAGE, - number=133, - message='MonitoringConfig', - ) - node_pool_auto_config: 'NodePoolAutoConfig' = proto.Field( - proto.MESSAGE, - number=136, - message='NodePoolAutoConfig', - ) - etag: str = proto.Field( - proto.STRING, - number=139, - ) - fleet: 'Fleet' = proto.Field( - proto.MESSAGE, - number=140, - message='Fleet', - ) - security_posture_config: 'SecurityPostureConfig' = proto.Field( - proto.MESSAGE, - number=145, - message='SecurityPostureConfig', - ) - control_plane_endpoints_config: 'ControlPlaneEndpointsConfig' = proto.Field( - proto.MESSAGE, - number=146, - message='ControlPlaneEndpointsConfig', - ) - enable_k8s_beta_apis: 'K8sBetaAPIConfig' = proto.Field( - proto.MESSAGE, - number=143, - message='K8sBetaAPIConfig', - ) - enterprise_config: 'EnterpriseConfig' = proto.Field( - proto.MESSAGE, - number=149, - message='EnterpriseConfig', - ) - secret_manager_config: 'SecretManagerConfig' = proto.Field( - proto.MESSAGE, - number=150, - message='SecretManagerConfig', - ) - compliance_posture_config: 'CompliancePostureConfig' = proto.Field( - proto.MESSAGE, - number=151, - message='CompliancePostureConfig', - ) - satisfies_pzs: bool = proto.Field( - proto.BOOL, - number=152, - optional=True, - ) - satisfies_pzi: bool = proto.Field( - proto.BOOL, - number=153, - optional=True, - ) - user_managed_keys_config: 'UserManagedKeysConfig' = proto.Field( - proto.MESSAGE, - number=154, - optional=True, - message='UserManagedKeysConfig', - ) - rbac_binding_config: 'RBACBindingConfig' = proto.Field( - proto.MESSAGE, - number=156, - optional=True, - message='RBACBindingConfig', - ) - - -class RBACBindingConfig(proto.Message): - r"""RBACBindingConfig allows user to restrict ClusterRoleBindings - an RoleBindings that can be created. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - enable_insecure_binding_system_unauthenticated (bool): - Setting this to true will allow any - ClusterRoleBinding and RoleBinding with subjets - system:anonymous or system:unauthenticated. - - This field is a member of `oneof`_ ``_enable_insecure_binding_system_unauthenticated``. - enable_insecure_binding_system_authenticated (bool): - Setting this to true will allow any - ClusterRoleBinding and RoleBinding with subjects - system:authenticated. - - This field is a member of `oneof`_ ``_enable_insecure_binding_system_authenticated``. - """ - - enable_insecure_binding_system_unauthenticated: bool = proto.Field( - proto.BOOL, - number=1, - optional=True, - ) - enable_insecure_binding_system_authenticated: bool = proto.Field( - proto.BOOL, - number=2, - optional=True, - ) - - -class UserManagedKeysConfig(proto.Message): - r"""UserManagedKeysConfig holds the resource address to Keys - which are used for signing certs and token that are used for - communication within cluster. - - Attributes: - cluster_ca (str): - The Certificate Authority Service caPool to - use for the cluster CA in this cluster. - etcd_api_ca (str): - Resource path of the Certificate Authority - Service caPool to use for the etcd API CA in - this cluster. - etcd_peer_ca (str): - Resource path of the Certificate Authority - Service caPool to use for the etcd peer CA in - this cluster. - service_account_signing_keys (MutableSequence[str]): - The Cloud KMS cryptoKeyVersions to use for signing service - account JWTs issued by this cluster. - - Format: - ``projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}`` - service_account_verification_keys (MutableSequence[str]): - The Cloud KMS cryptoKeyVersions to use for verifying service - account JWTs issued by this cluster. - - Format: - ``projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}`` - aggregation_ca (str): - The Certificate Authority Service caPool to - use for the aggregation CA in this cluster. - control_plane_disk_encryption_key (str): - The Cloud KMS cryptoKey to use for - Confidential Hyperdisk on the control plane - nodes. - gkeops_etcd_backup_encryption_key (str): - Resource path of the Cloud KMS cryptoKey to - use for encryption of internal etcd backups. - """ - - cluster_ca: str = proto.Field( - proto.STRING, - number=10, - ) - etcd_api_ca: str = proto.Field( - proto.STRING, - number=11, - ) - etcd_peer_ca: str = proto.Field( - proto.STRING, - number=12, - ) - service_account_signing_keys: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=13, - ) - service_account_verification_keys: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=14, - ) - aggregation_ca: str = proto.Field( - proto.STRING, - number=15, - ) - control_plane_disk_encryption_key: str = proto.Field( - proto.STRING, - number=16, - ) - gkeops_etcd_backup_encryption_key: str = proto.Field( - proto.STRING, - number=17, - ) - - -class CompliancePostureConfig(proto.Message): - r"""CompliancePostureConfig defines the settings needed to - enable/disable features for the Compliance Posture. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - mode (google.cloud.container_v1.types.CompliancePostureConfig.Mode): - Defines the enablement mode for Compliance - Posture. - - This field is a member of `oneof`_ ``_mode``. - compliance_standards (MutableSequence[google.cloud.container_v1.types.CompliancePostureConfig.ComplianceStandard]): - List of enabled compliance standards. - """ - class Mode(proto.Enum): - r"""Mode defines enablement mode for Compliance Posture. - - Values: - MODE_UNSPECIFIED (0): - Default value not specified. - DISABLED (1): - Disables Compliance Posture features on the - cluster. - ENABLED (2): - Enables Compliance Posture features on the - cluster. - """ - MODE_UNSPECIFIED = 0 - DISABLED = 1 - ENABLED = 2 - - class ComplianceStandard(proto.Message): - r"""Defines the details of a compliance standard. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - standard (str): - Name of the compliance standard. - - This field is a member of `oneof`_ ``_standard``. - """ - - standard: str = proto.Field( - proto.STRING, - number=1, - optional=True, - ) - - mode: Mode = proto.Field( - proto.ENUM, - number=1, - optional=True, - enum=Mode, - ) - compliance_standards: MutableSequence[ComplianceStandard] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message=ComplianceStandard, - ) - - -class K8sBetaAPIConfig(proto.Message): - r"""K8sBetaAPIConfig , configuration for beta APIs - - Attributes: - enabled_apis (MutableSequence[str]): - Enabled k8s beta APIs. - """ - - enabled_apis: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - - -class SecurityPostureConfig(proto.Message): - r"""SecurityPostureConfig defines the flags needed to - enable/disable features for the Security Posture API. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - mode (google.cloud.container_v1.types.SecurityPostureConfig.Mode): - Sets which mode to use for Security Posture - features. - - This field is a member of `oneof`_ ``_mode``. - vulnerability_mode (google.cloud.container_v1.types.SecurityPostureConfig.VulnerabilityMode): - Sets which mode to use for vulnerability - scanning. - - This field is a member of `oneof`_ ``_vulnerability_mode``. - """ - class Mode(proto.Enum): - r"""Mode defines enablement mode for GKE Security posture - features. - - Values: - MODE_UNSPECIFIED (0): - Default value not specified. - DISABLED (1): - Disables Security Posture features on the - cluster. - BASIC (2): - Applies Security Posture features on the - cluster. - ENTERPRISE (3): - Applies the Security Posture off cluster - Enterprise level features. - """ - MODE_UNSPECIFIED = 0 - DISABLED = 1 - BASIC = 2 - ENTERPRISE = 3 - - class VulnerabilityMode(proto.Enum): - r"""VulnerabilityMode defines enablement mode for vulnerability - scanning. - - Values: - VULNERABILITY_MODE_UNSPECIFIED (0): - Default value not specified. - VULNERABILITY_DISABLED (1): - Disables vulnerability scanning on the - cluster. - VULNERABILITY_BASIC (2): - Applies basic vulnerability scanning on the - cluster. - VULNERABILITY_ENTERPRISE (3): - Applies the Security Posture's vulnerability - on cluster Enterprise level features. - """ - VULNERABILITY_MODE_UNSPECIFIED = 0 - VULNERABILITY_DISABLED = 1 - VULNERABILITY_BASIC = 2 - VULNERABILITY_ENTERPRISE = 3 - - mode: Mode = proto.Field( - proto.ENUM, - number=1, - optional=True, - enum=Mode, - ) - vulnerability_mode: VulnerabilityMode = proto.Field( - proto.ENUM, - number=2, - optional=True, - enum=VulnerabilityMode, - ) - - -class NodePoolAutoConfig(proto.Message): - r"""Node pool configs that apply to all auto-provisioned node - pools in autopilot clusters and node auto-provisioning enabled - clusters. - - Attributes: - network_tags (google.cloud.container_v1.types.NetworkTags): - The list of instance tags applied to all - nodes. Tags are used to identify valid sources - or targets for network firewalls and are - specified by the client during cluster creation. - Each tag within the list must comply with - RFC1035. - resource_manager_tags (google.cloud.container_v1.types.ResourceManagerTags): - Resource manager tag keys and values to be - attached to the nodes for managing Compute - Engine firewalls using Network Firewall - Policies. - node_kubelet_config (google.cloud.container_v1.types.NodeKubeletConfig): - NodeKubeletConfig controls the defaults for autoprovisioned - node-pools. - - Currently only ``insecure_kubelet_readonly_port_enabled`` - can be set here. - linux_node_config (google.cloud.container_v1.types.LinuxNodeConfig): - Output only. Configuration options for Linux - nodes. - """ - - network_tags: 'NetworkTags' = proto.Field( - proto.MESSAGE, - number=1, - message='NetworkTags', - ) - resource_manager_tags: 'ResourceManagerTags' = proto.Field( - proto.MESSAGE, - number=2, - message='ResourceManagerTags', - ) - node_kubelet_config: 'NodeKubeletConfig' = proto.Field( - proto.MESSAGE, - number=3, - message='NodeKubeletConfig', - ) - linux_node_config: 'LinuxNodeConfig' = proto.Field( - proto.MESSAGE, - number=4, - message='LinuxNodeConfig', - ) - - -class NodePoolDefaults(proto.Message): - r"""Subset of Nodepool message that has defaults. - - Attributes: - node_config_defaults (google.cloud.container_v1.types.NodeConfigDefaults): - Subset of NodeConfig message that has - defaults. - """ - - node_config_defaults: 'NodeConfigDefaults' = proto.Field( - proto.MESSAGE, - number=1, - message='NodeConfigDefaults', - ) - - -class NodeConfigDefaults(proto.Message): - r"""Subset of NodeConfig message that has defaults. - - Attributes: - gcfs_config (google.cloud.container_v1.types.GcfsConfig): - GCFS (Google Container File System, also - known as Riptide) options. - logging_config (google.cloud.container_v1.types.NodePoolLoggingConfig): - Logging configuration for node pools. - containerd_config (google.cloud.container_v1.types.ContainerdConfig): - Parameters for containerd customization. - node_kubelet_config (google.cloud.container_v1.types.NodeKubeletConfig): - NodeKubeletConfig controls the defaults for new node-pools. - - Currently only ``insecure_kubelet_readonly_port_enabled`` - can be set here. - """ - - gcfs_config: 'GcfsConfig' = proto.Field( - proto.MESSAGE, - number=1, - message='GcfsConfig', - ) - logging_config: 'NodePoolLoggingConfig' = proto.Field( - proto.MESSAGE, - number=3, - message='NodePoolLoggingConfig', - ) - containerd_config: 'ContainerdConfig' = proto.Field( - proto.MESSAGE, - number=4, - message='ContainerdConfig', - ) - node_kubelet_config: 'NodeKubeletConfig' = proto.Field( - proto.MESSAGE, - number=6, - message='NodeKubeletConfig', - ) - - -class ClusterUpdate(proto.Message): - r"""ClusterUpdate describes an update to the cluster. Exactly one - update can be applied to a cluster with each request, so at most - one field can be provided. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - desired_node_version (str): - The Kubernetes version to change the nodes to - (typically an upgrade). - - Users may specify either explicit versions - offered by Kubernetes Engine or version aliases, - which have the following behavior: - - - "latest": picks the highest valid Kubernetes - version - - "1.X": picks the highest valid patch+gke.N - patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N patch - in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit Kubernetes - version - - "-": picks the Kubernetes master version - desired_monitoring_service (str): - The monitoring service the cluster should use to write - metrics. Currently available options: - - - "monitoring.googleapis.com/kubernetes" - The Cloud - Monitoring service with a Kubernetes-native resource - model - - ``monitoring.googleapis.com`` - The legacy Cloud - Monitoring service (no longer available as of GKE 1.15). - - ``none`` - No metrics will be exported from the cluster. - - If left as an empty - string,\ ``monitoring.googleapis.com/kubernetes`` will be - used for GKE 1.14+ or ``monitoring.googleapis.com`` for - earlier versions. - desired_addons_config (google.cloud.container_v1.types.AddonsConfig): - Configurations for the various addons - available to run in the cluster. - desired_node_pool_id (str): - The node pool to be upgraded. This field is mandatory if - "desired_node_version", "desired_image_family" or - "desired_node_pool_autoscaling" is specified and there is - more than one node pool on the cluster. - desired_image_type (str): - The desired image type for the node pool. NOTE: Set the - "desired_node_pool" field as well. - desired_database_encryption (google.cloud.container_v1.types.DatabaseEncryption): - Configuration of etcd encryption. - desired_workload_identity_config (google.cloud.container_v1.types.WorkloadIdentityConfig): - Configuration for Workload Identity. - desired_mesh_certificates (google.cloud.container_v1.types.MeshCertificates): - Configuration for issuance of mTLS keys and - certificates to Kubernetes pods. - desired_shielded_nodes (google.cloud.container_v1.types.ShieldedNodes): - Configuration for Shielded Nodes. - desired_cost_management_config (google.cloud.container_v1.types.CostManagementConfig): - The desired configuration for the - fine-grained cost management feature. - desired_dns_config (google.cloud.container_v1.types.DNSConfig): - DNSConfig contains clusterDNS config for this - cluster. - desired_node_pool_autoscaling (google.cloud.container_v1.types.NodePoolAutoscaling): - Autoscaler configuration for the node pool specified in - desired_node_pool_id. If there is only one pool in the - cluster and desired_node_pool_id is not provided then the - change applies to that single node pool. - desired_locations (MutableSequence[str]): - The desired list of Google Compute Engine - `zones `__ - in which the cluster's nodes should be located. - - This list must always include the cluster's primary zone. - - Warning: changing cluster locations will update the - locations of all node pools and will result in nodes being - added and/or removed. - desired_master_authorized_networks_config (google.cloud.container_v1.types.MasterAuthorizedNetworksConfig): - The desired configuration options for master authorized - networks feature. - - Deprecated: Use - desired_control_plane_endpoints_config.ip_endpoints_config.authorized_networks_config - instead. - desired_cluster_autoscaling (google.cloud.container_v1.types.ClusterAutoscaling): - Cluster-level autoscaling configuration. - desired_binary_authorization (google.cloud.container_v1.types.BinaryAuthorization): - The desired configuration options for the - Binary Authorization feature. - desired_logging_service (str): - The logging service the cluster should use to write logs. - Currently available options: - - - ``logging.googleapis.com/kubernetes`` - The Cloud Logging - service with a Kubernetes-native resource model - - ``logging.googleapis.com`` - The legacy Cloud Logging - service (no longer available as of GKE 1.15). - - ``none`` - no logs will be exported from the cluster. - - If left as an empty - string,\ ``logging.googleapis.com/kubernetes`` will be used - for GKE 1.14+ or ``logging.googleapis.com`` for earlier - versions. - desired_resource_usage_export_config (google.cloud.container_v1.types.ResourceUsageExportConfig): - The desired configuration for exporting - resource usage. - desired_vertical_pod_autoscaling (google.cloud.container_v1.types.VerticalPodAutoscaling): - Cluster-level Vertical Pod Autoscaling - configuration. - desired_private_cluster_config (google.cloud.container_v1.types.PrivateClusterConfig): - The desired private cluster configuration. - master_global_access_config is the only field that can be - changed via this field. See also - [ClusterUpdate.desired_enable_private_endpoint][google.container.v1.ClusterUpdate.desired_enable_private_endpoint] - for modifying other fields within - [PrivateClusterConfig][google.container.v1.PrivateClusterConfig]. - - Deprecated: Use - desired_control_plane_endpoints_config.ip_endpoints_config.global_access - instead. - desired_intra_node_visibility_config (google.cloud.container_v1.types.IntraNodeVisibilityConfig): - The desired config of Intra-node visibility. - desired_default_snat_status (google.cloud.container_v1.types.DefaultSnatStatus): - The desired status of whether to disable - default sNAT for this cluster. - desired_release_channel (google.cloud.container_v1.types.ReleaseChannel): - The desired release channel configuration. - desired_l4ilb_subsetting_config (google.cloud.container_v1.types.ILBSubsettingConfig): - The desired L4 Internal Load Balancer - Subsetting configuration. - desired_datapath_provider (google.cloud.container_v1.types.DatapathProvider): - The desired datapath provider for the - cluster. - desired_private_ipv6_google_access (google.cloud.container_v1.types.PrivateIPv6GoogleAccess): - The desired state of IPv6 connectivity to - Google Services. - desired_notification_config (google.cloud.container_v1.types.NotificationConfig): - The desired notification configuration. - desired_authenticator_groups_config (google.cloud.container_v1.types.AuthenticatorGroupsConfig): - The desired authenticator groups config for - the cluster. - desired_logging_config (google.cloud.container_v1.types.LoggingConfig): - The desired logging configuration. - desired_monitoring_config (google.cloud.container_v1.types.MonitoringConfig): - The desired monitoring configuration. - desired_identity_service_config (google.cloud.container_v1.types.IdentityServiceConfig): - The desired Identity Service component - configuration. - desired_service_external_ips_config (google.cloud.container_v1.types.ServiceExternalIPsConfig): - ServiceExternalIPsConfig specifies the config - for the use of Services with ExternalIPs field. - desired_enable_private_endpoint (bool): - Enable/Disable private endpoint for the cluster's master. - - Deprecated: Use - desired_control_plane_endpoints_config.ip_endpoints_config.enable_public_endpoint - instead. Note that the value of enable_public_endpoint is - reversed: if enable_private_endpoint is false, then - enable_public_endpoint will be true. - - This field is a member of `oneof`_ ``_desired_enable_private_endpoint``. - desired_default_enable_private_nodes (bool): - Override the default setting of whether future created nodes - have private IP addresses only, namely - [NetworkConfig.default_enable_private_nodes][google.container.v1.NetworkConfig.default_enable_private_nodes] - - This field is a member of `oneof`_ ``_desired_default_enable_private_nodes``. - desired_control_plane_endpoints_config (google.cloud.container_v1.types.ControlPlaneEndpointsConfig): - [Control plane - endpoints][google.container.v1.Cluster.control_plane_endpoints_config] - configuration. - desired_master_version (str): - The Kubernetes version to change the master - to. - Users may specify either explicit versions - offered by Kubernetes Engine or version aliases, - which have the following behavior: - - - "latest": picks the highest valid Kubernetes - version - - "1.X": picks the highest valid patch+gke.N - patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N patch - in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit Kubernetes - version - - "-": picks the default Kubernetes version - desired_gcfs_config (google.cloud.container_v1.types.GcfsConfig): - The desired GCFS config for the cluster - desired_node_pool_auto_config_network_tags (google.cloud.container_v1.types.NetworkTags): - The desired network tags that apply to all - auto-provisioned node pools in autopilot - clusters and node auto-provisioning enabled - clusters. - desired_gateway_api_config (google.cloud.container_v1.types.GatewayAPIConfig): - The desired config of Gateway API on this - cluster. - etag (str): - The current etag of the cluster. - If an etag is provided and does not match the - current etag of the cluster, update will be - blocked and an ABORTED error will be returned. - desired_node_pool_logging_config (google.cloud.container_v1.types.NodePoolLoggingConfig): - The desired node pool logging configuration - defaults for the cluster. - desired_fleet (google.cloud.container_v1.types.Fleet): - The desired fleet configuration for the - cluster. - desired_stack_type (google.cloud.container_v1.types.StackType): - The desired stack type of the cluster. - If a stack type is provided and does not match - the current stack type of the cluster, update - will attempt to change the stack type to the new - type. - additional_pod_ranges_config (google.cloud.container_v1.types.AdditionalPodRangesConfig): - The additional pod ranges to be added to the - cluster. These pod ranges can be used by node - pools to allocate pod IPs. - removed_additional_pod_ranges_config (google.cloud.container_v1.types.AdditionalPodRangesConfig): - The additional pod ranges that are to be removed from the - cluster. The pod ranges specified here must have been - specified earlier in the 'additional_pod_ranges_config' - argument. - enable_k8s_beta_apis (google.cloud.container_v1.types.K8sBetaAPIConfig): - Kubernetes open source beta apis enabled on - the cluster. Only beta apis - desired_security_posture_config (google.cloud.container_v1.types.SecurityPostureConfig): - Enable/Disable Security Posture API features - for the cluster. - desired_network_performance_config (google.cloud.container_v1.types.NetworkConfig.ClusterNetworkPerformanceConfig): - The desired network performance config. - desired_enable_fqdn_network_policy (bool): - Enable/Disable FQDN Network Policy for the - cluster. - - This field is a member of `oneof`_ ``_desired_enable_fqdn_network_policy``. - desired_autopilot_workload_policy_config (google.cloud.container_v1.types.WorkloadPolicyConfig): - The desired workload policy configuration for - the autopilot cluster. - desired_k8s_beta_apis (google.cloud.container_v1.types.K8sBetaAPIConfig): - Desired Beta APIs to be enabled for cluster. - desired_containerd_config (google.cloud.container_v1.types.ContainerdConfig): - The desired containerd config for the - cluster. - desired_enable_multi_networking (bool): - Enable/Disable Multi-Networking for the - cluster - - This field is a member of `oneof`_ ``_desired_enable_multi_networking``. - desired_node_pool_auto_config_resource_manager_tags (google.cloud.container_v1.types.ResourceManagerTags): - The desired resource manager tags that apply - to all auto-provisioned node pools in autopilot - clusters and node auto-provisioning enabled - clusters. - desired_in_transit_encryption_config (google.cloud.container_v1.types.InTransitEncryptionConfig): - Specify the details of in-transit encryption. - - This field is a member of `oneof`_ ``_desired_in_transit_encryption_config``. - desired_enable_cilium_clusterwide_network_policy (bool): - Enable/Disable Cilium Clusterwide Network - Policy for the cluster. - - This field is a member of `oneof`_ ``_desired_enable_cilium_clusterwide_network_policy``. - desired_secret_manager_config (google.cloud.container_v1.types.SecretManagerConfig): - Enable/Disable Secret Manager Config. - - This field is a member of `oneof`_ ``_desired_secret_manager_config``. - desired_compliance_posture_config (google.cloud.container_v1.types.CompliancePostureConfig): - Enable/Disable Compliance Posture features - for the cluster. - - This field is a member of `oneof`_ ``_desired_compliance_posture_config``. - desired_node_kubelet_config (google.cloud.container_v1.types.NodeKubeletConfig): - The desired node kubelet config for the - cluster. - desired_node_pool_auto_config_kubelet_config (google.cloud.container_v1.types.NodeKubeletConfig): - The desired node kubelet config for all - auto-provisioned node pools in autopilot - clusters and node auto-provisioning enabled - clusters. - user_managed_keys_config (google.cloud.container_v1.types.UserManagedKeysConfig): - The Custom keys configuration for the - cluster. - desired_rbac_binding_config (google.cloud.container_v1.types.RBACBindingConfig): - RBACBindingConfig allows user to restrict - ClusterRoleBindings an RoleBindings that can be - created. - - This field is a member of `oneof`_ ``_desired_rbac_binding_config``. - desired_enterprise_config (google.cloud.container_v1.types.DesiredEnterpriseConfig): - The desired enterprise configuration for the - cluster. - desired_node_pool_auto_config_linux_node_config (google.cloud.container_v1.types.LinuxNodeConfig): - The desired Linux node config for all auto-provisioned node - pools in autopilot clusters and node auto-provisioning - enabled clusters. - - Currently only ``cgroup_mode`` can be set here. - """ - - desired_node_version: str = proto.Field( - proto.STRING, - number=4, - ) - desired_monitoring_service: str = proto.Field( - proto.STRING, - number=5, - ) - desired_addons_config: 'AddonsConfig' = proto.Field( - proto.MESSAGE, - number=6, - message='AddonsConfig', - ) - desired_node_pool_id: str = proto.Field( - proto.STRING, - number=7, - ) - desired_image_type: str = proto.Field( - proto.STRING, - number=8, - ) - desired_database_encryption: 'DatabaseEncryption' = proto.Field( - proto.MESSAGE, - number=46, - message='DatabaseEncryption', - ) - desired_workload_identity_config: 'WorkloadIdentityConfig' = proto.Field( - proto.MESSAGE, - number=47, - message='WorkloadIdentityConfig', - ) - desired_mesh_certificates: 'MeshCertificates' = proto.Field( - proto.MESSAGE, - number=67, - message='MeshCertificates', - ) - desired_shielded_nodes: 'ShieldedNodes' = proto.Field( - proto.MESSAGE, - number=48, - message='ShieldedNodes', - ) - desired_cost_management_config: 'CostManagementConfig' = proto.Field( - proto.MESSAGE, - number=49, - message='CostManagementConfig', - ) - desired_dns_config: 'DNSConfig' = proto.Field( - proto.MESSAGE, - number=53, - message='DNSConfig', - ) - desired_node_pool_autoscaling: 'NodePoolAutoscaling' = proto.Field( - proto.MESSAGE, - number=9, - message='NodePoolAutoscaling', - ) - desired_locations: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=10, - ) - desired_master_authorized_networks_config: 'MasterAuthorizedNetworksConfig' = proto.Field( - proto.MESSAGE, - number=12, - message='MasterAuthorizedNetworksConfig', - ) - desired_cluster_autoscaling: 'ClusterAutoscaling' = proto.Field( - proto.MESSAGE, - number=15, - message='ClusterAutoscaling', - ) - desired_binary_authorization: 'BinaryAuthorization' = proto.Field( - proto.MESSAGE, - number=16, - message='BinaryAuthorization', - ) - desired_logging_service: str = proto.Field( - proto.STRING, - number=19, - ) - desired_resource_usage_export_config: 'ResourceUsageExportConfig' = proto.Field( - proto.MESSAGE, - number=21, - message='ResourceUsageExportConfig', - ) - desired_vertical_pod_autoscaling: 'VerticalPodAutoscaling' = proto.Field( - proto.MESSAGE, - number=22, - message='VerticalPodAutoscaling', - ) - desired_private_cluster_config: 'PrivateClusterConfig' = proto.Field( - proto.MESSAGE, - number=25, - message='PrivateClusterConfig', - ) - desired_intra_node_visibility_config: 'IntraNodeVisibilityConfig' = proto.Field( - proto.MESSAGE, - number=26, - message='IntraNodeVisibilityConfig', - ) - desired_default_snat_status: 'DefaultSnatStatus' = proto.Field( - proto.MESSAGE, - number=28, - message='DefaultSnatStatus', - ) - desired_release_channel: 'ReleaseChannel' = proto.Field( - proto.MESSAGE, - number=31, - message='ReleaseChannel', - ) - desired_l4ilb_subsetting_config: 'ILBSubsettingConfig' = proto.Field( - proto.MESSAGE, - number=39, - message='ILBSubsettingConfig', - ) - desired_datapath_provider: 'DatapathProvider' = proto.Field( - proto.ENUM, - number=50, - enum='DatapathProvider', - ) - desired_private_ipv6_google_access: 'PrivateIPv6GoogleAccess' = proto.Field( - proto.ENUM, - number=51, - enum='PrivateIPv6GoogleAccess', - ) - desired_notification_config: 'NotificationConfig' = proto.Field( - proto.MESSAGE, - number=55, - message='NotificationConfig', - ) - desired_authenticator_groups_config: 'AuthenticatorGroupsConfig' = proto.Field( - proto.MESSAGE, - number=63, - message='AuthenticatorGroupsConfig', - ) - desired_logging_config: 'LoggingConfig' = proto.Field( - proto.MESSAGE, - number=64, - message='LoggingConfig', - ) - desired_monitoring_config: 'MonitoringConfig' = proto.Field( - proto.MESSAGE, - number=65, - message='MonitoringConfig', - ) - desired_identity_service_config: 'IdentityServiceConfig' = proto.Field( - proto.MESSAGE, - number=66, - message='IdentityServiceConfig', - ) - desired_service_external_ips_config: 'ServiceExternalIPsConfig' = proto.Field( - proto.MESSAGE, - number=60, - message='ServiceExternalIPsConfig', - ) - desired_enable_private_endpoint: bool = proto.Field( - proto.BOOL, - number=71, - optional=True, - ) - desired_default_enable_private_nodes: bool = proto.Field( - proto.BOOL, - number=72, - optional=True, - ) - desired_control_plane_endpoints_config: 'ControlPlaneEndpointsConfig' = proto.Field( - proto.MESSAGE, - number=73, - message='ControlPlaneEndpointsConfig', - ) - desired_master_version: str = proto.Field( - proto.STRING, - number=100, - ) - desired_gcfs_config: 'GcfsConfig' = proto.Field( - proto.MESSAGE, - number=109, - message='GcfsConfig', - ) - desired_node_pool_auto_config_network_tags: 'NetworkTags' = proto.Field( - proto.MESSAGE, - number=110, - message='NetworkTags', - ) - desired_gateway_api_config: 'GatewayAPIConfig' = proto.Field( - proto.MESSAGE, - number=114, - message='GatewayAPIConfig', - ) - etag: str = proto.Field( - proto.STRING, - number=115, - ) - desired_node_pool_logging_config: 'NodePoolLoggingConfig' = proto.Field( - proto.MESSAGE, - number=116, - message='NodePoolLoggingConfig', - ) - desired_fleet: 'Fleet' = proto.Field( - proto.MESSAGE, - number=117, - message='Fleet', - ) - desired_stack_type: 'StackType' = proto.Field( - proto.ENUM, - number=119, - enum='StackType', - ) - additional_pod_ranges_config: 'AdditionalPodRangesConfig' = proto.Field( - proto.MESSAGE, - number=120, - message='AdditionalPodRangesConfig', - ) - removed_additional_pod_ranges_config: 'AdditionalPodRangesConfig' = proto.Field( - proto.MESSAGE, - number=121, - message='AdditionalPodRangesConfig', - ) - enable_k8s_beta_apis: 'K8sBetaAPIConfig' = proto.Field( - proto.MESSAGE, - number=122, - message='K8sBetaAPIConfig', - ) - desired_security_posture_config: 'SecurityPostureConfig' = proto.Field( - proto.MESSAGE, - number=124, - message='SecurityPostureConfig', - ) - desired_network_performance_config: 'NetworkConfig.ClusterNetworkPerformanceConfig' = proto.Field( - proto.MESSAGE, - number=125, - message='NetworkConfig.ClusterNetworkPerformanceConfig', - ) - desired_enable_fqdn_network_policy: bool = proto.Field( - proto.BOOL, - number=126, - optional=True, - ) - desired_autopilot_workload_policy_config: 'WorkloadPolicyConfig' = proto.Field( - proto.MESSAGE, - number=128, - message='WorkloadPolicyConfig', - ) - desired_k8s_beta_apis: 'K8sBetaAPIConfig' = proto.Field( - proto.MESSAGE, - number=131, - message='K8sBetaAPIConfig', - ) - desired_containerd_config: 'ContainerdConfig' = proto.Field( - proto.MESSAGE, - number=134, - message='ContainerdConfig', - ) - desired_enable_multi_networking: bool = proto.Field( - proto.BOOL, - number=135, - optional=True, - ) - desired_node_pool_auto_config_resource_manager_tags: 'ResourceManagerTags' = proto.Field( - proto.MESSAGE, - number=136, - message='ResourceManagerTags', - ) - desired_in_transit_encryption_config: 'InTransitEncryptionConfig' = proto.Field( - proto.ENUM, - number=137, - optional=True, - enum='InTransitEncryptionConfig', - ) - desired_enable_cilium_clusterwide_network_policy: bool = proto.Field( - proto.BOOL, - number=138, - optional=True, - ) - desired_secret_manager_config: 'SecretManagerConfig' = proto.Field( - proto.MESSAGE, - number=139, - optional=True, - message='SecretManagerConfig', - ) - desired_compliance_posture_config: 'CompliancePostureConfig' = proto.Field( - proto.MESSAGE, - number=140, - optional=True, - message='CompliancePostureConfig', - ) - desired_node_kubelet_config: 'NodeKubeletConfig' = proto.Field( - proto.MESSAGE, - number=141, - message='NodeKubeletConfig', - ) - desired_node_pool_auto_config_kubelet_config: 'NodeKubeletConfig' = proto.Field( - proto.MESSAGE, - number=142, - message='NodeKubeletConfig', - ) - user_managed_keys_config: 'UserManagedKeysConfig' = proto.Field( - proto.MESSAGE, - number=143, - message='UserManagedKeysConfig', - ) - desired_rbac_binding_config: 'RBACBindingConfig' = proto.Field( - proto.MESSAGE, - number=144, - optional=True, - message='RBACBindingConfig', - ) - desired_enterprise_config: 'DesiredEnterpriseConfig' = proto.Field( - proto.MESSAGE, - number=147, - message='DesiredEnterpriseConfig', - ) - desired_node_pool_auto_config_linux_node_config: 'LinuxNodeConfig' = proto.Field( - proto.MESSAGE, - number=150, - message='LinuxNodeConfig', - ) - - -class AdditionalPodRangesConfig(proto.Message): - r"""AdditionalPodRangesConfig is the configuration for additional - pod secondary ranges supporting the ClusterUpdate message. - - Attributes: - pod_range_names (MutableSequence[str]): - Name for pod secondary ipv4 range which has - the actual range defined ahead. - pod_range_info (MutableSequence[google.cloud.container_v1.types.RangeInfo]): - Output only. Information for additional pod - range. - """ - - pod_range_names: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - pod_range_info: MutableSequence['RangeInfo'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='RangeInfo', - ) - - -class RangeInfo(proto.Message): - r"""RangeInfo contains the range name and the range utilization - by this cluster. - - Attributes: - range_name (str): - Output only. Name of a range. - utilization (float): - Output only. The utilization of the range. - """ - - range_name: str = proto.Field( - proto.STRING, - number=1, - ) - utilization: float = proto.Field( - proto.DOUBLE, - number=2, - ) - - -class DesiredEnterpriseConfig(proto.Message): - r"""DesiredEnterpriseConfig is a wrapper used for updating - enterprise_config. - - Attributes: - desired_tier (google.cloud.container_v1.types.EnterpriseConfig.ClusterTier): - desired_tier specifies the desired tier of the cluster. - """ - - desired_tier: 'EnterpriseConfig.ClusterTier' = proto.Field( - proto.ENUM, - number=1, - enum='EnterpriseConfig.ClusterTier', - ) - - -class Operation(proto.Message): - r"""This operation resource represents operations that may have - happened or are happening on the cluster. All fields are output - only. - - Attributes: - name (str): - Output only. The server-assigned ID for the - operation. - zone (str): - Output only. The name of the Google Compute Engine - `zone `__ - in which the operation is taking place. This field is - deprecated, use location instead. - operation_type (google.cloud.container_v1.types.Operation.Type): - Output only. The operation type. - status (google.cloud.container_v1.types.Operation.Status): - Output only. The current status of the - operation. - detail (str): - Output only. Detailed operation progress, if - available. - status_message (str): - Output only. If an error has occurred, a - textual description of the error. Deprecated. - Use the field error instead. - self_link (str): - Output only. Server-defined URI for the operation. Example: - ``https://container.googleapis.com/v1alpha1/projects/123/locations/us-central1/operations/operation-123``. - target_link (str): - Output only. Server-defined URI for the target of the - operation. The format of this is a URI to the resource being - modified (such as a cluster, node pool, or node). For node - pool repairs, there may be multiple nodes being repaired, - but only one will be the target. - - Examples: - - - - - ``https://container.googleapis.com/v1/projects/123/locations/us-central1/clusters/my-cluster`` - - ``https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np`` - - ``https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np/node/my-node`` - location (str): - Output only. The name of the Google Compute Engine - `zone `__ - or - `region `__ - in which the cluster resides. - start_time (str): - Output only. The time the operation started, in - `RFC3339 `__ text - format. - end_time (str): - Output only. The time the operation completed, in - `RFC3339 `__ text - format. - progress (google.cloud.container_v1.types.OperationProgress): - Output only. Progress information for an - operation. - cluster_conditions (MutableSequence[google.cloud.container_v1.types.StatusCondition]): - Which conditions caused the current cluster - state. Deprecated. Use field error instead. - nodepool_conditions (MutableSequence[google.cloud.container_v1.types.StatusCondition]): - Which conditions caused the current node pool - state. Deprecated. Use field error instead. - error (google.rpc.status_pb2.Status): - The error result of the operation in case of - failure. - """ - class Status(proto.Enum): - r"""Current status of the operation. - - Values: - STATUS_UNSPECIFIED (0): - Not set. - PENDING (1): - The operation has been created. - RUNNING (2): - The operation is currently running. - DONE (3): - The operation is done, either cancelled or - completed. - ABORTING (4): - The operation is aborting. - """ - STATUS_UNSPECIFIED = 0 - PENDING = 1 - RUNNING = 2 - DONE = 3 - ABORTING = 4 - - class Type(proto.Enum): - r"""Operation type categorizes the operation. - - Values: - TYPE_UNSPECIFIED (0): - Not set. - CREATE_CLUSTER (1): - The cluster is being created. The cluster should be assumed - to be unusable until the operation finishes. - - In the event of the operation failing, the cluster will - enter the [ERROR state][Cluster.Status.ERROR] and eventually - be deleted. - DELETE_CLUSTER (2): - The cluster is being deleted. The cluster should be assumed - to be unusable as soon as this operation starts. - - In the event of the operation failing, the cluster will - enter the [ERROR state][Cluster.Status.ERROR] and the - deletion will be automatically retried until completed. - UPGRADE_MASTER (3): - The [cluster - version][google.container.v1.ClusterUpdate.desired_master_version] - is being updated. Note that this includes "upgrades" to the - same version, which are simply a recreation. This also - includes - `auto-upgrades `__. - For more details, see `documentation on cluster - upgrades `__. - UPGRADE_NODES (4): - A node pool is being updated. Despite calling this an - "upgrade", this includes most forms of updates to node - pools. This also includes - `auto-upgrades `__. - - This operation sets the - [progress][google.container.v1.Operation.progress] field and - may be - [canceled][google.container.v1.ClusterManager.CancelOperation]. - - The upgrade strategy depends on `node pool - configuration `__. - The nodes are generally still usable during this operation. - REPAIR_CLUSTER (5): - A problem has been detected with the control plane and is - being repaired. This operation type is initiated by GKE. For - more details, see `documentation on - repairs `__. - UPDATE_CLUSTER (6): - The cluster is being updated. This is a broad category of - operations and includes operations that only change metadata - as well as those that must recreate the entire cluster. If - the control plane must be recreated, this will cause - temporary downtime for zonal clusters. - - Some features require recreating the nodes as well. Those - will be recreated as separate operations and the update may - not be completely functional until the node pools - recreations finish. Node recreations will generally follow - `maintenance - policies `__. - - Some GKE-initiated operations use this type. This includes - certain types of auto-upgrades and incident mitigations. - CREATE_NODE_POOL (7): - A node pool is being created. The node pool should be - assumed to be unusable until this operation finishes. In the - event of an error, the node pool may be partially created. - - If enabled, `node - autoprovisioning `__ - may have automatically initiated such operations. - DELETE_NODE_POOL (8): - The node pool is being deleted. The node pool - should be assumed to be unusable as soon as this - operation starts. - SET_NODE_POOL_MANAGEMENT (9): - The node pool's - [manamagent][google.container.v1.NodePool.management] field - is being updated. These operations only update metadata and - may be concurrent with most other operations. - AUTO_REPAIR_NODES (10): - A problem has been detected with nodes and `they are being - repaired `__. - This operation type is initiated by GKE, typically - automatically. This operation may be concurrent with other - operations and there may be multiple repairs occurring on - the same node pool. - AUTO_UPGRADE_NODES (11): - Unused. Automatic node upgrade uses - [UPGRADE_NODES][google.container.v1.Operation.Type.UPGRADE_NODES]. - SET_LABELS (12): - Unused. Updating labels uses - [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. - SET_MASTER_AUTH (13): - Unused. Updating master auth uses - [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. - SET_NODE_POOL_SIZE (14): - The node pool is being resized. With the - exception of resizing to or from size zero, the - node pool is generally usable during this - operation. - SET_NETWORK_POLICY (15): - Unused. Updating network policy uses - [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. - SET_MAINTENANCE_POLICY (16): - Unused. Updating maintenance policy uses - [UPDATE_CLUSTER][google.container.v1.Operation.Type.UPDATE_CLUSTER]. - RESIZE_CLUSTER (18): - The control plane is being resized. This operation type is - initiated by GKE. These operations are often performed - preemptively to ensure that the control plane has sufficient - resources and is not typically an indication of issues. For - more details, see `documentation on - resizes `__. - FLEET_FEATURE_UPGRADE (19): - Fleet features of GKE Enterprise are being - upgraded. The cluster should be assumed to be - blocked for other upgrades until the operation - finishes. - """ - TYPE_UNSPECIFIED = 0 - CREATE_CLUSTER = 1 - DELETE_CLUSTER = 2 - UPGRADE_MASTER = 3 - UPGRADE_NODES = 4 - REPAIR_CLUSTER = 5 - UPDATE_CLUSTER = 6 - CREATE_NODE_POOL = 7 - DELETE_NODE_POOL = 8 - SET_NODE_POOL_MANAGEMENT = 9 - AUTO_REPAIR_NODES = 10 - AUTO_UPGRADE_NODES = 11 - SET_LABELS = 12 - SET_MASTER_AUTH = 13 - SET_NODE_POOL_SIZE = 14 - SET_NETWORK_POLICY = 15 - SET_MAINTENANCE_POLICY = 16 - RESIZE_CLUSTER = 18 - FLEET_FEATURE_UPGRADE = 19 - - name: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - operation_type: Type = proto.Field( - proto.ENUM, - number=3, - enum=Type, - ) - status: Status = proto.Field( - proto.ENUM, - number=4, - enum=Status, - ) - detail: str = proto.Field( - proto.STRING, - number=8, - ) - status_message: str = proto.Field( - proto.STRING, - number=5, - ) - self_link: str = proto.Field( - proto.STRING, - number=6, - ) - target_link: str = proto.Field( - proto.STRING, - number=7, - ) - location: str = proto.Field( - proto.STRING, - number=9, - ) - start_time: str = proto.Field( - proto.STRING, - number=10, - ) - end_time: str = proto.Field( - proto.STRING, - number=11, - ) - progress: 'OperationProgress' = proto.Field( - proto.MESSAGE, - number=12, - message='OperationProgress', - ) - cluster_conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( - proto.MESSAGE, - number=13, - message='StatusCondition', - ) - nodepool_conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( - proto.MESSAGE, - number=14, - message='StatusCondition', - ) - error: status_pb2.Status = proto.Field( - proto.MESSAGE, - number=15, - message=status_pb2.Status, - ) - - -class OperationProgress(proto.Message): - r"""Information about operation (or operation stage) progress. - - Attributes: - name (str): - A non-parameterized string describing an - operation stage. Unset for single-stage - operations. - status (google.cloud.container_v1.types.Operation.Status): - Status of an operation stage. - Unset for single-stage operations. - metrics (MutableSequence[google.cloud.container_v1.types.OperationProgress.Metric]): - Progress metric bundle, for example: metrics: [{name: "nodes - done", int_value: 15}, {name: "nodes total", int_value: 32}] - or metrics: [{name: "progress", double_value: 0.56}, {name: - "progress scale", double_value: 1.0}] - stages (MutableSequence[google.cloud.container_v1.types.OperationProgress]): - Substages of an operation or a stage. - """ - - class Metric(proto.Message): - r"""Progress metric is (string, int|float|string) pair. - - 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): - Required. Metric name, e.g., "nodes total", - "percent done". - int_value (int): - For metrics with integer value. - - This field is a member of `oneof`_ ``value``. - double_value (float): - For metrics with floating point value. - - This field is a member of `oneof`_ ``value``. - string_value (str): - For metrics with custom values (ratios, - visual progress, etc.). - - This field is a member of `oneof`_ ``value``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - int_value: int = proto.Field( - proto.INT64, - number=2, - oneof='value', - ) - double_value: float = proto.Field( - proto.DOUBLE, - number=3, - oneof='value', - ) - string_value: str = proto.Field( - proto.STRING, - number=4, - oneof='value', - ) - - name: str = proto.Field( - proto.STRING, - number=1, - ) - status: 'Operation.Status' = proto.Field( - proto.ENUM, - number=2, - enum='Operation.Status', - ) - metrics: MutableSequence[Metric] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message=Metric, - ) - stages: MutableSequence['OperationProgress'] = proto.RepeatedField( - proto.MESSAGE, - number=4, - message='OperationProgress', - ) - - -class CreateClusterRequest(proto.Message): - r"""CreateClusterRequest creates a cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the parent - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the parent field. - cluster (google.cloud.container_v1.types.Cluster): - Required. A `cluster - resource `__ - parent (str): - The parent (project and location) where the cluster will be - created. Specified in the format ``projects/*/locations/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster: 'Cluster' = proto.Field( - proto.MESSAGE, - number=3, - message='Cluster', - ) - parent: str = proto.Field( - proto.STRING, - number=5, - ) - - -class GetClusterRequest(proto.Message): - r"""GetClusterRequest gets the settings of a cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - retrieve. This field has been deprecated and - replaced by the name field. - name (str): - The name (project, location, cluster) of the cluster to - retrieve. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - name: str = proto.Field( - proto.STRING, - number=5, - ) - - -class UpdateClusterRequest(proto.Message): - r"""UpdateClusterRequest updates the settings of a cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - upgrade. This field has been deprecated and - replaced by the name field. - update (google.cloud.container_v1.types.ClusterUpdate): - Required. A description of the update. - name (str): - The name (project, location, cluster) of the cluster to - update. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - update: 'ClusterUpdate' = proto.Field( - proto.MESSAGE, - number=4, - message='ClusterUpdate', - ) - name: str = proto.Field( - proto.STRING, - number=5, - ) - - -class UpdateNodePoolRequest(proto.Message): - r"""UpdateNodePoolRequests update a node pool's image and/or - version. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - upgrade. This field has been deprecated and - replaced by the name field. - node_pool_id (str): - Deprecated. The name of the node pool to - upgrade. This field has been deprecated and - replaced by the name field. - node_version (str): - Required. The Kubernetes version to change - the nodes to (typically an upgrade). - - Users may specify either explicit versions - offered by Kubernetes Engine or version aliases, - which have the following behavior: - - - "latest": picks the highest valid Kubernetes - version - - "1.X": picks the highest valid patch+gke.N - patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N patch - in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit Kubernetes - version - - "-": picks the Kubernetes master version - image_type (str): - Required. The desired image type for the node - pool. Please see - https://cloud.google.com/kubernetes-engine/docs/concepts/node-images - for available image types. - name (str): - The name (project, location, cluster, node pool) of the node - pool to update. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - locations (MutableSequence[str]): - The desired list of Google Compute Engine - `zones `__ - in which the node pool's nodes should be located. Changing - the locations for a node pool will result in nodes being - either created or removed from the node pool, depending on - whether locations are being added or removed. - workload_metadata_config (google.cloud.container_v1.types.WorkloadMetadataConfig): - The desired workload metadata config for the - node pool. - upgrade_settings (google.cloud.container_v1.types.NodePool.UpgradeSettings): - Upgrade settings control disruption and speed - of the upgrade. - tags (google.cloud.container_v1.types.NetworkTags): - The desired network tags to be applied to all nodes in the - node pool. If this field is not present, the tags will not - be changed. Otherwise, the existing network tags will be - *replaced* with the provided tags. - taints (google.cloud.container_v1.types.NodeTaints): - The desired node taints to be applied to all nodes in the - node pool. If this field is not present, the taints will not - be changed. Otherwise, the existing node taints will be - *replaced* with the provided taints. - labels (google.cloud.container_v1.types.NodeLabels): - The desired node labels to be applied to all nodes in the - node pool. If this field is not present, the labels will not - be changed. Otherwise, the existing node labels will be - *replaced* with the provided labels. - linux_node_config (google.cloud.container_v1.types.LinuxNodeConfig): - Parameters that can be configured on Linux - nodes. - kubelet_config (google.cloud.container_v1.types.NodeKubeletConfig): - Node kubelet configs. - node_network_config (google.cloud.container_v1.types.NodeNetworkConfig): - Node network config. - gcfs_config (google.cloud.container_v1.types.GcfsConfig): - GCFS config. - confidential_nodes (google.cloud.container_v1.types.ConfidentialNodes): - Confidential nodes config. - All the nodes in the node pool will be - Confidential VM once enabled. - gvnic (google.cloud.container_v1.types.VirtualNIC): - Enable or disable gvnic on the node pool. - etag (str): - The current etag of the node pool. - If an etag is provided and does not match the - current etag of the node pool, update will be - blocked and an ABORTED error will be returned. - fast_socket (google.cloud.container_v1.types.FastSocket): - Enable or disable NCCL fast socket for the - node pool. - logging_config (google.cloud.container_v1.types.NodePoolLoggingConfig): - Logging configuration. - resource_labels (google.cloud.container_v1.types.ResourceLabels): - The resource labels for the node pool to use - to annotate any related Google Compute Engine - resources. - windows_node_config (google.cloud.container_v1.types.WindowsNodeConfig): - Parameters that can be configured on Windows - nodes. - accelerators (MutableSequence[google.cloud.container_v1.types.AcceleratorConfig]): - A list of hardware accelerators to be - attached to each node. See - https://cloud.google.com/compute/docs/gpus for - more information about support for GPUs. - machine_type (str): - Optional. The desired `Google Compute Engine machine - type `__ - for nodes in the node pool. Initiates an upgrade operation - that migrates the nodes in the node pool to the specified - machine type. - disk_type (str): - Optional. The desired disk type (e.g. - 'pd-standard', 'pd-ssd' or 'pd-balanced') for - nodes in the node pool. Initiates an upgrade - operation that migrates the nodes in the node - pool to the specified disk type. - disk_size_gb (int): - Optional. The desired disk size for nodes in - the node pool specified in GB. The smallest - allowed disk size is 10GB. Initiates an upgrade - operation that migrates the nodes in the node - pool to the specified disk size. - resource_manager_tags (google.cloud.container_v1.types.ResourceManagerTags): - Desired resource manager tag keys and values - to be attached to the nodes for managing Compute - Engine firewalls using Network Firewall - Policies. Existing tags will be replaced with - new values. - containerd_config (google.cloud.container_v1.types.ContainerdConfig): - The desired containerd config for nodes in - the node pool. Initiates an upgrade operation - that recreates the nodes with the new config. - queued_provisioning (google.cloud.container_v1.types.NodePool.QueuedProvisioning): - Specifies the configuration of queued - provisioning. - storage_pools (MutableSequence[str]): - List of Storage Pools where boot disks are - provisioned. Existing Storage Pools will be - replaced with storage-pools. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - node_version: str = proto.Field( - proto.STRING, - number=5, - ) - image_type: str = proto.Field( - proto.STRING, - number=6, - ) - name: str = proto.Field( - proto.STRING, - number=8, - ) - locations: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=13, - ) - workload_metadata_config: 'WorkloadMetadataConfig' = proto.Field( - proto.MESSAGE, - number=14, - message='WorkloadMetadataConfig', - ) - upgrade_settings: 'NodePool.UpgradeSettings' = proto.Field( - proto.MESSAGE, - number=15, - message='NodePool.UpgradeSettings', - ) - tags: 'NetworkTags' = proto.Field( - proto.MESSAGE, - number=16, - message='NetworkTags', - ) - taints: 'NodeTaints' = proto.Field( - proto.MESSAGE, - number=17, - message='NodeTaints', - ) - labels: 'NodeLabels' = proto.Field( - proto.MESSAGE, - number=18, - message='NodeLabels', - ) - linux_node_config: 'LinuxNodeConfig' = proto.Field( - proto.MESSAGE, - number=19, - message='LinuxNodeConfig', - ) - kubelet_config: 'NodeKubeletConfig' = proto.Field( - proto.MESSAGE, - number=20, - message='NodeKubeletConfig', - ) - node_network_config: 'NodeNetworkConfig' = proto.Field( - proto.MESSAGE, - number=21, - message='NodeNetworkConfig', - ) - gcfs_config: 'GcfsConfig' = proto.Field( - proto.MESSAGE, - number=22, - message='GcfsConfig', - ) - confidential_nodes: 'ConfidentialNodes' = proto.Field( - proto.MESSAGE, - number=23, - message='ConfidentialNodes', - ) - gvnic: 'VirtualNIC' = proto.Field( - proto.MESSAGE, - number=29, - message='VirtualNIC', - ) - etag: str = proto.Field( - proto.STRING, - number=30, - ) - fast_socket: 'FastSocket' = proto.Field( - proto.MESSAGE, - number=31, - message='FastSocket', - ) - logging_config: 'NodePoolLoggingConfig' = proto.Field( - proto.MESSAGE, - number=32, - message='NodePoolLoggingConfig', - ) - resource_labels: 'ResourceLabels' = proto.Field( - proto.MESSAGE, - number=33, - message='ResourceLabels', - ) - windows_node_config: 'WindowsNodeConfig' = proto.Field( - proto.MESSAGE, - number=34, - message='WindowsNodeConfig', - ) - accelerators: MutableSequence['AcceleratorConfig'] = proto.RepeatedField( - proto.MESSAGE, - number=35, - message='AcceleratorConfig', - ) - machine_type: str = proto.Field( - proto.STRING, - number=36, - ) - disk_type: str = proto.Field( - proto.STRING, - number=37, - ) - disk_size_gb: int = proto.Field( - proto.INT64, - number=38, - ) - resource_manager_tags: 'ResourceManagerTags' = proto.Field( - proto.MESSAGE, - number=39, - message='ResourceManagerTags', - ) - containerd_config: 'ContainerdConfig' = proto.Field( - proto.MESSAGE, - number=40, - message='ContainerdConfig', - ) - queued_provisioning: 'NodePool.QueuedProvisioning' = proto.Field( - proto.MESSAGE, - number=42, - message='NodePool.QueuedProvisioning', - ) - storage_pools: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=43, - ) - - -class SetNodePoolAutoscalingRequest(proto.Message): - r"""SetNodePoolAutoscalingRequest sets the autoscaler settings of - a node pool. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - upgrade. This field has been deprecated and - replaced by the name field. - node_pool_id (str): - Deprecated. The name of the node pool to - upgrade. This field has been deprecated and - replaced by the name field. - autoscaling (google.cloud.container_v1.types.NodePoolAutoscaling): - Required. Autoscaling configuration for the - node pool. - name (str): - The name (project, location, cluster, node pool) of the node - pool to set autoscaler settings. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - autoscaling: 'NodePoolAutoscaling' = proto.Field( - proto.MESSAGE, - number=5, - message='NodePoolAutoscaling', - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class SetLoggingServiceRequest(proto.Message): - r"""SetLoggingServiceRequest sets the logging service of a - cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - upgrade. This field has been deprecated and - replaced by the name field. - logging_service (str): - Required. The logging service the cluster should use to - write logs. Currently available options: - - - ``logging.googleapis.com/kubernetes`` - The Cloud Logging - service with a Kubernetes-native resource model - - ``logging.googleapis.com`` - The legacy Cloud Logging - service (no longer available as of GKE 1.15). - - ``none`` - no logs will be exported from the cluster. - - If left as an empty - string,\ ``logging.googleapis.com/kubernetes`` will be used - for GKE 1.14+ or ``logging.googleapis.com`` for earlier - versions. - name (str): - The name (project, location, cluster) of the cluster to set - logging. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - logging_service: str = proto.Field( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=5, - ) - - -class SetMonitoringServiceRequest(proto.Message): - r"""SetMonitoringServiceRequest sets the monitoring service of a - cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - upgrade. This field has been deprecated and - replaced by the name field. - monitoring_service (str): - Required. The monitoring service the cluster should use to - write metrics. Currently available options: - - - "monitoring.googleapis.com/kubernetes" - The Cloud - Monitoring service with a Kubernetes-native resource - model - - ``monitoring.googleapis.com`` - The legacy Cloud - Monitoring service (no longer available as of GKE 1.15). - - ``none`` - No metrics will be exported from the cluster. - - If left as an empty - string,\ ``monitoring.googleapis.com/kubernetes`` will be - used for GKE 1.14+ or ``monitoring.googleapis.com`` for - earlier versions. - name (str): - The name (project, location, cluster) of the cluster to set - monitoring. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - monitoring_service: str = proto.Field( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class SetAddonsConfigRequest(proto.Message): - r"""SetAddonsConfigRequest sets the addons associated with the - cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - upgrade. This field has been deprecated and - replaced by the name field. - addons_config (google.cloud.container_v1.types.AddonsConfig): - Required. The desired configurations for the - various addons available to run in the cluster. - name (str): - The name (project, location, cluster) of the cluster to set - addons. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - addons_config: 'AddonsConfig' = proto.Field( - proto.MESSAGE, - number=4, - message='AddonsConfig', - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class SetLocationsRequest(proto.Message): - r"""SetLocationsRequest sets the locations of the cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - upgrade. This field has been deprecated and - replaced by the name field. - locations (MutableSequence[str]): - Required. The desired list of Google Compute Engine - `zones `__ - in which the cluster's nodes should be located. Changing the - locations a cluster is in will result in nodes being either - created or removed from the cluster, depending on whether - locations are being added or removed. - - This list must always include the cluster's primary zone. - name (str): - The name (project, location, cluster) of the cluster to set - locations. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - locations: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class UpdateMasterRequest(proto.Message): - r"""UpdateMasterRequest updates the master of the cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - upgrade. This field has been deprecated and - replaced by the name field. - master_version (str): - Required. The Kubernetes version to change - the master to. - Users may specify either explicit versions - offered by Kubernetes Engine or version aliases, - which have the following behavior: - - - "latest": picks the highest valid Kubernetes - version - - "1.X": picks the highest valid patch+gke.N - patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N patch - in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit Kubernetes - version - - "-": picks the default Kubernetes version - name (str): - The name (project, location, cluster) of the cluster to - update. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - master_version: str = proto.Field( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=7, - ) - - -class SetMasterAuthRequest(proto.Message): - r"""SetMasterAuthRequest updates the admin password of a cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - upgrade. This field has been deprecated and - replaced by the name field. - action (google.cloud.container_v1.types.SetMasterAuthRequest.Action): - Required. The exact form of action to be - taken on the master auth. - update (google.cloud.container_v1.types.MasterAuth): - Required. A description of the update. - name (str): - The name (project, location, cluster) of the cluster to set - auth. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - class Action(proto.Enum): - r"""Operation type: what type update to perform. - - Values: - UNKNOWN (0): - Operation is unknown and will error out. - SET_PASSWORD (1): - Set the password to a user generated value. - GENERATE_PASSWORD (2): - Generate a new password and set it to that. - SET_USERNAME (3): - Set the username. If an empty username is - provided, basic authentication is disabled for - the cluster. If a non-empty username is - provided, basic authentication is enabled, with - either a provided password or a generated one. - """ - UNKNOWN = 0 - SET_PASSWORD = 1 - GENERATE_PASSWORD = 2 - SET_USERNAME = 3 - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - action: Action = proto.Field( - proto.ENUM, - number=4, - enum=Action, - ) - update: 'MasterAuth' = proto.Field( - proto.MESSAGE, - number=5, - message='MasterAuth', - ) - name: str = proto.Field( - proto.STRING, - number=7, - ) - - -class DeleteClusterRequest(proto.Message): - r"""DeleteClusterRequest deletes a cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - delete. This field has been deprecated and - replaced by the name field. - name (str): - The name (project, location, cluster) of the cluster to - delete. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - name: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListClustersRequest(proto.Message): - r"""ListClustersRequest lists clusters. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the parent - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides, or "-" for all zones. This - field has been deprecated and replaced by the parent field. - parent (str): - The parent (project and location) where the clusters will be - listed. Specified in the format ``projects/*/locations/*``. - Location "-" matches all zones and all regions. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - parent: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListClustersResponse(proto.Message): - r"""ListClustersResponse is the result of ListClustersRequest. - - Attributes: - clusters (MutableSequence[google.cloud.container_v1.types.Cluster]): - A list of clusters in the project in the - specified zone, or across all ones. - missing_zones (MutableSequence[str]): - If any zones are listed here, the list of - clusters returned may be missing those zones. - """ - - clusters: MutableSequence['Cluster'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='Cluster', - ) - missing_zones: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=2, - ) - - -class GetOperationRequest(proto.Message): - r"""GetOperationRequest gets a single operation. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - operation_id (str): - Deprecated. The server-assigned ``name`` of the operation. - This field has been deprecated and replaced by the name - field. - name (str): - The name (project, location, operation id) of the operation - to get. Specified in the format - ``projects/*/locations/*/operations/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - operation_id: str = proto.Field( - proto.STRING, - number=3, - ) - name: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListOperationsRequest(proto.Message): - r"""ListOperationsRequest lists operations. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the parent - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - to return operations for, or ``-`` for all zones. This field - has been deprecated and replaced by the parent field. - parent (str): - The parent (project and location) where the operations will - be listed. Specified in the format - ``projects/*/locations/*``. Location "-" matches all zones - and all regions. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - parent: str = proto.Field( - proto.STRING, - number=4, - ) - - -class CancelOperationRequest(proto.Message): - r"""CancelOperationRequest cancels a single operation. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the operation resides. This field has been - deprecated and replaced by the name field. - operation_id (str): - Deprecated. The server-assigned ``name`` of the operation. - This field has been deprecated and replaced by the name - field. - name (str): - The name (project, location, operation id) of the operation - to cancel. Specified in the format - ``projects/*/locations/*/operations/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - operation_id: str = proto.Field( - proto.STRING, - number=3, - ) - name: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListOperationsResponse(proto.Message): - r"""ListOperationsResponse is the result of - ListOperationsRequest. - - Attributes: - operations (MutableSequence[google.cloud.container_v1.types.Operation]): - A list of operations in the project in the - specified zone. - missing_zones (MutableSequence[str]): - If any zones are listed here, the list of - operations returned may be missing the - operations from those zones. - """ - - operations: MutableSequence['Operation'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='Operation', - ) - missing_zones: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=2, - ) - - -class GetServerConfigRequest(proto.Message): - r"""Gets the current Kubernetes Engine service configuration. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - to return operations for. This field has been deprecated and - replaced by the name field. - name (str): - The name (project and location) of the server config to get, - specified in the format ``projects/*/locations/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - name: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ServerConfig(proto.Message): - r"""Kubernetes Engine service configuration. - - Attributes: - default_cluster_version (str): - Version of Kubernetes the service deploys by - default. - valid_node_versions (MutableSequence[str]): - List of valid node upgrade target versions, - in descending order. - default_image_type (str): - Default image type. - valid_image_types (MutableSequence[str]): - List of valid image types. - valid_master_versions (MutableSequence[str]): - List of valid master versions, in descending - order. - channels (MutableSequence[google.cloud.container_v1.types.ServerConfig.ReleaseChannelConfig]): - List of release channel configurations. - """ - - class ReleaseChannelConfig(proto.Message): - r"""ReleaseChannelConfig exposes configuration for a release - channel. - - Attributes: - channel (google.cloud.container_v1.types.ReleaseChannel.Channel): - The release channel this configuration - applies to. - default_version (str): - The default version for newly created - clusters on the channel. - valid_versions (MutableSequence[str]): - List of valid versions for the channel. - upgrade_target_version (str): - The auto upgrade target version for clusters - on the channel. - """ - - channel: 'ReleaseChannel.Channel' = proto.Field( - proto.ENUM, - number=1, - enum='ReleaseChannel.Channel', - ) - default_version: str = proto.Field( - proto.STRING, - number=2, - ) - valid_versions: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - upgrade_target_version: str = proto.Field( - proto.STRING, - number=5, - ) - - default_cluster_version: str = proto.Field( - proto.STRING, - number=1, - ) - valid_node_versions: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - default_image_type: str = proto.Field( - proto.STRING, - number=4, - ) - valid_image_types: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=5, - ) - valid_master_versions: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=6, - ) - channels: MutableSequence[ReleaseChannelConfig] = proto.RepeatedField( - proto.MESSAGE, - number=9, - message=ReleaseChannelConfig, - ) - - -class CreateNodePoolRequest(proto.Message): - r"""CreateNodePoolRequest creates a node pool for a cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the parent - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the parent field. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and replaced by - the parent field. - node_pool (google.cloud.container_v1.types.NodePool): - Required. The node pool to create. - parent (str): - The parent (project, location, cluster name) where the node - pool will be created. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool: 'NodePool' = proto.Field( - proto.MESSAGE, - number=4, - message='NodePool', - ) - parent: str = proto.Field( - proto.STRING, - number=6, - ) - - -class DeleteNodePoolRequest(proto.Message): - r"""DeleteNodePoolRequest deletes a node pool for a cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and replaced by - the name field. - node_pool_id (str): - Deprecated. The name of the node pool to - delete. This field has been deprecated and - replaced by the name field. - name (str): - The name (project, location, cluster, node pool id) of the - node pool to delete. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class ListNodePoolsRequest(proto.Message): - r"""ListNodePoolsRequest lists the node pool(s) for a cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the parent - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the parent field. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and replaced by - the parent field. - parent (str): - The parent (project, location, cluster name) where the node - pools will be listed. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - parent: str = proto.Field( - proto.STRING, - number=5, - ) - - -class GetNodePoolRequest(proto.Message): - r"""GetNodePoolRequest retrieves a node pool for a cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and replaced by - the name field. - node_pool_id (str): - Deprecated. The name of the node pool. - This field has been deprecated and replaced by - the name field. - name (str): - The name (project, location, cluster, node pool id) of the - node pool to get. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class BlueGreenSettings(proto.Message): - r"""Settings for blue-green upgrade. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - standard_rollout_policy (google.cloud.container_v1.types.BlueGreenSettings.StandardRolloutPolicy): - Standard policy for the blue-green upgrade. - - This field is a member of `oneof`_ ``rollout_policy``. - node_pool_soak_duration (google.protobuf.duration_pb2.Duration): - Time needed after draining entire blue pool. - After this period, blue pool will be cleaned up. - - This field is a member of `oneof`_ ``_node_pool_soak_duration``. - """ - - class StandardRolloutPolicy(proto.Message): - r"""Standard rollout policy is the default policy for blue-green. - - 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: - batch_percentage (float): - Percentage of the blue pool nodes to drain in a batch. The - range of this field should be (0.0, 1.0]. - - This field is a member of `oneof`_ ``update_batch_size``. - batch_node_count (int): - Number of blue nodes to drain in a batch. - - This field is a member of `oneof`_ ``update_batch_size``. - batch_soak_duration (google.protobuf.duration_pb2.Duration): - Soak time after each batch gets drained. - Default to zero. - - This field is a member of `oneof`_ ``_batch_soak_duration``. - """ - - batch_percentage: float = proto.Field( - proto.FLOAT, - number=1, - oneof='update_batch_size', - ) - batch_node_count: int = proto.Field( - proto.INT32, - number=2, - oneof='update_batch_size', - ) - batch_soak_duration: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=3, - optional=True, - message=duration_pb2.Duration, - ) - - standard_rollout_policy: StandardRolloutPolicy = proto.Field( - proto.MESSAGE, - number=1, - oneof='rollout_policy', - message=StandardRolloutPolicy, - ) - node_pool_soak_duration: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=2, - optional=True, - message=duration_pb2.Duration, - ) - - -class NodePool(proto.Message): - r"""NodePool contains the name and configuration for a cluster's - node pool. Node pools are a set of nodes (i.e. VM's), with a - common configuration and specification, under the control of the - cluster master. They may have a set of Kubernetes labels applied - to them, which may be used to reference them during pod - scheduling. They may also be resized up or down, to accommodate - the workload. - - Attributes: - name (str): - The name of the node pool. - config (google.cloud.container_v1.types.NodeConfig): - The node configuration of the pool. - initial_node_count (int): - The initial node count for the pool. You must ensure that - your Compute Engine `resource - quota `__ is - sufficient for this number of instances. You must also have - available firewall and routes quota. - locations (MutableSequence[str]): - The list of Google Compute Engine - `zones `__ - in which the NodePool's nodes should be located. - - If this value is unspecified during node pool creation, the - `Cluster.Locations `__ - value will be used, instead. - - Warning: changing node pool locations will result in nodes - being added and/or removed. - network_config (google.cloud.container_v1.types.NodeNetworkConfig): - Networking configuration for this NodePool. - If specified, it overrides the cluster-level - defaults. - self_link (str): - Output only. Server-defined URL for the - resource. - version (str): - The version of Kubernetes running on this NodePool's nodes. - If unspecified, it defaults as described - `here `__. - instance_group_urls (MutableSequence[str]): - Output only. The resource URLs of the `managed instance - groups `__ - associated with this node pool. During the node pool - blue-green upgrade operation, the URLs contain both blue and - green resources. - status (google.cloud.container_v1.types.NodePool.Status): - Output only. The status of the nodes in this - pool instance. - status_message (str): - Output only. Deprecated. Use conditions - instead. Additional information about the - current status of this node pool instance, if - available. - autoscaling (google.cloud.container_v1.types.NodePoolAutoscaling): - Autoscaler configuration for this NodePool. - Autoscaler is enabled only if a valid - configuration is present. - management (google.cloud.container_v1.types.NodeManagement): - NodeManagement configuration for this - NodePool. - max_pods_constraint (google.cloud.container_v1.types.MaxPodsConstraint): - The constraint on the maximum number of pods - that can be run simultaneously on a node in the - node pool. - conditions (MutableSequence[google.cloud.container_v1.types.StatusCondition]): - Which conditions caused the current node pool - state. - pod_ipv4_cidr_size (int): - Output only. The pod CIDR block size per node - in this node pool. - upgrade_settings (google.cloud.container_v1.types.NodePool.UpgradeSettings): - Upgrade settings control disruption and speed - of the upgrade. - placement_policy (google.cloud.container_v1.types.NodePool.PlacementPolicy): - Specifies the node placement policy. - update_info (google.cloud.container_v1.types.NodePool.UpdateInfo): - Output only. Update info contains relevant - information during a node pool update. - etag (str): - This checksum is computed by the server based - on the value of node pool fields, and may be - sent on update requests to ensure the client has - an up-to-date value before proceeding. - queued_provisioning (google.cloud.container_v1.types.NodePool.QueuedProvisioning): - Specifies the configuration of queued - provisioning. - best_effort_provisioning (google.cloud.container_v1.types.BestEffortProvisioning): - Enable best effort provisioning for nodes - """ - class Status(proto.Enum): - r"""The current status of the node pool instance. - - Values: - STATUS_UNSPECIFIED (0): - Not set. - PROVISIONING (1): - The PROVISIONING state indicates the node - pool is being created. - RUNNING (2): - The RUNNING state indicates the node pool has - been created and is fully usable. - RUNNING_WITH_ERROR (3): - The RUNNING_WITH_ERROR state indicates the node pool has - been created and is partially usable. Some error state has - occurred and some functionality may be impaired. Customer - may need to reissue a request or trigger a new update. - RECONCILING (4): - The RECONCILING state indicates that some work is actively - being done on the node pool, such as upgrading node - software. Details can be found in the ``statusMessage`` - field. - STOPPING (5): - The STOPPING state indicates the node pool is - being deleted. - ERROR (6): - The ERROR state indicates the node pool may be unusable. - Details can be found in the ``statusMessage`` field. - """ - STATUS_UNSPECIFIED = 0 - PROVISIONING = 1 - RUNNING = 2 - RUNNING_WITH_ERROR = 3 - RECONCILING = 4 - STOPPING = 5 - ERROR = 6 - - class UpgradeSettings(proto.Message): - r"""These upgrade settings control the level of parallelism and the - level of disruption caused by an upgrade. - - maxUnavailable controls the number of nodes that can be - simultaneously unavailable. - - maxSurge controls the number of additional nodes that can be added - to the node pool temporarily for the time of the upgrade to increase - the number of available nodes. - - (maxUnavailable + maxSurge) determines the level of parallelism (how - many nodes are being upgraded at the same time). - - Note: upgrades inevitably introduce some disruption since workloads - need to be moved from old nodes to new, upgraded ones. Even if - maxUnavailable=0, this holds true. (Disruption stays within the - limits of PodDisruptionBudget, if it is configured.) - - Consider a hypothetical node pool with 5 nodes having maxSurge=2, - maxUnavailable=1. This means the upgrade process upgrades 3 nodes - simultaneously. It creates 2 additional (upgraded) nodes, then it - brings down 3 old (not yet upgraded) nodes at the same time. This - ensures that there are always at least 4 nodes available. - - These upgrade settings configure the upgrade strategy for the node - pool. Use strategy to switch between the strategies applied to the - node pool. - - If the strategy is ROLLING, use max_surge and max_unavailable to - control the level of parallelism and the level of disruption caused - by upgrade. - - 1. maxSurge controls the number of additional nodes that can be - added to the node pool temporarily for the time of the upgrade to - increase the number of available nodes. - 2. maxUnavailable controls the number of nodes that can be - simultaneously unavailable. - 3. (maxUnavailable + maxSurge) determines the level of parallelism - (how many nodes are being upgraded at the same time). - - If the strategy is BLUE_GREEN, use blue_green_settings to configure - the blue-green upgrade related settings. - - 1. standard_rollout_policy is the default policy. The policy is used - to control the way blue pool gets drained. The draining is - executed in the batch mode. The batch size could be specified as - either percentage of the node pool size or the number of nodes. - batch_soak_duration is the soak time after each batch gets - drained. - 2. node_pool_soak_duration is the soak time after all blue nodes are - drained. After this period, the blue pool nodes will be deleted. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - max_surge (int): - The maximum number of nodes that can be - created beyond the current size of the node pool - during the upgrade process. - max_unavailable (int): - The maximum number of nodes that can be - simultaneously unavailable during the upgrade - process. A node is considered available if its - status is Ready. - strategy (google.cloud.container_v1.types.NodePoolUpdateStrategy): - Update strategy of the node pool. - - This field is a member of `oneof`_ ``_strategy``. - blue_green_settings (google.cloud.container_v1.types.BlueGreenSettings): - Settings for blue-green upgrade strategy. - - This field is a member of `oneof`_ ``_blue_green_settings``. - """ - - max_surge: int = proto.Field( - proto.INT32, - number=1, - ) - max_unavailable: int = proto.Field( - proto.INT32, - number=2, - ) - strategy: 'NodePoolUpdateStrategy' = proto.Field( - proto.ENUM, - number=3, - optional=True, - enum='NodePoolUpdateStrategy', - ) - blue_green_settings: 'BlueGreenSettings' = proto.Field( - proto.MESSAGE, - number=4, - optional=True, - message='BlueGreenSettings', - ) - - class UpdateInfo(proto.Message): - r"""UpdateInfo contains resource (instance groups, etc), status - and other intermediate information relevant to a node pool - upgrade. - - Attributes: - blue_green_info (google.cloud.container_v1.types.NodePool.UpdateInfo.BlueGreenInfo): - Information of a blue-green upgrade. - """ - - class BlueGreenInfo(proto.Message): - r"""Information relevant to blue-green upgrade. - - Attributes: - phase (google.cloud.container_v1.types.NodePool.UpdateInfo.BlueGreenInfo.Phase): - Current blue-green upgrade phase. - blue_instance_group_urls (MutableSequence[str]): - The resource URLs of the [managed instance groups] - (/compute/docs/instance-groups/creating-groups-of-managed-instances) - associated with blue pool. - green_instance_group_urls (MutableSequence[str]): - The resource URLs of the [managed instance groups] - (/compute/docs/instance-groups/creating-groups-of-managed-instances) - associated with green pool. - blue_pool_deletion_start_time (str): - Time to start deleting blue pool to complete blue-green - upgrade, in - `RFC3339 `__ text - format. - green_pool_version (str): - Version of green pool. - """ - class Phase(proto.Enum): - r"""Phase represents the different stages blue-green upgrade is - running in. - - Values: - PHASE_UNSPECIFIED (0): - Unspecified phase. - UPDATE_STARTED (1): - blue-green upgrade has been initiated. - CREATING_GREEN_POOL (2): - Start creating green pool nodes. - CORDONING_BLUE_POOL (3): - Start cordoning blue pool nodes. - DRAINING_BLUE_POOL (4): - Start draining blue pool nodes. - NODE_POOL_SOAKING (5): - Start soaking time after draining entire blue - pool. - DELETING_BLUE_POOL (6): - Start deleting blue nodes. - ROLLBACK_STARTED (7): - Rollback has been initiated. - """ - PHASE_UNSPECIFIED = 0 - UPDATE_STARTED = 1 - CREATING_GREEN_POOL = 2 - CORDONING_BLUE_POOL = 3 - DRAINING_BLUE_POOL = 4 - NODE_POOL_SOAKING = 5 - DELETING_BLUE_POOL = 6 - ROLLBACK_STARTED = 7 - - phase: 'NodePool.UpdateInfo.BlueGreenInfo.Phase' = proto.Field( - proto.ENUM, - number=1, - enum='NodePool.UpdateInfo.BlueGreenInfo.Phase', - ) - blue_instance_group_urls: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=2, - ) - green_instance_group_urls: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - blue_pool_deletion_start_time: str = proto.Field( - proto.STRING, - number=4, - ) - green_pool_version: str = proto.Field( - proto.STRING, - number=5, - ) - - blue_green_info: 'NodePool.UpdateInfo.BlueGreenInfo' = proto.Field( - proto.MESSAGE, - number=1, - message='NodePool.UpdateInfo.BlueGreenInfo', - ) - - class PlacementPolicy(proto.Message): - r"""PlacementPolicy defines the placement policy used by the node - pool. - - Attributes: - type_ (google.cloud.container_v1.types.NodePool.PlacementPolicy.Type): - The type of placement. - tpu_topology (str): - Optional. TPU placement topology for pod slice node pool. - https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies - policy_name (str): - If set, refers to the name of a custom - resource policy supplied by the user. The - resource policy must be in the same project and - region as the node pool. If not found, - InvalidArgument error is returned. - """ - class Type(proto.Enum): - r"""Type defines the type of placement policy. - - Values: - TYPE_UNSPECIFIED (0): - TYPE_UNSPECIFIED specifies no requirements on nodes - placement. - COMPACT (1): - COMPACT specifies node placement in the same - availability domain to ensure low communication - latency. - """ - TYPE_UNSPECIFIED = 0 - COMPACT = 1 - - type_: 'NodePool.PlacementPolicy.Type' = proto.Field( - proto.ENUM, - number=1, - enum='NodePool.PlacementPolicy.Type', - ) - tpu_topology: str = proto.Field( - proto.STRING, - number=2, - ) - policy_name: str = proto.Field( - proto.STRING, - number=3, - ) - - class QueuedProvisioning(proto.Message): - r"""QueuedProvisioning defines the queued provisioning used by - the node pool. - - Attributes: - enabled (bool): - Denotes that this nodepool is QRM specific, - meaning nodes can be only obtained through - queuing via the Cluster Autoscaler - ProvisioningRequest API. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - name: str = proto.Field( - proto.STRING, - number=1, - ) - config: 'NodeConfig' = proto.Field( - proto.MESSAGE, - number=2, - message='NodeConfig', - ) - initial_node_count: int = proto.Field( - proto.INT32, - number=3, - ) - locations: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=13, - ) - network_config: 'NodeNetworkConfig' = proto.Field( - proto.MESSAGE, - number=14, - message='NodeNetworkConfig', - ) - self_link: str = proto.Field( - proto.STRING, - number=100, - ) - version: str = proto.Field( - proto.STRING, - number=101, - ) - instance_group_urls: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=102, - ) - status: Status = proto.Field( - proto.ENUM, - number=103, - enum=Status, - ) - status_message: str = proto.Field( - proto.STRING, - number=104, - ) - autoscaling: 'NodePoolAutoscaling' = proto.Field( - proto.MESSAGE, - number=4, - message='NodePoolAutoscaling', - ) - management: 'NodeManagement' = proto.Field( - proto.MESSAGE, - number=5, - message='NodeManagement', - ) - max_pods_constraint: 'MaxPodsConstraint' = proto.Field( - proto.MESSAGE, - number=6, - message='MaxPodsConstraint', - ) - conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( - proto.MESSAGE, - number=105, - message='StatusCondition', - ) - pod_ipv4_cidr_size: int = proto.Field( - proto.INT32, - number=7, - ) - upgrade_settings: UpgradeSettings = proto.Field( - proto.MESSAGE, - number=107, - message=UpgradeSettings, - ) - placement_policy: PlacementPolicy = proto.Field( - proto.MESSAGE, - number=108, - message=PlacementPolicy, - ) - update_info: UpdateInfo = proto.Field( - proto.MESSAGE, - number=109, - message=UpdateInfo, - ) - etag: str = proto.Field( - proto.STRING, - number=110, - ) - queued_provisioning: QueuedProvisioning = proto.Field( - proto.MESSAGE, - number=112, - message=QueuedProvisioning, - ) - best_effort_provisioning: 'BestEffortProvisioning' = proto.Field( - proto.MESSAGE, - number=113, - message='BestEffortProvisioning', - ) - - -class NodeManagement(proto.Message): - r"""NodeManagement defines the set of node management services - turned on for the node pool. - - Attributes: - auto_upgrade (bool): - A flag that specifies whether node - auto-upgrade is enabled for the node pool. If - enabled, node auto-upgrade helps keep the nodes - in your node pool up to date with the latest - release version of Kubernetes. - auto_repair (bool): - A flag that specifies whether the node - auto-repair is enabled for the node pool. If - enabled, the nodes in this node pool will be - monitored and, if they fail health checks too - many times, an automatic repair action will be - triggered. - upgrade_options (google.cloud.container_v1.types.AutoUpgradeOptions): - Specifies the Auto Upgrade knobs for the node - pool. - """ - - auto_upgrade: bool = proto.Field( - proto.BOOL, - number=1, - ) - auto_repair: bool = proto.Field( - proto.BOOL, - number=2, - ) - upgrade_options: 'AutoUpgradeOptions' = proto.Field( - proto.MESSAGE, - number=10, - message='AutoUpgradeOptions', - ) - - -class BestEffortProvisioning(proto.Message): - r"""Best effort provisioning. - - Attributes: - enabled (bool): - When this is enabled, cluster/node pool - creations will ignore non-fatal errors like - stockout to best provision as many nodes as - possible right now and eventually bring up all - target number of nodes - min_provision_nodes (int): - Minimum number of nodes to be provisioned to - be considered as succeeded, and the rest of - nodes will be provisioned gradually and - eventually when stockout issue has been - resolved. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - min_provision_nodes: int = proto.Field( - proto.INT32, - number=2, - ) - - -class AutoUpgradeOptions(proto.Message): - r"""AutoUpgradeOptions defines the set of options for the user to - control how the Auto Upgrades will proceed. - - Attributes: - auto_upgrade_start_time (str): - Output only. This field is set when upgrades are about to - commence with the approximate start time for the upgrades, - in `RFC3339 `__ text - format. - description (str): - Output only. This field is set when upgrades - are about to commence with the description of - the upgrade. - """ - - auto_upgrade_start_time: str = proto.Field( - proto.STRING, - number=1, - ) - description: str = proto.Field( - proto.STRING, - number=2, - ) - - -class MaintenancePolicy(proto.Message): - r"""MaintenancePolicy defines the maintenance policy to be used - for the cluster. - - Attributes: - window (google.cloud.container_v1.types.MaintenanceWindow): - Specifies the maintenance window in which - maintenance may be performed. - resource_version (str): - A hash identifying the version of this policy, so that - updates to fields of the policy won't accidentally undo - intermediate changes (and so that users of the API unaware - of some fields won't accidentally remove other fields). Make - a ``get()`` request to the cluster to get the current - resource version and include it with requests to set the - policy. - """ - - window: 'MaintenanceWindow' = proto.Field( - proto.MESSAGE, - number=1, - message='MaintenanceWindow', - ) - resource_version: str = proto.Field( - proto.STRING, - number=3, - ) - - -class MaintenanceWindow(proto.Message): - r"""MaintenanceWindow defines the maintenance window to be used - for the cluster. - - 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: - daily_maintenance_window (google.cloud.container_v1.types.DailyMaintenanceWindow): - DailyMaintenanceWindow specifies a daily - maintenance operation window. - - This field is a member of `oneof`_ ``policy``. - recurring_window (google.cloud.container_v1.types.RecurringTimeWindow): - RecurringWindow specifies some number of - recurring time periods for maintenance to occur. - The time windows may be overlapping. If no - maintenance windows are set, maintenance can - occur at any time. - - This field is a member of `oneof`_ ``policy``. - maintenance_exclusions (MutableMapping[str, google.cloud.container_v1.types.TimeWindow]): - Exceptions to maintenance window. - Non-emergency maintenance should not occur in - these windows. - """ - - daily_maintenance_window: 'DailyMaintenanceWindow' = proto.Field( - proto.MESSAGE, - number=2, - oneof='policy', - message='DailyMaintenanceWindow', - ) - recurring_window: 'RecurringTimeWindow' = proto.Field( - proto.MESSAGE, - number=3, - oneof='policy', - message='RecurringTimeWindow', - ) - maintenance_exclusions: MutableMapping[str, 'TimeWindow'] = proto.MapField( - proto.STRING, - proto.MESSAGE, - number=4, - message='TimeWindow', - ) - - -class TimeWindow(proto.Message): - r"""Represents an arbitrary window of time. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - maintenance_exclusion_options (google.cloud.container_v1.types.MaintenanceExclusionOptions): - MaintenanceExclusionOptions provides - maintenance exclusion related options. - - This field is a member of `oneof`_ ``options``. - start_time (google.protobuf.timestamp_pb2.Timestamp): - The time that the window first starts. - end_time (google.protobuf.timestamp_pb2.Timestamp): - The time that the window ends. The end time - should take place after the start time. - """ - - maintenance_exclusion_options: 'MaintenanceExclusionOptions' = proto.Field( - proto.MESSAGE, - number=3, - oneof='options', - message='MaintenanceExclusionOptions', - ) - start_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, - ) - - -class MaintenanceExclusionOptions(proto.Message): - r"""Represents the Maintenance exclusion option. - - Attributes: - scope (google.cloud.container_v1.types.MaintenanceExclusionOptions.Scope): - Scope specifies the upgrade scope which - upgrades are blocked by the exclusion. - """ - class Scope(proto.Enum): - r"""Scope of exclusion. - - Values: - NO_UPGRADES (0): - NO_UPGRADES excludes all upgrades, including patch upgrades - and minor upgrades across control planes and nodes. This is - the default exclusion behavior. - NO_MINOR_UPGRADES (1): - NO_MINOR_UPGRADES excludes all minor upgrades for the - cluster, only patches are allowed. - NO_MINOR_OR_NODE_UPGRADES (2): - NO_MINOR_OR_NODE_UPGRADES excludes all minor upgrades for - the cluster, and also exclude all node pool upgrades. Only - control plane patches are allowed. - """ - NO_UPGRADES = 0 - NO_MINOR_UPGRADES = 1 - NO_MINOR_OR_NODE_UPGRADES = 2 - - scope: Scope = proto.Field( - proto.ENUM, - number=1, - enum=Scope, - ) - - -class RecurringTimeWindow(proto.Message): - r"""Represents an arbitrary window of time that recurs. - - Attributes: - window (google.cloud.container_v1.types.TimeWindow): - The window of the first recurrence. - recurrence (str): - An RRULE - (https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for - how this window reccurs. They go on for the span of time - between the start and end time. - - For example, to have something repeat every weekday, you'd - use: ``FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR`` - - To repeat some window daily (equivalent to the - DailyMaintenanceWindow): ``FREQ=DAILY`` - - For the first weekend of every month: - ``FREQ=MONTHLY;BYSETPOS=1;BYDAY=SA,SU`` - - This specifies how frequently the window starts. Eg, if you - wanted to have a 9-5 UTC-4 window every weekday, you'd use - something like: - - :: - - start time = 2019-01-01T09:00:00-0400 - end time = 2019-01-01T17:00:00-0400 - recurrence = FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR - - Windows can span multiple days. Eg, to make the window - encompass every weekend from midnight Saturday till the last - minute of Sunday UTC: - - :: - - start time = 2019-01-05T00:00:00Z - end time = 2019-01-07T23:59:00Z - recurrence = FREQ=WEEKLY;BYDAY=SA - - Note the start and end time's specific dates are largely - arbitrary except to specify duration of the window and when - it first starts. The FREQ values of HOURLY, MINUTELY, and - SECONDLY are not supported. - """ - - window: 'TimeWindow' = proto.Field( - proto.MESSAGE, - number=1, - message='TimeWindow', - ) - recurrence: str = proto.Field( - proto.STRING, - number=2, - ) - - -class DailyMaintenanceWindow(proto.Message): - r"""Time window specified for daily maintenance operations. - - Attributes: - start_time (str): - Time within the maintenance window to start the maintenance - operations. Time format should be in - `RFC3339 `__ format - "HH:MM", where HH : [00-23] and MM : [00-59] GMT. - duration (str): - Output only. Duration of the time window, automatically - chosen to be smallest possible in the given scenario. - Duration will be in - `RFC3339 `__ format - "PTnHnMnS". - """ - - start_time: str = proto.Field( - proto.STRING, - number=2, - ) - duration: str = proto.Field( - proto.STRING, - number=3, - ) - - -class SetNodePoolManagementRequest(proto.Message): - r"""SetNodePoolManagementRequest sets the node management - properties of a node pool. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - update. This field has been deprecated and - replaced by the name field. - node_pool_id (str): - Deprecated. The name of the node pool to - update. This field has been deprecated and - replaced by the name field. - management (google.cloud.container_v1.types.NodeManagement): - Required. NodeManagement configuration for - the node pool. - name (str): - The name (project, location, cluster, node pool id) of the - node pool to set management properties. Specified in the - format ``projects/*/locations/*/clusters/*/nodePools/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - management: 'NodeManagement' = proto.Field( - proto.MESSAGE, - number=5, - message='NodeManagement', - ) - name: str = proto.Field( - proto.STRING, - number=7, - ) - - -class SetNodePoolSizeRequest(proto.Message): - r"""SetNodePoolSizeRequest sets the size of a node pool. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - update. This field has been deprecated and - replaced by the name field. - node_pool_id (str): - Deprecated. The name of the node pool to - update. This field has been deprecated and - replaced by the name field. - node_count (int): - Required. The desired node count for the - pool. - name (str): - The name (project, location, cluster, node pool id) of the - node pool to set size. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - node_count: int = proto.Field( - proto.INT32, - number=5, - ) - name: str = proto.Field( - proto.STRING, - number=7, - ) - - -class CompleteNodePoolUpgradeRequest(proto.Message): - r"""CompleteNodePoolUpgradeRequest sets the name of target node - pool to complete upgrade. - - Attributes: - name (str): - The name (project, location, cluster, node pool id) of the - node pool to complete upgrade. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class RollbackNodePoolUpgradeRequest(proto.Message): - r"""RollbackNodePoolUpgradeRequest rollbacks the previously - Aborted or Failed NodePool upgrade. This will be an no-op if the - last upgrade successfully completed. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - rollback. This field has been deprecated and - replaced by the name field. - node_pool_id (str): - Deprecated. The name of the node pool to - rollback. This field has been deprecated and - replaced by the name field. - name (str): - The name (project, location, cluster, node pool id) of the - node poll to rollback upgrade. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - respect_pdb (bool): - Option for rollback to ignore the - PodDisruptionBudget. Default value is false. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - respect_pdb: bool = proto.Field( - proto.BOOL, - number=7, - ) - - -class ListNodePoolsResponse(proto.Message): - r"""ListNodePoolsResponse is the result of ListNodePoolsRequest. - - Attributes: - node_pools (MutableSequence[google.cloud.container_v1.types.NodePool]): - A list of node pools for a cluster. - """ - - node_pools: MutableSequence['NodePool'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='NodePool', - ) - - -class ClusterAutoscaling(proto.Message): - r"""ClusterAutoscaling contains global, per-cluster information - required by Cluster Autoscaler to automatically adjust the size - of the cluster and create/delete - node pools based on the current needs. - - Attributes: - enable_node_autoprovisioning (bool): - Enables automatic node pool creation and - deletion. - resource_limits (MutableSequence[google.cloud.container_v1.types.ResourceLimit]): - Contains global constraints regarding minimum - and maximum amount of resources in the cluster. - autoscaling_profile (google.cloud.container_v1.types.ClusterAutoscaling.AutoscalingProfile): - Defines autoscaling behaviour. - autoprovisioning_node_pool_defaults (google.cloud.container_v1.types.AutoprovisioningNodePoolDefaults): - AutoprovisioningNodePoolDefaults contains - defaults for a node pool created by NAP. - autoprovisioning_locations (MutableSequence[str]): - The list of Google Compute Engine - `zones `__ - in which the NodePool's nodes can be created by NAP. - """ - class AutoscalingProfile(proto.Enum): - r"""Defines possible options for autoscaling_profile field. - - Values: - PROFILE_UNSPECIFIED (0): - No change to autoscaling configuration. - OPTIMIZE_UTILIZATION (1): - Prioritize optimizing utilization of - resources. - BALANCED (2): - Use default (balanced) autoscaling - configuration. - """ - PROFILE_UNSPECIFIED = 0 - OPTIMIZE_UTILIZATION = 1 - BALANCED = 2 - - enable_node_autoprovisioning: bool = proto.Field( - proto.BOOL, - number=1, - ) - resource_limits: MutableSequence['ResourceLimit'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='ResourceLimit', - ) - autoscaling_profile: AutoscalingProfile = proto.Field( - proto.ENUM, - number=3, - enum=AutoscalingProfile, - ) - autoprovisioning_node_pool_defaults: 'AutoprovisioningNodePoolDefaults' = proto.Field( - proto.MESSAGE, - number=4, - message='AutoprovisioningNodePoolDefaults', - ) - autoprovisioning_locations: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=5, - ) - - -class AutoprovisioningNodePoolDefaults(proto.Message): - r"""AutoprovisioningNodePoolDefaults contains defaults for a node - pool created by NAP. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - oauth_scopes (MutableSequence[str]): - Scopes that are used by NAP when creating - node pools. - service_account (str): - The Google Cloud Platform Service Account to - be used by the node VMs. - upgrade_settings (google.cloud.container_v1.types.NodePool.UpgradeSettings): - Specifies the upgrade settings for NAP - created node pools - management (google.cloud.container_v1.types.NodeManagement): - Specifies the node management options for NAP - created node-pools. - min_cpu_platform (str): - Deprecated. Minimum CPU platform to be used for NAP created - node pools. The instance may be scheduled on the specified - or newer CPU platform. Applicable values are the friendly - names of CPU platforms, such as minCpuPlatform: Intel - Haswell or minCpuPlatform: Intel Sandy Bridge. For more - information, read `how to specify min CPU - platform `__. - This field is deprecated, min_cpu_platform should be - specified using - ``cloud.google.com/requested-min-cpu-platform`` label - selector on the pod. To unset the min cpu platform field - pass "automatic" as field value. - disk_size_gb (int): - Size of the disk attached to each node, - specified in GB. The smallest allowed disk size - is 10GB. - - If unspecified, the default disk size is 100GB. - disk_type (str): - Type of the disk attached to each node (e.g. - 'pd-standard', 'pd-ssd' or 'pd-balanced') - - If unspecified, the default disk type is - 'pd-standard' - shielded_instance_config (google.cloud.container_v1.types.ShieldedInstanceConfig): - Shielded Instance options. - boot_disk_kms_key (str): - The Customer Managed Encryption Key used to encrypt the boot - disk attached to each node in the node pool. This should be - of the form - projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. - For more information about protecting resources with Cloud - KMS Keys please see: - https://cloud.google.com/compute/docs/disks/customer-managed-encryption - image_type (str): - The image type to use for NAP created node. - Please see - https://cloud.google.com/kubernetes-engine/docs/concepts/node-images - for available image types. - insecure_kubelet_readonly_port_enabled (bool): - Enable or disable Kubelet read only port. - - This field is a member of `oneof`_ ``_insecure_kubelet_readonly_port_enabled``. - """ - - oauth_scopes: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - service_account: str = proto.Field( - proto.STRING, - number=2, - ) - upgrade_settings: 'NodePool.UpgradeSettings' = proto.Field( - proto.MESSAGE, - number=3, - message='NodePool.UpgradeSettings', - ) - management: 'NodeManagement' = proto.Field( - proto.MESSAGE, - number=4, - message='NodeManagement', - ) - min_cpu_platform: str = proto.Field( - proto.STRING, - number=5, - ) - disk_size_gb: int = proto.Field( - proto.INT32, - number=6, - ) - disk_type: str = proto.Field( - proto.STRING, - number=7, - ) - shielded_instance_config: 'ShieldedInstanceConfig' = proto.Field( - proto.MESSAGE, - number=8, - message='ShieldedInstanceConfig', - ) - boot_disk_kms_key: str = proto.Field( - proto.STRING, - number=9, - ) - image_type: str = proto.Field( - proto.STRING, - number=10, - ) - insecure_kubelet_readonly_port_enabled: bool = proto.Field( - proto.BOOL, - number=13, - optional=True, - ) - - -class ResourceLimit(proto.Message): - r"""Contains information about amount of some resource in the - cluster. For memory, value should be in GB. - - Attributes: - resource_type (str): - Resource name "cpu", "memory" or gpu-specific - string. - minimum (int): - Minimum amount of the resource in the - cluster. - maximum (int): - Maximum amount of the resource in the - cluster. - """ - - resource_type: str = proto.Field( - proto.STRING, - number=1, - ) - minimum: int = proto.Field( - proto.INT64, - number=2, - ) - maximum: int = proto.Field( - proto.INT64, - number=3, - ) - - -class NodePoolAutoscaling(proto.Message): - r"""NodePoolAutoscaling contains information required by cluster - autoscaler to adjust the size of the node pool to the current - cluster usage. - - Attributes: - enabled (bool): - Is autoscaling enabled for this node pool. - min_node_count (int): - Minimum number of nodes for one location in the node pool. - Must be greater than or equal to 0 and less than or equal to - max_node_count. - max_node_count (int): - Maximum number of nodes for one location in the node pool. - Must be >= min_node_count. There has to be enough quota to - scale up the cluster. - autoprovisioned (bool): - Can this node pool be deleted automatically. - location_policy (google.cloud.container_v1.types.NodePoolAutoscaling.LocationPolicy): - Location policy used when scaling up a - nodepool. - total_min_node_count (int): - Minimum number of nodes in the node pool. Must be greater - than or equal to 0 and less than or equal to - total_max_node_count. The total_*_node_count fields are - mutually exclusive with the \*_node_count fields. - total_max_node_count (int): - Maximum number of nodes in the node pool. Must be greater - than or equal to total_min_node_count. There has to be - enough quota to scale up the cluster. The total_*_node_count - fields are mutually exclusive with the \*_node_count fields. - """ - class LocationPolicy(proto.Enum): - r"""Location policy specifies how zones are picked when scaling - up the nodepool. - - Values: - LOCATION_POLICY_UNSPECIFIED (0): - Not set. - BALANCED (1): - BALANCED is a best effort policy that aims to - balance the sizes of different zones. - ANY (2): - ANY policy picks zones that have the highest - capacity available. - """ - LOCATION_POLICY_UNSPECIFIED = 0 - BALANCED = 1 - ANY = 2 - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - min_node_count: int = proto.Field( - proto.INT32, - number=2, - ) - max_node_count: int = proto.Field( - proto.INT32, - number=3, - ) - autoprovisioned: bool = proto.Field( - proto.BOOL, - number=4, - ) - location_policy: LocationPolicy = proto.Field( - proto.ENUM, - number=5, - enum=LocationPolicy, - ) - total_min_node_count: int = proto.Field( - proto.INT32, - number=6, - ) - total_max_node_count: int = proto.Field( - proto.INT32, - number=7, - ) - - -class SetLabelsRequest(proto.Message): - r"""SetLabelsRequest sets the Google Cloud Platform labels on a - Google Container Engine cluster, which will in turn set them for - Google Compute Engine resources used by that cluster - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and replaced by - the name field. - resource_labels (MutableMapping[str, str]): - Required. The labels to set for that cluster. - label_fingerprint (str): - Required. The fingerprint of the previous set of labels for - this resource, used to detect conflicts. The fingerprint is - initially generated by Kubernetes Engine and changes after - every request to modify or update labels. You must always - provide an up-to-date fingerprint hash when updating or - changing labels. Make a ``get()`` request to the resource to - get the latest fingerprint. - name (str): - The name (project, location, cluster name) of the cluster to - set labels. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - resource_labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - label_fingerprint: str = proto.Field( - proto.STRING, - number=5, - ) - name: str = proto.Field( - proto.STRING, - number=7, - ) - - -class SetLegacyAbacRequest(proto.Message): - r"""SetLegacyAbacRequest enables or disables the ABAC - authorization mechanism for a cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster to - update. This field has been deprecated and - replaced by the name field. - enabled (bool): - Required. Whether ABAC authorization will be - enabled in the cluster. - name (str): - The name (project, location, cluster name) of the cluster to - set legacy abac. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - enabled: bool = proto.Field( - proto.BOOL, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class StartIPRotationRequest(proto.Message): - r"""StartIPRotationRequest creates a new IP for the cluster and - then performs a node upgrade on each node pool to point to the - new IP. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and replaced by - the name field. - name (str): - The name (project, location, cluster name) of the cluster to - start IP rotation. Specified in the format - ``projects/*/locations/*/clusters/*``. - rotate_credentials (bool): - Whether to rotate credentials during IP - rotation. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - rotate_credentials: bool = proto.Field( - proto.BOOL, - number=7, - ) - - -class CompleteIPRotationRequest(proto.Message): - r"""CompleteIPRotationRequest moves the cluster master back into - single-IP mode. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and replaced by - the name field. - name (str): - The name (project, location, cluster name) of the cluster to - complete IP rotation. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - name: str = proto.Field( - proto.STRING, - number=7, - ) - - -class AcceleratorConfig(proto.Message): - r"""AcceleratorConfig represents a Hardware Accelerator request. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - accelerator_count (int): - The number of the accelerator cards exposed - to an instance. - accelerator_type (str): - The accelerator type resource name. List of supported - accelerators - `here `__ - gpu_partition_size (str): - Size of partitions to create on the GPU. Valid values are - described in the NVIDIA `mig user - guide `__. - gpu_sharing_config (google.cloud.container_v1.types.GPUSharingConfig): - The configuration for GPU sharing options. - - This field is a member of `oneof`_ ``_gpu_sharing_config``. - gpu_driver_installation_config (google.cloud.container_v1.types.GPUDriverInstallationConfig): - The configuration for auto installation of - GPU driver. - - This field is a member of `oneof`_ ``_gpu_driver_installation_config``. - """ - - accelerator_count: int = proto.Field( - proto.INT64, - number=1, - ) - accelerator_type: str = proto.Field( - proto.STRING, - number=2, - ) - gpu_partition_size: str = proto.Field( - proto.STRING, - number=3, - ) - gpu_sharing_config: 'GPUSharingConfig' = proto.Field( - proto.MESSAGE, - number=5, - optional=True, - message='GPUSharingConfig', - ) - gpu_driver_installation_config: 'GPUDriverInstallationConfig' = proto.Field( - proto.MESSAGE, - number=6, - optional=True, - message='GPUDriverInstallationConfig', - ) - - -class GPUSharingConfig(proto.Message): - r"""GPUSharingConfig represents the GPU sharing configuration for - Hardware Accelerators. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - max_shared_clients_per_gpu (int): - The max number of containers that can share a - physical GPU. - gpu_sharing_strategy (google.cloud.container_v1.types.GPUSharingConfig.GPUSharingStrategy): - The type of GPU sharing strategy to enable on - the GPU node. - - This field is a member of `oneof`_ ``_gpu_sharing_strategy``. - """ - class GPUSharingStrategy(proto.Enum): - r"""The type of GPU sharing strategy currently provided. - - Values: - GPU_SHARING_STRATEGY_UNSPECIFIED (0): - Default value. - TIME_SHARING (1): - GPUs are time-shared between containers. - MPS (2): - GPUs are shared between containers with - NVIDIA MPS. - """ - GPU_SHARING_STRATEGY_UNSPECIFIED = 0 - TIME_SHARING = 1 - MPS = 2 - - max_shared_clients_per_gpu: int = proto.Field( - proto.INT64, - number=1, - ) - gpu_sharing_strategy: GPUSharingStrategy = proto.Field( - proto.ENUM, - number=2, - optional=True, - enum=GPUSharingStrategy, - ) - - -class GPUDriverInstallationConfig(proto.Message): - r"""GPUDriverInstallationConfig specifies the version of GPU - driver to be auto installed. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - gpu_driver_version (google.cloud.container_v1.types.GPUDriverInstallationConfig.GPUDriverVersion): - Mode for how the GPU driver is installed. - - This field is a member of `oneof`_ ``_gpu_driver_version``. - """ - class GPUDriverVersion(proto.Enum): - r"""The GPU driver version to install. - - Values: - GPU_DRIVER_VERSION_UNSPECIFIED (0): - Default value is to not install any GPU - driver. - INSTALLATION_DISABLED (1): - Disable GPU driver auto installation and - needs manual installation - DEFAULT (2): - "Default" GPU driver in COS and Ubuntu. - LATEST (3): - "Latest" GPU driver in COS. - """ - GPU_DRIVER_VERSION_UNSPECIFIED = 0 - INSTALLATION_DISABLED = 1 - DEFAULT = 2 - LATEST = 3 - - gpu_driver_version: GPUDriverVersion = proto.Field( - proto.ENUM, - number=1, - optional=True, - enum=GPUDriverVersion, - ) - - -class WorkloadMetadataConfig(proto.Message): - r"""WorkloadMetadataConfig defines the metadata configuration to - expose to workloads on the node pool. - - Attributes: - mode (google.cloud.container_v1.types.WorkloadMetadataConfig.Mode): - Mode is the configuration for how to expose - metadata to workloads running on the node pool. - """ - class Mode(proto.Enum): - r"""Mode is the configuration for how to expose metadata to - workloads running on the node. - - Values: - MODE_UNSPECIFIED (0): - Not set. - GCE_METADATA (1): - Expose all Compute Engine metadata to pods. - GKE_METADATA (2): - Run the GKE Metadata Server on this node. The - GKE Metadata Server exposes a metadata API to - workloads that is compatible with the V1 Compute - Metadata APIs exposed by the Compute Engine and - App Engine Metadata Servers. This feature can - only be enabled if Workload Identity is enabled - at the cluster level. - """ - MODE_UNSPECIFIED = 0 - GCE_METADATA = 1 - GKE_METADATA = 2 - - mode: Mode = proto.Field( - proto.ENUM, - number=2, - enum=Mode, - ) - - -class SetNetworkPolicyRequest(proto.Message): - r"""SetNetworkPolicyRequest enables/disables network policy for a - cluster. - - Attributes: - project_id (str): - Deprecated. The Google Developers Console `project ID or - project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Deprecated. The name of the cluster. - This field has been deprecated and replaced by - the name field. - network_policy (google.cloud.container_v1.types.NetworkPolicy): - Required. Configuration options for the - NetworkPolicy feature. - name (str): - The name (project, location, cluster name) of the cluster to - set networking policy. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - network_policy: 'NetworkPolicy' = proto.Field( - proto.MESSAGE, - number=4, - message='NetworkPolicy', - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class SetMaintenancePolicyRequest(proto.Message): - r"""SetMaintenancePolicyRequest sets the maintenance policy for a - cluster. - - Attributes: - project_id (str): - Required. The Google Developers Console `project ID or - project - number `__. - zone (str): - Required. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. - cluster_id (str): - Required. The name of the cluster to update. - maintenance_policy (google.cloud.container_v1.types.MaintenancePolicy): - Required. The maintenance policy to be set - for the cluster. An empty field clears the - existing maintenance policy. - name (str): - The name (project, location, cluster name) of the cluster to - set maintenance policy. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - maintenance_policy: 'MaintenancePolicy' = proto.Field( - proto.MESSAGE, - number=4, - message='MaintenancePolicy', - ) - name: str = proto.Field( - proto.STRING, - number=5, - ) - - -class StatusCondition(proto.Message): - r"""StatusCondition describes why a cluster or a node pool has a - certain status (e.g., ERROR or DEGRADED). - - Attributes: - code (google.cloud.container_v1.types.StatusCondition.Code): - Machine-friendly representation of the condition Deprecated. - Use canonical_code instead. - message (str): - Human-friendly representation of the - condition - canonical_code (google.rpc.code_pb2.Code): - Canonical code of the condition. - """ - class Code(proto.Enum): - r"""Code for each condition - - Values: - UNKNOWN (0): - UNKNOWN indicates a generic condition. - GCE_STOCKOUT (1): - GCE_STOCKOUT indicates that Google Compute Engine resources - are temporarily unavailable. - GKE_SERVICE_ACCOUNT_DELETED (2): - GKE_SERVICE_ACCOUNT_DELETED indicates that the user deleted - their robot service account. - GCE_QUOTA_EXCEEDED (3): - Google Compute Engine quota was exceeded. - SET_BY_OPERATOR (4): - Cluster state was manually changed by an SRE - due to a system logic error. - CLOUD_KMS_KEY_ERROR (7): - Unable to perform an encrypt operation - against the CloudKMS key used for etcd level - encryption. - CA_EXPIRING (9): - Cluster CA is expiring soon. - """ - UNKNOWN = 0 - GCE_STOCKOUT = 1 - GKE_SERVICE_ACCOUNT_DELETED = 2 - GCE_QUOTA_EXCEEDED = 3 - SET_BY_OPERATOR = 4 - CLOUD_KMS_KEY_ERROR = 7 - CA_EXPIRING = 9 - - code: Code = proto.Field( - proto.ENUM, - number=1, - enum=Code, - ) - message: str = proto.Field( - proto.STRING, - number=2, - ) - canonical_code: code_pb2.Code = proto.Field( - proto.ENUM, - number=3, - enum=code_pb2.Code, - ) - - -class NetworkConfig(proto.Message): - r"""NetworkConfig reports the relative names of network & - subnetwork. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - network (str): - Output only. The relative name of the Google Compute Engine - `network `__ - to which the cluster is connected. Example: - projects/my-project/global/networks/my-network - subnetwork (str): - Output only. The relative name of the Google Compute Engine - `subnetwork `__ - to which the cluster is connected. Example: - projects/my-project/regions/us-central1/subnetworks/my-subnet - enable_intra_node_visibility (bool): - Whether Intra-node visibility is enabled for - this cluster. This makes same node pod to pod - traffic visible for VPC network. - default_snat_status (google.cloud.container_v1.types.DefaultSnatStatus): - Whether the cluster disables default in-node sNAT rules. - In-node sNAT rules will be disabled when default_snat_status - is disabled. When disabled is set to false, default IP - masquerade rules will be applied to the nodes to prevent - sNAT on cluster internal traffic. - enable_l4ilb_subsetting (bool): - Whether L4ILB Subsetting is enabled for this - cluster. - datapath_provider (google.cloud.container_v1.types.DatapathProvider): - The desired datapath provider for this - cluster. By default, uses the IPTables-based - kube-proxy implementation. - private_ipv6_google_access (google.cloud.container_v1.types.PrivateIPv6GoogleAccess): - The desired state of IPv6 connectivity to - Google Services. By default, no private IPv6 - access to or from Google Services (all access - will be via IPv4) - dns_config (google.cloud.container_v1.types.DNSConfig): - DNSConfig contains clusterDNS config for this - cluster. - service_external_ips_config (google.cloud.container_v1.types.ServiceExternalIPsConfig): - ServiceExternalIPsConfig specifies if - services with externalIPs field are blocked or - not. - gateway_api_config (google.cloud.container_v1.types.GatewayAPIConfig): - GatewayAPIConfig contains the desired config - of Gateway API on this cluster. - enable_multi_networking (bool): - Whether multi-networking is enabled for this - cluster. - network_performance_config (google.cloud.container_v1.types.NetworkConfig.ClusterNetworkPerformanceConfig): - Network bandwidth tier configuration. - enable_fqdn_network_policy (bool): - Whether FQDN Network Policy is enabled on - this cluster. - - This field is a member of `oneof`_ ``_enable_fqdn_network_policy``. - in_transit_encryption_config (google.cloud.container_v1.types.InTransitEncryptionConfig): - Specify the details of in-transit encryption. - Now named inter-node transparent encryption. - - This field is a member of `oneof`_ ``_in_transit_encryption_config``. - enable_cilium_clusterwide_network_policy (bool): - Whether CiliumClusterwideNetworkPolicy is - enabled on this cluster. - - This field is a member of `oneof`_ ``_enable_cilium_clusterwide_network_policy``. - default_enable_private_nodes (bool): - Controls whether by default nodes have private IP addresses - only. It is invalid to specify both - [PrivateClusterConfig.enablePrivateNodes][] and this field - at the same time. To update the default setting, use - [ClusterUpdate.desired_default_enable_private_nodes][google.container.v1.ClusterUpdate.desired_default_enable_private_nodes] - - This field is a member of `oneof`_ ``_default_enable_private_nodes``. - """ - - class ClusterNetworkPerformanceConfig(proto.Message): - r"""Configuration of network bandwidth tiers - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - total_egress_bandwidth_tier (google.cloud.container_v1.types.NetworkConfig.ClusterNetworkPerformanceConfig.Tier): - Specifies the total network bandwidth tier - for NodePools in the cluster. - - This field is a member of `oneof`_ ``_total_egress_bandwidth_tier``. - """ - class Tier(proto.Enum): - r"""Node network tier - - Values: - TIER_UNSPECIFIED (0): - Default value - TIER_1 (1): - Higher bandwidth, actual values based on VM - size. - """ - TIER_UNSPECIFIED = 0 - TIER_1 = 1 - - total_egress_bandwidth_tier: 'NetworkConfig.ClusterNetworkPerformanceConfig.Tier' = proto.Field( - proto.ENUM, - number=1, - optional=True, - enum='NetworkConfig.ClusterNetworkPerformanceConfig.Tier', - ) - - network: str = proto.Field( - proto.STRING, - number=1, - ) - subnetwork: str = proto.Field( - proto.STRING, - number=2, - ) - enable_intra_node_visibility: bool = proto.Field( - proto.BOOL, - number=5, - ) - default_snat_status: 'DefaultSnatStatus' = proto.Field( - proto.MESSAGE, - number=7, - message='DefaultSnatStatus', - ) - enable_l4ilb_subsetting: bool = proto.Field( - proto.BOOL, - number=10, - ) - datapath_provider: 'DatapathProvider' = proto.Field( - proto.ENUM, - number=11, - enum='DatapathProvider', - ) - private_ipv6_google_access: 'PrivateIPv6GoogleAccess' = proto.Field( - proto.ENUM, - number=12, - enum='PrivateIPv6GoogleAccess', - ) - dns_config: 'DNSConfig' = proto.Field( - proto.MESSAGE, - number=13, - message='DNSConfig', - ) - service_external_ips_config: 'ServiceExternalIPsConfig' = proto.Field( - proto.MESSAGE, - number=15, - message='ServiceExternalIPsConfig', - ) - gateway_api_config: 'GatewayAPIConfig' = proto.Field( - proto.MESSAGE, - number=16, - message='GatewayAPIConfig', - ) - enable_multi_networking: bool = proto.Field( - proto.BOOL, - number=17, - ) - network_performance_config: ClusterNetworkPerformanceConfig = proto.Field( - proto.MESSAGE, - number=18, - message=ClusterNetworkPerformanceConfig, - ) - enable_fqdn_network_policy: bool = proto.Field( - proto.BOOL, - number=19, - optional=True, - ) - in_transit_encryption_config: 'InTransitEncryptionConfig' = proto.Field( - proto.ENUM, - number=20, - optional=True, - enum='InTransitEncryptionConfig', - ) - enable_cilium_clusterwide_network_policy: bool = proto.Field( - proto.BOOL, - number=21, - optional=True, - ) - default_enable_private_nodes: bool = proto.Field( - proto.BOOL, - number=22, - optional=True, - ) - - -class GatewayAPIConfig(proto.Message): - r"""GatewayAPIConfig contains the desired config of Gateway API - on this cluster. - - Attributes: - channel (google.cloud.container_v1.types.GatewayAPIConfig.Channel): - The Gateway API release channel to use for - Gateway API. - """ - class Channel(proto.Enum): - r"""Channel describes if/how Gateway API should be installed and - implemented in a cluster. - - Values: - CHANNEL_UNSPECIFIED (0): - Default value. - CHANNEL_DISABLED (1): - Gateway API support is disabled - CHANNEL_EXPERIMENTAL (3): - Deprecated: use CHANNEL_STANDARD instead. Gateway API - support is enabled, experimental CRDs are installed - CHANNEL_STANDARD (4): - Gateway API support is enabled, standard CRDs - are installed - """ - CHANNEL_UNSPECIFIED = 0 - CHANNEL_DISABLED = 1 - CHANNEL_EXPERIMENTAL = 3 - CHANNEL_STANDARD = 4 - - channel: Channel = proto.Field( - proto.ENUM, - number=1, - enum=Channel, - ) - - -class ServiceExternalIPsConfig(proto.Message): - r"""Config to block services with externalIPs field. - - Attributes: - enabled (bool): - Whether Services with ExternalIPs field are - allowed or not. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class GetOpenIDConfigRequest(proto.Message): - r"""GetOpenIDConfigRequest gets the OIDC discovery document for - the cluster. See the OpenID Connect Discovery 1.0 specification - for details. - - Attributes: - parent (str): - The cluster (project, location, cluster name) to get the - discovery document for. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - - -class GetOpenIDConfigResponse(proto.Message): - r"""GetOpenIDConfigResponse is an OIDC discovery document for the - cluster. See the OpenID Connect Discovery 1.0 specification for - details. - - Attributes: - issuer (str): - OIDC Issuer. - jwks_uri (str): - JSON Web Key uri. - response_types_supported (MutableSequence[str]): - Supported response types. - subject_types_supported (MutableSequence[str]): - Supported subject types. - id_token_signing_alg_values_supported (MutableSequence[str]): - supported ID Token signing Algorithms. - claims_supported (MutableSequence[str]): - Supported claims. - grant_types (MutableSequence[str]): - Supported grant types. - """ - - issuer: str = proto.Field( - proto.STRING, - number=1, - ) - jwks_uri: str = proto.Field( - proto.STRING, - number=2, - ) - response_types_supported: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - subject_types_supported: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - id_token_signing_alg_values_supported: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=5, - ) - claims_supported: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=6, - ) - grant_types: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=7, - ) - - -class GetJSONWebKeysRequest(proto.Message): - r"""GetJSONWebKeysRequest gets the public component of the keys used by - the cluster to sign token requests. This will be the jwks_uri for - the discover document returned by getOpenIDConfig. See the OpenID - Connect Discovery 1.0 specification for details. - - Attributes: - parent (str): - The cluster (project, location, cluster name) to get keys - for. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - - -class Jwk(proto.Message): - r"""Jwk is a JSON Web Key as specified in RFC 7517 - - Attributes: - kty (str): - Key Type. - alg (str): - Algorithm. - use (str): - Permitted uses for the public keys. - kid (str): - Key ID. - n (str): - Used for RSA keys. - e (str): - Used for RSA keys. - x (str): - Used for ECDSA keys. - y (str): - Used for ECDSA keys. - crv (str): - Used for ECDSA keys. - """ - - kty: str = proto.Field( - proto.STRING, - number=1, - ) - alg: str = proto.Field( - proto.STRING, - number=2, - ) - use: str = proto.Field( - proto.STRING, - number=3, - ) - kid: str = proto.Field( - proto.STRING, - number=4, - ) - n: str = proto.Field( - proto.STRING, - number=5, - ) - e: str = proto.Field( - proto.STRING, - number=6, - ) - x: str = proto.Field( - proto.STRING, - number=7, - ) - y: str = proto.Field( - proto.STRING, - number=8, - ) - crv: str = proto.Field( - proto.STRING, - number=9, - ) - - -class GetJSONWebKeysResponse(proto.Message): - r"""GetJSONWebKeysResponse is a valid JSON Web Key Set as - specififed in rfc 7517 - - Attributes: - keys (MutableSequence[google.cloud.container_v1.types.Jwk]): - The public component of the keys used by the - cluster to sign token requests. - """ - - keys: MutableSequence['Jwk'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='Jwk', - ) - - -class CheckAutopilotCompatibilityRequest(proto.Message): - r"""CheckAutopilotCompatibilityRequest requests getting the - blockers for the given operation in the cluster. - - Attributes: - name (str): - The name (project, location, cluster) of the cluster to - retrieve. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class AutopilotCompatibilityIssue(proto.Message): - r"""AutopilotCompatibilityIssue contains information about a - specific compatibility issue with Autopilot mode. - - Attributes: - last_observation (google.protobuf.timestamp_pb2.Timestamp): - The last time when this issue was observed. - constraint_type (str): - The constraint type of the issue. - incompatibility_type (google.cloud.container_v1.types.AutopilotCompatibilityIssue.IssueType): - The incompatibility type of this issue. - subjects (MutableSequence[str]): - The name of the resources which are subject - to this issue. - documentation_url (str): - A URL to a public documnetation, which - addresses resolving this issue. - description (str): - The description of the issue. - """ - class IssueType(proto.Enum): - r"""The type of the reported issue. - - Values: - UNSPECIFIED (0): - Default value, should not be used. - INCOMPATIBILITY (1): - Indicates that the issue is a known - incompatibility between the cluster and - Autopilot mode. - ADDITIONAL_CONFIG_REQUIRED (2): - Indicates the issue is an incompatibility if - customers take no further action to resolve. - PASSED_WITH_OPTIONAL_CONFIG (3): - Indicates the issue is not an - incompatibility, but depending on the workloads - business logic, there is a potential that they - won't work on Autopilot. - """ - UNSPECIFIED = 0 - INCOMPATIBILITY = 1 - ADDITIONAL_CONFIG_REQUIRED = 2 - PASSED_WITH_OPTIONAL_CONFIG = 3 - - last_observation: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=1, - message=timestamp_pb2.Timestamp, - ) - constraint_type: str = proto.Field( - proto.STRING, - number=2, - ) - incompatibility_type: IssueType = proto.Field( - proto.ENUM, - number=3, - enum=IssueType, - ) - subjects: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - documentation_url: str = proto.Field( - proto.STRING, - number=5, - ) - description: str = proto.Field( - proto.STRING, - number=6, - ) - - -class CheckAutopilotCompatibilityResponse(proto.Message): - r"""CheckAutopilotCompatibilityResponse has a list of - compatibility issues. - - Attributes: - issues (MutableSequence[google.cloud.container_v1.types.AutopilotCompatibilityIssue]): - The list of issues for the given operation. - summary (str): - The summary of the autopilot compatibility - response. - """ - - issues: MutableSequence['AutopilotCompatibilityIssue'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='AutopilotCompatibilityIssue', - ) - summary: str = proto.Field( - proto.STRING, - number=2, - ) - - -class ReleaseChannel(proto.Message): - r"""ReleaseChannel indicates which release channel a cluster is - subscribed to. Release channels are arranged in order of risk. - - When a cluster is subscribed to a release channel, Google - maintains both the master version and the node version. Node - auto-upgrade defaults to true and cannot be disabled. - - Attributes: - channel (google.cloud.container_v1.types.ReleaseChannel.Channel): - channel specifies which release channel the - cluster is subscribed to. - """ - class Channel(proto.Enum): - r"""Possible values for 'channel'. - - Values: - UNSPECIFIED (0): - No channel specified. - RAPID (1): - RAPID channel is offered on an early access - basis for customers who want to test new - releases. - - WARNING: Versions available in the RAPID Channel - may be subject to unresolved issues with no - known workaround and are not subject to any - SLAs. - REGULAR (2): - Clusters subscribed to REGULAR receive - versions that are considered GA quality. REGULAR - is intended for production users who want to - take advantage of new features. - STABLE (3): - Clusters subscribed to STABLE receive - versions that are known to be stable and - reliable in production. - EXTENDED (4): - Clusters subscribed to EXTENDED receive - extended support and availability for versions - which are known to be stable and reliable in - production. - """ - UNSPECIFIED = 0 - RAPID = 1 - REGULAR = 2 - STABLE = 3 - EXTENDED = 4 - - channel: Channel = proto.Field( - proto.ENUM, - number=1, - enum=Channel, - ) - - -class CostManagementConfig(proto.Message): - r"""Configuration for fine-grained cost management feature. - - Attributes: - enabled (bool): - Whether the feature is enabled or not. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class IntraNodeVisibilityConfig(proto.Message): - r"""IntraNodeVisibilityConfig contains the desired config of the - intra-node visibility on this cluster. - - Attributes: - enabled (bool): - Enables intra node visibility for this - cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class ILBSubsettingConfig(proto.Message): - r"""ILBSubsettingConfig contains the desired config of L4 - Internal LoadBalancer subsetting on this cluster. - - Attributes: - enabled (bool): - Enables l4 ILB subsetting for this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class DNSConfig(proto.Message): - r"""DNSConfig contains the desired set of options for configuring - clusterDNS. - - Attributes: - cluster_dns (google.cloud.container_v1.types.DNSConfig.Provider): - cluster_dns indicates which in-cluster DNS provider should - be used. - cluster_dns_scope (google.cloud.container_v1.types.DNSConfig.DNSScope): - cluster_dns_scope indicates the scope of access to cluster - DNS records. - cluster_dns_domain (str): - cluster_dns_domain is the suffix used for all cluster - service records. - additive_vpc_scope_dns_domain (str): - Optional. The domain used in Additive VPC - scope. - """ - class Provider(proto.Enum): - r"""Provider lists the various in-cluster DNS providers. - - Values: - PROVIDER_UNSPECIFIED (0): - Default value - PLATFORM_DEFAULT (1): - Use GKE default DNS provider(kube-dns) for - DNS resolution. - CLOUD_DNS (2): - Use CloudDNS for DNS resolution. - KUBE_DNS (3): - Use KubeDNS for DNS resolution. - """ - PROVIDER_UNSPECIFIED = 0 - PLATFORM_DEFAULT = 1 - CLOUD_DNS = 2 - KUBE_DNS = 3 - - class DNSScope(proto.Enum): - r"""DNSScope lists the various scopes of access to cluster DNS - records. - - Values: - DNS_SCOPE_UNSPECIFIED (0): - Default value, will be inferred as cluster - scope. - CLUSTER_SCOPE (1): - DNS records are accessible from within the - cluster. - VPC_SCOPE (2): - DNS records are accessible from within the - VPC. - """ - DNS_SCOPE_UNSPECIFIED = 0 - CLUSTER_SCOPE = 1 - VPC_SCOPE = 2 - - cluster_dns: Provider = proto.Field( - proto.ENUM, - number=1, - enum=Provider, - ) - cluster_dns_scope: DNSScope = proto.Field( - proto.ENUM, - number=2, - enum=DNSScope, - ) - cluster_dns_domain: str = proto.Field( - proto.STRING, - number=3, - ) - additive_vpc_scope_dns_domain: str = proto.Field( - proto.STRING, - number=5, - ) - - -class MaxPodsConstraint(proto.Message): - r"""Constraints applied to pods. - - Attributes: - max_pods_per_node (int): - Constraint enforced on the max num of pods - per node. - """ - - max_pods_per_node: int = proto.Field( - proto.INT64, - number=1, - ) - - -class WorkloadIdentityConfig(proto.Message): - r"""Configuration for the use of Kubernetes Service Accounts in - GCP IAM policies. - - Attributes: - workload_pool (str): - The workload pool to attach all Kubernetes - service accounts to. - """ - - workload_pool: str = proto.Field( - proto.STRING, - number=2, - ) - - -class IdentityServiceConfig(proto.Message): - r"""IdentityServiceConfig is configuration for Identity Service - which allows customers to use external identity providers with - the K8S API - - Attributes: - enabled (bool): - Whether to enable the Identity Service - component - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class MeshCertificates(proto.Message): - r"""Configuration for issuance of mTLS keys and certificates to - Kubernetes pods. - - Attributes: - enable_certificates (google.protobuf.wrappers_pb2.BoolValue): - enable_certificates controls issuance of workload mTLS - certificates. - - If set, the GKE Workload Identity Certificates controller - and node agent will be deployed in the cluster, which can - then be configured by creating a WorkloadCertificateConfig - Custom Resource. - - Requires Workload Identity - ([workload_pool][google.container.v1.WorkloadIdentityConfig.workload_pool] - must be non-empty). - """ - - enable_certificates: wrappers_pb2.BoolValue = proto.Field( - proto.MESSAGE, - number=1, - message=wrappers_pb2.BoolValue, - ) - - -class DatabaseEncryption(proto.Message): - r"""Configuration of etcd encryption. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - key_name (str): - Name of CloudKMS key to use for the - encryption of secrets in etcd. Ex. - projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key - state (google.cloud.container_v1.types.DatabaseEncryption.State): - The desired state of etcd encryption. - current_state (google.cloud.container_v1.types.DatabaseEncryption.CurrentState): - Output only. The current state of etcd - encryption. - - This field is a member of `oneof`_ ``_current_state``. - decryption_keys (MutableSequence[str]): - Output only. Keys in use by the cluster for decrypting - existing objects, in addition to the key in ``key_name``. - - Each item is a CloudKMS key resource. - last_operation_errors (MutableSequence[google.cloud.container_v1.types.DatabaseEncryption.OperationError]): - Output only. Records errors seen during - DatabaseEncryption update operations. - """ - class State(proto.Enum): - r"""State of etcd encryption. - - Values: - UNKNOWN (0): - Should never be set - ENCRYPTED (1): - Secrets in etcd are encrypted. - DECRYPTED (2): - Secrets in etcd are stored in plain text (at - etcd level) - this is unrelated to Compute - Engine level full disk encryption. - """ - UNKNOWN = 0 - ENCRYPTED = 1 - DECRYPTED = 2 - - class CurrentState(proto.Enum): - r"""Current State of etcd encryption. - - Values: - CURRENT_STATE_UNSPECIFIED (0): - Should never be set - CURRENT_STATE_ENCRYPTED (7): - Secrets in etcd are encrypted. - CURRENT_STATE_DECRYPTED (2): - Secrets in etcd are stored in plain text (at - etcd level) - this is unrelated to Compute - Engine level full disk encryption. - CURRENT_STATE_ENCRYPTION_PENDING (3): - Encryption (or re-encryption with a different - CloudKMS key) of Secrets is in progress. - CURRENT_STATE_ENCRYPTION_ERROR (4): - Encryption (or re-encryption with a different - CloudKMS key) of Secrets in etcd encountered an - error. - CURRENT_STATE_DECRYPTION_PENDING (5): - De-crypting Secrets to plain text in etcd is - in progress. - CURRENT_STATE_DECRYPTION_ERROR (6): - De-crypting Secrets to plain text in etcd - encountered an error. - """ - CURRENT_STATE_UNSPECIFIED = 0 - CURRENT_STATE_ENCRYPTED = 7 - CURRENT_STATE_DECRYPTED = 2 - CURRENT_STATE_ENCRYPTION_PENDING = 3 - CURRENT_STATE_ENCRYPTION_ERROR = 4 - CURRENT_STATE_DECRYPTION_PENDING = 5 - CURRENT_STATE_DECRYPTION_ERROR = 6 - - class OperationError(proto.Message): - r"""OperationError records errors seen from CloudKMS keys - encountered during updates to DatabaseEncryption configuration. - - Attributes: - key_name (str): - CloudKMS key resource that had the error. - error_message (str): - Description of the error seen during the - operation. - timestamp (google.protobuf.timestamp_pb2.Timestamp): - Time when the CloudKMS error was seen. - """ - - key_name: str = proto.Field( - proto.STRING, - number=1, - ) - error_message: str = proto.Field( - proto.STRING, - number=2, - ) - timestamp: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - - key_name: str = proto.Field( - proto.STRING, - number=1, - ) - state: State = proto.Field( - proto.ENUM, - number=2, - enum=State, - ) - current_state: CurrentState = proto.Field( - proto.ENUM, - number=3, - optional=True, - enum=CurrentState, - ) - decryption_keys: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - last_operation_errors: MutableSequence[OperationError] = proto.RepeatedField( - proto.MESSAGE, - number=5, - message=OperationError, - ) - - -class ListUsableSubnetworksRequest(proto.Message): - r"""ListUsableSubnetworksRequest requests the list of usable - subnetworks available to a user for creating clusters. - - Attributes: - parent (str): - The parent project where subnetworks are usable. Specified - in the format ``projects/*``. - filter (str): - Filtering currently only supports equality on the - networkProjectId and must be in the form: - "networkProjectId=[PROJECTID]", where ``networkProjectId`` - is the project which owns the listed subnetworks. This - defaults to the parent project ID. - page_size (int): - The max number of results per page that should be returned. - If the number of available results is larger than - ``page_size``, a ``next_page_token`` is returned which can - be used to get the next page of results in subsequent - requests. Acceptable values are 0 to 500, inclusive. - (Default: 500) - page_token (str): - Specifies a page token to use. Set this to - the nextPageToken returned by previous list - requests to get the next page of results. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - filter: str = proto.Field( - proto.STRING, - number=2, - ) - page_size: int = proto.Field( - proto.INT32, - number=3, - ) - page_token: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListUsableSubnetworksResponse(proto.Message): - r"""ListUsableSubnetworksResponse is the response of - ListUsableSubnetworksRequest. - - Attributes: - subnetworks (MutableSequence[google.cloud.container_v1.types.UsableSubnetwork]): - A list of usable subnetworks in the specified - network project. - next_page_token (str): - This token allows you to get the next page of results for - list requests. If the number of results is larger than - ``page_size``, use the ``next_page_token`` as a value for - the query parameter ``page_token`` in the next request. The - value will become empty when there are no more pages. - """ - - @property - def raw_page(self): - return self - - subnetworks: MutableSequence['UsableSubnetwork'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='UsableSubnetwork', - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class UsableSubnetworkSecondaryRange(proto.Message): - r"""Secondary IP range of a usable subnetwork. - - Attributes: - range_name (str): - The name associated with this subnetwork - secondary range, used when adding an alias IP - range to a VM instance. - ip_cidr_range (str): - The range of IP addresses belonging to this - subnetwork secondary range. - status (google.cloud.container_v1.types.UsableSubnetworkSecondaryRange.Status): - This field is to determine the status of the - secondary range programmably. - """ - class Status(proto.Enum): - r"""Status shows the current usage of a secondary IP range. - - Values: - UNKNOWN (0): - UNKNOWN is the zero value of the Status enum. - It's not a valid status. - UNUSED (1): - UNUSED denotes that this range is unclaimed - by any cluster. - IN_USE_SERVICE (2): - IN_USE_SERVICE denotes that this range is claimed by - cluster(s) for services. User-managed services range can be - shared between clusters within the same subnetwork. - IN_USE_SHAREABLE_POD (3): - IN_USE_SHAREABLE_POD denotes this range was created by the - network admin and is currently claimed by a cluster for - pods. It can only be used by other clusters as a pod range. - IN_USE_MANAGED_POD (4): - IN_USE_MANAGED_POD denotes this range was created by GKE and - is claimed for pods. It cannot be used for other clusters. - """ - UNKNOWN = 0 - UNUSED = 1 - IN_USE_SERVICE = 2 - IN_USE_SHAREABLE_POD = 3 - IN_USE_MANAGED_POD = 4 - - range_name: str = proto.Field( - proto.STRING, - number=1, - ) - ip_cidr_range: str = proto.Field( - proto.STRING, - number=2, - ) - status: Status = proto.Field( - proto.ENUM, - number=3, - enum=Status, - ) - - -class UsableSubnetwork(proto.Message): - r"""UsableSubnetwork resource returns the subnetwork name, its - associated network and the primary CIDR range. - - Attributes: - subnetwork (str): - Subnetwork Name. - Example: - projects/my-project/regions/us-central1/subnetworks/my-subnet - network (str): - Network Name. - Example: - projects/my-project/global/networks/my-network - ip_cidr_range (str): - The range of internal addresses that are - owned by this subnetwork. - secondary_ip_ranges (MutableSequence[google.cloud.container_v1.types.UsableSubnetworkSecondaryRange]): - Secondary IP ranges. - status_message (str): - A human readable status message representing the reasons for - cases where the caller cannot use the secondary ranges under - the subnet. For example if the secondary_ip_ranges is empty - due to a permission issue, an insufficient permission - message will be given by status_message. - """ - - subnetwork: str = proto.Field( - proto.STRING, - number=1, - ) - network: str = proto.Field( - proto.STRING, - number=2, - ) - ip_cidr_range: str = proto.Field( - proto.STRING, - number=3, - ) - secondary_ip_ranges: MutableSequence['UsableSubnetworkSecondaryRange'] = proto.RepeatedField( - proto.MESSAGE, - number=4, - message='UsableSubnetworkSecondaryRange', - ) - status_message: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ResourceUsageExportConfig(proto.Message): - r"""Configuration for exporting cluster resource usages. - - Attributes: - bigquery_destination (google.cloud.container_v1.types.ResourceUsageExportConfig.BigQueryDestination): - Configuration to use BigQuery as usage export - destination. - enable_network_egress_metering (bool): - Whether to enable network egress metering for - this cluster. If enabled, a daemonset will be - created in the cluster to meter network egress - traffic. - consumption_metering_config (google.cloud.container_v1.types.ResourceUsageExportConfig.ConsumptionMeteringConfig): - Configuration to enable resource consumption - metering. - """ - - class BigQueryDestination(proto.Message): - r"""Parameters for using BigQuery as the destination of resource - usage export. - - Attributes: - dataset_id (str): - The ID of a BigQuery Dataset. - """ - - dataset_id: str = proto.Field( - proto.STRING, - number=1, - ) - - class ConsumptionMeteringConfig(proto.Message): - r"""Parameters for controlling consumption metering. - - Attributes: - enabled (bool): - Whether to enable consumption metering for - this cluster. If enabled, a second BigQuery - table will be created to hold resource - consumption records. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - bigquery_destination: BigQueryDestination = proto.Field( - proto.MESSAGE, - number=1, - message=BigQueryDestination, - ) - enable_network_egress_metering: bool = proto.Field( - proto.BOOL, - number=2, - ) - consumption_metering_config: ConsumptionMeteringConfig = proto.Field( - proto.MESSAGE, - number=3, - message=ConsumptionMeteringConfig, - ) - - -class VerticalPodAutoscaling(proto.Message): - r"""VerticalPodAutoscaling contains global, per-cluster - information required by Vertical Pod Autoscaler to automatically - adjust the resources of pods controlled by it. - - Attributes: - enabled (bool): - Enables vertical pod autoscaling. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class DefaultSnatStatus(proto.Message): - r"""DefaultSnatStatus contains the desired state of whether - default sNAT should be disabled on the cluster. - - Attributes: - disabled (bool): - Disables cluster default sNAT rules. - """ - - disabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class ShieldedNodes(proto.Message): - r"""Configuration of Shielded Nodes feature. - - Attributes: - enabled (bool): - Whether Shielded Nodes features are enabled - on all nodes in this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class VirtualNIC(proto.Message): - r"""Configuration of gVNIC feature. - - Attributes: - enabled (bool): - Whether gVNIC features are enabled in the - node pool. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class FastSocket(proto.Message): - r"""Configuration of Fast Socket feature. - - Attributes: - enabled (bool): - Whether Fast Socket features are enabled in - the node pool. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class NotificationConfig(proto.Message): - r"""NotificationConfig is the configuration of notifications. - - Attributes: - pubsub (google.cloud.container_v1.types.NotificationConfig.PubSub): - Notification config for Pub/Sub. - """ - class EventType(proto.Enum): - r"""Types of notifications currently supported. Can be used to - filter what notifications are sent. - - Values: - EVENT_TYPE_UNSPECIFIED (0): - Not set, will be ignored. - UPGRADE_AVAILABLE_EVENT (1): - Corresponds with UpgradeAvailableEvent. - UPGRADE_EVENT (2): - Corresponds with UpgradeEvent. - SECURITY_BULLETIN_EVENT (3): - Corresponds with SecurityBulletinEvent. - """ - EVENT_TYPE_UNSPECIFIED = 0 - UPGRADE_AVAILABLE_EVENT = 1 - UPGRADE_EVENT = 2 - SECURITY_BULLETIN_EVENT = 3 - - class PubSub(proto.Message): - r"""Pub/Sub specific notification config. - - Attributes: - enabled (bool): - Enable notifications for Pub/Sub. - topic (str): - The desired Pub/Sub topic to which notifications will be - sent by GKE. Format is - ``projects/{project}/topics/{topic}``. - filter (google.cloud.container_v1.types.NotificationConfig.Filter): - Allows filtering to one or more specific - event types. If no filter is specified, or if a - filter is specified with no event types, all - event types will be sent - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - topic: str = proto.Field( - proto.STRING, - number=2, - ) - filter: 'NotificationConfig.Filter' = proto.Field( - proto.MESSAGE, - number=3, - message='NotificationConfig.Filter', - ) - - class Filter(proto.Message): - r"""Allows filtering to one or more specific event types. If - event types are present, those and only those event types will - be transmitted to the cluster. Other types will be skipped. If - no filter is specified, or no event types are present, all event - types will be sent - - Attributes: - event_type (MutableSequence[google.cloud.container_v1.types.NotificationConfig.EventType]): - Event types to allowlist. - """ - - event_type: MutableSequence['NotificationConfig.EventType'] = proto.RepeatedField( - proto.ENUM, - number=1, - enum='NotificationConfig.EventType', - ) - - pubsub: PubSub = proto.Field( - proto.MESSAGE, - number=1, - message=PubSub, - ) - - -class ConfidentialNodes(proto.Message): - r"""ConfidentialNodes is configuration for the confidential nodes - feature, which makes nodes run on confidential VMs. - - Attributes: - enabled (bool): - Whether Confidential Nodes feature is - enabled. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class UpgradeEvent(proto.Message): - r"""UpgradeEvent is a notification sent to customers by the - cluster server when a resource is upgrading. - - Attributes: - resource_type (google.cloud.container_v1.types.UpgradeResourceType): - The resource type that is upgrading. - operation (str): - The operation associated with this upgrade. - operation_start_time (google.protobuf.timestamp_pb2.Timestamp): - The time when the operation was started. - current_version (str): - The current version before the upgrade. - target_version (str): - The target version for the upgrade. - resource (str): - Optional relative path to the resource. For - example in node pool upgrades, the relative path - of the node pool. - """ - - resource_type: 'UpgradeResourceType' = proto.Field( - proto.ENUM, - number=1, - enum='UpgradeResourceType', - ) - operation: str = proto.Field( - proto.STRING, - number=2, - ) - operation_start_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - current_version: str = proto.Field( - proto.STRING, - number=4, - ) - target_version: str = proto.Field( - proto.STRING, - number=5, - ) - resource: str = proto.Field( - proto.STRING, - number=6, - ) - - -class UpgradeInfoEvent(proto.Message): - r"""UpgradeInfoEvent is a notification sent to customers about - the upgrade information of a resource. - - Attributes: - resource_type (google.cloud.container_v1.types.UpgradeResourceType): - The resource type associated with the - upgrade. - operation (str): - The operation associated with this upgrade. - start_time (google.protobuf.timestamp_pb2.Timestamp): - The time when the operation was started. - end_time (google.protobuf.timestamp_pb2.Timestamp): - The time when the operation ended. - current_version (str): - The current version before the upgrade. - target_version (str): - The target version for the upgrade. - resource (str): - Optional relative path to the resource. For - example in node pool upgrades, the relative path - of the node pool. - state (google.cloud.container_v1.types.UpgradeInfoEvent.State): - Output only. The state of the upgrade. - description (str): - A brief description of the event. - """ - class State(proto.Enum): - r"""The state of the upgrade. - - Values: - STATE_UNSPECIFIED (0): - STATE_UNSPECIFIED indicates the state is unspecified. - STARTED (3): - STARTED indicates the upgrade has started. - SUCCEEDED (4): - SUCCEEDED indicates the upgrade has completed - successfully. - FAILED (5): - FAILED indicates the upgrade has failed. - CANCELED (6): - CANCELED indicates the upgrade has canceled. - """ - STATE_UNSPECIFIED = 0 - STARTED = 3 - SUCCEEDED = 4 - FAILED = 5 - CANCELED = 6 - - resource_type: 'UpgradeResourceType' = proto.Field( - proto.ENUM, - number=1, - enum='UpgradeResourceType', - ) - operation: str = proto.Field( - proto.STRING, - number=2, - ) - start_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - end_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=4, - message=timestamp_pb2.Timestamp, - ) - current_version: str = proto.Field( - proto.STRING, - number=5, - ) - target_version: str = proto.Field( - proto.STRING, - number=6, - ) - resource: str = proto.Field( - proto.STRING, - number=7, - ) - state: State = proto.Field( - proto.ENUM, - number=8, - enum=State, - ) - description: str = proto.Field( - proto.STRING, - number=11, - ) - - -class UpgradeAvailableEvent(proto.Message): - r"""UpgradeAvailableEvent is a notification sent to customers - when a new available version is released. - - Attributes: - version (str): - The release version available for upgrade. - resource_type (google.cloud.container_v1.types.UpgradeResourceType): - The resource type of the release version. - release_channel (google.cloud.container_v1.types.ReleaseChannel): - The release channel of the version. If empty, - it means a non-channel release. - resource (str): - Optional relative path to the resource. For - example, the relative path of the node pool. - """ - - version: str = proto.Field( - proto.STRING, - number=1, - ) - resource_type: 'UpgradeResourceType' = proto.Field( - proto.ENUM, - number=2, - enum='UpgradeResourceType', - ) - release_channel: 'ReleaseChannel' = proto.Field( - proto.MESSAGE, - number=3, - message='ReleaseChannel', - ) - resource: str = proto.Field( - proto.STRING, - number=4, - ) - - -class SecurityBulletinEvent(proto.Message): - r"""SecurityBulletinEvent is a notification sent to customers - when a security bulletin has been posted that they are - vulnerable to. - - Attributes: - resource_type_affected (str): - The resource type (node/control plane) that - has the vulnerability. Multiple notifications (1 - notification per resource type) will be sent for - a vulnerability that affects > 1 resource type. - bulletin_id (str): - The ID of the bulletin corresponding to the - vulnerability. - cve_ids (MutableSequence[str]): - The CVEs associated with this bulletin. - severity (str): - The severity of this bulletin as it relates - to GKE. - bulletin_uri (str): - The URI link to the bulletin on the website - for more information. - brief_description (str): - A brief description of the bulletin. See the bulletin - pointed to by the bulletin_uri field for an expanded - description. - affected_supported_minors (MutableSequence[str]): - The GKE minor versions affected by this - vulnerability. - patched_versions (MutableSequence[str]): - The GKE versions where this vulnerability is - patched. - suggested_upgrade_target (str): - This represents a version selected from the patched_versions - field that the cluster receiving this notification should - most likely want to upgrade to based on its current version. - Note that if this notification is being received by a given - cluster, it means that this version is currently available - as an upgrade target in that cluster's location. - manual_steps_required (bool): - If this field is specified, it means there - are manual steps that the user must take to make - their clusters safe. - """ - - resource_type_affected: str = proto.Field( - proto.STRING, - number=1, - ) - bulletin_id: str = proto.Field( - proto.STRING, - number=2, - ) - cve_ids: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - severity: str = proto.Field( - proto.STRING, - number=4, - ) - bulletin_uri: str = proto.Field( - proto.STRING, - number=5, - ) - brief_description: str = proto.Field( - proto.STRING, - number=6, - ) - affected_supported_minors: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=7, - ) - patched_versions: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=8, - ) - suggested_upgrade_target: str = proto.Field( - proto.STRING, - number=9, - ) - manual_steps_required: bool = proto.Field( - proto.BOOL, - number=10, - ) - - -class Autopilot(proto.Message): - r"""Autopilot is the configuration for Autopilot settings on the - cluster. - - Attributes: - enabled (bool): - Enable Autopilot - workload_policy_config (google.cloud.container_v1.types.WorkloadPolicyConfig): - Workload policy configuration for Autopilot. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - workload_policy_config: 'WorkloadPolicyConfig' = proto.Field( - proto.MESSAGE, - number=2, - message='WorkloadPolicyConfig', - ) - - -class WorkloadPolicyConfig(proto.Message): - r"""WorkloadPolicyConfig is the configuration of workload policy - for autopilot clusters. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - allow_net_admin (bool): - If true, workloads can use NET_ADMIN capability. - - This field is a member of `oneof`_ ``_allow_net_admin``. - """ - - allow_net_admin: bool = proto.Field( - proto.BOOL, - number=1, - optional=True, - ) - - -class LoggingConfig(proto.Message): - r"""LoggingConfig is cluster logging configuration. - - Attributes: - component_config (google.cloud.container_v1.types.LoggingComponentConfig): - Logging components configuration - """ - - component_config: 'LoggingComponentConfig' = proto.Field( - proto.MESSAGE, - number=1, - message='LoggingComponentConfig', - ) - - -class LoggingComponentConfig(proto.Message): - r"""LoggingComponentConfig is cluster logging component - configuration. - - Attributes: - enable_components (MutableSequence[google.cloud.container_v1.types.LoggingComponentConfig.Component]): - Select components to collect logs. An empty - set would disable all logging. - """ - class Component(proto.Enum): - r"""GKE components exposing logs - - Values: - COMPONENT_UNSPECIFIED (0): - Default value. This shouldn't be used. - SYSTEM_COMPONENTS (1): - system components - WORKLOADS (2): - workloads - APISERVER (3): - kube-apiserver - SCHEDULER (4): - kube-scheduler - CONTROLLER_MANAGER (5): - kube-controller-manager - KCP_SSHD (7): - kcp-sshd - KCP_CONNECTION (8): - kcp connection logs - """ - COMPONENT_UNSPECIFIED = 0 - SYSTEM_COMPONENTS = 1 - WORKLOADS = 2 - APISERVER = 3 - SCHEDULER = 4 - CONTROLLER_MANAGER = 5 - KCP_SSHD = 7 - KCP_CONNECTION = 8 - - enable_components: MutableSequence[Component] = proto.RepeatedField( - proto.ENUM, - number=1, - enum=Component, - ) - - -class RayClusterLoggingConfig(proto.Message): - r"""RayClusterLoggingConfig specifies configuration of Ray - logging. - - Attributes: - enabled (bool): - Enable log collection for Ray clusters. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class MonitoringConfig(proto.Message): - r"""MonitoringConfig is cluster monitoring configuration. - - Attributes: - component_config (google.cloud.container_v1.types.MonitoringComponentConfig): - Monitoring components configuration - managed_prometheus_config (google.cloud.container_v1.types.ManagedPrometheusConfig): - Enable Google Cloud Managed Service for - Prometheus in the cluster. - advanced_datapath_observability_config (google.cloud.container_v1.types.AdvancedDatapathObservabilityConfig): - Configuration of Advanced Datapath - Observability features. - """ - - component_config: 'MonitoringComponentConfig' = proto.Field( - proto.MESSAGE, - number=1, - message='MonitoringComponentConfig', - ) - managed_prometheus_config: 'ManagedPrometheusConfig' = proto.Field( - proto.MESSAGE, - number=2, - message='ManagedPrometheusConfig', - ) - advanced_datapath_observability_config: 'AdvancedDatapathObservabilityConfig' = proto.Field( - proto.MESSAGE, - number=3, - message='AdvancedDatapathObservabilityConfig', - ) - - -class AdvancedDatapathObservabilityConfig(proto.Message): - r"""AdvancedDatapathObservabilityConfig specifies configuration - of observability features of advanced datapath. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - enable_metrics (bool): - Expose flow metrics on nodes - relay_mode (google.cloud.container_v1.types.AdvancedDatapathObservabilityConfig.RelayMode): - Method used to make Relay available - enable_relay (bool): - Enable Relay component - - This field is a member of `oneof`_ ``_enable_relay``. - """ - class RelayMode(proto.Enum): - r"""Supported Relay modes - - Values: - RELAY_MODE_UNSPECIFIED (0): - Default value. This shouldn't be used. - DISABLED (1): - disabled - INTERNAL_VPC_LB (3): - exposed via internal load balancer - EXTERNAL_LB (4): - exposed via external load balancer - """ - RELAY_MODE_UNSPECIFIED = 0 - DISABLED = 1 - INTERNAL_VPC_LB = 3 - EXTERNAL_LB = 4 - - enable_metrics: bool = proto.Field( - proto.BOOL, - number=1, - ) - relay_mode: RelayMode = proto.Field( - proto.ENUM, - number=2, - enum=RelayMode, - ) - enable_relay: bool = proto.Field( - proto.BOOL, - number=3, - optional=True, - ) - - -class RayClusterMonitoringConfig(proto.Message): - r"""RayClusterMonitoringConfig specifies monitoring configuration - for Ray clusters. - - Attributes: - enabled (bool): - Enable metrics collection for Ray clusters. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class NodePoolLoggingConfig(proto.Message): - r"""NodePoolLoggingConfig specifies logging configuration for - nodepools. - - Attributes: - variant_config (google.cloud.container_v1.types.LoggingVariantConfig): - Logging variant configuration. - """ - - variant_config: 'LoggingVariantConfig' = proto.Field( - proto.MESSAGE, - number=1, - message='LoggingVariantConfig', - ) - - -class LoggingVariantConfig(proto.Message): - r"""LoggingVariantConfig specifies the behaviour of the logging - component. - - Attributes: - variant (google.cloud.container_v1.types.LoggingVariantConfig.Variant): - Logging variant deployed on nodes. - """ - class Variant(proto.Enum): - r"""Logging component variants. - - Values: - VARIANT_UNSPECIFIED (0): - Default value. This shouldn't be used. - DEFAULT (1): - default logging variant. - MAX_THROUGHPUT (2): - maximum logging throughput variant. - """ - VARIANT_UNSPECIFIED = 0 - DEFAULT = 1 - MAX_THROUGHPUT = 2 - - variant: Variant = proto.Field( - proto.ENUM, - number=1, - enum=Variant, - ) - - -class MonitoringComponentConfig(proto.Message): - r"""MonitoringComponentConfig is cluster monitoring component - configuration. - - Attributes: - enable_components (MutableSequence[google.cloud.container_v1.types.MonitoringComponentConfig.Component]): - Select components to collect metrics. An - empty set would disable all monitoring. - """ - class Component(proto.Enum): - r"""GKE components exposing metrics - - Values: - COMPONENT_UNSPECIFIED (0): - Default value. This shouldn't be used. - SYSTEM_COMPONENTS (1): - system components - APISERVER (3): - kube-apiserver - SCHEDULER (4): - kube-scheduler - CONTROLLER_MANAGER (5): - kube-controller-manager - STORAGE (7): - Storage - HPA (8): - Horizontal Pod Autoscaling - POD (9): - Pod - DAEMONSET (10): - DaemonSet - DEPLOYMENT (11): - Deployment - STATEFULSET (12): - Statefulset - CADVISOR (13): - CADVISOR - KUBELET (14): - KUBELET - DCGM (15): - NVIDIA Data Center GPU Manager (DCGM) - """ - COMPONENT_UNSPECIFIED = 0 - SYSTEM_COMPONENTS = 1 - APISERVER = 3 - SCHEDULER = 4 - CONTROLLER_MANAGER = 5 - STORAGE = 7 - HPA = 8 - POD = 9 - DAEMONSET = 10 - DEPLOYMENT = 11 - STATEFULSET = 12 - CADVISOR = 13 - KUBELET = 14 - DCGM = 15 - - enable_components: MutableSequence[Component] = proto.RepeatedField( - proto.ENUM, - number=1, - enum=Component, - ) - - -class ManagedPrometheusConfig(proto.Message): - r"""ManagedPrometheusConfig defines the configuration for - Google Cloud Managed Service for Prometheus. - - Attributes: - enabled (bool): - Enable Managed Collection. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class Fleet(proto.Message): - r"""Fleet is the fleet configuration for the cluster. - - Attributes: - project (str): - The Fleet host project(project ID or project - number) where this cluster will be registered - to. This field cannot be changed after the - cluster has been registered. - membership (str): - Output only. The full resource name of the registered fleet - membership of the cluster, in the format - ``//gkehub.googleapis.com/projects/*/locations/*/memberships/*``. - pre_registered (bool): - Output only. Whether the cluster has been - registered through the fleet API. - """ - - project: str = proto.Field( - proto.STRING, - number=1, - ) - membership: str = proto.Field( - proto.STRING, - number=2, - ) - pre_registered: bool = proto.Field( - proto.BOOL, - number=3, - ) - - -class ControlPlaneEndpointsConfig(proto.Message): - r"""Configuration for all of the cluster's control plane - endpoints. - - Attributes: - dns_endpoint_config (google.cloud.container_v1.types.ControlPlaneEndpointsConfig.DNSEndpointConfig): - DNS endpoint configuration. - ip_endpoints_config (google.cloud.container_v1.types.ControlPlaneEndpointsConfig.IPEndpointsConfig): - IP endpoints configuration. - """ - - class DNSEndpointConfig(proto.Message): - r"""Describes the configuration of a DNS endpoint. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - endpoint (str): - Output only. The cluster's DNS endpoint configuration. A DNS - format address. This is accessible from the public internet. - Ex: uid.us-central1.gke.goog. Always present, but the - behavior may change according to the value of - [DNSEndpointConfig.allow_external_traffic][google.container.v1.ControlPlaneEndpointsConfig.DNSEndpointConfig.allow_external_traffic]. - allow_external_traffic (bool): - Controls whether user traffic is allowed over - this endpoint. Note that GCP-managed services - may still use the endpoint even if this is - false. - - This field is a member of `oneof`_ ``_allow_external_traffic``. - """ - - endpoint: str = proto.Field( - proto.STRING, - number=2, - ) - allow_external_traffic: bool = proto.Field( - proto.BOOL, - number=3, - optional=True, - ) - - class IPEndpointsConfig(proto.Message): - r"""IP endpoints configuration. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - enabled (bool): - Controls whether to allow direct IP access. - - This field is a member of `oneof`_ ``_enabled``. - enable_public_endpoint (bool): - Controls whether the control plane allows access through a - public IP. It is invalid to specify both - [PrivateClusterConfig.enablePrivateEndpoint][] and this - field at the same time. - - This field is a member of `oneof`_ ``_enable_public_endpoint``. - global_access (bool): - Controls whether the control plane's private endpoint is - accessible from sources in other regions. It is invalid to - specify both - [PrivateClusterMasterGlobalAccessConfig.enabled][google.container.v1.PrivateClusterMasterGlobalAccessConfig.enabled] - and this field at the same time. - - This field is a member of `oneof`_ ``_global_access``. - authorized_networks_config (google.cloud.container_v1.types.MasterAuthorizedNetworksConfig): - Configuration of authorized networks. If enabled, restricts - access to the control plane based on source IP. It is - invalid to specify both - [Cluster.masterAuthorizedNetworksConfig][] and this field at - the same time. - public_endpoint (str): - Output only. The external IP address of this - cluster's control plane. Only populated if - enabled. - private_endpoint (str): - Output only. The internal IP address of this - cluster's control plane. Only populated if - enabled. - private_endpoint_subnetwork (str): - Subnet to provision the master's private endpoint during - cluster creation. Specified in - projects/\ */regions/*/subnetworks/\* format. It is invalid - to specify both - [PrivateClusterConfig.privateEndpointSubnetwork][] and this - field at the same time. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - optional=True, - ) - enable_public_endpoint: bool = proto.Field( - proto.BOOL, - number=2, - optional=True, - ) - global_access: bool = proto.Field( - proto.BOOL, - number=3, - optional=True, - ) - authorized_networks_config: 'MasterAuthorizedNetworksConfig' = proto.Field( - proto.MESSAGE, - number=4, - message='MasterAuthorizedNetworksConfig', - ) - public_endpoint: str = proto.Field( - proto.STRING, - number=5, - ) - private_endpoint: str = proto.Field( - proto.STRING, - number=6, - ) - private_endpoint_subnetwork: str = proto.Field( - proto.STRING, - number=7, - ) - - dns_endpoint_config: DNSEndpointConfig = proto.Field( - proto.MESSAGE, - number=1, - message=DNSEndpointConfig, - ) - ip_endpoints_config: IPEndpointsConfig = proto.Field( - proto.MESSAGE, - number=3, - message=IPEndpointsConfig, - ) - - -class LocalNvmeSsdBlockConfig(proto.Message): - r"""LocalNvmeSsdBlockConfig contains configuration for using - raw-block local NVMe SSDs - - Attributes: - local_ssd_count (int): - Number of local NVMe SSDs to use. The limit for this value - is dependent upon the maximum number of disk available on a - machine per zone. See: - https://cloud.google.com/compute/docs/disks/local-ssd for - more information. - - A zero (or unset) value has different meanings depending on - machine type being used: - - 1. For pre-Gen3 machines, which support flexible numbers of - local ssds, zero (or unset) means to disable using local - SSDs as ephemeral storage. - 2. For Gen3 machines which dictate a specific number of - local ssds, zero (or unset) means to use the default - number of local ssds that goes with that machine type. - For example, for a c3-standard-8-lssd machine, 2 local - ssds would be provisioned. For c3-standard-8 (which - doesn't support local ssds), 0 will be provisioned. See - https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds - for more info. - """ - - local_ssd_count: int = proto.Field( - proto.INT32, - number=1, - ) - - -class EphemeralStorageLocalSsdConfig(proto.Message): - r"""EphemeralStorageLocalSsdConfig contains configuration for the - node ephemeral storage using Local SSDs. - - Attributes: - local_ssd_count (int): - Number of local SSDs to use to back ephemeral storage. Uses - NVMe interfaces. - - A zero (or unset) value has different meanings depending on - machine type being used: - - 1. For pre-Gen3 machines, which support flexible numbers of - local ssds, zero (or unset) means to disable using local - SSDs as ephemeral storage. The limit for this value is - dependent upon the maximum number of disk available on a - machine per zone. See: - https://cloud.google.com/compute/docs/disks/local-ssd for - more information. - 2. For Gen3 machines which dictate a specific number of - local ssds, zero (or unset) means to use the default - number of local ssds that goes with that machine type. - For example, for a c3-standard-8-lssd machine, 2 local - ssds would be provisioned. For c3-standard-8 (which - doesn't support local ssds), 0 will be provisioned. See - https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds - for more info. - """ - - local_ssd_count: int = proto.Field( - proto.INT32, - number=1, - ) - - -class ResourceManagerTags(proto.Message): - r"""A map of resource manager tag keys and values to be attached - to the nodes for managing Compute Engine firewalls using Network - Firewall Policies. Tags must be according to specifications in - https://cloud.google.com/vpc/docs/tags-firewalls-overview#specifications. - A maximum of 5 tag key-value pairs can be specified. Existing - tags will be replaced with new values. - - Attributes: - tags (MutableMapping[str, str]): - TagKeyValue must be in one of the following formats - ([KEY]=[VALUE]) - - 1. ``tagKeys/{tag_key_id}=tagValues/{tag_value_id}`` - 2. ``{org_id}/{tag_key_name}={tag_value_name}`` - 3. ``{project_id}/{tag_key_name}={tag_value_name}`` - """ - - tags: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=1, - ) - - -class EnterpriseConfig(proto.Message): - r"""EnterpriseConfig is the cluster enterprise configuration. - - Attributes: - cluster_tier (google.cloud.container_v1.types.EnterpriseConfig.ClusterTier): - Output only. cluster_tier indicates the effective tier of - the cluster. - desired_tier (google.cloud.container_v1.types.EnterpriseConfig.ClusterTier): - desired_tier specifies the desired tier of the cluster. - """ - class ClusterTier(proto.Enum): - r"""Premium tiers for GKE Cluster. - - Values: - CLUSTER_TIER_UNSPECIFIED (0): - CLUSTER_TIER_UNSPECIFIED is when cluster_tier is not set. - STANDARD (1): - STANDARD indicates a standard GKE cluster. - ENTERPRISE (2): - ENTERPRISE indicates a GKE Enterprise - cluster. - """ - CLUSTER_TIER_UNSPECIFIED = 0 - STANDARD = 1 - ENTERPRISE = 2 - - cluster_tier: ClusterTier = proto.Field( - proto.ENUM, - number=1, - enum=ClusterTier, - ) - desired_tier: ClusterTier = proto.Field( - proto.ENUM, - number=2, - enum=ClusterTier, - ) - - -class SecretManagerConfig(proto.Message): - r"""SecretManagerConfig is config for secret manager enablement. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - enabled (bool): - Enable/Disable Secret Manager Config. - - This field is a member of `oneof`_ ``_enabled``. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - optional=True, - ) - - -class SecondaryBootDisk(proto.Message): - r"""SecondaryBootDisk represents a persistent disk attached to a - node with special configurations based on its mode. - - Attributes: - mode (google.cloud.container_v1.types.SecondaryBootDisk.Mode): - Disk mode (container image cache, etc.) - disk_image (str): - Fully-qualified resource ID for an existing - disk image. - """ - class Mode(proto.Enum): - r"""Mode specifies how the secondary boot disk will be used. - This triggers mode-specified logic in the control plane. - - Values: - MODE_UNSPECIFIED (0): - MODE_UNSPECIFIED is when mode is not set. - CONTAINER_IMAGE_CACHE (1): - CONTAINER_IMAGE_CACHE is for using the secondary boot disk - as a container image cache. - """ - MODE_UNSPECIFIED = 0 - CONTAINER_IMAGE_CACHE = 1 - - mode: Mode = proto.Field( - proto.ENUM, - number=1, - enum=Mode, - ) - disk_image: str = proto.Field( - proto.STRING, - number=2, - ) - - -class SecondaryBootDiskUpdateStrategy(proto.Message): - r"""SecondaryBootDiskUpdateStrategy is a placeholder which will - be extended in the future to define different options for - updating secondary boot disks. - - """ - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/google-cloud-container/v1/mypy.ini b/owl-bot-staging/google-cloud-container/v1/mypy.ini deleted file mode 100644 index 574c5aed394b..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.7 -namespace_packages = True diff --git a/owl-bot-staging/google-cloud-container/v1/noxfile.py b/owl-bot-staging/google-cloud-container/v1/noxfile.py deleted file mode 100644 index 11a2bb18b3af..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/noxfile.py +++ /dev/null @@ -1,280 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 re -import shutil -import subprocess -import sys - - -import nox # type: ignore - -ALL_PYTHON = [ - "3.7", - "3.8", - "3.9", - "3.10", - "3.11", - "3.12", - "3.13", -] - -CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() - -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" -PACKAGE_NAME = 'google-cloud-container' - -BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.13" - -nox.sessions = [ - "unit", - "cover", - "mypy", - "check_lower_bounds" - # exclude update_lower_bounds from default - "docs", - "blacken", - "lint", - "prerelease_deps", -] - -@nox.session(python=ALL_PYTHON) -@nox.parametrize( - "protobuf_implementation", - [ "python", "upb", "cpp" ], -) -def unit(session, protobuf_implementation): - """Run the unit test suite.""" - - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): - session.skip("cpp implementation is not supported in python 3.11+") - - session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') - session.install('-e', '.', "-c", f"testing/constraints-{session.python}.txt") - - # Remove the 'cpp' implementation once support for Protobuf 3.x is dropped. - # The 'cpp' implementation requires Protobuf<4. - if protobuf_implementation == "cpp": - session.install("protobuf<4") - - session.run( - 'py.test', - '--quiet', - '--cov=google/cloud/container_v1/', - '--cov=tests/', - '--cov-config=.coveragerc', - '--cov-report=term', - '--cov-report=html', - os.path.join('tests', 'unit', ''.join(session.posargs)), - env={ - "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, - }, - ) - -@nox.session(python=ALL_PYTHON[-1]) -@nox.parametrize( - "protobuf_implementation", - [ "python", "upb", "cpp" ], -) -def prerelease_deps(session, protobuf_implementation): - """Run the unit test suite against pre-release versions of dependencies.""" - - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): - session.skip("cpp implementation is not supported in python 3.11+") - - # Install test environment dependencies - session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') - - # Install the package without dependencies - session.install('-e', '.', '--no-deps') - - # We test the minimum dependency versions using the minimum Python - # version so the lowest python runtime that we test has a corresponding constraints - # file, located at `testing/constraints--.txt`, which contains all of the - # dependencies and extras. - with open( - CURRENT_DIRECTORY - / "testing" - / f"constraints-{ALL_PYTHON[0]}.txt", - encoding="utf-8", - ) as constraints_file: - constraints_text = constraints_file.read() - - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] - - session.install(*constraints_deps) - - prerel_deps = [ - "googleapis-common-protos", - "google-api-core", - "google-auth", - # Exclude grpcio!=1.67.0rc1 which does not support python 3.13 - "grpcio!=1.67.0rc1", - "grpcio-status", - "protobuf", - "proto-plus", - ] - - for dep in prerel_deps: - session.install("--pre", "--no-deps", "--upgrade", dep) - - # Remaining dependencies - other_deps = [ - "requests", - ] - session.install(*other_deps) - - # Print out prerelease package versions - - session.run("python", "-c", "import google.api_core; print(google.api_core.__version__)") - session.run("python", "-c", "import google.auth; print(google.auth.__version__)") - session.run("python", "-c", "import grpc; print(grpc.__version__)") - session.run( - "python", "-c", "import google.protobuf; print(google.protobuf.__version__)" - ) - session.run( - "python", "-c", "import proto; print(proto.__version__)" - ) - - session.run( - 'py.test', - '--quiet', - '--cov=google/cloud/container_v1/', - '--cov=tests/', - '--cov-config=.coveragerc', - '--cov-report=term', - '--cov-report=html', - os.path.join('tests', 'unit', ''.join(session.posargs)), - env={ - "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, - }, - ) - - -@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', - '-p', - '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==7.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, - ) diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_async.py deleted file mode 100644 index dd70d24e20ce..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_async.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CancelOperation -# 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-container - - -# [START container_v1_generated_ClusterManager_CancelOperation_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 import container_v1 - - -async def sample_cancel_operation(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.CancelOperationRequest( - ) - - # Make the request - await client.cancel_operation(request=request) - - -# [END container_v1_generated_ClusterManager_CancelOperation_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_sync.py deleted file mode 100644 index 4cbf6a8798ae..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_cancel_operation_sync.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CancelOperation -# 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-container - - -# [START container_v1_generated_ClusterManager_CancelOperation_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 import container_v1 - - -def sample_cancel_operation(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.CancelOperationRequest( - ) - - # Make the request - client.cancel_operation(request=request) - - -# [END container_v1_generated_ClusterManager_CancelOperation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py deleted file mode 100644 index 43365c3acaaa..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CheckAutopilotCompatibility -# 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-container - - -# [START container_v1_generated_ClusterManager_CheckAutopilotCompatibility_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 import container_v1 - - -async def sample_check_autopilot_compatibility(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.CheckAutopilotCompatibilityRequest( - ) - - # Make the request - response = await client.check_autopilot_compatibility(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py deleted file mode 100644 index 6f9dbb1be73f..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CheckAutopilotCompatibility -# 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-container - - -# [START container_v1_generated_ClusterManager_CheckAutopilotCompatibility_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 import container_v1 - - -def sample_check_autopilot_compatibility(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.CheckAutopilotCompatibilityRequest( - ) - - # Make the request - response = client.check_autopilot_compatibility(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_CheckAutopilotCompatibility_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_async.py deleted file mode 100644 index df4c0aa503ee..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CompleteIPRotation -# 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-container - - -# [START container_v1_generated_ClusterManager_CompleteIPRotation_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 import container_v1 - - -async def sample_complete_ip_rotation(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.CompleteIPRotationRequest( - ) - - # Make the request - response = await client.complete_ip_rotation(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_CompleteIPRotation_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_sync.py deleted file mode 100644 index 80ff9867f440..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_ip_rotation_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CompleteIPRotation -# 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-container - - -# [START container_v1_generated_ClusterManager_CompleteIPRotation_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 import container_v1 - - -def sample_complete_ip_rotation(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.CompleteIPRotationRequest( - ) - - # Make the request - response = client.complete_ip_rotation(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_CompleteIPRotation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py deleted file mode 100644 index 522c62eace86..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CompleteNodePoolUpgrade -# 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-container - - -# [START container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_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 import container_v1 - - -async def sample_complete_node_pool_upgrade(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.CompleteNodePoolUpgradeRequest( - ) - - # Make the request - await client.complete_node_pool_upgrade(request=request) - - -# [END container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py deleted file mode 100644 index 95fc00346f52..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CompleteNodePoolUpgrade -# 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-container - - -# [START container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_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 import container_v1 - - -def sample_complete_node_pool_upgrade(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.CompleteNodePoolUpgradeRequest( - ) - - # Make the request - client.complete_node_pool_upgrade(request=request) - - -# [END container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_async.py deleted file mode 100644 index 854d9fc9588f..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CreateCluster -# 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-container - - -# [START container_v1_generated_ClusterManager_CreateCluster_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 import container_v1 - - -async def sample_create_cluster(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.CreateClusterRequest( - ) - - # Make the request - response = await client.create_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_CreateCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_sync.py deleted file mode 100644 index 39a23f38fdac..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_cluster_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CreateCluster -# 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-container - - -# [START container_v1_generated_ClusterManager_CreateCluster_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 import container_v1 - - -def sample_create_cluster(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.CreateClusterRequest( - ) - - # Make the request - response = client.create_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_CreateCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_async.py deleted file mode 100644 index c68610be2818..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CreateNodePool -# 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-container - - -# [START container_v1_generated_ClusterManager_CreateNodePool_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 import container_v1 - - -async def sample_create_node_pool(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.CreateNodePoolRequest( - ) - - # Make the request - response = await client.create_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_CreateNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_sync.py deleted file mode 100644 index cccfe7fc46c0..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_create_node_pool_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CreateNodePool -# 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-container - - -# [START container_v1_generated_ClusterManager_CreateNodePool_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 import container_v1 - - -def sample_create_node_pool(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.CreateNodePoolRequest( - ) - - # Make the request - response = client.create_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_CreateNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_async.py deleted file mode 100644 index 1602e612c901..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 DeleteCluster -# 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-container - - -# [START container_v1_generated_ClusterManager_DeleteCluster_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 import container_v1 - - -async def sample_delete_cluster(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.DeleteClusterRequest( - ) - - # Make the request - response = await client.delete_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_DeleteCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_sync.py deleted file mode 100644 index 3d001beac35e..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_cluster_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 DeleteCluster -# 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-container - - -# [START container_v1_generated_ClusterManager_DeleteCluster_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 import container_v1 - - -def sample_delete_cluster(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.DeleteClusterRequest( - ) - - # Make the request - response = client.delete_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_DeleteCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_async.py deleted file mode 100644 index 9e6205a0950f..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 DeleteNodePool -# 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-container - - -# [START container_v1_generated_ClusterManager_DeleteNodePool_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 import container_v1 - - -async def sample_delete_node_pool(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.DeleteNodePoolRequest( - ) - - # Make the request - response = await client.delete_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_DeleteNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_sync.py deleted file mode 100644 index 175051c61d8c..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_delete_node_pool_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 DeleteNodePool -# 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-container - - -# [START container_v1_generated_ClusterManager_DeleteNodePool_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 import container_v1 - - -def sample_delete_node_pool(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.DeleteNodePoolRequest( - ) - - # Make the request - response = client.delete_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_DeleteNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_async.py deleted file mode 100644 index aae40af786b5..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetCluster -# 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-container - - -# [START container_v1_generated_ClusterManager_GetCluster_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 import container_v1 - - -async def sample_get_cluster(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.GetClusterRequest( - ) - - # Make the request - response = await client.get_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_GetCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_sync.py deleted file mode 100644 index 4a8000c32663..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_cluster_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetCluster -# 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-container - - -# [START container_v1_generated_ClusterManager_GetCluster_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 import container_v1 - - -def sample_get_cluster(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.GetClusterRequest( - ) - - # Make the request - response = client.get_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_GetCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_async.py deleted file mode 100644 index 5204ffcb60dc..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetJSONWebKeys -# 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-container - - -# [START container_v1_generated_ClusterManager_GetJSONWebKeys_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 import container_v1 - - -async def sample_get_json_web_keys(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.GetJSONWebKeysRequest( - ) - - # Make the request - response = await client.get_json_web_keys(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_GetJSONWebKeys_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_sync.py deleted file mode 100644 index 8ae4a8c07717..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_json_web_keys_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetJSONWebKeys -# 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-container - - -# [START container_v1_generated_ClusterManager_GetJSONWebKeys_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 import container_v1 - - -def sample_get_json_web_keys(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.GetJSONWebKeysRequest( - ) - - # Make the request - response = client.get_json_web_keys(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_GetJSONWebKeys_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_async.py deleted file mode 100644 index 466818b0187d..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetNodePool -# 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-container - - -# [START container_v1_generated_ClusterManager_GetNodePool_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 import container_v1 - - -async def sample_get_node_pool(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.GetNodePoolRequest( - ) - - # Make the request - response = await client.get_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_GetNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_sync.py deleted file mode 100644 index 2c53ec36853a..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_node_pool_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetNodePool -# 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-container - - -# [START container_v1_generated_ClusterManager_GetNodePool_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 import container_v1 - - -def sample_get_node_pool(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.GetNodePoolRequest( - ) - - # Make the request - response = client.get_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_GetNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_async.py deleted file mode 100644 index 23d35891f194..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetOperation -# 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-container - - -# [START container_v1_generated_ClusterManager_GetOperation_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 import container_v1 - - -async def sample_get_operation(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.GetOperationRequest( - ) - - # Make the request - response = await client.get_operation(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_GetOperation_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_sync.py deleted file mode 100644 index 8e4859308765..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_operation_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetOperation -# 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-container - - -# [START container_v1_generated_ClusterManager_GetOperation_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 import container_v1 - - -def sample_get_operation(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.GetOperationRequest( - ) - - # Make the request - response = client.get_operation(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_GetOperation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_async.py deleted file mode 100644 index 8dfebf6b3eef..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetServerConfig -# 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-container - - -# [START container_v1_generated_ClusterManager_GetServerConfig_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 import container_v1 - - -async def sample_get_server_config(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.GetServerConfigRequest( - ) - - # Make the request - response = await client.get_server_config(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_GetServerConfig_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_sync.py deleted file mode 100644 index cf55088d66d9..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_get_server_config_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetServerConfig -# 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-container - - -# [START container_v1_generated_ClusterManager_GetServerConfig_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 import container_v1 - - -def sample_get_server_config(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.GetServerConfigRequest( - ) - - # Make the request - response = client.get_server_config(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_GetServerConfig_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_async.py deleted file mode 100644 index a31644c16c35..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListClusters -# 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-container - - -# [START container_v1_generated_ClusterManager_ListClusters_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 import container_v1 - - -async def sample_list_clusters(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.ListClustersRequest( - ) - - # Make the request - response = await client.list_clusters(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_ListClusters_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_sync.py deleted file mode 100644 index 8461fc23a969..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_clusters_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListClusters -# 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-container - - -# [START container_v1_generated_ClusterManager_ListClusters_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 import container_v1 - - -def sample_list_clusters(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.ListClustersRequest( - ) - - # Make the request - response = client.list_clusters(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_ListClusters_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_async.py deleted file mode 100644 index f5e12b53eb95..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListNodePools -# 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-container - - -# [START container_v1_generated_ClusterManager_ListNodePools_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 import container_v1 - - -async def sample_list_node_pools(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.ListNodePoolsRequest( - ) - - # Make the request - response = await client.list_node_pools(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_ListNodePools_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_sync.py deleted file mode 100644 index f983793d6e8c..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_node_pools_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListNodePools -# 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-container - - -# [START container_v1_generated_ClusterManager_ListNodePools_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 import container_v1 - - -def sample_list_node_pools(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.ListNodePoolsRequest( - ) - - # Make the request - response = client.list_node_pools(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_ListNodePools_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_async.py deleted file mode 100644 index 40562e00eaf3..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListOperations -# 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-container - - -# [START container_v1_generated_ClusterManager_ListOperations_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 import container_v1 - - -async def sample_list_operations(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.ListOperationsRequest( - ) - - # Make the request - response = await client.list_operations(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_ListOperations_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_sync.py deleted file mode 100644 index 25b21217990e..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_operations_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListOperations -# 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-container - - -# [START container_v1_generated_ClusterManager_ListOperations_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 import container_v1 - - -def sample_list_operations(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.ListOperationsRequest( - ) - - # Make the request - response = client.list_operations(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_ListOperations_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_async.py deleted file mode 100644 index 691ab32d5d22..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListUsableSubnetworks -# 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-container - - -# [START container_v1_generated_ClusterManager_ListUsableSubnetworks_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 import container_v1 - - -async def sample_list_usable_subnetworks(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.ListUsableSubnetworksRequest( - ) - - # Make the request - page_result = client.list_usable_subnetworks(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END container_v1_generated_ClusterManager_ListUsableSubnetworks_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_sync.py deleted file mode 100644 index e6cddf613c8f..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_list_usable_subnetworks_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListUsableSubnetworks -# 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-container - - -# [START container_v1_generated_ClusterManager_ListUsableSubnetworks_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 import container_v1 - - -def sample_list_usable_subnetworks(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.ListUsableSubnetworksRequest( - ) - - # Make the request - page_result = client.list_usable_subnetworks(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END container_v1_generated_ClusterManager_ListUsableSubnetworks_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_async.py deleted file mode 100644 index 5d578a274811..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 RollbackNodePoolUpgrade -# 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-container - - -# [START container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_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 import container_v1 - - -async def sample_rollback_node_pool_upgrade(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.RollbackNodePoolUpgradeRequest( - ) - - # Make the request - response = await client.rollback_node_pool_upgrade(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py deleted file mode 100644 index a9484a8410e3..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 RollbackNodePoolUpgrade -# 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-container - - -# [START container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_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 import container_v1 - - -def sample_rollback_node_pool_upgrade(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.RollbackNodePoolUpgradeRequest( - ) - - # Make the request - response = client.rollback_node_pool_upgrade(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_async.py deleted file mode 100644 index 4a80f4059037..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetAddonsConfig -# 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-container - - -# [START container_v1_generated_ClusterManager_SetAddonsConfig_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 import container_v1 - - -async def sample_set_addons_config(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetAddonsConfigRequest( - ) - - # Make the request - response = await client.set_addons_config(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetAddonsConfig_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_sync.py deleted file mode 100644 index 7c74c9c5b1f3..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetAddonsConfig -# 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-container - - -# [START container_v1_generated_ClusterManager_SetAddonsConfig_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 import container_v1 - - -def sample_set_addons_config(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetAddonsConfigRequest( - ) - - # Make the request - response = client.set_addons_config(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetAddonsConfig_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_async.py deleted file mode 100644 index 0855ecdebefe..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLabels -# 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-container - - -# [START container_v1_generated_ClusterManager_SetLabels_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 import container_v1 - - -async def sample_set_labels(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetLabelsRequest( - label_fingerprint="label_fingerprint_value", - ) - - # Make the request - response = await client.set_labels(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetLabels_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_sync.py deleted file mode 100644 index 444f86368adf..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_labels_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLabels -# 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-container - - -# [START container_v1_generated_ClusterManager_SetLabels_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 import container_v1 - - -def sample_set_labels(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetLabelsRequest( - label_fingerprint="label_fingerprint_value", - ) - - # Make the request - response = client.set_labels(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetLabels_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_async.py deleted file mode 100644 index bf4704f3b3a3..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLegacyAbac -# 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-container - - -# [START container_v1_generated_ClusterManager_SetLegacyAbac_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 import container_v1 - - -async def sample_set_legacy_abac(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetLegacyAbacRequest( - enabled=True, - ) - - # Make the request - response = await client.set_legacy_abac(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetLegacyAbac_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_sync.py deleted file mode 100644 index 18ab0c4a2769..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_legacy_abac_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLegacyAbac -# 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-container - - -# [START container_v1_generated_ClusterManager_SetLegacyAbac_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 import container_v1 - - -def sample_set_legacy_abac(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetLegacyAbacRequest( - enabled=True, - ) - - # Make the request - response = client.set_legacy_abac(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetLegacyAbac_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_async.py deleted file mode 100644 index db8973f93242..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLocations -# 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-container - - -# [START container_v1_generated_ClusterManager_SetLocations_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 import container_v1 - - -async def sample_set_locations(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetLocationsRequest( - locations=['locations_value1', 'locations_value2'], - ) - - # Make the request - response = await client.set_locations(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetLocations_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_sync.py deleted file mode 100644 index 46d75ef6f450..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_locations_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLocations -# 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-container - - -# [START container_v1_generated_ClusterManager_SetLocations_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 import container_v1 - - -def sample_set_locations(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetLocationsRequest( - locations=['locations_value1', 'locations_value2'], - ) - - # Make the request - response = client.set_locations(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetLocations_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_async.py deleted file mode 100644 index 4102c4ea493d..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLoggingService -# 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-container - - -# [START container_v1_generated_ClusterManager_SetLoggingService_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 import container_v1 - - -async def sample_set_logging_service(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetLoggingServiceRequest( - logging_service="logging_service_value", - ) - - # Make the request - response = await client.set_logging_service(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetLoggingService_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_sync.py deleted file mode 100644 index 239afd4a6372..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_logging_service_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLoggingService -# 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-container - - -# [START container_v1_generated_ClusterManager_SetLoggingService_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 import container_v1 - - -def sample_set_logging_service(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetLoggingServiceRequest( - logging_service="logging_service_value", - ) - - # Make the request - response = client.set_logging_service(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetLoggingService_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_async.py deleted file mode 100644 index 4e60498c151f..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetMaintenancePolicy -# 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-container - - -# [START container_v1_generated_ClusterManager_SetMaintenancePolicy_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 import container_v1 - - -async def sample_set_maintenance_policy(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetMaintenancePolicyRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.set_maintenance_policy(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetMaintenancePolicy_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_sync.py deleted file mode 100644 index 3aff379c43d9..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_maintenance_policy_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetMaintenancePolicy -# 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-container - - -# [START container_v1_generated_ClusterManager_SetMaintenancePolicy_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 import container_v1 - - -def sample_set_maintenance_policy(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetMaintenancePolicyRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.set_maintenance_policy(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetMaintenancePolicy_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_async.py deleted file mode 100644 index dea630333a1d..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetMasterAuth -# 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-container - - -# [START container_v1_generated_ClusterManager_SetMasterAuth_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 import container_v1 - - -async def sample_set_master_auth(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetMasterAuthRequest( - action="SET_USERNAME", - ) - - # Make the request - response = await client.set_master_auth(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetMasterAuth_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_sync.py deleted file mode 100644 index e2c70a02bdd6..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_master_auth_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetMasterAuth -# 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-container - - -# [START container_v1_generated_ClusterManager_SetMasterAuth_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 import container_v1 - - -def sample_set_master_auth(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetMasterAuthRequest( - action="SET_USERNAME", - ) - - # Make the request - response = client.set_master_auth(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetMasterAuth_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_async.py deleted file mode 100644 index d9eab4c409af..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetMonitoringService -# 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-container - - -# [START container_v1_generated_ClusterManager_SetMonitoringService_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 import container_v1 - - -async def sample_set_monitoring_service(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetMonitoringServiceRequest( - monitoring_service="monitoring_service_value", - ) - - # Make the request - response = await client.set_monitoring_service(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetMonitoringService_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_sync.py deleted file mode 100644 index 89fd21bf294b..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_monitoring_service_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetMonitoringService -# 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-container - - -# [START container_v1_generated_ClusterManager_SetMonitoringService_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 import container_v1 - - -def sample_set_monitoring_service(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetMonitoringServiceRequest( - monitoring_service="monitoring_service_value", - ) - - # Make the request - response = client.set_monitoring_service(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetMonitoringService_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_async.py deleted file mode 100644 index 886f596caea0..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNetworkPolicy -# 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-container - - -# [START container_v1_generated_ClusterManager_SetNetworkPolicy_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 import container_v1 - - -async def sample_set_network_policy(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetNetworkPolicyRequest( - ) - - # Make the request - response = await client.set_network_policy(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetNetworkPolicy_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_sync.py deleted file mode 100644 index f6f31b6c20f5..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_network_policy_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNetworkPolicy -# 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-container - - -# [START container_v1_generated_ClusterManager_SetNetworkPolicy_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 import container_v1 - - -def sample_set_network_policy(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetNetworkPolicyRequest( - ) - - # Make the request - response = client.set_network_policy(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetNetworkPolicy_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_async.py deleted file mode 100644 index 633c0d8482ce..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNodePoolAutoscaling -# 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-container - - -# [START container_v1_generated_ClusterManager_SetNodePoolAutoscaling_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 import container_v1 - - -async def sample_set_node_pool_autoscaling(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetNodePoolAutoscalingRequest( - ) - - # Make the request - response = await client.set_node_pool_autoscaling(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetNodePoolAutoscaling_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_sync.py deleted file mode 100644 index 0793797e02bd..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_autoscaling_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNodePoolAutoscaling -# 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-container - - -# [START container_v1_generated_ClusterManager_SetNodePoolAutoscaling_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 import container_v1 - - -def sample_set_node_pool_autoscaling(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetNodePoolAutoscalingRequest( - ) - - # Make the request - response = client.set_node_pool_autoscaling(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetNodePoolAutoscaling_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_async.py deleted file mode 100644 index a722f458e2d6..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNodePoolManagement -# 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-container - - -# [START container_v1_generated_ClusterManager_SetNodePoolManagement_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 import container_v1 - - -async def sample_set_node_pool_management(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetNodePoolManagementRequest( - ) - - # Make the request - response = await client.set_node_pool_management(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetNodePoolManagement_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_sync.py deleted file mode 100644 index 5b6ce089a1e1..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_management_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNodePoolManagement -# 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-container - - -# [START container_v1_generated_ClusterManager_SetNodePoolManagement_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 import container_v1 - - -def sample_set_node_pool_management(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetNodePoolManagementRequest( - ) - - # Make the request - response = client.set_node_pool_management(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetNodePoolManagement_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_async.py deleted file mode 100644 index b3e197d6de6a..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNodePoolSize -# 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-container - - -# [START container_v1_generated_ClusterManager_SetNodePoolSize_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 import container_v1 - - -async def sample_set_node_pool_size(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.SetNodePoolSizeRequest( - node_count=1070, - ) - - # Make the request - response = await client.set_node_pool_size(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetNodePoolSize_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_sync.py deleted file mode 100644 index 89892f89ddd5..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_set_node_pool_size_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNodePoolSize -# 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-container - - -# [START container_v1_generated_ClusterManager_SetNodePoolSize_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 import container_v1 - - -def sample_set_node_pool_size(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.SetNodePoolSizeRequest( - node_count=1070, - ) - - # Make the request - response = client.set_node_pool_size(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_SetNodePoolSize_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_async.py deleted file mode 100644 index 1988441499b6..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 StartIPRotation -# 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-container - - -# [START container_v1_generated_ClusterManager_StartIPRotation_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 import container_v1 - - -async def sample_start_ip_rotation(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.StartIPRotationRequest( - ) - - # Make the request - response = await client.start_ip_rotation(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_StartIPRotation_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_sync.py deleted file mode 100644 index 37ffde003bd0..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_start_ip_rotation_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 StartIPRotation -# 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-container - - -# [START container_v1_generated_ClusterManager_StartIPRotation_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 import container_v1 - - -def sample_start_ip_rotation(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.StartIPRotationRequest( - ) - - # Make the request - response = client.start_ip_rotation(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_StartIPRotation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_async.py deleted file mode 100644 index df96b74f48ed..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 UpdateCluster -# 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-container - - -# [START container_v1_generated_ClusterManager_UpdateCluster_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 import container_v1 - - -async def sample_update_cluster(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.UpdateClusterRequest( - ) - - # Make the request - response = await client.update_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_UpdateCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_sync.py deleted file mode 100644 index 4df40327670d..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_cluster_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 UpdateCluster -# 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-container - - -# [START container_v1_generated_ClusterManager_UpdateCluster_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 import container_v1 - - -def sample_update_cluster(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.UpdateClusterRequest( - ) - - # Make the request - response = client.update_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_UpdateCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_async.py deleted file mode 100644 index 00265e753ac9..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 UpdateMaster -# 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-container - - -# [START container_v1_generated_ClusterManager_UpdateMaster_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 import container_v1 - - -async def sample_update_master(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.UpdateMasterRequest( - master_version="master_version_value", - ) - - # Make the request - response = await client.update_master(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_UpdateMaster_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_sync.py deleted file mode 100644 index f5571b170ef5..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_master_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 UpdateMaster -# 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-container - - -# [START container_v1_generated_ClusterManager_UpdateMaster_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 import container_v1 - - -def sample_update_master(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.UpdateMasterRequest( - master_version="master_version_value", - ) - - # Make the request - response = client.update_master(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_UpdateMaster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_async.py deleted file mode 100644 index 4b9298daec5d..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 UpdateNodePool -# 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-container - - -# [START container_v1_generated_ClusterManager_UpdateNodePool_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 import container_v1 - - -async def sample_update_node_pool(): - # Create a client - client = container_v1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1.UpdateNodePoolRequest( - node_version="node_version_value", - image_type="image_type_value", - ) - - # Make the request - response = await client.update_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_UpdateNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_sync.py deleted file mode 100644 index 6b282f9e92ea..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/container_v1_generated_cluster_manager_update_node_pool_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 UpdateNodePool -# 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-container - - -# [START container_v1_generated_ClusterManager_UpdateNodePool_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 import container_v1 - - -def sample_update_node_pool(): - # Create a client - client = container_v1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1.UpdateNodePoolRequest( - node_version="node_version_value", - image_type="image_type_value", - ) - - # Make the request - response = client.update_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1_generated_ClusterManager_UpdateNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/snippet_metadata_google.container.v1.json b/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/snippet_metadata_google.container.v1.json deleted file mode 100644 index 815ec00b3982..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/samples/generated_samples/snippet_metadata_google.container.v1.json +++ /dev/null @@ -1,6053 +0,0 @@ -{ - "clientLibrary": { - "apis": [ - { - "id": "google.container.v1", - "version": "v1" - } - ], - "language": "PYTHON", - "name": "google-cloud-container", - "version": "0.1.0" - }, - "snippets": [ - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.cancel_operation", - "method": { - "fullName": "google.container.v1.ClusterManager.CancelOperation", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CancelOperation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.CancelOperationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "operation_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "shortName": "cancel_operation" - }, - "description": "Sample for CancelOperation", - "file": "container_v1_generated_cluster_manager_cancel_operation_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_CancelOperation_async", - "segments": [ - { - "end": 48, - "start": 27, - "type": "FULL" - }, - { - "end": 48, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_cancel_operation_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.cancel_operation", - "method": { - "fullName": "google.container.v1.ClusterManager.CancelOperation", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CancelOperation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.CancelOperationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "operation_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "shortName": "cancel_operation" - }, - "description": "Sample for CancelOperation", - "file": "container_v1_generated_cluster_manager_cancel_operation_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_CancelOperation_sync", - "segments": [ - { - "end": 48, - "start": 27, - "type": "FULL" - }, - { - "end": 48, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_cancel_operation_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.check_autopilot_compatibility", - "method": { - "fullName": "google.container.v1.ClusterManager.CheckAutopilotCompatibility", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CheckAutopilotCompatibility" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.CheckAutopilotCompatibilityRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.CheckAutopilotCompatibilityResponse", - "shortName": "check_autopilot_compatibility" - }, - "description": "Sample for CheckAutopilotCompatibility", - "file": "container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.check_autopilot_compatibility", - "method": { - "fullName": "google.container.v1.ClusterManager.CheckAutopilotCompatibility", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CheckAutopilotCompatibility" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.CheckAutopilotCompatibilityRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.CheckAutopilotCompatibilityResponse", - "shortName": "check_autopilot_compatibility" - }, - "description": "Sample for CheckAutopilotCompatibility", - "file": "container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_CheckAutopilotCompatibility_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.complete_ip_rotation", - "method": { - "fullName": "google.container.v1.ClusterManager.CompleteIPRotation", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CompleteIPRotation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.CompleteIPRotationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "complete_ip_rotation" - }, - "description": "Sample for CompleteIPRotation", - "file": "container_v1_generated_cluster_manager_complete_ip_rotation_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_CompleteIPRotation_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_complete_ip_rotation_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.complete_ip_rotation", - "method": { - "fullName": "google.container.v1.ClusterManager.CompleteIPRotation", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CompleteIPRotation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.CompleteIPRotationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "complete_ip_rotation" - }, - "description": "Sample for CompleteIPRotation", - "file": "container_v1_generated_cluster_manager_complete_ip_rotation_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_CompleteIPRotation_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_complete_ip_rotation_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.complete_node_pool_upgrade", - "method": { - "fullName": "google.container.v1.ClusterManager.CompleteNodePoolUpgrade", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CompleteNodePoolUpgrade" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.CompleteNodePoolUpgradeRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "shortName": "complete_node_pool_upgrade" - }, - "description": "Sample for CompleteNodePoolUpgrade", - "file": "container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async", - "segments": [ - { - "end": 48, - "start": 27, - "type": "FULL" - }, - { - "end": 48, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.complete_node_pool_upgrade", - "method": { - "fullName": "google.container.v1.ClusterManager.CompleteNodePoolUpgrade", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CompleteNodePoolUpgrade" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.CompleteNodePoolUpgradeRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "shortName": "complete_node_pool_upgrade" - }, - "description": "Sample for CompleteNodePoolUpgrade", - "file": "container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_sync", - "segments": [ - { - "end": 48, - "start": 27, - "type": "FULL" - }, - { - "end": 48, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.create_cluster", - "method": { - "fullName": "google.container.v1.ClusterManager.CreateCluster", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CreateCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.CreateClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster", - "type": "google.cloud.container_v1.types.Cluster" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "create_cluster" - }, - "description": "Sample for CreateCluster", - "file": "container_v1_generated_cluster_manager_create_cluster_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_CreateCluster_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_create_cluster_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.create_cluster", - "method": { - "fullName": "google.container.v1.ClusterManager.CreateCluster", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CreateCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.CreateClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster", - "type": "google.cloud.container_v1.types.Cluster" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "create_cluster" - }, - "description": "Sample for CreateCluster", - "file": "container_v1_generated_cluster_manager_create_cluster_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_CreateCluster_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_create_cluster_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.create_node_pool", - "method": { - "fullName": "google.container.v1.ClusterManager.CreateNodePool", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CreateNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.CreateNodePoolRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool", - "type": "google.cloud.container_v1.types.NodePool" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "create_node_pool" - }, - "description": "Sample for CreateNodePool", - "file": "container_v1_generated_cluster_manager_create_node_pool_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_CreateNodePool_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_create_node_pool_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.create_node_pool", - "method": { - "fullName": "google.container.v1.ClusterManager.CreateNodePool", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CreateNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.CreateNodePoolRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool", - "type": "google.cloud.container_v1.types.NodePool" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "create_node_pool" - }, - "description": "Sample for CreateNodePool", - "file": "container_v1_generated_cluster_manager_create_node_pool_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_CreateNodePool_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_create_node_pool_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.delete_cluster", - "method": { - "fullName": "google.container.v1.ClusterManager.DeleteCluster", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "DeleteCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.DeleteClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "delete_cluster" - }, - "description": "Sample for DeleteCluster", - "file": "container_v1_generated_cluster_manager_delete_cluster_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_DeleteCluster_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_delete_cluster_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.delete_cluster", - "method": { - "fullName": "google.container.v1.ClusterManager.DeleteCluster", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "DeleteCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.DeleteClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "delete_cluster" - }, - "description": "Sample for DeleteCluster", - "file": "container_v1_generated_cluster_manager_delete_cluster_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_DeleteCluster_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_delete_cluster_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.delete_node_pool", - "method": { - "fullName": "google.container.v1.ClusterManager.DeleteNodePool", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "DeleteNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.DeleteNodePoolRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "delete_node_pool" - }, - "description": "Sample for DeleteNodePool", - "file": "container_v1_generated_cluster_manager_delete_node_pool_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_DeleteNodePool_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_delete_node_pool_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.delete_node_pool", - "method": { - "fullName": "google.container.v1.ClusterManager.DeleteNodePool", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "DeleteNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.DeleteNodePoolRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "delete_node_pool" - }, - "description": "Sample for DeleteNodePool", - "file": "container_v1_generated_cluster_manager_delete_node_pool_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_DeleteNodePool_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_delete_node_pool_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.get_cluster", - "method": { - "fullName": "google.container.v1.ClusterManager.GetCluster", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.GetClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Cluster", - "shortName": "get_cluster" - }, - "description": "Sample for GetCluster", - "file": "container_v1_generated_cluster_manager_get_cluster_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_GetCluster_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_get_cluster_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.get_cluster", - "method": { - "fullName": "google.container.v1.ClusterManager.GetCluster", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.GetClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Cluster", - "shortName": "get_cluster" - }, - "description": "Sample for GetCluster", - "file": "container_v1_generated_cluster_manager_get_cluster_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_GetCluster_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_get_cluster_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.get_json_web_keys", - "method": { - "fullName": "google.container.v1.ClusterManager.GetJSONWebKeys", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetJSONWebKeys" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.GetJSONWebKeysRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.GetJSONWebKeysResponse", - "shortName": "get_json_web_keys" - }, - "description": "Sample for GetJSONWebKeys", - "file": "container_v1_generated_cluster_manager_get_json_web_keys_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_GetJSONWebKeys_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_get_json_web_keys_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.get_json_web_keys", - "method": { - "fullName": "google.container.v1.ClusterManager.GetJSONWebKeys", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetJSONWebKeys" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.GetJSONWebKeysRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.GetJSONWebKeysResponse", - "shortName": "get_json_web_keys" - }, - "description": "Sample for GetJSONWebKeys", - "file": "container_v1_generated_cluster_manager_get_json_web_keys_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_GetJSONWebKeys_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_get_json_web_keys_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.get_node_pool", - "method": { - "fullName": "google.container.v1.ClusterManager.GetNodePool", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.GetNodePoolRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.NodePool", - "shortName": "get_node_pool" - }, - "description": "Sample for GetNodePool", - "file": "container_v1_generated_cluster_manager_get_node_pool_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_GetNodePool_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_get_node_pool_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.get_node_pool", - "method": { - "fullName": "google.container.v1.ClusterManager.GetNodePool", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.GetNodePoolRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.NodePool", - "shortName": "get_node_pool" - }, - "description": "Sample for GetNodePool", - "file": "container_v1_generated_cluster_manager_get_node_pool_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_GetNodePool_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_get_node_pool_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.get_operation", - "method": { - "fullName": "google.container.v1.ClusterManager.GetOperation", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetOperation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.GetOperationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "operation_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "get_operation" - }, - "description": "Sample for GetOperation", - "file": "container_v1_generated_cluster_manager_get_operation_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_GetOperation_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_get_operation_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.get_operation", - "method": { - "fullName": "google.container.v1.ClusterManager.GetOperation", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetOperation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.GetOperationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "operation_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "get_operation" - }, - "description": "Sample for GetOperation", - "file": "container_v1_generated_cluster_manager_get_operation_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_GetOperation_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_get_operation_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.get_server_config", - "method": { - "fullName": "google.container.v1.ClusterManager.GetServerConfig", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetServerConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.GetServerConfigRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.ServerConfig", - "shortName": "get_server_config" - }, - "description": "Sample for GetServerConfig", - "file": "container_v1_generated_cluster_manager_get_server_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_GetServerConfig_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_get_server_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.get_server_config", - "method": { - "fullName": "google.container.v1.ClusterManager.GetServerConfig", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetServerConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.GetServerConfigRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.ServerConfig", - "shortName": "get_server_config" - }, - "description": "Sample for GetServerConfig", - "file": "container_v1_generated_cluster_manager_get_server_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_GetServerConfig_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_get_server_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.list_clusters", - "method": { - "fullName": "google.container.v1.ClusterManager.ListClusters", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListClusters" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.ListClustersRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.ListClustersResponse", - "shortName": "list_clusters" - }, - "description": "Sample for ListClusters", - "file": "container_v1_generated_cluster_manager_list_clusters_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_ListClusters_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_list_clusters_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.list_clusters", - "method": { - "fullName": "google.container.v1.ClusterManager.ListClusters", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListClusters" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.ListClustersRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.ListClustersResponse", - "shortName": "list_clusters" - }, - "description": "Sample for ListClusters", - "file": "container_v1_generated_cluster_manager_list_clusters_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_ListClusters_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_list_clusters_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.list_node_pools", - "method": { - "fullName": "google.container.v1.ClusterManager.ListNodePools", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListNodePools" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.ListNodePoolsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.ListNodePoolsResponse", - "shortName": "list_node_pools" - }, - "description": "Sample for ListNodePools", - "file": "container_v1_generated_cluster_manager_list_node_pools_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_ListNodePools_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_list_node_pools_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.list_node_pools", - "method": { - "fullName": "google.container.v1.ClusterManager.ListNodePools", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListNodePools" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.ListNodePoolsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.ListNodePoolsResponse", - "shortName": "list_node_pools" - }, - "description": "Sample for ListNodePools", - "file": "container_v1_generated_cluster_manager_list_node_pools_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_ListNodePools_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_list_node_pools_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.list_operations", - "method": { - "fullName": "google.container.v1.ClusterManager.ListOperations", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListOperations" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.ListOperationsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.ListOperationsResponse", - "shortName": "list_operations" - }, - "description": "Sample for ListOperations", - "file": "container_v1_generated_cluster_manager_list_operations_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_ListOperations_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_list_operations_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.list_operations", - "method": { - "fullName": "google.container.v1.ClusterManager.ListOperations", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListOperations" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.ListOperationsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.ListOperationsResponse", - "shortName": "list_operations" - }, - "description": "Sample for ListOperations", - "file": "container_v1_generated_cluster_manager_list_operations_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_ListOperations_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_list_operations_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.list_usable_subnetworks", - "method": { - "fullName": "google.container.v1.ClusterManager.ListUsableSubnetworks", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListUsableSubnetworks" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.ListUsableSubnetworksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.services.cluster_manager.pagers.ListUsableSubnetworksAsyncPager", - "shortName": "list_usable_subnetworks" - }, - "description": "Sample for ListUsableSubnetworks", - "file": "container_v1_generated_cluster_manager_list_usable_subnetworks_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_ListUsableSubnetworks_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_list_usable_subnetworks_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.list_usable_subnetworks", - "method": { - "fullName": "google.container.v1.ClusterManager.ListUsableSubnetworks", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListUsableSubnetworks" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.ListUsableSubnetworksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.services.cluster_manager.pagers.ListUsableSubnetworksPager", - "shortName": "list_usable_subnetworks" - }, - "description": "Sample for ListUsableSubnetworks", - "file": "container_v1_generated_cluster_manager_list_usable_subnetworks_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_ListUsableSubnetworks_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_list_usable_subnetworks_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.rollback_node_pool_upgrade", - "method": { - "fullName": "google.container.v1.ClusterManager.RollbackNodePoolUpgrade", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "RollbackNodePoolUpgrade" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.RollbackNodePoolUpgradeRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "rollback_node_pool_upgrade" - }, - "description": "Sample for RollbackNodePoolUpgrade", - "file": "container_v1_generated_cluster_manager_rollback_node_pool_upgrade_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_rollback_node_pool_upgrade_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.rollback_node_pool_upgrade", - "method": { - "fullName": "google.container.v1.ClusterManager.RollbackNodePoolUpgrade", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "RollbackNodePoolUpgrade" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.RollbackNodePoolUpgradeRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "rollback_node_pool_upgrade" - }, - "description": "Sample for RollbackNodePoolUpgrade", - "file": "container_v1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_RollbackNodePoolUpgrade_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_addons_config", - "method": { - "fullName": "google.container.v1.ClusterManager.SetAddonsConfig", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetAddonsConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetAddonsConfigRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "addons_config", - "type": "google.cloud.container_v1.types.AddonsConfig" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_addons_config" - }, - "description": "Sample for SetAddonsConfig", - "file": "container_v1_generated_cluster_manager_set_addons_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetAddonsConfig_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_set_addons_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.set_addons_config", - "method": { - "fullName": "google.container.v1.ClusterManager.SetAddonsConfig", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetAddonsConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetAddonsConfigRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "addons_config", - "type": "google.cloud.container_v1.types.AddonsConfig" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_addons_config" - }, - "description": "Sample for SetAddonsConfig", - "file": "container_v1_generated_cluster_manager_set_addons_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetAddonsConfig_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_set_addons_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_labels", - "method": { - "fullName": "google.container.v1.ClusterManager.SetLabels", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLabels" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetLabelsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_labels" - }, - "description": "Sample for SetLabels", - "file": "container_v1_generated_cluster_manager_set_labels_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetLabels_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": "container_v1_generated_cluster_manager_set_labels_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.set_labels", - "method": { - "fullName": "google.container.v1.ClusterManager.SetLabels", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLabels" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetLabelsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_labels" - }, - "description": "Sample for SetLabels", - "file": "container_v1_generated_cluster_manager_set_labels_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetLabels_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": "container_v1_generated_cluster_manager_set_labels_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_legacy_abac", - "method": { - "fullName": "google.container.v1.ClusterManager.SetLegacyAbac", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLegacyAbac" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetLegacyAbacRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "enabled", - "type": "bool" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_legacy_abac" - }, - "description": "Sample for SetLegacyAbac", - "file": "container_v1_generated_cluster_manager_set_legacy_abac_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetLegacyAbac_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": "container_v1_generated_cluster_manager_set_legacy_abac_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.set_legacy_abac", - "method": { - "fullName": "google.container.v1.ClusterManager.SetLegacyAbac", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLegacyAbac" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetLegacyAbacRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "enabled", - "type": "bool" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_legacy_abac" - }, - "description": "Sample for SetLegacyAbac", - "file": "container_v1_generated_cluster_manager_set_legacy_abac_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetLegacyAbac_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": "container_v1_generated_cluster_manager_set_legacy_abac_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_locations", - "method": { - "fullName": "google.container.v1.ClusterManager.SetLocations", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLocations" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetLocationsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "locations", - "type": "MutableSequence[str]" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_locations" - }, - "description": "Sample for SetLocations", - "file": "container_v1_generated_cluster_manager_set_locations_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetLocations_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": "container_v1_generated_cluster_manager_set_locations_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.set_locations", - "method": { - "fullName": "google.container.v1.ClusterManager.SetLocations", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLocations" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetLocationsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "locations", - "type": "MutableSequence[str]" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_locations" - }, - "description": "Sample for SetLocations", - "file": "container_v1_generated_cluster_manager_set_locations_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetLocations_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": "container_v1_generated_cluster_manager_set_locations_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_logging_service", - "method": { - "fullName": "google.container.v1.ClusterManager.SetLoggingService", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLoggingService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetLoggingServiceRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "logging_service", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_logging_service" - }, - "description": "Sample for SetLoggingService", - "file": "container_v1_generated_cluster_manager_set_logging_service_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetLoggingService_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": "container_v1_generated_cluster_manager_set_logging_service_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.set_logging_service", - "method": { - "fullName": "google.container.v1.ClusterManager.SetLoggingService", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLoggingService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetLoggingServiceRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "logging_service", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_logging_service" - }, - "description": "Sample for SetLoggingService", - "file": "container_v1_generated_cluster_manager_set_logging_service_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetLoggingService_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": "container_v1_generated_cluster_manager_set_logging_service_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_maintenance_policy", - "method": { - "fullName": "google.container.v1.ClusterManager.SetMaintenancePolicy", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetMaintenancePolicy" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetMaintenancePolicyRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "maintenance_policy", - "type": "google.cloud.container_v1.types.MaintenancePolicy" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_maintenance_policy" - }, - "description": "Sample for SetMaintenancePolicy", - "file": "container_v1_generated_cluster_manager_set_maintenance_policy_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetMaintenancePolicy_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_set_maintenance_policy_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.set_maintenance_policy", - "method": { - "fullName": "google.container.v1.ClusterManager.SetMaintenancePolicy", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetMaintenancePolicy" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetMaintenancePolicyRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "maintenance_policy", - "type": "google.cloud.container_v1.types.MaintenancePolicy" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_maintenance_policy" - }, - "description": "Sample for SetMaintenancePolicy", - "file": "container_v1_generated_cluster_manager_set_maintenance_policy_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetMaintenancePolicy_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_set_maintenance_policy_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_master_auth", - "method": { - "fullName": "google.container.v1.ClusterManager.SetMasterAuth", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetMasterAuth" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetMasterAuthRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_master_auth" - }, - "description": "Sample for SetMasterAuth", - "file": "container_v1_generated_cluster_manager_set_master_auth_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetMasterAuth_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": "container_v1_generated_cluster_manager_set_master_auth_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.set_master_auth", - "method": { - "fullName": "google.container.v1.ClusterManager.SetMasterAuth", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetMasterAuth" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetMasterAuthRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_master_auth" - }, - "description": "Sample for SetMasterAuth", - "file": "container_v1_generated_cluster_manager_set_master_auth_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetMasterAuth_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": "container_v1_generated_cluster_manager_set_master_auth_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_monitoring_service", - "method": { - "fullName": "google.container.v1.ClusterManager.SetMonitoringService", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetMonitoringService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetMonitoringServiceRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "monitoring_service", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_monitoring_service" - }, - "description": "Sample for SetMonitoringService", - "file": "container_v1_generated_cluster_manager_set_monitoring_service_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetMonitoringService_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": "container_v1_generated_cluster_manager_set_monitoring_service_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.set_monitoring_service", - "method": { - "fullName": "google.container.v1.ClusterManager.SetMonitoringService", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetMonitoringService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetMonitoringServiceRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "monitoring_service", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_monitoring_service" - }, - "description": "Sample for SetMonitoringService", - "file": "container_v1_generated_cluster_manager_set_monitoring_service_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetMonitoringService_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": "container_v1_generated_cluster_manager_set_monitoring_service_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_network_policy", - "method": { - "fullName": "google.container.v1.ClusterManager.SetNetworkPolicy", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNetworkPolicy" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetNetworkPolicyRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "network_policy", - "type": "google.cloud.container_v1.types.NetworkPolicy" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_network_policy" - }, - "description": "Sample for SetNetworkPolicy", - "file": "container_v1_generated_cluster_manager_set_network_policy_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetNetworkPolicy_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_set_network_policy_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.set_network_policy", - "method": { - "fullName": "google.container.v1.ClusterManager.SetNetworkPolicy", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNetworkPolicy" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetNetworkPolicyRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "network_policy", - "type": "google.cloud.container_v1.types.NetworkPolicy" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_network_policy" - }, - "description": "Sample for SetNetworkPolicy", - "file": "container_v1_generated_cluster_manager_set_network_policy_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetNetworkPolicy_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_set_network_policy_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_node_pool_autoscaling", - "method": { - "fullName": "google.container.v1.ClusterManager.SetNodePoolAutoscaling", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNodePoolAutoscaling" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetNodePoolAutoscalingRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_node_pool_autoscaling" - }, - "description": "Sample for SetNodePoolAutoscaling", - "file": "container_v1_generated_cluster_manager_set_node_pool_autoscaling_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetNodePoolAutoscaling_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_set_node_pool_autoscaling_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.set_node_pool_autoscaling", - "method": { - "fullName": "google.container.v1.ClusterManager.SetNodePoolAutoscaling", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNodePoolAutoscaling" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetNodePoolAutoscalingRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_node_pool_autoscaling" - }, - "description": "Sample for SetNodePoolAutoscaling", - "file": "container_v1_generated_cluster_manager_set_node_pool_autoscaling_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetNodePoolAutoscaling_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_set_node_pool_autoscaling_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_node_pool_management", - "method": { - "fullName": "google.container.v1.ClusterManager.SetNodePoolManagement", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNodePoolManagement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetNodePoolManagementRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_node_pool_management" - }, - "description": "Sample for SetNodePoolManagement", - "file": "container_v1_generated_cluster_manager_set_node_pool_management_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetNodePoolManagement_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_set_node_pool_management_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.set_node_pool_management", - "method": { - "fullName": "google.container.v1.ClusterManager.SetNodePoolManagement", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNodePoolManagement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetNodePoolManagementRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_node_pool_management" - }, - "description": "Sample for SetNodePoolManagement", - "file": "container_v1_generated_cluster_manager_set_node_pool_management_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetNodePoolManagement_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_set_node_pool_management_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.set_node_pool_size", - "method": { - "fullName": "google.container.v1.ClusterManager.SetNodePoolSize", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNodePoolSize" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetNodePoolSizeRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_node_pool_size" - }, - "description": "Sample for SetNodePoolSize", - "file": "container_v1_generated_cluster_manager_set_node_pool_size_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetNodePoolSize_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": "container_v1_generated_cluster_manager_set_node_pool_size_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.set_node_pool_size", - "method": { - "fullName": "google.container.v1.ClusterManager.SetNodePoolSize", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNodePoolSize" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.SetNodePoolSizeRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "set_node_pool_size" - }, - "description": "Sample for SetNodePoolSize", - "file": "container_v1_generated_cluster_manager_set_node_pool_size_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_SetNodePoolSize_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": "container_v1_generated_cluster_manager_set_node_pool_size_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.start_ip_rotation", - "method": { - "fullName": "google.container.v1.ClusterManager.StartIPRotation", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "StartIPRotation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.StartIPRotationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "start_ip_rotation" - }, - "description": "Sample for StartIPRotation", - "file": "container_v1_generated_cluster_manager_start_ip_rotation_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_StartIPRotation_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_start_ip_rotation_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.start_ip_rotation", - "method": { - "fullName": "google.container.v1.ClusterManager.StartIPRotation", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "StartIPRotation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.StartIPRotationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "start_ip_rotation" - }, - "description": "Sample for StartIPRotation", - "file": "container_v1_generated_cluster_manager_start_ip_rotation_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_StartIPRotation_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_start_ip_rotation_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.update_cluster", - "method": { - "fullName": "google.container.v1.ClusterManager.UpdateCluster", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "UpdateCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.UpdateClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "update", - "type": "google.cloud.container_v1.types.ClusterUpdate" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "update_cluster" - }, - "description": "Sample for UpdateCluster", - "file": "container_v1_generated_cluster_manager_update_cluster_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_UpdateCluster_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_update_cluster_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.update_cluster", - "method": { - "fullName": "google.container.v1.ClusterManager.UpdateCluster", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "UpdateCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.UpdateClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "update", - "type": "google.cloud.container_v1.types.ClusterUpdate" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "update_cluster" - }, - "description": "Sample for UpdateCluster", - "file": "container_v1_generated_cluster_manager_update_cluster_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_UpdateCluster_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1_generated_cluster_manager_update_cluster_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.update_master", - "method": { - "fullName": "google.container.v1.ClusterManager.UpdateMaster", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "UpdateMaster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.UpdateMasterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "master_version", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "update_master" - }, - "description": "Sample for UpdateMaster", - "file": "container_v1_generated_cluster_manager_update_master_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_UpdateMaster_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": "container_v1_generated_cluster_manager_update_master_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.update_master", - "method": { - "fullName": "google.container.v1.ClusterManager.UpdateMaster", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "UpdateMaster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.UpdateMasterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "master_version", - "type": "str" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "update_master" - }, - "description": "Sample for UpdateMaster", - "file": "container_v1_generated_cluster_manager_update_master_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_UpdateMaster_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": "container_v1_generated_cluster_manager_update_master_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.update_node_pool", - "method": { - "fullName": "google.container.v1.ClusterManager.UpdateNodePool", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "UpdateNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.UpdateNodePoolRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "update_node_pool" - }, - "description": "Sample for UpdateNodePool", - "file": "container_v1_generated_cluster_manager_update_node_pool_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_UpdateNodePool_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": "container_v1_generated_cluster_manager_update_node_pool_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1.ClusterManagerClient.update_node_pool", - "method": { - "fullName": "google.container.v1.ClusterManager.UpdateNodePool", - "service": { - "fullName": "google.container.v1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "UpdateNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1.types.UpdateNodePoolRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1.types.Operation", - "shortName": "update_node_pool" - }, - "description": "Sample for UpdateNodePool", - "file": "container_v1_generated_cluster_manager_update_node_pool_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1_generated_ClusterManager_UpdateNodePool_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": "container_v1_generated_cluster_manager_update_node_pool_sync.py" - } - ] -} diff --git a/owl-bot-staging/google-cloud-container/v1/scripts/fixup_container_v1_keywords.py b/owl-bot-staging/google-cloud-container/v1/scripts/fixup_container_v1_keywords.py deleted file mode 100644 index 5ecd6d887b07..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/scripts/fixup_container_v1_keywords.py +++ /dev/null @@ -1,209 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 containerCallTransformer(cst.CSTTransformer): - CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') - METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'cancel_operation': ('project_id', 'zone', 'operation_id', 'name', ), - 'check_autopilot_compatibility': ('name', ), - 'complete_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', ), - 'complete_node_pool_upgrade': ('name', ), - 'create_cluster': ('cluster', 'project_id', 'zone', 'parent', ), - 'create_node_pool': ('node_pool', 'project_id', 'zone', 'cluster_id', 'parent', ), - 'delete_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), - 'delete_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'get_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), - 'get_json_web_keys': ('parent', ), - 'get_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'get_operation': ('project_id', 'zone', 'operation_id', 'name', ), - 'get_server_config': ('project_id', 'zone', 'name', ), - 'list_clusters': ('project_id', 'zone', 'parent', ), - 'list_node_pools': ('project_id', 'zone', 'cluster_id', 'parent', ), - 'list_operations': ('project_id', 'zone', 'parent', ), - 'list_usable_subnetworks': ('parent', 'filter', 'page_size', 'page_token', ), - 'rollback_node_pool_upgrade': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', 'respect_pdb', ), - 'set_addons_config': ('addons_config', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_labels': ('resource_labels', 'label_fingerprint', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_legacy_abac': ('enabled', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_locations': ('locations', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_logging_service': ('logging_service', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_maintenance_policy': ('project_id', 'zone', 'cluster_id', 'maintenance_policy', 'name', ), - 'set_master_auth': ('action', 'update', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_monitoring_service': ('monitoring_service', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_network_policy': ('network_policy', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_node_pool_autoscaling': ('autoscaling', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'set_node_pool_management': ('management', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'set_node_pool_size': ('node_count', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'start_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', 'rotate_credentials', ), - 'update_cluster': ('update', 'project_id', 'zone', 'cluster_id', 'name', ), - 'update_master': ('master_version', 'project_id', 'zone', 'cluster_id', 'name', ), - 'update_node_pool': ('node_version', 'image_type', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', 'locations', 'workload_metadata_config', 'upgrade_settings', 'tags', 'taints', 'labels', 'linux_node_config', 'kubelet_config', 'node_network_config', 'gcfs_config', 'confidential_nodes', 'gvnic', 'etag', 'fast_socket', 'logging_config', 'resource_labels', 'windows_node_config', 'accelerators', 'machine_type', 'disk_type', 'disk_size_gb', 'resource_manager_tags', 'containerd_config', 'queued_provisioning', 'storage_pools', ), - } - - 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=containerCallTransformer(), -): - """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 container 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/google-cloud-container/v1/setup.py b/owl-bot-staging/google-cloud-container/v1/setup.py deleted file mode 100644 index 0085de6f1022..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/setup.py +++ /dev/null @@ -1,98 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 re - -import setuptools # type: ignore - -package_root = os.path.abspath(os.path.dirname(__file__)) - -name = 'google-cloud-container' - - -description = "Google Cloud Container API client library" - -version = None - -with open(os.path.join(package_root, 'google/cloud/container/gapic_version.py')) as fp: - version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read()) - assert (len(version_candidates) == 1) - version = version_candidates[0] - -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.1, <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.*", - # Exclude incompatible versions of `google-auth` - # See https://github.com/googleapis/google-cloud-python/issues/12364 - "google-auth >= 2.14.1, <3.0.0dev,!=2.24.0,!=2.25.0", - "proto-plus >= 1.22.3, <2.0.0dev", - "proto-plus >= 1.25.0, <2.0.0dev; python_version >= '3.13'", - "protobuf>=3.20.2,<6.0.0dev,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", -] -extras = { -} -url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-container" - -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.find_namespace_packages() - if package.startswith("google") -] - -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", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Operating System :: OS Independent", - "Topic :: Internet", - ], - platforms="Posix; MacOS X; Windows", - packages=packages, - python_requires=">=3.7", - install_requires=dependencies, - extras_require=extras, - include_package_data=True, - zip_safe=False, -) diff --git a/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.10.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.10.txt deleted file mode 100644 index ed7f9aed2559..000000000000 --- a/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1/testing/constraints-3.11.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.11.txt deleted file mode 100644 index ed7f9aed2559..000000000000 --- a/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1/testing/constraints-3.12.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.12.txt deleted file mode 100644 index ed7f9aed2559..000000000000 --- a/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1/testing/constraints-3.13.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.13.txt deleted file mode 100644 index ed7f9aed2559..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.13.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/google-cloud-container/v1/testing/constraints-3.7.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.7.txt deleted file mode 100644 index fc812592b0ee..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.7.txt +++ /dev/null @@ -1,10 +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.1 -google-auth==2.14.1 -proto-plus==1.22.3 -protobuf==3.20.2 diff --git a/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.8.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.8.txt deleted file mode 100644 index ed7f9aed2559..000000000000 --- a/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1/testing/constraints-3.9.txt b/owl-bot-staging/google-cloud-container/v1/testing/constraints-3.9.txt deleted file mode 100644 index ed7f9aed2559..000000000000 --- a/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1/tests/__init__.py b/owl-bot-staging/google-cloud-container/v1/tests/__init__.py deleted file mode 100644 index 7b3de3117f38..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/tests/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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/google-cloud-container/v1/tests/unit/__init__.py b/owl-bot-staging/google-cloud-container/v1/tests/unit/__init__.py deleted file mode 100644 index 7b3de3117f38..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/tests/unit/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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/google-cloud-container/v1/tests/unit/gapic/__init__.py b/owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/__init__.py deleted file mode 100644 index 7b3de3117f38..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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/google-cloud-container/v1/tests/unit/gapic/container_v1/__init__.py b/owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/container_v1/__init__.py deleted file mode 100644 index 7b3de3117f38..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/container_v1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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/google-cloud-container/v1/tests/unit/gapic/container_v1/test_cluster_manager.py b/owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/container_v1/test_cluster_manager.py deleted file mode 100644 index cc38169afc33..000000000000 --- a/owl-bot-staging/google-cloud-container/v1/tests/unit/gapic/container_v1/test_cluster_manager.py +++ /dev/null @@ -1,24315 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 -from collections.abc import Iterable, AsyncIterable -from google.protobuf import json_format -import json -import math -import pytest -from google.api_core import api_core_version -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers -from requests import Response -from requests import Request, PreparedRequest -from requests.sessions import Session -from google.protobuf import json_format - -try: - from google.auth.aio import credentials as ga_credentials_async - HAS_GOOGLE_AUTH_AIO = True -except ImportError: # pragma: NO COVER - HAS_GOOGLE_AUTH_AIO = False - -from google.api_core import client_options -from google.api_core import exceptions as core_exceptions -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 path_template -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials -from google.auth.exceptions import MutualTLSChannelError -from google.cloud.container_v1.services.cluster_manager import ClusterManagerAsyncClient -from google.cloud.container_v1.services.cluster_manager import ClusterManagerClient -from google.cloud.container_v1.services.cluster_manager import pagers -from google.cloud.container_v1.services.cluster_manager import transports -from google.cloud.container_v1.types import cluster_service -from google.oauth2 import service_account -from google.protobuf import duration_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from google.protobuf import wrappers_pb2 # type: ignore -from google.rpc import code_pb2 # type: ignore -from google.rpc import status_pb2 # type: ignore -import google.auth - - -async def mock_async_gen(data, chunk_size=1): - for i in range(0, len(data)): # pragma: NO COVER - chunk = data[i : i + chunk_size] - yield chunk.encode("utf-8") - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - -# TODO: use async auth anon credentials by default once the minimum version of google-auth is upgraded. -# See related issue: https://github.com/googleapis/gapic-generator-python/issues/2107. -def async_anonymous_credentials(): - if HAS_GOOGLE_AUTH_AIO: - return ga_credentials_async.AnonymousCredentials() - return ga_credentials.AnonymousCredentials() - -# 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 - -# If default endpoint template is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint template so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint_template(client): - return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE - - -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 ClusterManagerClient._get_default_mtls_endpoint(None) is None - assert ClusterManagerClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - assert ClusterManagerClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint - assert ClusterManagerClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint - assert ClusterManagerClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint - assert ClusterManagerClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - -def test__read_environment_variables(): - assert ClusterManagerClient._read_environment_variables() == (False, "auto", None) - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - assert ClusterManagerClient._read_environment_variables() == (True, "auto", None) - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - assert ClusterManagerClient._read_environment_variables() == (False, "auto", None) - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): - with pytest.raises(ValueError) as excinfo: - ClusterManagerClient._read_environment_variables() - assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - assert ClusterManagerClient._read_environment_variables() == (False, "never", None) - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - assert ClusterManagerClient._read_environment_variables() == (False, "always", None) - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}): - assert ClusterManagerClient._read_environment_variables() == (False, "auto", None) - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError) as excinfo: - ClusterManagerClient._read_environment_variables() - assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - - with mock.patch.dict(os.environ, {"GOOGLE_CLOUD_UNIVERSE_DOMAIN": "foo.com"}): - assert ClusterManagerClient._read_environment_variables() == (False, "auto", "foo.com") - -def test__get_client_cert_source(): - mock_provided_cert_source = mock.Mock() - mock_default_cert_source = mock.Mock() - - assert ClusterManagerClient._get_client_cert_source(None, False) is None - assert ClusterManagerClient._get_client_cert_source(mock_provided_cert_source, False) is None - assert ClusterManagerClient._get_client_cert_source(mock_provided_cert_source, True) == mock_provided_cert_source - - 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_default_cert_source): - assert ClusterManagerClient._get_client_cert_source(None, True) is mock_default_cert_source - assert ClusterManagerClient._get_client_cert_source(mock_provided_cert_source, "true") is mock_provided_cert_source - -@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) -@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) -def test__get_api_endpoint(): - api_override = "foo.com" - mock_client_cert_source = mock.Mock() - default_universe = ClusterManagerClient._DEFAULT_UNIVERSE - default_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=default_universe) - mock_universe = "bar.com" - mock_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=mock_universe) - - assert ClusterManagerClient._get_api_endpoint(api_override, mock_client_cert_source, default_universe, "always") == api_override - assert ClusterManagerClient._get_api_endpoint(None, mock_client_cert_source, default_universe, "auto") == ClusterManagerClient.DEFAULT_MTLS_ENDPOINT - assert ClusterManagerClient._get_api_endpoint(None, None, default_universe, "auto") == default_endpoint - assert ClusterManagerClient._get_api_endpoint(None, None, default_universe, "always") == ClusterManagerClient.DEFAULT_MTLS_ENDPOINT - assert ClusterManagerClient._get_api_endpoint(None, mock_client_cert_source, default_universe, "always") == ClusterManagerClient.DEFAULT_MTLS_ENDPOINT - assert ClusterManagerClient._get_api_endpoint(None, None, mock_universe, "never") == mock_endpoint - assert ClusterManagerClient._get_api_endpoint(None, None, default_universe, "never") == default_endpoint - - with pytest.raises(MutualTLSChannelError) as excinfo: - ClusterManagerClient._get_api_endpoint(None, mock_client_cert_source, mock_universe, "auto") - assert str(excinfo.value) == "mTLS is not supported in any universe other than googleapis.com." - - -def test__get_universe_domain(): - client_universe_domain = "foo.com" - universe_domain_env = "bar.com" - - assert ClusterManagerClient._get_universe_domain(client_universe_domain, universe_domain_env) == client_universe_domain - assert ClusterManagerClient._get_universe_domain(None, universe_domain_env) == universe_domain_env - assert ClusterManagerClient._get_universe_domain(None, None) == ClusterManagerClient._DEFAULT_UNIVERSE - - with pytest.raises(ValueError) as excinfo: - ClusterManagerClient._get_universe_domain("", None) - assert str(excinfo.value) == "Universe Domain cannot be an empty string." - - -@pytest.mark.parametrize("client_class,transport_name", [ - (ClusterManagerClient, "grpc"), - (ClusterManagerAsyncClient, "grpc_asyncio"), - (ClusterManagerClient, "rest"), -]) -def test_cluster_manager_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 == ( - 'container.googleapis.com:443' - if transport_name in ['grpc', 'grpc_asyncio'] - else - 'https://container.googleapis.com' - ) - - -@pytest.mark.parametrize("transport_class,transport_name", [ - (transports.ClusterManagerGrpcTransport, "grpc"), - (transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio"), - (transports.ClusterManagerRestTransport, "rest"), -]) -def test_cluster_manager_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", [ - (ClusterManagerClient, "grpc"), - (ClusterManagerAsyncClient, "grpc_asyncio"), - (ClusterManagerClient, "rest"), -]) -def test_cluster_manager_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 == ( - 'container.googleapis.com:443' - if transport_name in ['grpc', 'grpc_asyncio'] - else - 'https://container.googleapis.com' - ) - - -def test_cluster_manager_client_get_transport_class(): - transport = ClusterManagerClient.get_transport_class() - available_transports = [ - transports.ClusterManagerGrpcTransport, - transports.ClusterManagerRestTransport, - ] - assert transport in available_transports - - transport = ClusterManagerClient.get_transport_class("grpc") - assert transport == transports.ClusterManagerGrpcTransport - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc"), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio"), - (ClusterManagerClient, transports.ClusterManagerRestTransport, "rest"), -]) -@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) -@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) -def test_cluster_manager_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(ClusterManagerClient, '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(ClusterManagerClient, '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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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) as excinfo: - client = client_class(transport=transport_name) - assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - - # 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) as excinfo: - client = client_class(transport=transport_name) - assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - - # 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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", [ - (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", "true"), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", "true"), - (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", "false"), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", "false"), - (ClusterManagerClient, transports.ClusterManagerRestTransport, "rest", "true"), - (ClusterManagerClient, transports.ClusterManagerRestTransport, "rest", "false"), -]) -@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) -@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE) - 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE) - 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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", [ - ClusterManagerClient, ClusterManagerAsyncClient -]) -@mock.patch.object(ClusterManagerClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ClusterManagerClient)) -@mock.patch.object(ClusterManagerAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ClusterManagerAsyncClient)) -def test_cluster_manager_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 - - # 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) as excinfo: - client_class.get_mtls_endpoint_and_cert_source() - - assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - - # 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) as excinfo: - client_class.get_mtls_endpoint_and_cert_source() - - assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - -@pytest.mark.parametrize("client_class", [ - ClusterManagerClient, ClusterManagerAsyncClient -]) -@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) -@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) -def test_cluster_manager_client_client_api_endpoint(client_class): - mock_client_cert_source = client_cert_source_callback - api_override = "foo.com" - default_universe = ClusterManagerClient._DEFAULT_UNIVERSE - default_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=default_universe) - mock_universe = "bar.com" - mock_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=mock_universe) - - # If ClientOptions.api_endpoint is set and GOOGLE_API_USE_CLIENT_CERTIFICATE="true", - # use ClientOptions.api_endpoint as the api endpoint regardless. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch("google.auth.transport.requests.AuthorizedSession.configure_mtls_channel"): - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=api_override) - client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) - assert client.api_endpoint == api_override - - # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", - # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=ga_credentials.AnonymousCredentials()) - assert client.api_endpoint == default_endpoint - - # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", - # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=ga_credentials.AnonymousCredentials()) - assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - - # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), - # GOOGLE_API_USE_CLIENT_CERTIFICATE="false" (default), default cert source doesn't exist, - # and ClientOptions.universe_domain="bar.com", - # use the _DEFAULT_ENDPOINT_TEMPLATE populated with universe domain as the api endpoint. - options = client_options.ClientOptions() - universe_exists = hasattr(options, "universe_domain") - if universe_exists: - options = client_options.ClientOptions(universe_domain=mock_universe) - client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) - else: - client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) - assert client.api_endpoint == (mock_endpoint if universe_exists else default_endpoint) - assert client.universe_domain == (mock_universe if universe_exists else default_universe) - - # If ClientOptions does not have a universe domain attribute and GOOGLE_API_USE_MTLS_ENDPOINT="never", - # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. - options = client_options.ClientOptions() - if hasattr(options, "universe_domain"): - delattr(options, "universe_domain") - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) - assert client.api_endpoint == default_endpoint - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc"), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio"), - (ClusterManagerClient, transports.ClusterManagerRestTransport, "rest"), -]) -def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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", [ - (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", grpc_helpers), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), - (ClusterManagerClient, transports.ClusterManagerRestTransport, "rest", None), -]) -def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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_cluster_manager_client_client_options_from_dict(): - with mock.patch('google.cloud.container_v1.services.cluster_manager.transports.ClusterManagerGrpcTransport.__init__') as grpc_transport: - grpc_transport.return_value = None - client = ClusterManagerClient( - 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", [ - (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", grpc_helpers), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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( - "container.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="container.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.ListClustersRequest, - dict, -]) -def test_list_clusters(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_clusters), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListClustersResponse( - missing_zones=['missing_zones_value'], - ) - response = client.list_clusters(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.ListClustersRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListClustersResponse) - assert response.missing_zones == ['missing_zones_value'] - - -def test_list_clusters_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.ListClustersRequest( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.list_clusters(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListClustersRequest( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - -def test_list_clusters_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.list_clusters in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.list_clusters] = mock_rpc - request = {} - client.list_clusters(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.list_clusters(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_clusters_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.list_clusters in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.list_clusters] = mock_rpc - - request = {} - await client.list_clusters(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.list_clusters(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_clusters_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListClustersRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_clusters), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse( - missing_zones=['missing_zones_value'], - )) - response = await client.list_clusters(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.ListClustersRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListClustersResponse) - assert response.missing_zones == ['missing_zones_value'] - - -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - -def test_list_clusters_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListClustersRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - call.return_value = cluster_service.ListClustersResponse() - client.list_clusters(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_clusters_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListClustersRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse()) - await client.list_clusters(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_clusters_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListClustersResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_clusters( - project_id='project_id_value', - zone='zone_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_clusters_flattened_error(): - client = ClusterManagerClient( - 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_clusters( - cluster_service.ListClustersRequest(), - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_clusters_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListClustersResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_clusters( - project_id='project_id_value', - zone='zone_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_clusters_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_clusters( - cluster_service.ListClustersRequest(), - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetClusterRequest, - dict, -]) -def test_get_cluster(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Cluster( - name='name_value', - description='description_value', - initial_node_count=1911, - logging_service='logging_service_value', - monitoring_service='monitoring_service_value', - network='network_value', - cluster_ipv4_cidr='cluster_ipv4_cidr_value', - subnetwork='subnetwork_value', - locations=['locations_value'], - enable_kubernetes_alpha=True, - label_fingerprint='label_fingerprint_value', - self_link='self_link_value', - zone='zone_value', - endpoint='endpoint_value', - initial_cluster_version='initial_cluster_version_value', - current_master_version='current_master_version_value', - current_node_version='current_node_version_value', - create_time='create_time_value', - status=cluster_service.Cluster.Status.PROVISIONING, - status_message='status_message_value', - node_ipv4_cidr_size=1955, - services_ipv4_cidr='services_ipv4_cidr_value', - instance_group_urls=['instance_group_urls_value'], - current_node_count=1936, - expire_time='expire_time_value', - location='location_value', - enable_tpu=True, - tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', - id='id_value', - etag='etag_value', - satisfies_pzs=True, - satisfies_pzi=True, - ) - response = client.get_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.GetClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Cluster) - assert response.name == 'name_value' - assert response.description == 'description_value' - assert response.initial_node_count == 1911 - assert response.logging_service == 'logging_service_value' - assert response.monitoring_service == 'monitoring_service_value' - assert response.network == 'network_value' - assert response.cluster_ipv4_cidr == 'cluster_ipv4_cidr_value' - assert response.subnetwork == 'subnetwork_value' - assert response.locations == ['locations_value'] - assert response.enable_kubernetes_alpha is True - assert response.label_fingerprint == 'label_fingerprint_value' - assert response.self_link == 'self_link_value' - assert response.zone == 'zone_value' - assert response.endpoint == 'endpoint_value' - assert response.initial_cluster_version == 'initial_cluster_version_value' - assert response.current_master_version == 'current_master_version_value' - assert response.current_node_version == 'current_node_version_value' - assert response.create_time == 'create_time_value' - assert response.status == cluster_service.Cluster.Status.PROVISIONING - assert response.status_message == 'status_message_value' - assert response.node_ipv4_cidr_size == 1955 - assert response.services_ipv4_cidr == 'services_ipv4_cidr_value' - assert response.instance_group_urls == ['instance_group_urls_value'] - assert response.current_node_count == 1936 - assert response.expire_time == 'expire_time_value' - assert response.location == 'location_value' - assert response.enable_tpu is True - assert response.tpu_ipv4_cidr_block == 'tpu_ipv4_cidr_block_value' - assert response.id == 'id_value' - assert response.etag == 'etag_value' - assert response.satisfies_pzs is True - assert response.satisfies_pzi is True - - -def test_get_cluster_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.GetClusterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.get_cluster(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetClusterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_get_cluster_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_cluster in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_cluster] = mock_rpc - request = {} - client.get_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.get_cluster in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.get_cluster] = mock_rpc - - request = {} - await client.get_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.get_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetClusterRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster( - name='name_value', - description='description_value', - initial_node_count=1911, - logging_service='logging_service_value', - monitoring_service='monitoring_service_value', - network='network_value', - cluster_ipv4_cidr='cluster_ipv4_cidr_value', - subnetwork='subnetwork_value', - locations=['locations_value'], - enable_kubernetes_alpha=True, - label_fingerprint='label_fingerprint_value', - self_link='self_link_value', - zone='zone_value', - endpoint='endpoint_value', - initial_cluster_version='initial_cluster_version_value', - current_master_version='current_master_version_value', - current_node_version='current_node_version_value', - create_time='create_time_value', - status=cluster_service.Cluster.Status.PROVISIONING, - status_message='status_message_value', - node_ipv4_cidr_size=1955, - services_ipv4_cidr='services_ipv4_cidr_value', - instance_group_urls=['instance_group_urls_value'], - current_node_count=1936, - expire_time='expire_time_value', - location='location_value', - enable_tpu=True, - tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', - id='id_value', - etag='etag_value', - satisfies_pzs=True, - satisfies_pzi=True, - )) - response = await client.get_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.GetClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Cluster) - assert response.name == 'name_value' - assert response.description == 'description_value' - assert response.initial_node_count == 1911 - assert response.logging_service == 'logging_service_value' - assert response.monitoring_service == 'monitoring_service_value' - assert response.network == 'network_value' - assert response.cluster_ipv4_cidr == 'cluster_ipv4_cidr_value' - assert response.subnetwork == 'subnetwork_value' - assert response.locations == ['locations_value'] - assert response.enable_kubernetes_alpha is True - assert response.label_fingerprint == 'label_fingerprint_value' - assert response.self_link == 'self_link_value' - assert response.zone == 'zone_value' - assert response.endpoint == 'endpoint_value' - assert response.initial_cluster_version == 'initial_cluster_version_value' - assert response.current_master_version == 'current_master_version_value' - assert response.current_node_version == 'current_node_version_value' - assert response.create_time == 'create_time_value' - assert response.status == cluster_service.Cluster.Status.PROVISIONING - assert response.status_message == 'status_message_value' - assert response.node_ipv4_cidr_size == 1955 - assert response.services_ipv4_cidr == 'services_ipv4_cidr_value' - assert response.instance_group_urls == ['instance_group_urls_value'] - assert response.current_node_count == 1936 - assert response.expire_time == 'expire_time_value' - assert response.location == 'location_value' - assert response.enable_tpu is True - assert response.tpu_ipv4_cidr_block == 'tpu_ipv4_cidr_block_value' - assert response.id == 'id_value' - assert response.etag == 'etag_value' - assert response.satisfies_pzs is True - assert response.satisfies_pzi is True - - -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - -def test_get_cluster_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetClusterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - call.return_value = cluster_service.Cluster() - client.get_cluster(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_cluster_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetClusterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster()) - await client.get_cluster(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_cluster_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Cluster() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_cluster( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_cluster_flattened_error(): - client = ClusterManagerClient( - 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_cluster( - cluster_service.GetClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_cluster_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Cluster() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_cluster( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_cluster( - cluster_service.GetClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CreateClusterRequest, - dict, -]) -def test_create_cluster(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.create_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.CreateClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_create_cluster_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.CreateClusterRequest( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.create_cluster(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateClusterRequest( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - -def test_create_cluster_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.create_cluster in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.create_cluster] = mock_rpc - request = {} - client.create_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.create_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_create_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.create_cluster in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.create_cluster] = mock_rpc - - request = {} - await client.create_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.create_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_create_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CreateClusterRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.create_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.CreateClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - -def test_create_cluster_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CreateClusterRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.create_cluster(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_cluster_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CreateClusterRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.create_cluster(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_cluster_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.create_cluster( - project_id='project_id_value', - zone='zone_value', - cluster=cluster_service.Cluster(name='name_value'), - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster - mock_val = cluster_service.Cluster(name='name_value') - assert arg == mock_val - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_create_cluster_flattened_error(): - client = ClusterManagerClient( - 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_cluster( - cluster_service.CreateClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster=cluster_service.Cluster(name='name_value'), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_create_cluster_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_cluster( - project_id='project_id_value', - zone='zone_value', - cluster=cluster_service.Cluster(name='name_value'), - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster - mock_val = cluster_service.Cluster(name='name_value') - assert arg == mock_val - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_cluster( - cluster_service.CreateClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster=cluster_service.Cluster(name='name_value'), - parent='parent_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.UpdateClusterRequest, - dict, -]) -def test_update_cluster(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.update_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.UpdateClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_update_cluster_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.UpdateClusterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.update_cluster(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateClusterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_update_cluster_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.update_cluster in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.update_cluster] = mock_rpc - request = {} - client.update_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.update_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_update_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.update_cluster in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.update_cluster] = mock_rpc - - request = {} - await client.update_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.update_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_update_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.UpdateClusterRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.update_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.UpdateClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - -def test_update_cluster_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.UpdateClusterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.update_cluster(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_update_cluster_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.UpdateClusterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.update_cluster(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_update_cluster_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.update_cluster( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].update - mock_val = cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value') - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_update_cluster_flattened_error(): - client = ClusterManagerClient( - 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_cluster( - cluster_service.UpdateClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_update_cluster_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_cluster( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].update - mock_val = cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value') - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_cluster( - cluster_service.UpdateClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.UpdateNodePoolRequest, - dict, -]) -def test_update_node_pool(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.update_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.UpdateNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_update_node_pool_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.UpdateNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - node_version='node_version_value', - image_type='image_type_value', - name='name_value', - etag='etag_value', - machine_type='machine_type_value', - disk_type='disk_type_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_node_pool), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.update_node_pool(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - node_version='node_version_value', - image_type='image_type_value', - name='name_value', - etag='etag_value', - machine_type='machine_type_value', - disk_type='disk_type_value', - ) - -def test_update_node_pool_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.update_node_pool in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.update_node_pool] = mock_rpc - request = {} - client.update_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.update_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_update_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.update_node_pool in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.update_node_pool] = mock_rpc - - request = {} - await client.update_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.update_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_update_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.UpdateNodePoolRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.update_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.UpdateNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_update_node_pool_async_from_dict(): - await test_update_node_pool_async(request_type=dict) - -def test_update_node_pool_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.UpdateNodePoolRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_node_pool), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.update_node_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_update_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.UpdateNodePoolRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_node_pool), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.update_node_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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetNodePoolAutoscalingRequest, - dict, -]) -def test_set_node_pool_autoscaling(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_node_pool_autoscaling), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_node_pool_autoscaling(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNodePoolAutoscalingRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_node_pool_autoscaling_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetNodePoolAutoscalingRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_autoscaling), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_node_pool_autoscaling(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolAutoscalingRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -def test_set_node_pool_autoscaling_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_node_pool_autoscaling in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_node_pool_autoscaling] = mock_rpc - request = {} - client.set_node_pool_autoscaling(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_node_pool_autoscaling(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_node_pool_autoscaling_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_node_pool_autoscaling in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_node_pool_autoscaling] = mock_rpc - - request = {} - await client.set_node_pool_autoscaling(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_node_pool_autoscaling(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_node_pool_autoscaling_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNodePoolAutoscalingRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_node_pool_autoscaling), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_node_pool_autoscaling(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNodePoolAutoscalingRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_node_pool_autoscaling_async_from_dict(): - await test_set_node_pool_autoscaling_async(request_type=dict) - -def test_set_node_pool_autoscaling_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNodePoolAutoscalingRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_autoscaling), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_node_pool_autoscaling(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_set_node_pool_autoscaling_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNodePoolAutoscalingRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_autoscaling), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_node_pool_autoscaling(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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetLoggingServiceRequest, - dict, -]) -def test_set_logging_service(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_logging_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_logging_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLoggingServiceRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_logging_service_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetLoggingServiceRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_logging_service(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLoggingServiceRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_value', - name='name_value', - ) - -def test_set_logging_service_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_logging_service in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_logging_service] = mock_rpc - request = {} - client.set_logging_service(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_logging_service(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_logging_service_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_logging_service in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_logging_service] = mock_rpc - - request = {} - await client.set_logging_service(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_logging_service(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_logging_service_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLoggingServiceRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_logging_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_logging_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLoggingServiceRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_logging_service_async_from_dict(): - await test_set_logging_service_async(request_type=dict) - -def test_set_logging_service_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLoggingServiceRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_logging_service(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_set_logging_service_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLoggingServiceRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_logging_service(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_set_logging_service_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_logging_service( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].logging_service - mock_val = 'logging_service_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_set_logging_service_flattened_error(): - client = ClusterManagerClient( - 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.set_logging_service( - cluster_service.SetLoggingServiceRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_value', - name='name_value', - ) - -@pytest.mark.asyncio -async def test_set_logging_service_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_logging_service( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].logging_service - mock_val = 'logging_service_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_logging_service_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_logging_service( - cluster_service.SetLoggingServiceRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_value', - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetMonitoringServiceRequest, - dict, -]) -def test_set_monitoring_service(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_monitoring_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_monitoring_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetMonitoringServiceRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_monitoring_service_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetMonitoringServiceRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_monitoring_service(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMonitoringServiceRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_value', - name='name_value', - ) - -def test_set_monitoring_service_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_monitoring_service in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_monitoring_service] = mock_rpc - request = {} - client.set_monitoring_service(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_monitoring_service(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_monitoring_service_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_monitoring_service in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_monitoring_service] = mock_rpc - - request = {} - await client.set_monitoring_service(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_monitoring_service(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_monitoring_service_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetMonitoringServiceRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_monitoring_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_monitoring_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetMonitoringServiceRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_monitoring_service_async_from_dict(): - await test_set_monitoring_service_async(request_type=dict) - -def test_set_monitoring_service_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetMonitoringServiceRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_monitoring_service(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_set_monitoring_service_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetMonitoringServiceRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_monitoring_service(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_set_monitoring_service_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_monitoring_service( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].monitoring_service - mock_val = 'monitoring_service_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_set_monitoring_service_flattened_error(): - client = ClusterManagerClient( - 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.set_monitoring_service( - cluster_service.SetMonitoringServiceRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_value', - name='name_value', - ) - -@pytest.mark.asyncio -async def test_set_monitoring_service_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_monitoring_service( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].monitoring_service - mock_val = 'monitoring_service_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_monitoring_service_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_monitoring_service( - cluster_service.SetMonitoringServiceRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_value', - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetAddonsConfigRequest, - dict, -]) -def test_set_addons_config(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_addons_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_addons_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetAddonsConfigRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_addons_config_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetAddonsConfigRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_addons_config(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetAddonsConfigRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_set_addons_config_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_addons_config in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_addons_config] = mock_rpc - request = {} - client.set_addons_config(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_addons_config(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_addons_config_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_addons_config in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_addons_config] = mock_rpc - - request = {} - await client.set_addons_config(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_addons_config(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_addons_config_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetAddonsConfigRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_addons_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_addons_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetAddonsConfigRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_addons_config_async_from_dict(): - await test_set_addons_config_async(request_type=dict) - -def test_set_addons_config_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetAddonsConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_addons_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_set_addons_config_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetAddonsConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_addons_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_set_addons_config_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_addons_config( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].addons_config - mock_val = cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)) - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_set_addons_config_flattened_error(): - client = ClusterManagerClient( - 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.set_addons_config( - cluster_service.SetAddonsConfigRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_set_addons_config_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_addons_config( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].addons_config - mock_val = cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)) - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_addons_config_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_addons_config( - cluster_service.SetAddonsConfigRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetLocationsRequest, - dict, -]) -def test_set_locations(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_locations(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLocationsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_locations_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetLocationsRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_locations(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLocationsRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_set_locations_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_locations in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_locations] = mock_rpc - request = {} - client.set_locations(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_locations(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_locations_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_locations in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_locations] = mock_rpc - - request = {} - await client.set_locations(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_locations(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_locations_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLocationsRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_locations(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLocationsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_locations_async_from_dict(): - await test_set_locations_async(request_type=dict) - -def test_set_locations_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLocationsRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_locations(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_set_locations_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLocationsRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_locations(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_set_locations_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_locations( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - locations=['locations_value'], - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].locations - mock_val = ['locations_value'] - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_set_locations_flattened_error(): - client = ClusterManagerClient( - 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.set_locations( - cluster_service.SetLocationsRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - locations=['locations_value'], - name='name_value', - ) - -@pytest.mark.asyncio -async def test_set_locations_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_locations( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - locations=['locations_value'], - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].locations - mock_val = ['locations_value'] - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_locations_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_locations( - cluster_service.SetLocationsRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - locations=['locations_value'], - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.UpdateMasterRequest, - dict, -]) -def test_update_master(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_master), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.update_master(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.UpdateMasterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_update_master_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.UpdateMasterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.update_master(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateMasterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_value', - name='name_value', - ) - -def test_update_master_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.update_master in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.update_master] = mock_rpc - request = {} - client.update_master(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.update_master(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_update_master_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.update_master in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.update_master] = mock_rpc - - request = {} - await client.update_master(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.update_master(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_update_master_async(transport: str = 'grpc_asyncio', request_type=cluster_service.UpdateMasterRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_master), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.update_master(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.UpdateMasterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_update_master_async_from_dict(): - await test_update_master_async(request_type=dict) - -def test_update_master_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.UpdateMasterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.update_master(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_update_master_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.UpdateMasterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.update_master(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_update_master_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.update_master( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].master_version - mock_val = 'master_version_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_update_master_flattened_error(): - client = ClusterManagerClient( - 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_master( - cluster_service.UpdateMasterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_value', - name='name_value', - ) - -@pytest.mark.asyncio -async def test_update_master_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_master( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].master_version - mock_val = 'master_version_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_master_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_master( - cluster_service.UpdateMasterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_value', - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetMasterAuthRequest, - dict, -]) -def test_set_master_auth(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_master_auth), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_master_auth(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetMasterAuthRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_master_auth_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetMasterAuthRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_master_auth), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_master_auth(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMasterAuthRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_set_master_auth_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_master_auth in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_master_auth] = mock_rpc - request = {} - client.set_master_auth(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_master_auth(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_master_auth_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_master_auth in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_master_auth] = mock_rpc - - request = {} - await client.set_master_auth(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_master_auth(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_master_auth_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetMasterAuthRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_master_auth), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_master_auth(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetMasterAuthRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_master_auth_async_from_dict(): - await test_set_master_auth_async(request_type=dict) - -def test_set_master_auth_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetMasterAuthRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_master_auth), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_master_auth(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_set_master_auth_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetMasterAuthRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_master_auth), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_master_auth(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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.DeleteClusterRequest, - dict, -]) -def test_delete_cluster(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.delete_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.DeleteClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_delete_cluster_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.DeleteClusterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.delete_cluster(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteClusterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_delete_cluster_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.delete_cluster in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.delete_cluster] = mock_rpc - request = {} - client.delete_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.delete_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_delete_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.delete_cluster in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.delete_cluster] = mock_rpc - - request = {} - await client.delete_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.delete_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_delete_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.DeleteClusterRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.delete_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.DeleteClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - -def test_delete_cluster_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.DeleteClusterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.delete_cluster(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_cluster_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.DeleteClusterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.delete_cluster(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_cluster_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_cluster( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_cluster_flattened_error(): - client = ClusterManagerClient( - 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_cluster( - cluster_service.DeleteClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -@pytest.mark.asyncio -async def test_delete_cluster_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_cluster( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_cluster( - cluster_service.DeleteClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.ListOperationsRequest, - dict, -]) -def test_list_operations(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_operations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListOperationsResponse( - missing_zones=['missing_zones_value'], - ) - response = client.list_operations(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.ListOperationsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListOperationsResponse) - assert response.missing_zones == ['missing_zones_value'] - - -def test_list_operations_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.ListOperationsRequest( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.list_operations(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListOperationsRequest( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - -def test_list_operations_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.list_operations in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.list_operations] = mock_rpc - request = {} - client.list_operations(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.list_operations(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_operations_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.list_operations in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.list_operations] = mock_rpc - - request = {} - await client.list_operations(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.list_operations(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_operations_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListOperationsRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_operations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse( - missing_zones=['missing_zones_value'], - )) - response = await client.list_operations(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.ListOperationsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListOperationsResponse) - assert response.missing_zones == ['missing_zones_value'] - - -@pytest.mark.asyncio -async def test_list_operations_async_from_dict(): - await test_list_operations_async(request_type=dict) - -def test_list_operations_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListOperationsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - call.return_value = cluster_service.ListOperationsResponse() - client.list_operations(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_operations_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListOperationsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse()) - await client.list_operations(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_operations_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListOperationsResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_operations( - project_id='project_id_value', - zone='zone_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_operations_flattened_error(): - client = ClusterManagerClient( - 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_operations( - cluster_service.ListOperationsRequest(), - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_operations_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListOperationsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_operations( - project_id='project_id_value', - zone='zone_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_operations_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_operations( - cluster_service.ListOperationsRequest(), - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetOperationRequest, - dict, -]) -def test_get_operation(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.get_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.GetOperationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_get_operation_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.GetOperationRequest( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.get_operation(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetOperationRequest( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - -def test_get_operation_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_operation in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_operation] = mock_rpc - request = {} - client.get_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_operation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_operation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.get_operation in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.get_operation] = mock_rpc - - request = {} - await client.get_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.get_operation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_operation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetOperationRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.get_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.GetOperationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_get_operation_async_from_dict(): - await test_get_operation_async(request_type=dict) - -def test_get_operation_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetOperationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.get_operation(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_operation_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetOperationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.get_operation(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_operation_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_operation( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].operation_id - mock_val = 'operation_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_operation_flattened_error(): - client = ClusterManagerClient( - 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_operation( - cluster_service.GetOperationRequest(), - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_operation_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_operation( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].operation_id - mock_val = 'operation_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_operation_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_operation( - cluster_service.GetOperationRequest(), - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CancelOperationRequest, - dict, -]) -def test_cancel_operation(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.cancel_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.cancel_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.CancelOperationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None - - -def test_cancel_operation_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.CancelOperationRequest( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.cancel_operation(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CancelOperationRequest( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - -def test_cancel_operation_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.cancel_operation in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.cancel_operation] = mock_rpc - request = {} - client.cancel_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.cancel_operation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_cancel_operation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.cancel_operation in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.cancel_operation] = mock_rpc - - request = {} - await client.cancel_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.cancel_operation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_cancel_operation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CancelOperationRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.cancel_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.cancel_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.CancelOperationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.asyncio -async def test_cancel_operation_async_from_dict(): - await test_cancel_operation_async(request_type=dict) - -def test_cancel_operation_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CancelOperationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - call.return_value = None - client.cancel_operation(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_cancel_operation_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CancelOperationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.cancel_operation(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_cancel_operation_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.cancel_operation( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].operation_id - mock_val = 'operation_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_cancel_operation_flattened_error(): - client = ClusterManagerClient( - 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.cancel_operation( - cluster_service.CancelOperationRequest(), - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - -@pytest.mark.asyncio -async def test_cancel_operation_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.cancel_operation( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].operation_id - mock_val = 'operation_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_cancel_operation_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.cancel_operation( - cluster_service.CancelOperationRequest(), - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetServerConfigRequest, - dict, -]) -def test_get_server_config(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_server_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ServerConfig( - default_cluster_version='default_cluster_version_value', - valid_node_versions=['valid_node_versions_value'], - default_image_type='default_image_type_value', - valid_image_types=['valid_image_types_value'], - valid_master_versions=['valid_master_versions_value'], - ) - response = client.get_server_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.GetServerConfigRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ServerConfig) - assert response.default_cluster_version == 'default_cluster_version_value' - assert response.valid_node_versions == ['valid_node_versions_value'] - assert response.default_image_type == 'default_image_type_value' - assert response.valid_image_types == ['valid_image_types_value'] - assert response.valid_master_versions == ['valid_master_versions_value'] - - -def test_get_server_config_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.GetServerConfigRequest( - project_id='project_id_value', - zone='zone_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.get_server_config(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetServerConfigRequest( - project_id='project_id_value', - zone='zone_value', - name='name_value', - ) - -def test_get_server_config_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_server_config in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_server_config] = mock_rpc - request = {} - client.get_server_config(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_server_config(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_server_config_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.get_server_config in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.get_server_config] = mock_rpc - - request = {} - await client.get_server_config(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.get_server_config(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_server_config_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetServerConfigRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_server_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig( - default_cluster_version='default_cluster_version_value', - valid_node_versions=['valid_node_versions_value'], - default_image_type='default_image_type_value', - valid_image_types=['valid_image_types_value'], - valid_master_versions=['valid_master_versions_value'], - )) - response = await client.get_server_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.GetServerConfigRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ServerConfig) - assert response.default_cluster_version == 'default_cluster_version_value' - assert response.valid_node_versions == ['valid_node_versions_value'] - assert response.default_image_type == 'default_image_type_value' - assert response.valid_image_types == ['valid_image_types_value'] - assert response.valid_master_versions == ['valid_master_versions_value'] - - -@pytest.mark.asyncio -async def test_get_server_config_async_from_dict(): - await test_get_server_config_async(request_type=dict) - -def test_get_server_config_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetServerConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - call.return_value = cluster_service.ServerConfig() - client.get_server_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_server_config_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetServerConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig()) - await client.get_server_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_server_config_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ServerConfig() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_server_config( - project_id='project_id_value', - zone='zone_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_server_config_flattened_error(): - client = ClusterManagerClient( - 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_server_config( - cluster_service.GetServerConfigRequest(), - project_id='project_id_value', - zone='zone_value', - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_server_config_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ServerConfig() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_server_config( - project_id='project_id_value', - zone='zone_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_server_config_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_server_config( - cluster_service.GetServerConfigRequest(), - project_id='project_id_value', - zone='zone_value', - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetJSONWebKeysRequest, - dict, -]) -def test_get_json_web_keys(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_json_web_keys), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.GetJSONWebKeysResponse( - ) - response = client.get_json_web_keys(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.GetJSONWebKeysRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.GetJSONWebKeysResponse) - - -def test_get_json_web_keys_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.GetJSONWebKeysRequest( - parent='parent_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_json_web_keys), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.get_json_web_keys(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetJSONWebKeysRequest( - parent='parent_value', - ) - -def test_get_json_web_keys_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_json_web_keys in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_json_web_keys] = mock_rpc - request = {} - client.get_json_web_keys(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_json_web_keys(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_json_web_keys_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.get_json_web_keys in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.get_json_web_keys] = mock_rpc - - request = {} - await client.get_json_web_keys(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.get_json_web_keys(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_json_web_keys_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetJSONWebKeysRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_json_web_keys), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.GetJSONWebKeysResponse( - )) - response = await client.get_json_web_keys(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.GetJSONWebKeysRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.GetJSONWebKeysResponse) - - -@pytest.mark.asyncio -async def test_get_json_web_keys_async_from_dict(): - await test_get_json_web_keys_async(request_type=dict) - -def test_get_json_web_keys_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetJSONWebKeysRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_json_web_keys), - '__call__') as call: - call.return_value = cluster_service.GetJSONWebKeysResponse() - client.get_json_web_keys(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_get_json_web_keys_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetJSONWebKeysRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_json_web_keys), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.GetJSONWebKeysResponse()) - await client.get_json_web_keys(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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.ListNodePoolsRequest, - dict, -]) -def test_list_node_pools(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_node_pools), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListNodePoolsResponse( - ) - response = client.list_node_pools(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.ListNodePoolsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListNodePoolsResponse) - - -def test_list_node_pools_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.ListNodePoolsRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - parent='parent_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.list_node_pools(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListNodePoolsRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - parent='parent_value', - ) - -def test_list_node_pools_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.list_node_pools in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.list_node_pools] = mock_rpc - request = {} - client.list_node_pools(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.list_node_pools(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_node_pools_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.list_node_pools in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.list_node_pools] = mock_rpc - - request = {} - await client.list_node_pools(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.list_node_pools(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_node_pools_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListNodePoolsRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_node_pools), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse( - )) - response = await client.list_node_pools(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.ListNodePoolsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListNodePoolsResponse) - - -@pytest.mark.asyncio -async def test_list_node_pools_async_from_dict(): - await test_list_node_pools_async(request_type=dict) - -def test_list_node_pools_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListNodePoolsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - call.return_value = cluster_service.ListNodePoolsResponse() - client.list_node_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_node_pools_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListNodePoolsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse()) - await client.list_node_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_node_pools_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListNodePoolsResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_node_pools( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_node_pools_flattened_error(): - client = ClusterManagerClient( - 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_node_pools( - cluster_service.ListNodePoolsRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_node_pools_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListNodePoolsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_node_pools( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_node_pools_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_node_pools( - cluster_service.ListNodePoolsRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - parent='parent_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetNodePoolRequest, - dict, -]) -def test_get_node_pool(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.NodePool( - name='name_value', - initial_node_count=1911, - locations=['locations_value'], - self_link='self_link_value', - version='version_value', - instance_group_urls=['instance_group_urls_value'], - status=cluster_service.NodePool.Status.PROVISIONING, - status_message='status_message_value', - pod_ipv4_cidr_size=1856, - etag='etag_value', - ) - response = client.get_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.GetNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.NodePool) - assert response.name == 'name_value' - assert response.initial_node_count == 1911 - assert response.locations == ['locations_value'] - assert response.self_link == 'self_link_value' - assert response.version == 'version_value' - assert response.instance_group_urls == ['instance_group_urls_value'] - assert response.status == cluster_service.NodePool.Status.PROVISIONING - assert response.status_message == 'status_message_value' - assert response.pod_ipv4_cidr_size == 1856 - assert response.etag == 'etag_value' - - -def test_get_node_pool_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.GetNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.get_node_pool(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -def test_get_node_pool_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_node_pool in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_node_pool] = mock_rpc - request = {} - client.get_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.get_node_pool in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.get_node_pool] = mock_rpc - - request = {} - await client.get_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.get_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetNodePoolRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool( - name='name_value', - initial_node_count=1911, - locations=['locations_value'], - self_link='self_link_value', - version='version_value', - instance_group_urls=['instance_group_urls_value'], - status=cluster_service.NodePool.Status.PROVISIONING, - status_message='status_message_value', - pod_ipv4_cidr_size=1856, - etag='etag_value', - )) - response = await client.get_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.GetNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.NodePool) - assert response.name == 'name_value' - assert response.initial_node_count == 1911 - assert response.locations == ['locations_value'] - assert response.self_link == 'self_link_value' - assert response.version == 'version_value' - assert response.instance_group_urls == ['instance_group_urls_value'] - assert response.status == cluster_service.NodePool.Status.PROVISIONING - assert response.status_message == 'status_message_value' - assert response.pod_ipv4_cidr_size == 1856 - assert response.etag == 'etag_value' - - -@pytest.mark.asyncio -async def test_get_node_pool_async_from_dict(): - await test_get_node_pool_async(request_type=dict) - -def test_get_node_pool_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetNodePoolRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - call.return_value = cluster_service.NodePool() - client.get_node_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_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetNodePoolRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool()) - await client.get_node_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_node_pool_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.NodePool() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_node_pool( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_node_pool_flattened_error(): - client = ClusterManagerClient( - 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_node_pool( - cluster_service.GetNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_node_pool_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.NodePool() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_node_pool( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_node_pool_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_node_pool( - cluster_service.GetNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CreateNodePoolRequest, - dict, -]) -def test_create_node_pool(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.create_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.CreateNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_create_node_pool_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.CreateNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - parent='parent_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.create_node_pool(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - parent='parent_value', - ) - -def test_create_node_pool_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.create_node_pool in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.create_node_pool] = mock_rpc - request = {} - client.create_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.create_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_create_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.create_node_pool in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.create_node_pool] = mock_rpc - - request = {} - await client.create_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.create_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_create_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CreateNodePoolRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.create_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.CreateNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_create_node_pool_async_from_dict(): - await test_create_node_pool_async(request_type=dict) - -def test_create_node_pool_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CreateNodePoolRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.create_node_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_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CreateNodePoolRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.create_node_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_node_pool_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.create_node_pool( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool=cluster_service.NodePool(name='name_value'), - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool - mock_val = cluster_service.NodePool(name='name_value') - assert arg == mock_val - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_create_node_pool_flattened_error(): - client = ClusterManagerClient( - 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_node_pool( - cluster_service.CreateNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool=cluster_service.NodePool(name='name_value'), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_create_node_pool_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_node_pool( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool=cluster_service.NodePool(name='name_value'), - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool - mock_val = cluster_service.NodePool(name='name_value') - assert arg == mock_val - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_node_pool_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_node_pool( - cluster_service.CreateNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool=cluster_service.NodePool(name='name_value'), - parent='parent_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.DeleteNodePoolRequest, - dict, -]) -def test_delete_node_pool(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.delete_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.DeleteNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_delete_node_pool_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.DeleteNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.delete_node_pool(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -def test_delete_node_pool_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.delete_node_pool in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.delete_node_pool] = mock_rpc - request = {} - client.delete_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.delete_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_delete_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.delete_node_pool in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.delete_node_pool] = mock_rpc - - request = {} - await client.delete_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.delete_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_delete_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.DeleteNodePoolRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.delete_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.DeleteNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_delete_node_pool_async_from_dict(): - await test_delete_node_pool_async(request_type=dict) - -def test_delete_node_pool_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.DeleteNodePoolRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.delete_node_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_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.DeleteNodePoolRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.delete_node_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_node_pool_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_node_pool( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_node_pool_flattened_error(): - client = ClusterManagerClient( - 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_node_pool( - cluster_service.DeleteNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -@pytest.mark.asyncio -async def test_delete_node_pool_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_node_pool( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_node_pool_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_node_pool( - cluster_service.DeleteNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CompleteNodePoolUpgradeRequest, - dict, -]) -def test_complete_node_pool_upgrade(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.complete_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.complete_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.CompleteNodePoolUpgradeRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None - - -def test_complete_node_pool_upgrade_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.CompleteNodePoolUpgradeRequest( - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_node_pool_upgrade), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.complete_node_pool_upgrade(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteNodePoolUpgradeRequest( - name='name_value', - ) - -def test_complete_node_pool_upgrade_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.complete_node_pool_upgrade in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.complete_node_pool_upgrade] = mock_rpc - request = {} - client.complete_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.complete_node_pool_upgrade(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_complete_node_pool_upgrade_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.complete_node_pool_upgrade in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.complete_node_pool_upgrade] = mock_rpc - - request = {} - await client.complete_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.complete_node_pool_upgrade(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_complete_node_pool_upgrade_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CompleteNodePoolUpgradeRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.complete_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.complete_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.CompleteNodePoolUpgradeRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.asyncio -async def test_complete_node_pool_upgrade_async_from_dict(): - await test_complete_node_pool_upgrade_async(request_type=dict) - -def test_complete_node_pool_upgrade_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CompleteNodePoolUpgradeRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_node_pool_upgrade), - '__call__') as call: - call.return_value = None - client.complete_node_pool_upgrade(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_complete_node_pool_upgrade_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CompleteNodePoolUpgradeRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_node_pool_upgrade), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.complete_node_pool_upgrade(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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.RollbackNodePoolUpgradeRequest, - dict, -]) -def test_rollback_node_pool_upgrade(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.rollback_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.rollback_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.RollbackNodePoolUpgradeRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_rollback_node_pool_upgrade_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.RollbackNodePoolUpgradeRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.rollback_node_pool_upgrade(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -def test_rollback_node_pool_upgrade_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.rollback_node_pool_upgrade in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.rollback_node_pool_upgrade] = mock_rpc - request = {} - client.rollback_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.rollback_node_pool_upgrade(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.rollback_node_pool_upgrade in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.rollback_node_pool_upgrade] = mock_rpc - - request = {} - await client.rollback_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.rollback_node_pool_upgrade(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_async(transport: str = 'grpc_asyncio', request_type=cluster_service.RollbackNodePoolUpgradeRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.rollback_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.rollback_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.RollbackNodePoolUpgradeRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_async_from_dict(): - await test_rollback_node_pool_upgrade_async(request_type=dict) - -def test_rollback_node_pool_upgrade_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.RollbackNodePoolUpgradeRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.rollback_node_pool_upgrade(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_rollback_node_pool_upgrade_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.RollbackNodePoolUpgradeRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.rollback_node_pool_upgrade(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_rollback_node_pool_upgrade_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.rollback_node_pool_upgrade( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_rollback_node_pool_upgrade_flattened_error(): - client = ClusterManagerClient( - 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.rollback_node_pool_upgrade( - cluster_service.RollbackNodePoolUpgradeRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.rollback_node_pool_upgrade( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.rollback_node_pool_upgrade( - cluster_service.RollbackNodePoolUpgradeRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetNodePoolManagementRequest, - dict, -]) -def test_set_node_pool_management(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_node_pool_management), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_node_pool_management(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNodePoolManagementRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_node_pool_management_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetNodePoolManagementRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_management), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_node_pool_management(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolManagementRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -def test_set_node_pool_management_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_node_pool_management in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_node_pool_management] = mock_rpc - request = {} - client.set_node_pool_management(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_node_pool_management(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_node_pool_management_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_node_pool_management in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_node_pool_management] = mock_rpc - - request = {} - await client.set_node_pool_management(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_node_pool_management(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_node_pool_management_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNodePoolManagementRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_node_pool_management), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_node_pool_management(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNodePoolManagementRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_node_pool_management_async_from_dict(): - await test_set_node_pool_management_async(request_type=dict) - -def test_set_node_pool_management_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNodePoolManagementRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_management), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_node_pool_management(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_set_node_pool_management_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNodePoolManagementRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_management), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_node_pool_management(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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetLabelsRequest, - dict, -]) -def test_set_labels(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_labels), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_labels(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLabelsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_labels_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetLabelsRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - label_fingerprint='label_fingerprint_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_labels), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_labels(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLabelsRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - label_fingerprint='label_fingerprint_value', - name='name_value', - ) - -def test_set_labels_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_labels in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_labels] = mock_rpc - request = {} - client.set_labels(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_labels(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_labels_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_labels in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_labels] = mock_rpc - - request = {} - await client.set_labels(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_labels(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_labels_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLabelsRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_labels), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_labels(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLabelsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_labels_async_from_dict(): - await test_set_labels_async(request_type=dict) - -def test_set_labels_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLabelsRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_labels), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_labels(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_set_labels_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLabelsRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_labels), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_labels(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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetLegacyAbacRequest, - dict, -]) -def test_set_legacy_abac(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_legacy_abac), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_legacy_abac(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLegacyAbacRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_legacy_abac_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetLegacyAbacRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_legacy_abac(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLegacyAbacRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_set_legacy_abac_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_legacy_abac in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_legacy_abac] = mock_rpc - request = {} - client.set_legacy_abac(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_legacy_abac(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_legacy_abac_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_legacy_abac in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_legacy_abac] = mock_rpc - - request = {} - await client.set_legacy_abac(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_legacy_abac(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_legacy_abac_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLegacyAbacRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_legacy_abac), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_legacy_abac(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLegacyAbacRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_legacy_abac_async_from_dict(): - await test_set_legacy_abac_async(request_type=dict) - -def test_set_legacy_abac_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLegacyAbacRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_legacy_abac(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_set_legacy_abac_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLegacyAbacRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_legacy_abac(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_set_legacy_abac_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_legacy_abac( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - enabled=True, - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].enabled - mock_val = True - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_set_legacy_abac_flattened_error(): - client = ClusterManagerClient( - 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.set_legacy_abac( - cluster_service.SetLegacyAbacRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - enabled=True, - name='name_value', - ) - -@pytest.mark.asyncio -async def test_set_legacy_abac_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_legacy_abac( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - enabled=True, - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].enabled - mock_val = True - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_legacy_abac_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_legacy_abac( - cluster_service.SetLegacyAbacRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - enabled=True, - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.StartIPRotationRequest, - dict, -]) -def test_start_ip_rotation(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.start_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.start_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.StartIPRotationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_start_ip_rotation_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.StartIPRotationRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.start_ip_rotation(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.StartIPRotationRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_start_ip_rotation_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.start_ip_rotation in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.start_ip_rotation] = mock_rpc - request = {} - client.start_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.start_ip_rotation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_start_ip_rotation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.start_ip_rotation in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.start_ip_rotation] = mock_rpc - - request = {} - await client.start_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.start_ip_rotation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_start_ip_rotation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.StartIPRotationRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.start_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.start_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.StartIPRotationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_start_ip_rotation_async_from_dict(): - await test_start_ip_rotation_async(request_type=dict) - -def test_start_ip_rotation_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.StartIPRotationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.start_ip_rotation(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_start_ip_rotation_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.StartIPRotationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.start_ip_rotation(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_start_ip_rotation_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.start_ip_rotation( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_start_ip_rotation_flattened_error(): - client = ClusterManagerClient( - 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.start_ip_rotation( - cluster_service.StartIPRotationRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -@pytest.mark.asyncio -async def test_start_ip_rotation_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.start_ip_rotation( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_start_ip_rotation_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.start_ip_rotation( - cluster_service.StartIPRotationRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CompleteIPRotationRequest, - dict, -]) -def test_complete_ip_rotation(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.complete_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.complete_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.CompleteIPRotationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_complete_ip_rotation_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.CompleteIPRotationRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.complete_ip_rotation(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteIPRotationRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_complete_ip_rotation_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.complete_ip_rotation in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.complete_ip_rotation] = mock_rpc - request = {} - client.complete_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.complete_ip_rotation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_complete_ip_rotation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.complete_ip_rotation in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.complete_ip_rotation] = mock_rpc - - request = {} - await client.complete_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.complete_ip_rotation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_complete_ip_rotation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CompleteIPRotationRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.complete_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.complete_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.CompleteIPRotationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_complete_ip_rotation_async_from_dict(): - await test_complete_ip_rotation_async(request_type=dict) - -def test_complete_ip_rotation_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CompleteIPRotationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.complete_ip_rotation(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_complete_ip_rotation_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CompleteIPRotationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.complete_ip_rotation(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_complete_ip_rotation_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.complete_ip_rotation( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_complete_ip_rotation_flattened_error(): - client = ClusterManagerClient( - 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.complete_ip_rotation( - cluster_service.CompleteIPRotationRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -@pytest.mark.asyncio -async def test_complete_ip_rotation_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.complete_ip_rotation( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_complete_ip_rotation_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.complete_ip_rotation( - cluster_service.CompleteIPRotationRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetNodePoolSizeRequest, - dict, -]) -def test_set_node_pool_size(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_node_pool_size), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_node_pool_size(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNodePoolSizeRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_node_pool_size_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetNodePoolSizeRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_size), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_node_pool_size(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolSizeRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -def test_set_node_pool_size_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_node_pool_size in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_node_pool_size] = mock_rpc - request = {} - client.set_node_pool_size(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_node_pool_size(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_node_pool_size_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_node_pool_size in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_node_pool_size] = mock_rpc - - request = {} - await client.set_node_pool_size(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_node_pool_size(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_node_pool_size_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNodePoolSizeRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_node_pool_size), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_node_pool_size(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNodePoolSizeRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_node_pool_size_async_from_dict(): - await test_set_node_pool_size_async(request_type=dict) - -def test_set_node_pool_size_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNodePoolSizeRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_size), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_node_pool_size(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_set_node_pool_size_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNodePoolSizeRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_size), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_node_pool_size(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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetNetworkPolicyRequest, - dict, -]) -def test_set_network_policy(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_network_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_network_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNetworkPolicyRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_network_policy_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetNetworkPolicyRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_network_policy(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNetworkPolicyRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_set_network_policy_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_network_policy in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_network_policy] = mock_rpc - request = {} - client.set_network_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_network_policy(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_network_policy_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_network_policy in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_network_policy] = mock_rpc - - request = {} - await client.set_network_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_network_policy(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_network_policy_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNetworkPolicyRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_network_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_network_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNetworkPolicyRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_network_policy_async_from_dict(): - await test_set_network_policy_async(request_type=dict) - -def test_set_network_policy_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNetworkPolicyRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_network_policy(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_set_network_policy_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNetworkPolicyRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_network_policy(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_set_network_policy_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_network_policy( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].network_policy - mock_val = cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO) - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_set_network_policy_flattened_error(): - client = ClusterManagerClient( - 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.set_network_policy( - cluster_service.SetNetworkPolicyRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_set_network_policy_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_network_policy( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].network_policy - mock_val = cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO) - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_network_policy_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_network_policy( - cluster_service.SetNetworkPolicyRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetMaintenancePolicyRequest, - dict, -]) -def test_set_maintenance_policy(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_maintenance_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_maintenance_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetMaintenancePolicyRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_maintenance_policy_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetMaintenancePolicyRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_maintenance_policy(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMaintenancePolicyRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_set_maintenance_policy_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_maintenance_policy in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_maintenance_policy] = mock_rpc - request = {} - client.set_maintenance_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_maintenance_policy(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_maintenance_policy_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_maintenance_policy in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_maintenance_policy] = mock_rpc - - request = {} - await client.set_maintenance_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_maintenance_policy(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_maintenance_policy_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetMaintenancePolicyRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_maintenance_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_maintenance_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetMaintenancePolicyRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_maintenance_policy_async_from_dict(): - await test_set_maintenance_policy_async(request_type=dict) - -def test_set_maintenance_policy_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetMaintenancePolicyRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_maintenance_policy(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_set_maintenance_policy_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetMaintenancePolicyRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_maintenance_policy(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_set_maintenance_policy_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_maintenance_policy( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].maintenance_policy - mock_val = cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))) - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_set_maintenance_policy_flattened_error(): - client = ClusterManagerClient( - 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.set_maintenance_policy( - cluster_service.SetMaintenancePolicyRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_set_maintenance_policy_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_maintenance_policy( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), - 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].maintenance_policy - mock_val = cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))) - assert arg == mock_val - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_maintenance_policy_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_maintenance_policy( - cluster_service.SetMaintenancePolicyRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.ListUsableSubnetworksRequest, - dict, -]) -def test_list_usable_subnetworks(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_usable_subnetworks), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListUsableSubnetworksResponse( - next_page_token='next_page_token_value', - ) - response = client.list_usable_subnetworks(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.ListUsableSubnetworksRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListUsableSubnetworksPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_usable_subnetworks_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.ListUsableSubnetworksRequest( - parent='parent_value', - filter='filter_value', - page_token='page_token_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.list_usable_subnetworks(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListUsableSubnetworksRequest( - parent='parent_value', - filter='filter_value', - page_token='page_token_value', - ) - -def test_list_usable_subnetworks_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.list_usable_subnetworks in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.list_usable_subnetworks] = mock_rpc - request = {} - client.list_usable_subnetworks(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.list_usable_subnetworks(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_usable_subnetworks_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.list_usable_subnetworks in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.list_usable_subnetworks] = mock_rpc - - request = {} - await client.list_usable_subnetworks(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.list_usable_subnetworks(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_usable_subnetworks_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListUsableSubnetworksRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_usable_subnetworks), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_usable_subnetworks(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.ListUsableSubnetworksRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListUsableSubnetworksAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_usable_subnetworks_async_from_dict(): - await test_list_usable_subnetworks_async(request_type=dict) - -def test_list_usable_subnetworks_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListUsableSubnetworksRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__') as call: - call.return_value = cluster_service.ListUsableSubnetworksResponse() - client.list_usable_subnetworks(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_usable_subnetworks_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListUsableSubnetworksRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse()) - await client.list_usable_subnetworks(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_usable_subnetworks_pager(transport_name: str = "grpc"): - client = ClusterManagerClient( - 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_usable_subnetworks), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - next_page_token='abc', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[], - next_page_token='def', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - ], - next_page_token='ghi', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - ), - RuntimeError, - ) - - expected_metadata = () - retry = retries.Retry() - timeout = 5 - expected_metadata = tuple(expected_metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_usable_subnetworks(request={}, retry=retry, timeout=timeout) - - assert pager._metadata == expected_metadata - assert pager._retry == retry - assert pager._timeout == timeout - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, cluster_service.UsableSubnetwork) - for i in results) -def test_list_usable_subnetworks_pages(transport_name: str = "grpc"): - client = ClusterManagerClient( - 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_usable_subnetworks), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - next_page_token='abc', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[], - next_page_token='def', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - ], - next_page_token='ghi', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - ), - RuntimeError, - ) - pages = list(client.list_usable_subnetworks(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_usable_subnetworks_async_pager(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - next_page_token='abc', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[], - next_page_token='def', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - ], - next_page_token='ghi', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_usable_subnetworks(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, cluster_service.UsableSubnetwork) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_usable_subnetworks_async_pages(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - next_page_token='abc', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[], - next_page_token='def', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - ], - next_page_token='ghi', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_usable_subnetworks(request={}) - ).pages: - 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", [ - cluster_service.CheckAutopilotCompatibilityRequest, - dict, -]) -def test_check_autopilot_compatibility(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.check_autopilot_compatibility), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.CheckAutopilotCompatibilityResponse( - summary='summary_value', - ) - response = client.check_autopilot_compatibility(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.CheckAutopilotCompatibilityRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) - assert response.summary == 'summary_value' - - -def test_check_autopilot_compatibility_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.CheckAutopilotCompatibilityRequest( - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.check_autopilot_compatibility), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.check_autopilot_compatibility(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CheckAutopilotCompatibilityRequest( - name='name_value', - ) - -def test_check_autopilot_compatibility_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.check_autopilot_compatibility in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.check_autopilot_compatibility] = mock_rpc - request = {} - client.check_autopilot_compatibility(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.check_autopilot_compatibility(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_check_autopilot_compatibility_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.check_autopilot_compatibility in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.check_autopilot_compatibility] = mock_rpc - - request = {} - await client.check_autopilot_compatibility(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.check_autopilot_compatibility(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_check_autopilot_compatibility_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CheckAutopilotCompatibilityRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.check_autopilot_compatibility), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.CheckAutopilotCompatibilityResponse( - summary='summary_value', - )) - response = await client.check_autopilot_compatibility(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.CheckAutopilotCompatibilityRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) - assert response.summary == 'summary_value' - - -@pytest.mark.asyncio -async def test_check_autopilot_compatibility_async_from_dict(): - await test_check_autopilot_compatibility_async(request_type=dict) - -def test_check_autopilot_compatibility_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CheckAutopilotCompatibilityRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.check_autopilot_compatibility), - '__call__') as call: - call.return_value = cluster_service.CheckAutopilotCompatibilityResponse() - client.check_autopilot_compatibility(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_check_autopilot_compatibility_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CheckAutopilotCompatibilityRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.check_autopilot_compatibility), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.CheckAutopilotCompatibilityResponse()) - await client.check_autopilot_compatibility(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_list_clusters_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.list_clusters in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.list_clusters] = mock_rpc - - request = {} - client.list_clusters(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.list_clusters(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_list_clusters_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.ListClustersResponse() - - # get arguments that satisfy an http rule for this method - sample_request = {'parent': 'projects/sample1/locations/sample2'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.ListClustersResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.list_clusters(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{parent=projects/*/locations/*}/clusters" % client.transport._host, args[1]) - - -def test_list_clusters_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_clusters( - cluster_service.ListClustersRequest(), - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - - -def test_get_cluster_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_cluster in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_cluster] = mock_rpc - - request = {} - client.get_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_get_cluster_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Cluster() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Cluster.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.get_cluster(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}" % client.transport._host, args[1]) - - -def test_get_cluster_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_cluster( - cluster_service.GetClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - -def test_create_cluster_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.create_cluster in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.create_cluster] = mock_rpc - - request = {} - client.create_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.create_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_create_cluster_rest_required_fields(request_type=cluster_service.CreateClusterRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).create_cluster._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).create_cluster._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.create_cluster(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_create_cluster_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.create_cluster._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("cluster", ))) - - -def test_create_cluster_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'parent': 'projects/sample1/locations/sample2'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster=cluster_service.Cluster(name='name_value'), - parent='parent_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.create_cluster(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{parent=projects/*/locations/*}/clusters" % client.transport._host, args[1]) - - -def test_create_cluster_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_cluster( - cluster_service.CreateClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster=cluster_service.Cluster(name='name_value'), - parent='parent_value', - ) - - -def test_update_cluster_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.update_cluster in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.update_cluster] = mock_rpc - - request = {} - client.update_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.update_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_update_cluster_rest_required_fields(request_type=cluster_service.UpdateClusterRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).update_cluster._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).update_cluster._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "put", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.update_cluster(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_update_cluster_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.update_cluster._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("update", ))) - - -def test_update_cluster_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.update_cluster(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}" % client.transport._host, args[1]) - - -def test_update_cluster_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_cluster( - cluster_service.UpdateClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), - name='name_value', - ) - - -def test_update_node_pool_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.update_node_pool in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.update_node_pool] = mock_rpc - - request = {} - client.update_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.update_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_update_node_pool_rest_required_fields(request_type=cluster_service.UpdateNodePoolRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request_init["node_version"] = "" - request_init["image_type"] = "" - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).update_node_pool._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - jsonified_request["nodeVersion"] = 'node_version_value' - jsonified_request["imageType"] = 'image_type_value' - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).update_node_pool._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - assert "nodeVersion" in jsonified_request - assert jsonified_request["nodeVersion"] == 'node_version_value' - assert "imageType" in jsonified_request - assert jsonified_request["imageType"] == 'image_type_value' - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "put", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.update_node_pool(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_update_node_pool_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.update_node_pool._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("nodeVersion", "imageType", ))) - - -def test_set_node_pool_autoscaling_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_node_pool_autoscaling in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_node_pool_autoscaling] = mock_rpc - - request = {} - client.set_node_pool_autoscaling(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_node_pool_autoscaling(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_set_node_pool_autoscaling_rest_required_fields(request_type=cluster_service.SetNodePoolAutoscalingRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_node_pool_autoscaling._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_node_pool_autoscaling._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.set_node_pool_autoscaling(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_set_node_pool_autoscaling_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.set_node_pool_autoscaling._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("autoscaling", ))) - - -def test_set_logging_service_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_logging_service in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_logging_service] = mock_rpc - - request = {} - client.set_logging_service(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_logging_service(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_set_logging_service_rest_required_fields(request_type=cluster_service.SetLoggingServiceRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request_init["logging_service"] = "" - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_logging_service._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - jsonified_request["loggingService"] = 'logging_service_value' - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_logging_service._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - assert "loggingService" in jsonified_request - assert jsonified_request["loggingService"] == 'logging_service_value' - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.set_logging_service(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_set_logging_service_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.set_logging_service._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("loggingService", ))) - - -def test_set_logging_service_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_value', - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.set_logging_service(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setLogging" % client.transport._host, args[1]) - - -def test_set_logging_service_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.set_logging_service( - cluster_service.SetLoggingServiceRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_value', - name='name_value', - ) - - -def test_set_monitoring_service_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_monitoring_service in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_monitoring_service] = mock_rpc - - request = {} - client.set_monitoring_service(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_monitoring_service(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_set_monitoring_service_rest_required_fields(request_type=cluster_service.SetMonitoringServiceRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request_init["monitoring_service"] = "" - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_monitoring_service._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - jsonified_request["monitoringService"] = 'monitoring_service_value' - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_monitoring_service._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - assert "monitoringService" in jsonified_request - assert jsonified_request["monitoringService"] == 'monitoring_service_value' - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.set_monitoring_service(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_set_monitoring_service_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.set_monitoring_service._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("monitoringService", ))) - - -def test_set_monitoring_service_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_value', - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.set_monitoring_service(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setMonitoring" % client.transport._host, args[1]) - - -def test_set_monitoring_service_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.set_monitoring_service( - cluster_service.SetMonitoringServiceRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_value', - name='name_value', - ) - - -def test_set_addons_config_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_addons_config in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_addons_config] = mock_rpc - - request = {} - client.set_addons_config(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_addons_config(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_set_addons_config_rest_required_fields(request_type=cluster_service.SetAddonsConfigRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_addons_config._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_addons_config._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.set_addons_config(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_set_addons_config_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.set_addons_config._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("addonsConfig", ))) - - -def test_set_addons_config_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.set_addons_config(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setAddons" % client.transport._host, args[1]) - - -def test_set_addons_config_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.set_addons_config( - cluster_service.SetAddonsConfigRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), - name='name_value', - ) - - -def test_set_locations_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_locations in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_locations] = mock_rpc - - request = {} - client.set_locations(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_locations(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_set_locations_rest_required_fields(request_type=cluster_service.SetLocationsRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request_init["locations"] = "" - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_locations._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - jsonified_request["locations"] = 'locations_value' - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_locations._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - assert "locations" in jsonified_request - assert jsonified_request["locations"] == 'locations_value' - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.set_locations(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_set_locations_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.set_locations._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("locations", ))) - - -def test_set_locations_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - locations=['locations_value'], - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.set_locations(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setLocations" % client.transport._host, args[1]) - - -def test_set_locations_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.set_locations( - cluster_service.SetLocationsRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - locations=['locations_value'], - name='name_value', - ) - - -def test_update_master_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.update_master in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.update_master] = mock_rpc - - request = {} - client.update_master(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.update_master(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_update_master_rest_required_fields(request_type=cluster_service.UpdateMasterRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request_init["master_version"] = "" - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).update_master._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - jsonified_request["masterVersion"] = 'master_version_value' - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).update_master._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - assert "masterVersion" in jsonified_request - assert jsonified_request["masterVersion"] == 'master_version_value' - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.update_master(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_update_master_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.update_master._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("masterVersion", ))) - - -def test_update_master_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_value', - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.update_master(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:updateMaster" % client.transport._host, args[1]) - - -def test_update_master_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_master( - cluster_service.UpdateMasterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_value', - name='name_value', - ) - - -def test_set_master_auth_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_master_auth in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_master_auth] = mock_rpc - - request = {} - client.set_master_auth(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_master_auth(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_set_master_auth_rest_required_fields(request_type=cluster_service.SetMasterAuthRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_master_auth._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_master_auth._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.set_master_auth(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_set_master_auth_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.set_master_auth._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("action", "update", ))) - - -def test_delete_cluster_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.delete_cluster in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.delete_cluster] = mock_rpc - - request = {} - client.delete_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.delete_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_delete_cluster_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.delete_cluster(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}" % client.transport._host, args[1]) - - -def test_delete_cluster_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_cluster( - cluster_service.DeleteClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - -def test_list_operations_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.list_operations in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.list_operations] = mock_rpc - - request = {} - client.list_operations(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.list_operations(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_list_operations_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.ListOperationsResponse() - - # get arguments that satisfy an http rule for this method - sample_request = {'parent': 'projects/sample1/locations/sample2'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.ListOperationsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.list_operations(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{parent=projects/*/locations/*}/operations" % client.transport._host, args[1]) - - -def test_list_operations_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_operations( - cluster_service.ListOperationsRequest(), - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - - -def test_get_operation_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_operation in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_operation] = mock_rpc - - request = {} - client.get_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_operation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_get_operation_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/operations/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.get_operation(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/operations/*}" % client.transport._host, args[1]) - - -def test_get_operation_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_operation( - cluster_service.GetOperationRequest(), - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - - -def test_cancel_operation_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.cancel_operation in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.cancel_operation] = mock_rpc - - request = {} - client.cancel_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.cancel_operation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_cancel_operation_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = None - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/operations/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = '' - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.cancel_operation(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/operations/*}:cancel" % client.transport._host, args[1]) - - -def test_cancel_operation_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.cancel_operation( - cluster_service.CancelOperationRequest(), - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - - -def test_get_server_config_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_server_config in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_server_config] = mock_rpc - - request = {} - client.get_server_config(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_server_config(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_get_server_config_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.ServerConfig() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.ServerConfig.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.get_server_config(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*}/serverConfig" % client.transport._host, args[1]) - - -def test_get_server_config_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_server_config( - cluster_service.GetServerConfigRequest(), - project_id='project_id_value', - zone='zone_value', - name='name_value', - ) - - -def test_get_json_web_keys_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_json_web_keys in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_json_web_keys] = mock_rpc - - request = {} - client.get_json_web_keys(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_json_web_keys(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_list_node_pools_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.list_node_pools in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.list_node_pools] = mock_rpc - - request = {} - client.list_node_pools(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.list_node_pools(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_list_node_pools_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.ListNodePoolsResponse() - - # get arguments that satisfy an http rule for this method - sample_request = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - parent='parent_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.ListNodePoolsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.list_node_pools(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{parent=projects/*/locations/*/clusters/*}/nodePools" % client.transport._host, args[1]) - - -def test_list_node_pools_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_node_pools( - cluster_service.ListNodePoolsRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - parent='parent_value', - ) - - -def test_get_node_pool_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_node_pool in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_node_pool] = mock_rpc - - request = {} - client.get_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_get_node_pool_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.NodePool() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.NodePool.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.get_node_pool(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}" % client.transport._host, args[1]) - - -def test_get_node_pool_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_node_pool( - cluster_service.GetNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - -def test_create_node_pool_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.create_node_pool in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.create_node_pool] = mock_rpc - - request = {} - client.create_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.create_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_create_node_pool_rest_required_fields(request_type=cluster_service.CreateNodePoolRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).create_node_pool._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).create_node_pool._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.create_node_pool(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_create_node_pool_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.create_node_pool._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("nodePool", ))) - - -def test_create_node_pool_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool=cluster_service.NodePool(name='name_value'), - parent='parent_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.create_node_pool(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{parent=projects/*/locations/*/clusters/*}/nodePools" % client.transport._host, args[1]) - - -def test_create_node_pool_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_node_pool( - cluster_service.CreateNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool=cluster_service.NodePool(name='name_value'), - parent='parent_value', - ) - - -def test_delete_node_pool_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.delete_node_pool in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.delete_node_pool] = mock_rpc - - request = {} - client.delete_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.delete_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_delete_node_pool_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.delete_node_pool(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}" % client.transport._host, args[1]) - - -def test_delete_node_pool_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_node_pool( - cluster_service.DeleteNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - -def test_complete_node_pool_upgrade_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.complete_node_pool_upgrade in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.complete_node_pool_upgrade] = mock_rpc - - request = {} - client.complete_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.complete_node_pool_upgrade(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_rollback_node_pool_upgrade_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.rollback_node_pool_upgrade in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.rollback_node_pool_upgrade] = mock_rpc - - request = {} - client.rollback_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.rollback_node_pool_upgrade(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_rollback_node_pool_upgrade_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.rollback_node_pool_upgrade(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*/nodePools/*}:rollback" % client.transport._host, args[1]) - - -def test_rollback_node_pool_upgrade_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.rollback_node_pool_upgrade( - cluster_service.RollbackNodePoolUpgradeRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - -def test_set_node_pool_management_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_node_pool_management in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_node_pool_management] = mock_rpc - - request = {} - client.set_node_pool_management(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_node_pool_management(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_set_node_pool_management_rest_required_fields(request_type=cluster_service.SetNodePoolManagementRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_node_pool_management._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_node_pool_management._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.set_node_pool_management(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_set_node_pool_management_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.set_node_pool_management._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("management", ))) - - -def test_set_labels_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_labels in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_labels] = mock_rpc - - request = {} - client.set_labels(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_labels(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_set_labels_rest_required_fields(request_type=cluster_service.SetLabelsRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request_init["label_fingerprint"] = "" - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_labels._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - jsonified_request["labelFingerprint"] = 'label_fingerprint_value' - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_labels._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - assert "labelFingerprint" in jsonified_request - assert jsonified_request["labelFingerprint"] == 'label_fingerprint_value' - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.set_labels(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_set_labels_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.set_labels._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("resourceLabels", "labelFingerprint", ))) - - -def test_set_legacy_abac_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_legacy_abac in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_legacy_abac] = mock_rpc - - request = {} - client.set_legacy_abac(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_legacy_abac(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_set_legacy_abac_rest_required_fields(request_type=cluster_service.SetLegacyAbacRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request_init["enabled"] = False - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_legacy_abac._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - jsonified_request["enabled"] = True - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_legacy_abac._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - assert "enabled" in jsonified_request - assert jsonified_request["enabled"] == True - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.set_legacy_abac(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_set_legacy_abac_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.set_legacy_abac._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("enabled", ))) - - -def test_set_legacy_abac_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - enabled=True, - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.set_legacy_abac(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setLegacyAbac" % client.transport._host, args[1]) - - -def test_set_legacy_abac_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.set_legacy_abac( - cluster_service.SetLegacyAbacRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - enabled=True, - name='name_value', - ) - - -def test_start_ip_rotation_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.start_ip_rotation in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.start_ip_rotation] = mock_rpc - - request = {} - client.start_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.start_ip_rotation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_start_ip_rotation_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.start_ip_rotation(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:startIpRotation" % client.transport._host, args[1]) - - -def test_start_ip_rotation_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.start_ip_rotation( - cluster_service.StartIPRotationRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - -def test_complete_ip_rotation_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.complete_ip_rotation in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.complete_ip_rotation] = mock_rpc - - request = {} - client.complete_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.complete_ip_rotation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_complete_ip_rotation_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.complete_ip_rotation(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:completeIpRotation" % client.transport._host, args[1]) - - -def test_complete_ip_rotation_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.complete_ip_rotation( - cluster_service.CompleteIPRotationRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - -def test_set_node_pool_size_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_node_pool_size in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_node_pool_size] = mock_rpc - - request = {} - client.set_node_pool_size(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_node_pool_size(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_set_node_pool_size_rest_required_fields(request_type=cluster_service.SetNodePoolSizeRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request_init["node_count"] = 0 - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_node_pool_size._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - jsonified_request["nodeCount"] = 1070 - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_node_pool_size._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - assert "nodeCount" in jsonified_request - assert jsonified_request["nodeCount"] == 1070 - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.set_node_pool_size(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_set_node_pool_size_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.set_node_pool_size._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("nodeCount", ))) - - -def test_set_network_policy_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_network_policy in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_network_policy] = mock_rpc - - request = {} - client.set_network_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_network_policy(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_set_network_policy_rest_required_fields(request_type=cluster_service.SetNetworkPolicyRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_network_policy._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_network_policy._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.set_network_policy(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_set_network_policy_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.set_network_policy._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("networkPolicy", ))) - - -def test_set_network_policy_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.set_network_policy(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setNetworkPolicy" % client.transport._host, args[1]) - - -def test_set_network_policy_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.set_network_policy( - cluster_service.SetNetworkPolicyRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), - name='name_value', - ) - - -def test_set_maintenance_policy_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_maintenance_policy in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_maintenance_policy] = mock_rpc - - request = {} - client.set_maintenance_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_maintenance_policy(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_set_maintenance_policy_rest_required_fields(request_type=cluster_service.SetMaintenancePolicyRequest): - transport_class = transports.ClusterManagerRestTransport - - request_init = {} - request_init["project_id"] = "" - request_init["zone"] = "" - request_init["cluster_id"] = "" - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads(json_format.MessageToJson( - pb_request, - use_integers_for_enums=False - )) - - # verify fields with default values are dropped - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_maintenance_policy._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - jsonified_request["projectId"] = 'project_id_value' - jsonified_request["zone"] = 'zone_value' - jsonified_request["clusterId"] = 'cluster_id_value' - - unset_fields = transport_class(credentials=ga_credentials.AnonymousCredentials()).set_maintenance_policy._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - assert "projectId" in jsonified_request - assert jsonified_request["projectId"] == 'project_id_value' - assert "zone" in jsonified_request - assert jsonified_request["zone"] == 'zone_value' - assert "clusterId" in jsonified_request - assert jsonified_request["clusterId"] == 'cluster_id_value' - - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='rest', - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, 'transcode') as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - 'uri': 'v1/sample_method', - 'method': "post", - 'query_params': pb_request, - } - transcode_result['body'] = pb_request - transcode.return_value = transcode_result - - response_value = Response() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - response = client.set_maintenance_policy(request) - - expected_params = [ - ('$alt', 'json;enum-encoding=int') - ] - actual_params = req.call_args.kwargs['params'] - assert expected_params == actual_params - - -def test_set_maintenance_policy_rest_unset_required_fields(): - transport = transports.ClusterManagerRestTransport(credentials=ga_credentials.AnonymousCredentials) - - unset_fields = transport.set_maintenance_policy._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("projectId", "zone", "clusterId", "maintenancePolicy", ))) - - -def test_set_maintenance_policy_rest_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation() - - # get arguments that satisfy an http rule for this method - sample_request = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - - # get truthy value for each flattened field - mock_args = dict( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), - name='name_value', - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - client.set_maintenance_policy(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate("%s/v1/{name=projects/*/locations/*/clusters/*}:setMaintenancePolicy" % client.transport._host, args[1]) - - -def test_set_maintenance_policy_rest_flattened_error(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.set_maintenance_policy( - cluster_service.SetMaintenancePolicyRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), - name='name_value', - ) - - -def test_list_usable_subnetworks_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.list_usable_subnetworks in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.list_usable_subnetworks] = mock_rpc - - request = {} - client.list_usable_subnetworks(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.list_usable_subnetworks(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_list_usable_subnetworks_rest_pager(transport: str = 'rest'): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, 'request') as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - #with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - next_page_token='abc', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[], - next_page_token='def', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - ], - next_page_token='ghi', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple(cluster_service.ListUsableSubnetworksResponse.to_json(x) for x in response) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode('UTF-8') - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {'parent': 'projects/sample1'} - - pager = client.list_usable_subnetworks(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, cluster_service.UsableSubnetwork) - for i in results) - - pages = list(client.list_usable_subnetworks(request=sample_request).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - - -def test_check_autopilot_compatibility_rest_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.check_autopilot_compatibility in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.check_autopilot_compatibility] = mock_rpc - - request = {} - client.check_autopilot_compatibility(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.check_autopilot_compatibility(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.ClusterManagerGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.ClusterManagerGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ClusterManagerClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.ClusterManagerGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = ClusterManagerClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = ClusterManagerClient( - client_options=options, - credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.ClusterManagerGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ClusterManagerClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.ClusterManagerGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = ClusterManagerClient(transport=transport) - assert client.transport is transport - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.ClusterManagerGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.ClusterManagerGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - -@pytest.mark.parametrize("transport_class", [ - transports.ClusterManagerGrpcTransport, - transports.ClusterManagerGrpcAsyncIOTransport, - transports.ClusterManagerRestTransport, -]) -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() - -def test_transport_kind_grpc(): - transport = ClusterManagerClient.get_transport_class("grpc")( - credentials=ga_credentials.AnonymousCredentials() - ) - assert transport.kind == "grpc" - - -def test_initialize_client_w_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc" - ) - assert client is not None - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_list_clusters_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - call.return_value = cluster_service.ListClustersResponse() - client.list_clusters(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListClustersRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_cluster_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - call.return_value = cluster_service.Cluster() - client.get_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_create_cluster_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.create_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CreateClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_update_cluster_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.update_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_update_node_pool_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_node_pool), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.update_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_node_pool_autoscaling_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_autoscaling), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_node_pool_autoscaling(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolAutoscalingRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_logging_service_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_logging_service(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLoggingServiceRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_monitoring_service_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_monitoring_service(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMonitoringServiceRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_addons_config_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_addons_config(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetAddonsConfigRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_locations_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_locations(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLocationsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_update_master_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.update_master(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateMasterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_master_auth_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_master_auth), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_master_auth(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMasterAuthRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_delete_cluster_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.delete_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.DeleteClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_list_operations_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - call.return_value = cluster_service.ListOperationsResponse() - client.list_operations(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListOperationsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_operation_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.get_operation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetOperationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_cancel_operation_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - call.return_value = None - client.cancel_operation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CancelOperationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_server_config_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - call.return_value = cluster_service.ServerConfig() - client.get_server_config(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetServerConfigRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_json_web_keys_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_json_web_keys), - '__call__') as call: - call.return_value = cluster_service.GetJSONWebKeysResponse() - client.get_json_web_keys(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetJSONWebKeysRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_list_node_pools_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - call.return_value = cluster_service.ListNodePoolsResponse() - client.list_node_pools(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListNodePoolsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_node_pool_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - call.return_value = cluster_service.NodePool() - client.get_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_create_node_pool_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.create_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CreateNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_delete_node_pool_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.delete_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.DeleteNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_complete_node_pool_upgrade_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.complete_node_pool_upgrade), - '__call__') as call: - call.return_value = None - client.complete_node_pool_upgrade(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CompleteNodePoolUpgradeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_rollback_node_pool_upgrade_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.rollback_node_pool_upgrade(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.RollbackNodePoolUpgradeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_node_pool_management_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_management), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_node_pool_management(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolManagementRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_labels_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_labels), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_labels(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLabelsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_legacy_abac_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_legacy_abac(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLegacyAbacRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_start_ip_rotation_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.start_ip_rotation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.StartIPRotationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_complete_ip_rotation_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.complete_ip_rotation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CompleteIPRotationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_node_pool_size_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_size), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_node_pool_size(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolSizeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_network_policy_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_network_policy(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNetworkPolicyRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_maintenance_policy_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_maintenance_policy(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMaintenancePolicyRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_list_usable_subnetworks_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__') as call: - call.return_value = cluster_service.ListUsableSubnetworksResponse() - client.list_usable_subnetworks(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListUsableSubnetworksRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_check_autopilot_compatibility_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.check_autopilot_compatibility), - '__call__') as call: - call.return_value = cluster_service.CheckAutopilotCompatibilityResponse() - client.check_autopilot_compatibility(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CheckAutopilotCompatibilityRequest() - - assert args[0] == request_msg - - -def test_transport_kind_grpc_asyncio(): - transport = ClusterManagerAsyncClient.get_transport_class("grpc_asyncio")( - credentials=async_anonymous_credentials() - ) - assert transport.kind == "grpc_asyncio" - - -def test_initialize_client_w_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio" - ) - assert client is not None - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_list_clusters_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse( - missing_zones=['missing_zones_value'], - )) - await client.list_clusters(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListClustersRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_get_cluster_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster( - name='name_value', - description='description_value', - initial_node_count=1911, - logging_service='logging_service_value', - monitoring_service='monitoring_service_value', - network='network_value', - cluster_ipv4_cidr='cluster_ipv4_cidr_value', - subnetwork='subnetwork_value', - locations=['locations_value'], - enable_kubernetes_alpha=True, - label_fingerprint='label_fingerprint_value', - self_link='self_link_value', - zone='zone_value', - endpoint='endpoint_value', - initial_cluster_version='initial_cluster_version_value', - current_master_version='current_master_version_value', - current_node_version='current_node_version_value', - create_time='create_time_value', - status=cluster_service.Cluster.Status.PROVISIONING, - status_message='status_message_value', - node_ipv4_cidr_size=1955, - services_ipv4_cidr='services_ipv4_cidr_value', - instance_group_urls=['instance_group_urls_value'], - current_node_count=1936, - expire_time='expire_time_value', - location='location_value', - enable_tpu=True, - tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', - id='id_value', - etag='etag_value', - satisfies_pzs=True, - satisfies_pzi=True, - )) - await client.get_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_create_cluster_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.create_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CreateClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_update_cluster_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.update_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_update_node_pool_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.update_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_node_pool_autoscaling_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_autoscaling), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_node_pool_autoscaling(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolAutoscalingRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_logging_service_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_logging_service(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLoggingServiceRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_monitoring_service_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_monitoring_service(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMonitoringServiceRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_addons_config_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_addons_config(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetAddonsConfigRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_locations_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_locations(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLocationsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_update_master_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.update_master(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateMasterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_master_auth_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_master_auth), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_master_auth(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMasterAuthRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_delete_cluster_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.delete_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.DeleteClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_list_operations_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse( - missing_zones=['missing_zones_value'], - )) - await client.list_operations(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListOperationsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_get_operation_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.get_operation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetOperationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_cancel_operation_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.cancel_operation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CancelOperationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_get_server_config_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig( - default_cluster_version='default_cluster_version_value', - valid_node_versions=['valid_node_versions_value'], - default_image_type='default_image_type_value', - valid_image_types=['valid_image_types_value'], - valid_master_versions=['valid_master_versions_value'], - )) - await client.get_server_config(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetServerConfigRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_get_json_web_keys_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_json_web_keys), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.GetJSONWebKeysResponse( - )) - await client.get_json_web_keys(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetJSONWebKeysRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_list_node_pools_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse( - )) - await client.list_node_pools(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListNodePoolsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_get_node_pool_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool( - name='name_value', - initial_node_count=1911, - locations=['locations_value'], - self_link='self_link_value', - version='version_value', - instance_group_urls=['instance_group_urls_value'], - status=cluster_service.NodePool.Status.PROVISIONING, - status_message='status_message_value', - pod_ipv4_cidr_size=1856, - etag='etag_value', - )) - await client.get_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_create_node_pool_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.create_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CreateNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_delete_node_pool_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.delete_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.DeleteNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_complete_node_pool_upgrade_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.complete_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.complete_node_pool_upgrade(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CompleteNodePoolUpgradeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.rollback_node_pool_upgrade(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.RollbackNodePoolUpgradeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_node_pool_management_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_management), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_node_pool_management(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolManagementRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_labels_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_labels), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_labels(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLabelsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_legacy_abac_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_legacy_abac(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLegacyAbacRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_start_ip_rotation_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.start_ip_rotation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.StartIPRotationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_complete_ip_rotation_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.complete_ip_rotation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CompleteIPRotationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_node_pool_size_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_size), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_node_pool_size(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolSizeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_network_policy_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_network_policy(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNetworkPolicyRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_maintenance_policy_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_maintenance_policy(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMaintenancePolicyRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_list_usable_subnetworks_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse( - next_page_token='next_page_token_value', - )) - await client.list_usable_subnetworks(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListUsableSubnetworksRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_check_autopilot_compatibility_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.check_autopilot_compatibility), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.CheckAutopilotCompatibilityResponse( - summary='summary_value', - )) - await client.check_autopilot_compatibility(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CheckAutopilotCompatibilityRequest() - - assert args[0] == request_msg - - -def test_transport_kind_rest(): - transport = ClusterManagerClient.get_transport_class("rest")( - credentials=ga_credentials.AnonymousCredentials() - ) - assert transport.kind == "rest" - - -def test_list_clusters_rest_bad_request(request_type=cluster_service.ListClustersRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1/locations/sample2'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.list_clusters(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.ListClustersRequest, - dict, -]) -def test_list_clusters_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1/locations/sample2'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.ListClustersResponse( - missing_zones=['missing_zones_value'], - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.ListClustersResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.list_clusters(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListClustersResponse) - assert response.missing_zones == ['missing_zones_value'] - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_clusters_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_list_clusters") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_list_clusters") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.ListClustersRequest.pb(cluster_service.ListClustersRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.ListClustersResponse.to_json(cluster_service.ListClustersResponse()) - req.return_value.content = return_value - - request = cluster_service.ListClustersRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.ListClustersResponse() - - client.list_clusters(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_get_cluster_rest_bad_request(request_type=cluster_service.GetClusterRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.get_cluster(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetClusterRequest, - dict, -]) -def test_get_cluster_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Cluster( - name='name_value', - description='description_value', - initial_node_count=1911, - logging_service='logging_service_value', - monitoring_service='monitoring_service_value', - network='network_value', - cluster_ipv4_cidr='cluster_ipv4_cidr_value', - subnetwork='subnetwork_value', - locations=['locations_value'], - enable_kubernetes_alpha=True, - label_fingerprint='label_fingerprint_value', - self_link='self_link_value', - zone='zone_value', - endpoint='endpoint_value', - initial_cluster_version='initial_cluster_version_value', - current_master_version='current_master_version_value', - current_node_version='current_node_version_value', - create_time='create_time_value', - status=cluster_service.Cluster.Status.PROVISIONING, - status_message='status_message_value', - node_ipv4_cidr_size=1955, - services_ipv4_cidr='services_ipv4_cidr_value', - instance_group_urls=['instance_group_urls_value'], - current_node_count=1936, - expire_time='expire_time_value', - location='location_value', - enable_tpu=True, - tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', - id='id_value', - etag='etag_value', - satisfies_pzs=True, - satisfies_pzi=True, - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Cluster.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.get_cluster(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Cluster) - assert response.name == 'name_value' - assert response.description == 'description_value' - assert response.initial_node_count == 1911 - assert response.logging_service == 'logging_service_value' - assert response.monitoring_service == 'monitoring_service_value' - assert response.network == 'network_value' - assert response.cluster_ipv4_cidr == 'cluster_ipv4_cidr_value' - assert response.subnetwork == 'subnetwork_value' - assert response.locations == ['locations_value'] - assert response.enable_kubernetes_alpha is True - assert response.label_fingerprint == 'label_fingerprint_value' - assert response.self_link == 'self_link_value' - assert response.zone == 'zone_value' - assert response.endpoint == 'endpoint_value' - assert response.initial_cluster_version == 'initial_cluster_version_value' - assert response.current_master_version == 'current_master_version_value' - assert response.current_node_version == 'current_node_version_value' - assert response.create_time == 'create_time_value' - assert response.status == cluster_service.Cluster.Status.PROVISIONING - assert response.status_message == 'status_message_value' - assert response.node_ipv4_cidr_size == 1955 - assert response.services_ipv4_cidr == 'services_ipv4_cidr_value' - assert response.instance_group_urls == ['instance_group_urls_value'] - assert response.current_node_count == 1936 - assert response.expire_time == 'expire_time_value' - assert response.location == 'location_value' - assert response.enable_tpu is True - assert response.tpu_ipv4_cidr_block == 'tpu_ipv4_cidr_block_value' - assert response.id == 'id_value' - assert response.etag == 'etag_value' - assert response.satisfies_pzs is True - assert response.satisfies_pzi is True - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_cluster_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_get_cluster") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_get_cluster") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.GetClusterRequest.pb(cluster_service.GetClusterRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Cluster.to_json(cluster_service.Cluster()) - req.return_value.content = return_value - - request = cluster_service.GetClusterRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Cluster() - - client.get_cluster(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_create_cluster_rest_bad_request(request_type=cluster_service.CreateClusterRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1/locations/sample2'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.create_cluster(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CreateClusterRequest, - dict, -]) -def test_create_cluster_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1/locations/sample2'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.create_cluster(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_cluster_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_create_cluster") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_create_cluster") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.CreateClusterRequest.pb(cluster_service.CreateClusterRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.CreateClusterRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.create_cluster(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_update_cluster_rest_bad_request(request_type=cluster_service.UpdateClusterRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.update_cluster(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.UpdateClusterRequest, - dict, -]) -def test_update_cluster_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.update_cluster(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_cluster_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_update_cluster") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_update_cluster") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.UpdateClusterRequest.pb(cluster_service.UpdateClusterRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.UpdateClusterRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.update_cluster(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_update_node_pool_rest_bad_request(request_type=cluster_service.UpdateNodePoolRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.update_node_pool(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.UpdateNodePoolRequest, - dict, -]) -def test_update_node_pool_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.update_node_pool(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_node_pool_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_update_node_pool") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_update_node_pool") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.UpdateNodePoolRequest.pb(cluster_service.UpdateNodePoolRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.UpdateNodePoolRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.update_node_pool(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_set_node_pool_autoscaling_rest_bad_request(request_type=cluster_service.SetNodePoolAutoscalingRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.set_node_pool_autoscaling(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetNodePoolAutoscalingRequest, - dict, -]) -def test_set_node_pool_autoscaling_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.set_node_pool_autoscaling(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_set_node_pool_autoscaling_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_node_pool_autoscaling") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_node_pool_autoscaling") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.SetNodePoolAutoscalingRequest.pb(cluster_service.SetNodePoolAutoscalingRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.SetNodePoolAutoscalingRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.set_node_pool_autoscaling(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_set_logging_service_rest_bad_request(request_type=cluster_service.SetLoggingServiceRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.set_logging_service(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetLoggingServiceRequest, - dict, -]) -def test_set_logging_service_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.set_logging_service(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_set_logging_service_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_logging_service") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_logging_service") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.SetLoggingServiceRequest.pb(cluster_service.SetLoggingServiceRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.SetLoggingServiceRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.set_logging_service(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_set_monitoring_service_rest_bad_request(request_type=cluster_service.SetMonitoringServiceRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.set_monitoring_service(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetMonitoringServiceRequest, - dict, -]) -def test_set_monitoring_service_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.set_monitoring_service(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_set_monitoring_service_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_monitoring_service") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_monitoring_service") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.SetMonitoringServiceRequest.pb(cluster_service.SetMonitoringServiceRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.SetMonitoringServiceRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.set_monitoring_service(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_set_addons_config_rest_bad_request(request_type=cluster_service.SetAddonsConfigRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.set_addons_config(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetAddonsConfigRequest, - dict, -]) -def test_set_addons_config_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.set_addons_config(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_set_addons_config_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_addons_config") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_addons_config") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.SetAddonsConfigRequest.pb(cluster_service.SetAddonsConfigRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.SetAddonsConfigRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.set_addons_config(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_set_locations_rest_bad_request(request_type=cluster_service.SetLocationsRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.set_locations(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetLocationsRequest, - dict, -]) -def test_set_locations_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.set_locations(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_set_locations_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_locations") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_locations") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.SetLocationsRequest.pb(cluster_service.SetLocationsRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.SetLocationsRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.set_locations(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_update_master_rest_bad_request(request_type=cluster_service.UpdateMasterRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.update_master(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.UpdateMasterRequest, - dict, -]) -def test_update_master_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.update_master(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_master_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_update_master") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_update_master") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.UpdateMasterRequest.pb(cluster_service.UpdateMasterRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.UpdateMasterRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.update_master(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_set_master_auth_rest_bad_request(request_type=cluster_service.SetMasterAuthRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.set_master_auth(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetMasterAuthRequest, - dict, -]) -def test_set_master_auth_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.set_master_auth(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_set_master_auth_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_master_auth") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_master_auth") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.SetMasterAuthRequest.pb(cluster_service.SetMasterAuthRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.SetMasterAuthRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.set_master_auth(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_delete_cluster_rest_bad_request(request_type=cluster_service.DeleteClusterRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.delete_cluster(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.DeleteClusterRequest, - dict, -]) -def test_delete_cluster_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.delete_cluster(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_cluster_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_delete_cluster") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_delete_cluster") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.DeleteClusterRequest.pb(cluster_service.DeleteClusterRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.DeleteClusterRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.delete_cluster(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_list_operations_rest_bad_request(request_type=cluster_service.ListOperationsRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1/locations/sample2'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.list_operations(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.ListOperationsRequest, - dict, -]) -def test_list_operations_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1/locations/sample2'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.ListOperationsResponse( - missing_zones=['missing_zones_value'], - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.ListOperationsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.list_operations(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListOperationsResponse) - assert response.missing_zones == ['missing_zones_value'] - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_operations_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_list_operations") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_list_operations") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.ListOperationsRequest.pb(cluster_service.ListOperationsRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.ListOperationsResponse.to_json(cluster_service.ListOperationsResponse()) - req.return_value.content = return_value - - request = cluster_service.ListOperationsRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.ListOperationsResponse() - - client.list_operations(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_get_operation_rest_bad_request(request_type=cluster_service.GetOperationRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/operations/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.get_operation(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetOperationRequest, - dict, -]) -def test_get_operation_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/operations/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.get_operation(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_operation_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_get_operation") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_get_operation") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.GetOperationRequest.pb(cluster_service.GetOperationRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.GetOperationRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.get_operation(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_cancel_operation_rest_bad_request(request_type=cluster_service.CancelOperationRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/operations/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.cancel_operation(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CancelOperationRequest, - dict, -]) -def test_cancel_operation_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/operations/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = None - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - json_return_value = '' - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.cancel_operation(request) - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_cancel_operation_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_cancel_operation") as pre: - pre.assert_not_called() - pb_message = cluster_service.CancelOperationRequest.pb(cluster_service.CancelOperationRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - request = cluster_service.CancelOperationRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - - client.cancel_operation(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - - -def test_get_server_config_rest_bad_request(request_type=cluster_service.GetServerConfigRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.get_server_config(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetServerConfigRequest, - dict, -]) -def test_get_server_config_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.ServerConfig( - default_cluster_version='default_cluster_version_value', - valid_node_versions=['valid_node_versions_value'], - default_image_type='default_image_type_value', - valid_image_types=['valid_image_types_value'], - valid_master_versions=['valid_master_versions_value'], - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.ServerConfig.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.get_server_config(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ServerConfig) - assert response.default_cluster_version == 'default_cluster_version_value' - assert response.valid_node_versions == ['valid_node_versions_value'] - assert response.default_image_type == 'default_image_type_value' - assert response.valid_image_types == ['valid_image_types_value'] - assert response.valid_master_versions == ['valid_master_versions_value'] - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_server_config_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_get_server_config") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_get_server_config") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.GetServerConfigRequest.pb(cluster_service.GetServerConfigRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.ServerConfig.to_json(cluster_service.ServerConfig()) - req.return_value.content = return_value - - request = cluster_service.GetServerConfigRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.ServerConfig() - - client.get_server_config(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_get_json_web_keys_rest_bad_request(request_type=cluster_service.GetJSONWebKeysRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.get_json_web_keys(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetJSONWebKeysRequest, - dict, -]) -def test_get_json_web_keys_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.GetJSONWebKeysResponse( - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.GetJSONWebKeysResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.get_json_web_keys(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.GetJSONWebKeysResponse) - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_json_web_keys_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_get_json_web_keys") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_get_json_web_keys") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.GetJSONWebKeysRequest.pb(cluster_service.GetJSONWebKeysRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.GetJSONWebKeysResponse.to_json(cluster_service.GetJSONWebKeysResponse()) - req.return_value.content = return_value - - request = cluster_service.GetJSONWebKeysRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.GetJSONWebKeysResponse() - - client.get_json_web_keys(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_list_node_pools_rest_bad_request(request_type=cluster_service.ListNodePoolsRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.list_node_pools(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.ListNodePoolsRequest, - dict, -]) -def test_list_node_pools_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.ListNodePoolsResponse( - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.ListNodePoolsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.list_node_pools(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListNodePoolsResponse) - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_node_pools_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_list_node_pools") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_list_node_pools") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.ListNodePoolsRequest.pb(cluster_service.ListNodePoolsRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.ListNodePoolsResponse.to_json(cluster_service.ListNodePoolsResponse()) - req.return_value.content = return_value - - request = cluster_service.ListNodePoolsRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.ListNodePoolsResponse() - - client.list_node_pools(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_get_node_pool_rest_bad_request(request_type=cluster_service.GetNodePoolRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.get_node_pool(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetNodePoolRequest, - dict, -]) -def test_get_node_pool_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.NodePool( - name='name_value', - initial_node_count=1911, - locations=['locations_value'], - self_link='self_link_value', - version='version_value', - instance_group_urls=['instance_group_urls_value'], - status=cluster_service.NodePool.Status.PROVISIONING, - status_message='status_message_value', - pod_ipv4_cidr_size=1856, - etag='etag_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.NodePool.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.get_node_pool(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.NodePool) - assert response.name == 'name_value' - assert response.initial_node_count == 1911 - assert response.locations == ['locations_value'] - assert response.self_link == 'self_link_value' - assert response.version == 'version_value' - assert response.instance_group_urls == ['instance_group_urls_value'] - assert response.status == cluster_service.NodePool.Status.PROVISIONING - assert response.status_message == 'status_message_value' - assert response.pod_ipv4_cidr_size == 1856 - assert response.etag == 'etag_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_node_pool_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_get_node_pool") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_get_node_pool") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.GetNodePoolRequest.pb(cluster_service.GetNodePoolRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.NodePool.to_json(cluster_service.NodePool()) - req.return_value.content = return_value - - request = cluster_service.GetNodePoolRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.NodePool() - - client.get_node_pool(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_create_node_pool_rest_bad_request(request_type=cluster_service.CreateNodePoolRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.create_node_pool(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CreateNodePoolRequest, - dict, -]) -def test_create_node_pool_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.create_node_pool(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_node_pool_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_create_node_pool") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_create_node_pool") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.CreateNodePoolRequest.pb(cluster_service.CreateNodePoolRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.CreateNodePoolRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.create_node_pool(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_delete_node_pool_rest_bad_request(request_type=cluster_service.DeleteNodePoolRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.delete_node_pool(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.DeleteNodePoolRequest, - dict, -]) -def test_delete_node_pool_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.delete_node_pool(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_node_pool_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_delete_node_pool") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_delete_node_pool") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.DeleteNodePoolRequest.pb(cluster_service.DeleteNodePoolRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.DeleteNodePoolRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.delete_node_pool(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_complete_node_pool_upgrade_rest_bad_request(request_type=cluster_service.CompleteNodePoolUpgradeRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.complete_node_pool_upgrade(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CompleteNodePoolUpgradeRequest, - dict, -]) -def test_complete_node_pool_upgrade_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = None - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - json_return_value = '' - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.complete_node_pool_upgrade(request) - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_complete_node_pool_upgrade_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_complete_node_pool_upgrade") as pre: - pre.assert_not_called() - pb_message = cluster_service.CompleteNodePoolUpgradeRequest.pb(cluster_service.CompleteNodePoolUpgradeRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - - request = cluster_service.CompleteNodePoolUpgradeRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - - client.complete_node_pool_upgrade(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - - -def test_rollback_node_pool_upgrade_rest_bad_request(request_type=cluster_service.RollbackNodePoolUpgradeRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.rollback_node_pool_upgrade(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.RollbackNodePoolUpgradeRequest, - dict, -]) -def test_rollback_node_pool_upgrade_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.rollback_node_pool_upgrade(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_rollback_node_pool_upgrade_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_rollback_node_pool_upgrade") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_rollback_node_pool_upgrade") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.RollbackNodePoolUpgradeRequest.pb(cluster_service.RollbackNodePoolUpgradeRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.RollbackNodePoolUpgradeRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.rollback_node_pool_upgrade(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_set_node_pool_management_rest_bad_request(request_type=cluster_service.SetNodePoolManagementRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.set_node_pool_management(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetNodePoolManagementRequest, - dict, -]) -def test_set_node_pool_management_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.set_node_pool_management(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_set_node_pool_management_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_node_pool_management") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_node_pool_management") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.SetNodePoolManagementRequest.pb(cluster_service.SetNodePoolManagementRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.SetNodePoolManagementRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.set_node_pool_management(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_set_labels_rest_bad_request(request_type=cluster_service.SetLabelsRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.set_labels(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetLabelsRequest, - dict, -]) -def test_set_labels_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.set_labels(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_set_labels_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_labels") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_labels") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.SetLabelsRequest.pb(cluster_service.SetLabelsRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.SetLabelsRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.set_labels(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_set_legacy_abac_rest_bad_request(request_type=cluster_service.SetLegacyAbacRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.set_legacy_abac(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetLegacyAbacRequest, - dict, -]) -def test_set_legacy_abac_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.set_legacy_abac(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_set_legacy_abac_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_legacy_abac") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_legacy_abac") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.SetLegacyAbacRequest.pb(cluster_service.SetLegacyAbacRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.SetLegacyAbacRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.set_legacy_abac(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_start_ip_rotation_rest_bad_request(request_type=cluster_service.StartIPRotationRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.start_ip_rotation(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.StartIPRotationRequest, - dict, -]) -def test_start_ip_rotation_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.start_ip_rotation(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_start_ip_rotation_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_start_ip_rotation") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_start_ip_rotation") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.StartIPRotationRequest.pb(cluster_service.StartIPRotationRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.StartIPRotationRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.start_ip_rotation(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_complete_ip_rotation_rest_bad_request(request_type=cluster_service.CompleteIPRotationRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.complete_ip_rotation(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CompleteIPRotationRequest, - dict, -]) -def test_complete_ip_rotation_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.complete_ip_rotation(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_complete_ip_rotation_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_complete_ip_rotation") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_complete_ip_rotation") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.CompleteIPRotationRequest.pb(cluster_service.CompleteIPRotationRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.CompleteIPRotationRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.complete_ip_rotation(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_set_node_pool_size_rest_bad_request(request_type=cluster_service.SetNodePoolSizeRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.set_node_pool_size(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetNodePoolSizeRequest, - dict, -]) -def test_set_node_pool_size_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3/nodePools/sample4'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.set_node_pool_size(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_set_node_pool_size_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_node_pool_size") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_node_pool_size") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.SetNodePoolSizeRequest.pb(cluster_service.SetNodePoolSizeRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.SetNodePoolSizeRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.set_node_pool_size(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_set_network_policy_rest_bad_request(request_type=cluster_service.SetNetworkPolicyRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.set_network_policy(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetNetworkPolicyRequest, - dict, -]) -def test_set_network_policy_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.set_network_policy(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_set_network_policy_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_network_policy") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_network_policy") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.SetNetworkPolicyRequest.pb(cluster_service.SetNetworkPolicyRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.SetNetworkPolicyRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.set_network_policy(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_set_maintenance_policy_rest_bad_request(request_type=cluster_service.SetMaintenancePolicyRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.set_maintenance_policy(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetMaintenancePolicyRequest, - dict, -]) -def test_set_maintenance_policy_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.Operation.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.set_maintenance_policy(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_set_maintenance_policy_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_set_maintenance_policy") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_set_maintenance_policy") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.SetMaintenancePolicyRequest.pb(cluster_service.SetMaintenancePolicyRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.Operation.to_json(cluster_service.Operation()) - req.return_value.content = return_value - - request = cluster_service.SetMaintenancePolicyRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.Operation() - - client.set_maintenance_policy(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_list_usable_subnetworks_rest_bad_request(request_type=cluster_service.ListUsableSubnetworksRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.list_usable_subnetworks(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.ListUsableSubnetworksRequest, - dict, -]) -def test_list_usable_subnetworks_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'parent': 'projects/sample1'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.ListUsableSubnetworksResponse( - next_page_token='next_page_token_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.ListUsableSubnetworksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.list_usable_subnetworks(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListUsableSubnetworksPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_usable_subnetworks_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_list_usable_subnetworks") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_list_usable_subnetworks") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.ListUsableSubnetworksRequest.pb(cluster_service.ListUsableSubnetworksRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.ListUsableSubnetworksResponse.to_json(cluster_service.ListUsableSubnetworksResponse()) - req.return_value.content = return_value - - request = cluster_service.ListUsableSubnetworksRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.ListUsableSubnetworksResponse() - - client.list_usable_subnetworks(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - - -def test_check_autopilot_compatibility_rest_bad_request(request_type=cluster_service.CheckAutopilotCompatibilityRequest): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, 'request') as req, pytest.raises(core_exceptions.BadRequest): - # Wrap the value into a proper Response obj - response_value = mock.Mock() - json_return_value = '' - response_value.json = mock.Mock(return_value={}) - response_value.status_code = 400 - response_value.request = mock.Mock() - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - client.check_autopilot_compatibility(request) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CheckAutopilotCompatibilityRequest, - dict, -]) -def test_check_autopilot_compatibility_rest_call_success(request_type): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - - # send a request that will satisfy transcoding - request_init = {'name': 'projects/sample1/locations/sample2/clusters/sample3'} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), 'request') as req: - # Designate an appropriate value for the returned response. - return_value = cluster_service.CheckAutopilotCompatibilityResponse( - summary='summary_value', - ) - - # Wrap the value into a proper Response obj - response_value = mock.Mock() - response_value.status_code = 200 - - # Convert return value to protobuf type - return_value = cluster_service.CheckAutopilotCompatibilityResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value.content = json_return_value.encode('UTF-8') - req.return_value = response_value - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - response = client.check_autopilot_compatibility(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) - assert response.summary == 'summary_value' - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_check_autopilot_compatibility_rest_interceptors(null_interceptor): - transport = transports.ClusterManagerRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ClusterManagerRestInterceptor(), - ) - client = ClusterManagerClient(transport=transport) - - with mock.patch.object(type(client.transport._session), "request") as req, \ - mock.patch.object(path_template, "transcode") as transcode, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "post_check_autopilot_compatibility") as post, \ - mock.patch.object(transports.ClusterManagerRestInterceptor, "pre_check_autopilot_compatibility") as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = cluster_service.CheckAutopilotCompatibilityRequest.pb(cluster_service.CheckAutopilotCompatibilityRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = mock.Mock() - req.return_value.status_code = 200 - req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} - return_value = cluster_service.CheckAutopilotCompatibilityResponse.to_json(cluster_service.CheckAutopilotCompatibilityResponse()) - req.return_value.content = return_value - - request = cluster_service.CheckAutopilotCompatibilityRequest() - metadata =[ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = cluster_service.CheckAutopilotCompatibilityResponse() - - client.check_autopilot_compatibility(request, metadata=[("key", "val"), ("cephalopod", "squid"),]) - - pre.assert_called_once() - post.assert_called_once() - -def test_initialize_client_w_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - assert client is not None - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_list_clusters_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - client.list_clusters(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListClustersRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_cluster_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - client.get_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_create_cluster_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - client.create_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CreateClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_update_cluster_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - client.update_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_update_node_pool_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_node_pool), - '__call__') as call: - client.update_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_node_pool_autoscaling_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_autoscaling), - '__call__') as call: - client.set_node_pool_autoscaling(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolAutoscalingRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_logging_service_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - client.set_logging_service(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLoggingServiceRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_monitoring_service_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - client.set_monitoring_service(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMonitoringServiceRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_addons_config_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - client.set_addons_config(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetAddonsConfigRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_locations_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - client.set_locations(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLocationsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_update_master_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - client.update_master(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateMasterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_master_auth_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_master_auth), - '__call__') as call: - client.set_master_auth(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMasterAuthRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_delete_cluster_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - client.delete_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.DeleteClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_list_operations_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - client.list_operations(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListOperationsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_operation_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - client.get_operation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetOperationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_cancel_operation_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - client.cancel_operation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CancelOperationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_server_config_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - client.get_server_config(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetServerConfigRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_json_web_keys_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_json_web_keys), - '__call__') as call: - client.get_json_web_keys(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetJSONWebKeysRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_list_node_pools_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - client.list_node_pools(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListNodePoolsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_node_pool_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - client.get_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_create_node_pool_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - client.create_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CreateNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_delete_node_pool_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - client.delete_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.DeleteNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_complete_node_pool_upgrade_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.complete_node_pool_upgrade), - '__call__') as call: - client.complete_node_pool_upgrade(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CompleteNodePoolUpgradeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_rollback_node_pool_upgrade_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - client.rollback_node_pool_upgrade(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.RollbackNodePoolUpgradeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_node_pool_management_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_management), - '__call__') as call: - client.set_node_pool_management(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolManagementRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_labels_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_labels), - '__call__') as call: - client.set_labels(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLabelsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_legacy_abac_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - client.set_legacy_abac(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLegacyAbacRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_start_ip_rotation_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - client.start_ip_rotation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.StartIPRotationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_complete_ip_rotation_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - client.complete_ip_rotation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CompleteIPRotationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_node_pool_size_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_size), - '__call__') as call: - client.set_node_pool_size(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolSizeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_network_policy_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - client.set_network_policy(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNetworkPolicyRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_maintenance_policy_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - client.set_maintenance_policy(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMaintenancePolicyRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_list_usable_subnetworks_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__') as call: - client.list_usable_subnetworks(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListUsableSubnetworksRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_check_autopilot_compatibility_empty_call_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.check_autopilot_compatibility), - '__call__') as call: - client.check_autopilot_compatibility(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CheckAutopilotCompatibilityRequest() - - assert args[0] == request_msg - - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.ClusterManagerGrpcTransport, - ) - -def test_cluster_manager_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.ClusterManagerTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json" - ) - - -def test_cluster_manager_base_transport(): - # Instantiate the base transport. - with mock.patch('google.cloud.container_v1.services.cluster_manager.transports.ClusterManagerTransport.__init__') as Transport: - Transport.return_value = None - transport = transports.ClusterManagerTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - 'list_clusters', - 'get_cluster', - 'create_cluster', - 'update_cluster', - 'update_node_pool', - 'set_node_pool_autoscaling', - 'set_logging_service', - 'set_monitoring_service', - 'set_addons_config', - 'set_locations', - 'update_master', - 'set_master_auth', - 'delete_cluster', - 'list_operations', - 'get_operation', - 'cancel_operation', - 'get_server_config', - 'get_json_web_keys', - 'list_node_pools', - 'get_node_pool', - 'create_node_pool', - 'delete_node_pool', - 'complete_node_pool_upgrade', - 'rollback_node_pool_upgrade', - 'set_node_pool_management', - 'set_labels', - 'set_legacy_abac', - 'start_ip_rotation', - 'complete_ip_rotation', - 'set_node_pool_size', - 'set_network_policy', - 'set_maintenance_policy', - 'list_usable_subnetworks', - 'check_autopilot_compatibility', - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Catch all for all remaining methods and properties - remainder = [ - 'kind', - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_cluster_manager_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.container_v1.services.cluster_manager.transports.ClusterManagerTransport._prep_wrapped_messages') as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.ClusterManagerTransport( - 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_cluster_manager_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.container_v1.services.cluster_manager.transports.ClusterManagerTransport._prep_wrapped_messages') as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.ClusterManagerTransport() - adc.assert_called_once() - - -def test_cluster_manager_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) - ClusterManagerClient() - 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.ClusterManagerGrpcTransport, - transports.ClusterManagerGrpcAsyncIOTransport, - ], -) -def test_cluster_manager_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.ClusterManagerGrpcTransport, - transports.ClusterManagerGrpcAsyncIOTransport, - transports.ClusterManagerRestTransport, - ], -) -def test_cluster_manager_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.ClusterManagerGrpcTransport, grpc_helpers), - (transports.ClusterManagerGrpcAsyncIOTransport, grpc_helpers_async) - ], -) -def test_cluster_manager_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( - "container.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="container.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("transport_class", [transports.ClusterManagerGrpcTransport, transports.ClusterManagerGrpcAsyncIOTransport]) -def test_cluster_manager_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 - ) - -def test_cluster_manager_http_transport_client_cert_source_for_mtls(): - cred = ga_credentials.AnonymousCredentials() - with mock.patch("google.auth.transport.requests.AuthorizedSession.configure_mtls_channel") as mock_configure_mtls_channel: - transports.ClusterManagerRestTransport ( - credentials=cred, - client_cert_source_for_mtls=client_cert_source_callback - ) - mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) - - -@pytest.mark.parametrize("transport_name", [ - "grpc", - "grpc_asyncio", - "rest", -]) -def test_cluster_manager_host_no_port(transport_name): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='container.googleapis.com'), - transport=transport_name, - ) - assert client.transport._host == ( - 'container.googleapis.com:443' - if transport_name in ['grpc', 'grpc_asyncio'] - else 'https://container.googleapis.com' - ) - -@pytest.mark.parametrize("transport_name", [ - "grpc", - "grpc_asyncio", - "rest", -]) -def test_cluster_manager_host_with_port(transport_name): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='container.googleapis.com:8000'), - transport=transport_name, - ) - assert client.transport._host == ( - 'container.googleapis.com:8000' - if transport_name in ['grpc', 'grpc_asyncio'] - else 'https://container.googleapis.com:8000' - ) - -@pytest.mark.parametrize("transport_name", [ - "rest", -]) -def test_cluster_manager_client_transport_session_collision(transport_name): - creds1 = ga_credentials.AnonymousCredentials() - creds2 = ga_credentials.AnonymousCredentials() - client1 = ClusterManagerClient( - credentials=creds1, - transport=transport_name, - ) - client2 = ClusterManagerClient( - credentials=creds2, - transport=transport_name, - ) - session1 = client1.transport.list_clusters._session - session2 = client2.transport.list_clusters._session - assert session1 != session2 - session1 = client1.transport.get_cluster._session - session2 = client2.transport.get_cluster._session - assert session1 != session2 - session1 = client1.transport.create_cluster._session - session2 = client2.transport.create_cluster._session - assert session1 != session2 - session1 = client1.transport.update_cluster._session - session2 = client2.transport.update_cluster._session - assert session1 != session2 - session1 = client1.transport.update_node_pool._session - session2 = client2.transport.update_node_pool._session - assert session1 != session2 - session1 = client1.transport.set_node_pool_autoscaling._session - session2 = client2.transport.set_node_pool_autoscaling._session - assert session1 != session2 - session1 = client1.transport.set_logging_service._session - session2 = client2.transport.set_logging_service._session - assert session1 != session2 - session1 = client1.transport.set_monitoring_service._session - session2 = client2.transport.set_monitoring_service._session - assert session1 != session2 - session1 = client1.transport.set_addons_config._session - session2 = client2.transport.set_addons_config._session - assert session1 != session2 - session1 = client1.transport.set_locations._session - session2 = client2.transport.set_locations._session - assert session1 != session2 - session1 = client1.transport.update_master._session - session2 = client2.transport.update_master._session - assert session1 != session2 - session1 = client1.transport.set_master_auth._session - session2 = client2.transport.set_master_auth._session - assert session1 != session2 - session1 = client1.transport.delete_cluster._session - session2 = client2.transport.delete_cluster._session - assert session1 != session2 - session1 = client1.transport.list_operations._session - session2 = client2.transport.list_operations._session - assert session1 != session2 - session1 = client1.transport.get_operation._session - session2 = client2.transport.get_operation._session - assert session1 != session2 - session1 = client1.transport.cancel_operation._session - session2 = client2.transport.cancel_operation._session - assert session1 != session2 - session1 = client1.transport.get_server_config._session - session2 = client2.transport.get_server_config._session - assert session1 != session2 - session1 = client1.transport.get_json_web_keys._session - session2 = client2.transport.get_json_web_keys._session - assert session1 != session2 - session1 = client1.transport.list_node_pools._session - session2 = client2.transport.list_node_pools._session - assert session1 != session2 - session1 = client1.transport.get_node_pool._session - session2 = client2.transport.get_node_pool._session - assert session1 != session2 - session1 = client1.transport.create_node_pool._session - session2 = client2.transport.create_node_pool._session - assert session1 != session2 - session1 = client1.transport.delete_node_pool._session - session2 = client2.transport.delete_node_pool._session - assert session1 != session2 - session1 = client1.transport.complete_node_pool_upgrade._session - session2 = client2.transport.complete_node_pool_upgrade._session - assert session1 != session2 - session1 = client1.transport.rollback_node_pool_upgrade._session - session2 = client2.transport.rollback_node_pool_upgrade._session - assert session1 != session2 - session1 = client1.transport.set_node_pool_management._session - session2 = client2.transport.set_node_pool_management._session - assert session1 != session2 - session1 = client1.transport.set_labels._session - session2 = client2.transport.set_labels._session - assert session1 != session2 - session1 = client1.transport.set_legacy_abac._session - session2 = client2.transport.set_legacy_abac._session - assert session1 != session2 - session1 = client1.transport.start_ip_rotation._session - session2 = client2.transport.start_ip_rotation._session - assert session1 != session2 - session1 = client1.transport.complete_ip_rotation._session - session2 = client2.transport.complete_ip_rotation._session - assert session1 != session2 - session1 = client1.transport.set_node_pool_size._session - session2 = client2.transport.set_node_pool_size._session - assert session1 != session2 - session1 = client1.transport.set_network_policy._session - session2 = client2.transport.set_network_policy._session - assert session1 != session2 - session1 = client1.transport.set_maintenance_policy._session - session2 = client2.transport.set_maintenance_policy._session - assert session1 != session2 - session1 = client1.transport.list_usable_subnetworks._session - session2 = client2.transport.list_usable_subnetworks._session - assert session1 != session2 - session1 = client1.transport.check_autopilot_compatibility._session - session2 = client2.transport.check_autopilot_compatibility._session - assert session1 != session2 -def test_cluster_manager_grpc_transport_channel(): - channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.ClusterManagerGrpcTransport( - 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_cluster_manager_grpc_asyncio_transport_channel(): - channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.ClusterManagerGrpcAsyncIOTransport( - 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.ClusterManagerGrpcTransport, transports.ClusterManagerGrpcAsyncIOTransport]) -def test_cluster_manager_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.ClusterManagerGrpcTransport, transports.ClusterManagerGrpcAsyncIOTransport]) -def test_cluster_manager_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_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 = ClusterManagerClient.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 = ClusterManagerClient.ca_pool_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.parse_ca_pool_path(path) - assert expected == actual - -def test_crypto_key_version_path(): - project = "cuttlefish" - location = "mussel" - key_ring = "winkle" - crypto_key = "nautilus" - crypto_key_version = "scallop" - expected = "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}".format(project=project, location=location, key_ring=key_ring, crypto_key=crypto_key, crypto_key_version=crypto_key_version, ) - actual = ClusterManagerClient.crypto_key_version_path(project, location, key_ring, crypto_key, crypto_key_version) - assert expected == actual - - -def test_parse_crypto_key_version_path(): - expected = { - "project": "abalone", - "location": "squid", - "key_ring": "clam", - "crypto_key": "whelk", - "crypto_key_version": "octopus", - } - path = ClusterManagerClient.crypto_key_version_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.parse_crypto_key_version_path(path) - assert expected == actual - -def test_topic_path(): - project = "oyster" - topic = "nudibranch" - expected = "projects/{project}/topics/{topic}".format(project=project, topic=topic, ) - actual = ClusterManagerClient.topic_path(project, topic) - assert expected == actual - - -def test_parse_topic_path(): - expected = { - "project": "cuttlefish", - "topic": "mussel", - } - path = ClusterManagerClient.topic_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.parse_topic_path(path) - assert expected == actual - -def test_common_billing_account_path(): - billing_account = "winkle" - expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) - actual = ClusterManagerClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "nautilus", - } - path = ClusterManagerClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.parse_common_billing_account_path(path) - assert expected == actual - -def test_common_folder_path(): - folder = "scallop" - expected = "folders/{folder}".format(folder=folder, ) - actual = ClusterManagerClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "abalone", - } - path = ClusterManagerClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.parse_common_folder_path(path) - assert expected == actual - -def test_common_organization_path(): - organization = "squid" - expected = "organizations/{organization}".format(organization=organization, ) - actual = ClusterManagerClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "clam", - } - path = ClusterManagerClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.parse_common_organization_path(path) - assert expected == actual - -def test_common_project_path(): - project = "whelk" - expected = "projects/{project}".format(project=project, ) - actual = ClusterManagerClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "octopus", - } - path = ClusterManagerClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.parse_common_project_path(path) - assert expected == actual - -def test_common_location_path(): - project = "oyster" - location = "nudibranch" - expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) - actual = ClusterManagerClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "cuttlefish", - "location": "mussel", - } - path = ClusterManagerClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.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.ClusterManagerTransport, '_prep_wrapped_messages') as prep: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object(transports.ClusterManagerTransport, '_prep_wrapped_messages') as prep: - transport_class = ClusterManagerClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - -def test_transport_close_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc" - ) - with mock.patch.object(type(getattr(client.transport, "_grpc_channel")), "close") as close: - with client: - close.assert_not_called() - close.assert_called_once() - - -@pytest.mark.asyncio -async def test_transport_close_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_rest(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest" - ) - with mock.patch.object(type(getattr(client.transport, "_session")), "close") as close: - with client: - close.assert_not_called() - close.assert_called_once() - - -def test_client_ctx(): - transports = [ - 'rest', - 'grpc', - ] - for transport in transports: - client = ClusterManagerClient( - 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", [ - (ClusterManagerClient, transports.ClusterManagerGrpcTransport), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport), -]) -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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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/google-cloud-container/v1beta1/.coveragerc b/owl-bot-staging/google-cloud-container/v1beta1/.coveragerc deleted file mode 100644 index 113f6dbccc9f..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -branch = True - -[report] -show_missing = True -omit = - google/cloud/container/__init__.py - google/cloud/container/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/google-cloud-container/v1beta1/.flake8 b/owl-bot-staging/google-cloud-container/v1beta1/.flake8 deleted file mode 100644 index 29227d4cf419..000000000000 --- a/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1beta1/MANIFEST.in b/owl-bot-staging/google-cloud-container/v1beta1/MANIFEST.in deleted file mode 100644 index d046233379ae..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -recursive-include google/cloud/container *.py -recursive-include google/cloud/container_v1beta1 *.py diff --git a/owl-bot-staging/google-cloud-container/v1beta1/README.rst b/owl-bot-staging/google-cloud-container/v1beta1/README.rst deleted file mode 100644 index 4f18726b102d..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/README.rst +++ /dev/null @@ -1,49 +0,0 @@ -Python Client for Google Cloud Container 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 Container 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/google-cloud-container/v1beta1/docs/_static/custom.css b/owl-bot-staging/google-cloud-container/v1beta1/docs/_static/custom.css deleted file mode 100644 index 06423be0b592..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/docs/_static/custom.css +++ /dev/null @@ -1,3 +0,0 @@ -dl.field-list > dt { - min-width: 100px -} diff --git a/owl-bot-staging/google-cloud-container/v1beta1/docs/conf.py b/owl-bot-staging/google-cloud-container/v1beta1/docs/conf.py deleted file mode 100644 index 5a9f847ff28e..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/docs/conf.py +++ /dev/null @@ -1,376 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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-container 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-container" -copyright = u"2023, 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 = 'en' - -# 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 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-container-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-container.tex", - u"google-cloud-container 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-container", - u"Google Cloud Container 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-container", - u"google-cloud-container Documentation", - author, - "google-cloud-container", - "GAPIC library for Google Cloud Container 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/google-cloud-container/v1beta1/docs/container_v1beta1/cluster_manager.rst b/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/cluster_manager.rst deleted file mode 100644 index 3a3a443d5810..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/cluster_manager.rst +++ /dev/null @@ -1,10 +0,0 @@ -ClusterManager --------------------------------- - -.. automodule:: google.cloud.container_v1beta1.services.cluster_manager - :members: - :inherited-members: - -.. automodule:: google.cloud.container_v1beta1.services.cluster_manager.pagers - :members: - :inherited-members: diff --git a/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/services_.rst b/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/services_.rst deleted file mode 100644 index 8b6dae4d5e90..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/services_.rst +++ /dev/null @@ -1,6 +0,0 @@ -Services for Google Cloud Container v1beta1 API -=============================================== -.. toctree:: - :maxdepth: 2 - - cluster_manager diff --git a/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/types_.rst b/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/types_.rst deleted file mode 100644 index d4baa1c5101b..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/docs/container_v1beta1/types_.rst +++ /dev/null @@ -1,6 +0,0 @@ -Types for Google Cloud Container v1beta1 API -============================================ - -.. automodule:: google.cloud.container_v1beta1.types - :members: - :show-inheritance: diff --git a/owl-bot-staging/google-cloud-container/v1beta1/docs/index.rst b/owl-bot-staging/google-cloud-container/v1beta1/docs/index.rst deleted file mode 100644 index 5f9a4d460489..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/docs/index.rst +++ /dev/null @@ -1,7 +0,0 @@ -API Reference -------------- -.. toctree:: - :maxdepth: 2 - - container_v1beta1/services_ - container_v1beta1/types_ diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/__init__.py deleted file mode 100644 index ddc4611b552a..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/__init__.py +++ /dev/null @@ -1,407 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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.container import gapic_version as package_version - -__version__ = package_version.__version__ - - -from google.cloud.container_v1beta1.services.cluster_manager.client import ClusterManagerClient -from google.cloud.container_v1beta1.services.cluster_manager.async_client import ClusterManagerAsyncClient - -from google.cloud.container_v1beta1.types.cluster_service import AcceleratorConfig -from google.cloud.container_v1beta1.types.cluster_service import AdditionalNodeNetworkConfig -from google.cloud.container_v1beta1.types.cluster_service import AdditionalPodNetworkConfig -from google.cloud.container_v1beta1.types.cluster_service import AdditionalPodRangesConfig -from google.cloud.container_v1beta1.types.cluster_service import AddonsConfig -from google.cloud.container_v1beta1.types.cluster_service import AdvancedDatapathObservabilityConfig -from google.cloud.container_v1beta1.types.cluster_service import AdvancedMachineFeatures -from google.cloud.container_v1beta1.types.cluster_service import AuthenticatorGroupsConfig -from google.cloud.container_v1beta1.types.cluster_service import Autopilot -from google.cloud.container_v1beta1.types.cluster_service import AutopilotCompatibilityIssue -from google.cloud.container_v1beta1.types.cluster_service import AutopilotConversionStatus -from google.cloud.container_v1beta1.types.cluster_service import AutoprovisioningNodePoolDefaults -from google.cloud.container_v1beta1.types.cluster_service import AutoUpgradeOptions -from google.cloud.container_v1beta1.types.cluster_service import BestEffortProvisioning -from google.cloud.container_v1beta1.types.cluster_service import BinaryAuthorization -from google.cloud.container_v1beta1.types.cluster_service import BlueGreenSettings -from google.cloud.container_v1beta1.types.cluster_service import CancelOperationRequest -from google.cloud.container_v1beta1.types.cluster_service import CheckAutopilotCompatibilityRequest -from google.cloud.container_v1beta1.types.cluster_service import CheckAutopilotCompatibilityResponse -from google.cloud.container_v1beta1.types.cluster_service import ClientCertificateConfig -from google.cloud.container_v1beta1.types.cluster_service import CloudRunConfig -from google.cloud.container_v1beta1.types.cluster_service import Cluster -from google.cloud.container_v1beta1.types.cluster_service import ClusterAutoscaling -from google.cloud.container_v1beta1.types.cluster_service import ClusterTelemetry -from google.cloud.container_v1beta1.types.cluster_service import ClusterUpdate -from google.cloud.container_v1beta1.types.cluster_service import CompleteIPRotationRequest -from google.cloud.container_v1beta1.types.cluster_service import CompleteNodePoolUpgradeRequest -from google.cloud.container_v1beta1.types.cluster_service import CompliancePostureConfig -from google.cloud.container_v1beta1.types.cluster_service import ConfidentialNodes -from google.cloud.container_v1beta1.types.cluster_service import ConfigConnectorConfig -from google.cloud.container_v1beta1.types.cluster_service import ContainerdConfig -from google.cloud.container_v1beta1.types.cluster_service import CostManagementConfig -from google.cloud.container_v1beta1.types.cluster_service import CreateClusterRequest -from google.cloud.container_v1beta1.types.cluster_service import CreateNodePoolRequest -from google.cloud.container_v1beta1.types.cluster_service import DailyMaintenanceWindow -from google.cloud.container_v1beta1.types.cluster_service import DatabaseEncryption -from google.cloud.container_v1beta1.types.cluster_service import DefaultSnatStatus -from google.cloud.container_v1beta1.types.cluster_service import DeleteClusterRequest -from google.cloud.container_v1beta1.types.cluster_service import DeleteNodePoolRequest -from google.cloud.container_v1beta1.types.cluster_service import DnsCacheConfig -from google.cloud.container_v1beta1.types.cluster_service import DNSConfig -from google.cloud.container_v1beta1.types.cluster_service import EnterpriseConfig -from google.cloud.container_v1beta1.types.cluster_service import EphemeralStorageConfig -from google.cloud.container_v1beta1.types.cluster_service import EphemeralStorageLocalSsdConfig -from google.cloud.container_v1beta1.types.cluster_service import FastSocket -from google.cloud.container_v1beta1.types.cluster_service import Fleet -from google.cloud.container_v1beta1.types.cluster_service import GatewayAPIConfig -from google.cloud.container_v1beta1.types.cluster_service import GcePersistentDiskCsiDriverConfig -from google.cloud.container_v1beta1.types.cluster_service import GcfsConfig -from google.cloud.container_v1beta1.types.cluster_service import GcpFilestoreCsiDriverConfig -from google.cloud.container_v1beta1.types.cluster_service import GcsFuseCsiDriverConfig -from google.cloud.container_v1beta1.types.cluster_service import GetClusterRequest -from google.cloud.container_v1beta1.types.cluster_service import GetJSONWebKeysRequest -from google.cloud.container_v1beta1.types.cluster_service import GetJSONWebKeysResponse -from google.cloud.container_v1beta1.types.cluster_service import GetNodePoolRequest -from google.cloud.container_v1beta1.types.cluster_service import GetOpenIDConfigRequest -from google.cloud.container_v1beta1.types.cluster_service import GetOpenIDConfigResponse -from google.cloud.container_v1beta1.types.cluster_service import GetOperationRequest -from google.cloud.container_v1beta1.types.cluster_service import GetServerConfigRequest -from google.cloud.container_v1beta1.types.cluster_service import GkeBackupAgentConfig -from google.cloud.container_v1beta1.types.cluster_service import GPUDriverInstallationConfig -from google.cloud.container_v1beta1.types.cluster_service import GPUSharingConfig -from google.cloud.container_v1beta1.types.cluster_service import HorizontalPodAutoscaling -from google.cloud.container_v1beta1.types.cluster_service import HostMaintenancePolicy -from google.cloud.container_v1beta1.types.cluster_service import HttpLoadBalancing -from google.cloud.container_v1beta1.types.cluster_service import IdentityServiceConfig -from google.cloud.container_v1beta1.types.cluster_service import ILBSubsettingConfig -from google.cloud.container_v1beta1.types.cluster_service import IntraNodeVisibilityConfig -from google.cloud.container_v1beta1.types.cluster_service import IPAllocationPolicy -from google.cloud.container_v1beta1.types.cluster_service import IstioConfig -from google.cloud.container_v1beta1.types.cluster_service import Jwk -from google.cloud.container_v1beta1.types.cluster_service import K8sBetaAPIConfig -from google.cloud.container_v1beta1.types.cluster_service import KalmConfig -from google.cloud.container_v1beta1.types.cluster_service import KubernetesDashboard -from google.cloud.container_v1beta1.types.cluster_service import LegacyAbac -from google.cloud.container_v1beta1.types.cluster_service import LinuxNodeConfig -from google.cloud.container_v1beta1.types.cluster_service import ListClustersRequest -from google.cloud.container_v1beta1.types.cluster_service import ListClustersResponse -from google.cloud.container_v1beta1.types.cluster_service import ListLocationsRequest -from google.cloud.container_v1beta1.types.cluster_service import ListLocationsResponse -from google.cloud.container_v1beta1.types.cluster_service import ListNodePoolsRequest -from google.cloud.container_v1beta1.types.cluster_service import ListNodePoolsResponse -from google.cloud.container_v1beta1.types.cluster_service import ListOperationsRequest -from google.cloud.container_v1beta1.types.cluster_service import ListOperationsResponse -from google.cloud.container_v1beta1.types.cluster_service import ListUsableSubnetworksRequest -from google.cloud.container_v1beta1.types.cluster_service import ListUsableSubnetworksResponse -from google.cloud.container_v1beta1.types.cluster_service import LocalNvmeSsdBlockConfig -from google.cloud.container_v1beta1.types.cluster_service import Location -from google.cloud.container_v1beta1.types.cluster_service import LoggingComponentConfig -from google.cloud.container_v1beta1.types.cluster_service import LoggingConfig -from google.cloud.container_v1beta1.types.cluster_service import LoggingVariantConfig -from google.cloud.container_v1beta1.types.cluster_service import MaintenanceExclusionOptions -from google.cloud.container_v1beta1.types.cluster_service import MaintenancePolicy -from google.cloud.container_v1beta1.types.cluster_service import MaintenanceWindow -from google.cloud.container_v1beta1.types.cluster_service import ManagedPrometheusConfig -from google.cloud.container_v1beta1.types.cluster_service import Master -from google.cloud.container_v1beta1.types.cluster_service import MasterAuth -from google.cloud.container_v1beta1.types.cluster_service import MasterAuthorizedNetworksConfig -from google.cloud.container_v1beta1.types.cluster_service import MaxPodsConstraint -from google.cloud.container_v1beta1.types.cluster_service import MeshCertificates -from google.cloud.container_v1beta1.types.cluster_service import MonitoringComponentConfig -from google.cloud.container_v1beta1.types.cluster_service import MonitoringConfig -from google.cloud.container_v1beta1.types.cluster_service import NetworkConfig -from google.cloud.container_v1beta1.types.cluster_service import NetworkPolicy -from google.cloud.container_v1beta1.types.cluster_service import NetworkPolicyConfig -from google.cloud.container_v1beta1.types.cluster_service import NetworkTags -from google.cloud.container_v1beta1.types.cluster_service import NodeConfig -from google.cloud.container_v1beta1.types.cluster_service import NodeConfigDefaults -from google.cloud.container_v1beta1.types.cluster_service import NodeKubeletConfig -from google.cloud.container_v1beta1.types.cluster_service import NodeLabels -from google.cloud.container_v1beta1.types.cluster_service import NodeManagement -from google.cloud.container_v1beta1.types.cluster_service import NodeNetworkConfig -from google.cloud.container_v1beta1.types.cluster_service import NodePool -from google.cloud.container_v1beta1.types.cluster_service import NodePoolAutoConfig -from google.cloud.container_v1beta1.types.cluster_service import NodePoolAutoscaling -from google.cloud.container_v1beta1.types.cluster_service import NodePoolDefaults -from google.cloud.container_v1beta1.types.cluster_service import NodePoolLoggingConfig -from google.cloud.container_v1beta1.types.cluster_service import NodeTaint -from google.cloud.container_v1beta1.types.cluster_service import NodeTaints -from google.cloud.container_v1beta1.types.cluster_service import NotificationConfig -from google.cloud.container_v1beta1.types.cluster_service import Operation -from google.cloud.container_v1beta1.types.cluster_service import OperationProgress -from google.cloud.container_v1beta1.types.cluster_service import PodCIDROverprovisionConfig -from google.cloud.container_v1beta1.types.cluster_service import PodSecurityPolicyConfig -from google.cloud.container_v1beta1.types.cluster_service import PrivateClusterConfig -from google.cloud.container_v1beta1.types.cluster_service import PrivateClusterMasterGlobalAccessConfig -from google.cloud.container_v1beta1.types.cluster_service import ProtectConfig -from google.cloud.container_v1beta1.types.cluster_service import RangeInfo -from google.cloud.container_v1beta1.types.cluster_service import RayClusterLoggingConfig -from google.cloud.container_v1beta1.types.cluster_service import RayClusterMonitoringConfig -from google.cloud.container_v1beta1.types.cluster_service import RayOperatorConfig -from google.cloud.container_v1beta1.types.cluster_service import RecurringTimeWindow -from google.cloud.container_v1beta1.types.cluster_service import ReleaseChannel -from google.cloud.container_v1beta1.types.cluster_service import ReservationAffinity -from google.cloud.container_v1beta1.types.cluster_service import ResourceLabels -from google.cloud.container_v1beta1.types.cluster_service import ResourceLimit -from google.cloud.container_v1beta1.types.cluster_service import ResourceManagerTags -from google.cloud.container_v1beta1.types.cluster_service import ResourceUsageExportConfig -from google.cloud.container_v1beta1.types.cluster_service import RollbackNodePoolUpgradeRequest -from google.cloud.container_v1beta1.types.cluster_service import SandboxConfig -from google.cloud.container_v1beta1.types.cluster_service import SecondaryBootDisk -from google.cloud.container_v1beta1.types.cluster_service import SecondaryBootDiskUpdateStrategy -from google.cloud.container_v1beta1.types.cluster_service import SecretManagerConfig -from google.cloud.container_v1beta1.types.cluster_service import SecurityBulletinEvent -from google.cloud.container_v1beta1.types.cluster_service import SecurityPostureConfig -from google.cloud.container_v1beta1.types.cluster_service import ServerConfig -from google.cloud.container_v1beta1.types.cluster_service import ServiceExternalIPsConfig -from google.cloud.container_v1beta1.types.cluster_service import SetAddonsConfigRequest -from google.cloud.container_v1beta1.types.cluster_service import SetLabelsRequest -from google.cloud.container_v1beta1.types.cluster_service import SetLegacyAbacRequest -from google.cloud.container_v1beta1.types.cluster_service import SetLocationsRequest -from google.cloud.container_v1beta1.types.cluster_service import SetLoggingServiceRequest -from google.cloud.container_v1beta1.types.cluster_service import SetMaintenancePolicyRequest -from google.cloud.container_v1beta1.types.cluster_service import SetMasterAuthRequest -from google.cloud.container_v1beta1.types.cluster_service import SetMonitoringServiceRequest -from google.cloud.container_v1beta1.types.cluster_service import SetNetworkPolicyRequest -from google.cloud.container_v1beta1.types.cluster_service import SetNodePoolAutoscalingRequest -from google.cloud.container_v1beta1.types.cluster_service import SetNodePoolManagementRequest -from google.cloud.container_v1beta1.types.cluster_service import SetNodePoolSizeRequest -from google.cloud.container_v1beta1.types.cluster_service import ShieldedInstanceConfig -from google.cloud.container_v1beta1.types.cluster_service import ShieldedNodes -from google.cloud.container_v1beta1.types.cluster_service import SoleTenantConfig -from google.cloud.container_v1beta1.types.cluster_service import StartIPRotationRequest -from google.cloud.container_v1beta1.types.cluster_service import StatefulHAConfig -from google.cloud.container_v1beta1.types.cluster_service import StatusCondition -from google.cloud.container_v1beta1.types.cluster_service import TimeWindow -from google.cloud.container_v1beta1.types.cluster_service import TpuConfig -from google.cloud.container_v1beta1.types.cluster_service import UpdateClusterRequest -from google.cloud.container_v1beta1.types.cluster_service import UpdateMasterRequest -from google.cloud.container_v1beta1.types.cluster_service import UpdateNodePoolRequest -from google.cloud.container_v1beta1.types.cluster_service import UpgradeAvailableEvent -from google.cloud.container_v1beta1.types.cluster_service import UpgradeEvent -from google.cloud.container_v1beta1.types.cluster_service import UsableSubnetwork -from google.cloud.container_v1beta1.types.cluster_service import UsableSubnetworkSecondaryRange -from google.cloud.container_v1beta1.types.cluster_service import VerticalPodAutoscaling -from google.cloud.container_v1beta1.types.cluster_service import VirtualNIC -from google.cloud.container_v1beta1.types.cluster_service import WindowsNodeConfig -from google.cloud.container_v1beta1.types.cluster_service import WindowsVersions -from google.cloud.container_v1beta1.types.cluster_service import WorkloadALTSConfig -from google.cloud.container_v1beta1.types.cluster_service import WorkloadCertificates -from google.cloud.container_v1beta1.types.cluster_service import WorkloadConfig -from google.cloud.container_v1beta1.types.cluster_service import WorkloadIdentityConfig -from google.cloud.container_v1beta1.types.cluster_service import WorkloadMetadataConfig -from google.cloud.container_v1beta1.types.cluster_service import WorkloadPolicyConfig -from google.cloud.container_v1beta1.types.cluster_service import DatapathProvider -from google.cloud.container_v1beta1.types.cluster_service import InTransitEncryptionConfig -from google.cloud.container_v1beta1.types.cluster_service import NodePoolUpdateStrategy -from google.cloud.container_v1beta1.types.cluster_service import PrivateIPv6GoogleAccess -from google.cloud.container_v1beta1.types.cluster_service import StackType -from google.cloud.container_v1beta1.types.cluster_service import UpgradeResourceType - -__all__ = ('ClusterManagerClient', - 'ClusterManagerAsyncClient', - 'AcceleratorConfig', - 'AdditionalNodeNetworkConfig', - 'AdditionalPodNetworkConfig', - 'AdditionalPodRangesConfig', - 'AddonsConfig', - 'AdvancedDatapathObservabilityConfig', - 'AdvancedMachineFeatures', - 'AuthenticatorGroupsConfig', - 'Autopilot', - 'AutopilotCompatibilityIssue', - 'AutopilotConversionStatus', - 'AutoprovisioningNodePoolDefaults', - 'AutoUpgradeOptions', - 'BestEffortProvisioning', - 'BinaryAuthorization', - 'BlueGreenSettings', - 'CancelOperationRequest', - 'CheckAutopilotCompatibilityRequest', - 'CheckAutopilotCompatibilityResponse', - 'ClientCertificateConfig', - 'CloudRunConfig', - 'Cluster', - 'ClusterAutoscaling', - 'ClusterTelemetry', - 'ClusterUpdate', - 'CompleteIPRotationRequest', - 'CompleteNodePoolUpgradeRequest', - 'CompliancePostureConfig', - 'ConfidentialNodes', - 'ConfigConnectorConfig', - 'ContainerdConfig', - 'CostManagementConfig', - 'CreateClusterRequest', - 'CreateNodePoolRequest', - 'DailyMaintenanceWindow', - 'DatabaseEncryption', - 'DefaultSnatStatus', - 'DeleteClusterRequest', - 'DeleteNodePoolRequest', - 'DnsCacheConfig', - 'DNSConfig', - 'EnterpriseConfig', - 'EphemeralStorageConfig', - 'EphemeralStorageLocalSsdConfig', - 'FastSocket', - 'Fleet', - 'GatewayAPIConfig', - 'GcePersistentDiskCsiDriverConfig', - 'GcfsConfig', - 'GcpFilestoreCsiDriverConfig', - 'GcsFuseCsiDriverConfig', - 'GetClusterRequest', - 'GetJSONWebKeysRequest', - 'GetJSONWebKeysResponse', - 'GetNodePoolRequest', - 'GetOpenIDConfigRequest', - 'GetOpenIDConfigResponse', - 'GetOperationRequest', - 'GetServerConfigRequest', - 'GkeBackupAgentConfig', - 'GPUDriverInstallationConfig', - 'GPUSharingConfig', - 'HorizontalPodAutoscaling', - 'HostMaintenancePolicy', - 'HttpLoadBalancing', - 'IdentityServiceConfig', - 'ILBSubsettingConfig', - 'IntraNodeVisibilityConfig', - 'IPAllocationPolicy', - 'IstioConfig', - 'Jwk', - 'K8sBetaAPIConfig', - 'KalmConfig', - 'KubernetesDashboard', - 'LegacyAbac', - 'LinuxNodeConfig', - 'ListClustersRequest', - 'ListClustersResponse', - 'ListLocationsRequest', - 'ListLocationsResponse', - 'ListNodePoolsRequest', - 'ListNodePoolsResponse', - 'ListOperationsRequest', - 'ListOperationsResponse', - 'ListUsableSubnetworksRequest', - 'ListUsableSubnetworksResponse', - 'LocalNvmeSsdBlockConfig', - 'Location', - 'LoggingComponentConfig', - 'LoggingConfig', - 'LoggingVariantConfig', - 'MaintenanceExclusionOptions', - 'MaintenancePolicy', - 'MaintenanceWindow', - 'ManagedPrometheusConfig', - 'Master', - 'MasterAuth', - 'MasterAuthorizedNetworksConfig', - 'MaxPodsConstraint', - 'MeshCertificates', - 'MonitoringComponentConfig', - 'MonitoringConfig', - 'NetworkConfig', - 'NetworkPolicy', - 'NetworkPolicyConfig', - 'NetworkTags', - 'NodeConfig', - 'NodeConfigDefaults', - 'NodeKubeletConfig', - 'NodeLabels', - 'NodeManagement', - 'NodeNetworkConfig', - 'NodePool', - 'NodePoolAutoConfig', - 'NodePoolAutoscaling', - 'NodePoolDefaults', - 'NodePoolLoggingConfig', - 'NodeTaint', - 'NodeTaints', - 'NotificationConfig', - 'Operation', - 'OperationProgress', - 'PodCIDROverprovisionConfig', - 'PodSecurityPolicyConfig', - 'PrivateClusterConfig', - 'PrivateClusterMasterGlobalAccessConfig', - 'ProtectConfig', - 'RangeInfo', - 'RayClusterLoggingConfig', - 'RayClusterMonitoringConfig', - 'RayOperatorConfig', - 'RecurringTimeWindow', - 'ReleaseChannel', - 'ReservationAffinity', - 'ResourceLabels', - 'ResourceLimit', - 'ResourceManagerTags', - 'ResourceUsageExportConfig', - 'RollbackNodePoolUpgradeRequest', - 'SandboxConfig', - 'SecondaryBootDisk', - 'SecondaryBootDiskUpdateStrategy', - 'SecretManagerConfig', - 'SecurityBulletinEvent', - 'SecurityPostureConfig', - 'ServerConfig', - 'ServiceExternalIPsConfig', - 'SetAddonsConfigRequest', - 'SetLabelsRequest', - 'SetLegacyAbacRequest', - 'SetLocationsRequest', - 'SetLoggingServiceRequest', - 'SetMaintenancePolicyRequest', - 'SetMasterAuthRequest', - 'SetMonitoringServiceRequest', - 'SetNetworkPolicyRequest', - 'SetNodePoolAutoscalingRequest', - 'SetNodePoolManagementRequest', - 'SetNodePoolSizeRequest', - 'ShieldedInstanceConfig', - 'ShieldedNodes', - 'SoleTenantConfig', - 'StartIPRotationRequest', - 'StatefulHAConfig', - 'StatusCondition', - 'TimeWindow', - 'TpuConfig', - 'UpdateClusterRequest', - 'UpdateMasterRequest', - 'UpdateNodePoolRequest', - 'UpgradeAvailableEvent', - 'UpgradeEvent', - 'UsableSubnetwork', - 'UsableSubnetworkSecondaryRange', - 'VerticalPodAutoscaling', - 'VirtualNIC', - 'WindowsNodeConfig', - 'WindowsVersions', - 'WorkloadALTSConfig', - 'WorkloadCertificates', - 'WorkloadConfig', - 'WorkloadIdentityConfig', - 'WorkloadMetadataConfig', - 'WorkloadPolicyConfig', - 'DatapathProvider', - 'InTransitEncryptionConfig', - 'NodePoolUpdateStrategy', - 'PrivateIPv6GoogleAccess', - 'StackType', - 'UpgradeResourceType', -) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/gapic_version.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/gapic_version.py deleted file mode 100644 index 558c8aab67c5..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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.0.0" # {x-release-please-version} diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/py.typed b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/py.typed deleted file mode 100644 index d5b0e29f91b4..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-container package uses inline types. diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/__init__.py deleted file mode 100644 index 67decca14bd8..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/__init__.py +++ /dev/null @@ -1,408 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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.container_v1beta1 import gapic_version as package_version - -__version__ = package_version.__version__ - - -from .services.cluster_manager import ClusterManagerClient -from .services.cluster_manager import ClusterManagerAsyncClient - -from .types.cluster_service import AcceleratorConfig -from .types.cluster_service import AdditionalNodeNetworkConfig -from .types.cluster_service import AdditionalPodNetworkConfig -from .types.cluster_service import AdditionalPodRangesConfig -from .types.cluster_service import AddonsConfig -from .types.cluster_service import AdvancedDatapathObservabilityConfig -from .types.cluster_service import AdvancedMachineFeatures -from .types.cluster_service import AuthenticatorGroupsConfig -from .types.cluster_service import Autopilot -from .types.cluster_service import AutopilotCompatibilityIssue -from .types.cluster_service import AutopilotConversionStatus -from .types.cluster_service import AutoprovisioningNodePoolDefaults -from .types.cluster_service import AutoUpgradeOptions -from .types.cluster_service import BestEffortProvisioning -from .types.cluster_service import BinaryAuthorization -from .types.cluster_service import BlueGreenSettings -from .types.cluster_service import CancelOperationRequest -from .types.cluster_service import CheckAutopilotCompatibilityRequest -from .types.cluster_service import CheckAutopilotCompatibilityResponse -from .types.cluster_service import ClientCertificateConfig -from .types.cluster_service import CloudRunConfig -from .types.cluster_service import Cluster -from .types.cluster_service import ClusterAutoscaling -from .types.cluster_service import ClusterTelemetry -from .types.cluster_service import ClusterUpdate -from .types.cluster_service import CompleteIPRotationRequest -from .types.cluster_service import CompleteNodePoolUpgradeRequest -from .types.cluster_service import CompliancePostureConfig -from .types.cluster_service import ConfidentialNodes -from .types.cluster_service import ConfigConnectorConfig -from .types.cluster_service import ContainerdConfig -from .types.cluster_service import CostManagementConfig -from .types.cluster_service import CreateClusterRequest -from .types.cluster_service import CreateNodePoolRequest -from .types.cluster_service import DailyMaintenanceWindow -from .types.cluster_service import DatabaseEncryption -from .types.cluster_service import DefaultSnatStatus -from .types.cluster_service import DeleteClusterRequest -from .types.cluster_service import DeleteNodePoolRequest -from .types.cluster_service import DnsCacheConfig -from .types.cluster_service import DNSConfig -from .types.cluster_service import EnterpriseConfig -from .types.cluster_service import EphemeralStorageConfig -from .types.cluster_service import EphemeralStorageLocalSsdConfig -from .types.cluster_service import FastSocket -from .types.cluster_service import Fleet -from .types.cluster_service import GatewayAPIConfig -from .types.cluster_service import GcePersistentDiskCsiDriverConfig -from .types.cluster_service import GcfsConfig -from .types.cluster_service import GcpFilestoreCsiDriverConfig -from .types.cluster_service import GcsFuseCsiDriverConfig -from .types.cluster_service import GetClusterRequest -from .types.cluster_service import GetJSONWebKeysRequest -from .types.cluster_service import GetJSONWebKeysResponse -from .types.cluster_service import GetNodePoolRequest -from .types.cluster_service import GetOpenIDConfigRequest -from .types.cluster_service import GetOpenIDConfigResponse -from .types.cluster_service import GetOperationRequest -from .types.cluster_service import GetServerConfigRequest -from .types.cluster_service import GkeBackupAgentConfig -from .types.cluster_service import GPUDriverInstallationConfig -from .types.cluster_service import GPUSharingConfig -from .types.cluster_service import HorizontalPodAutoscaling -from .types.cluster_service import HostMaintenancePolicy -from .types.cluster_service import HttpLoadBalancing -from .types.cluster_service import IdentityServiceConfig -from .types.cluster_service import ILBSubsettingConfig -from .types.cluster_service import IntraNodeVisibilityConfig -from .types.cluster_service import IPAllocationPolicy -from .types.cluster_service import IstioConfig -from .types.cluster_service import Jwk -from .types.cluster_service import K8sBetaAPIConfig -from .types.cluster_service import KalmConfig -from .types.cluster_service import KubernetesDashboard -from .types.cluster_service import LegacyAbac -from .types.cluster_service import LinuxNodeConfig -from .types.cluster_service import ListClustersRequest -from .types.cluster_service import ListClustersResponse -from .types.cluster_service import ListLocationsRequest -from .types.cluster_service import ListLocationsResponse -from .types.cluster_service import ListNodePoolsRequest -from .types.cluster_service import ListNodePoolsResponse -from .types.cluster_service import ListOperationsRequest -from .types.cluster_service import ListOperationsResponse -from .types.cluster_service import ListUsableSubnetworksRequest -from .types.cluster_service import ListUsableSubnetworksResponse -from .types.cluster_service import LocalNvmeSsdBlockConfig -from .types.cluster_service import Location -from .types.cluster_service import LoggingComponentConfig -from .types.cluster_service import LoggingConfig -from .types.cluster_service import LoggingVariantConfig -from .types.cluster_service import MaintenanceExclusionOptions -from .types.cluster_service import MaintenancePolicy -from .types.cluster_service import MaintenanceWindow -from .types.cluster_service import ManagedPrometheusConfig -from .types.cluster_service import Master -from .types.cluster_service import MasterAuth -from .types.cluster_service import MasterAuthorizedNetworksConfig -from .types.cluster_service import MaxPodsConstraint -from .types.cluster_service import MeshCertificates -from .types.cluster_service import MonitoringComponentConfig -from .types.cluster_service import MonitoringConfig -from .types.cluster_service import NetworkConfig -from .types.cluster_service import NetworkPolicy -from .types.cluster_service import NetworkPolicyConfig -from .types.cluster_service import NetworkTags -from .types.cluster_service import NodeConfig -from .types.cluster_service import NodeConfigDefaults -from .types.cluster_service import NodeKubeletConfig -from .types.cluster_service import NodeLabels -from .types.cluster_service import NodeManagement -from .types.cluster_service import NodeNetworkConfig -from .types.cluster_service import NodePool -from .types.cluster_service import NodePoolAutoConfig -from .types.cluster_service import NodePoolAutoscaling -from .types.cluster_service import NodePoolDefaults -from .types.cluster_service import NodePoolLoggingConfig -from .types.cluster_service import NodeTaint -from .types.cluster_service import NodeTaints -from .types.cluster_service import NotificationConfig -from .types.cluster_service import Operation -from .types.cluster_service import OperationProgress -from .types.cluster_service import PodCIDROverprovisionConfig -from .types.cluster_service import PodSecurityPolicyConfig -from .types.cluster_service import PrivateClusterConfig -from .types.cluster_service import PrivateClusterMasterGlobalAccessConfig -from .types.cluster_service import ProtectConfig -from .types.cluster_service import RangeInfo -from .types.cluster_service import RayClusterLoggingConfig -from .types.cluster_service import RayClusterMonitoringConfig -from .types.cluster_service import RayOperatorConfig -from .types.cluster_service import RecurringTimeWindow -from .types.cluster_service import ReleaseChannel -from .types.cluster_service import ReservationAffinity -from .types.cluster_service import ResourceLabels -from .types.cluster_service import ResourceLimit -from .types.cluster_service import ResourceManagerTags -from .types.cluster_service import ResourceUsageExportConfig -from .types.cluster_service import RollbackNodePoolUpgradeRequest -from .types.cluster_service import SandboxConfig -from .types.cluster_service import SecondaryBootDisk -from .types.cluster_service import SecondaryBootDiskUpdateStrategy -from .types.cluster_service import SecretManagerConfig -from .types.cluster_service import SecurityBulletinEvent -from .types.cluster_service import SecurityPostureConfig -from .types.cluster_service import ServerConfig -from .types.cluster_service import ServiceExternalIPsConfig -from .types.cluster_service import SetAddonsConfigRequest -from .types.cluster_service import SetLabelsRequest -from .types.cluster_service import SetLegacyAbacRequest -from .types.cluster_service import SetLocationsRequest -from .types.cluster_service import SetLoggingServiceRequest -from .types.cluster_service import SetMaintenancePolicyRequest -from .types.cluster_service import SetMasterAuthRequest -from .types.cluster_service import SetMonitoringServiceRequest -from .types.cluster_service import SetNetworkPolicyRequest -from .types.cluster_service import SetNodePoolAutoscalingRequest -from .types.cluster_service import SetNodePoolManagementRequest -from .types.cluster_service import SetNodePoolSizeRequest -from .types.cluster_service import ShieldedInstanceConfig -from .types.cluster_service import ShieldedNodes -from .types.cluster_service import SoleTenantConfig -from .types.cluster_service import StartIPRotationRequest -from .types.cluster_service import StatefulHAConfig -from .types.cluster_service import StatusCondition -from .types.cluster_service import TimeWindow -from .types.cluster_service import TpuConfig -from .types.cluster_service import UpdateClusterRequest -from .types.cluster_service import UpdateMasterRequest -from .types.cluster_service import UpdateNodePoolRequest -from .types.cluster_service import UpgradeAvailableEvent -from .types.cluster_service import UpgradeEvent -from .types.cluster_service import UsableSubnetwork -from .types.cluster_service import UsableSubnetworkSecondaryRange -from .types.cluster_service import VerticalPodAutoscaling -from .types.cluster_service import VirtualNIC -from .types.cluster_service import WindowsNodeConfig -from .types.cluster_service import WindowsVersions -from .types.cluster_service import WorkloadALTSConfig -from .types.cluster_service import WorkloadCertificates -from .types.cluster_service import WorkloadConfig -from .types.cluster_service import WorkloadIdentityConfig -from .types.cluster_service import WorkloadMetadataConfig -from .types.cluster_service import WorkloadPolicyConfig -from .types.cluster_service import DatapathProvider -from .types.cluster_service import InTransitEncryptionConfig -from .types.cluster_service import NodePoolUpdateStrategy -from .types.cluster_service import PrivateIPv6GoogleAccess -from .types.cluster_service import StackType -from .types.cluster_service import UpgradeResourceType - -__all__ = ( - 'ClusterManagerAsyncClient', -'AcceleratorConfig', -'AdditionalNodeNetworkConfig', -'AdditionalPodNetworkConfig', -'AdditionalPodRangesConfig', -'AddonsConfig', -'AdvancedDatapathObservabilityConfig', -'AdvancedMachineFeatures', -'AuthenticatorGroupsConfig', -'AutoUpgradeOptions', -'Autopilot', -'AutopilotCompatibilityIssue', -'AutopilotConversionStatus', -'AutoprovisioningNodePoolDefaults', -'BestEffortProvisioning', -'BinaryAuthorization', -'BlueGreenSettings', -'CancelOperationRequest', -'CheckAutopilotCompatibilityRequest', -'CheckAutopilotCompatibilityResponse', -'ClientCertificateConfig', -'CloudRunConfig', -'Cluster', -'ClusterAutoscaling', -'ClusterManagerClient', -'ClusterTelemetry', -'ClusterUpdate', -'CompleteIPRotationRequest', -'CompleteNodePoolUpgradeRequest', -'CompliancePostureConfig', -'ConfidentialNodes', -'ConfigConnectorConfig', -'ContainerdConfig', -'CostManagementConfig', -'CreateClusterRequest', -'CreateNodePoolRequest', -'DNSConfig', -'DailyMaintenanceWindow', -'DatabaseEncryption', -'DatapathProvider', -'DefaultSnatStatus', -'DeleteClusterRequest', -'DeleteNodePoolRequest', -'DnsCacheConfig', -'EnterpriseConfig', -'EphemeralStorageConfig', -'EphemeralStorageLocalSsdConfig', -'FastSocket', -'Fleet', -'GPUDriverInstallationConfig', -'GPUSharingConfig', -'GatewayAPIConfig', -'GcePersistentDiskCsiDriverConfig', -'GcfsConfig', -'GcpFilestoreCsiDriverConfig', -'GcsFuseCsiDriverConfig', -'GetClusterRequest', -'GetJSONWebKeysRequest', -'GetJSONWebKeysResponse', -'GetNodePoolRequest', -'GetOpenIDConfigRequest', -'GetOpenIDConfigResponse', -'GetOperationRequest', -'GetServerConfigRequest', -'GkeBackupAgentConfig', -'HorizontalPodAutoscaling', -'HostMaintenancePolicy', -'HttpLoadBalancing', -'ILBSubsettingConfig', -'IPAllocationPolicy', -'IdentityServiceConfig', -'InTransitEncryptionConfig', -'IntraNodeVisibilityConfig', -'IstioConfig', -'Jwk', -'K8sBetaAPIConfig', -'KalmConfig', -'KubernetesDashboard', -'LegacyAbac', -'LinuxNodeConfig', -'ListClustersRequest', -'ListClustersResponse', -'ListLocationsRequest', -'ListLocationsResponse', -'ListNodePoolsRequest', -'ListNodePoolsResponse', -'ListOperationsRequest', -'ListOperationsResponse', -'ListUsableSubnetworksRequest', -'ListUsableSubnetworksResponse', -'LocalNvmeSsdBlockConfig', -'Location', -'LoggingComponentConfig', -'LoggingConfig', -'LoggingVariantConfig', -'MaintenanceExclusionOptions', -'MaintenancePolicy', -'MaintenanceWindow', -'ManagedPrometheusConfig', -'Master', -'MasterAuth', -'MasterAuthorizedNetworksConfig', -'MaxPodsConstraint', -'MeshCertificates', -'MonitoringComponentConfig', -'MonitoringConfig', -'NetworkConfig', -'NetworkPolicy', -'NetworkPolicyConfig', -'NetworkTags', -'NodeConfig', -'NodeConfigDefaults', -'NodeKubeletConfig', -'NodeLabels', -'NodeManagement', -'NodeNetworkConfig', -'NodePool', -'NodePoolAutoConfig', -'NodePoolAutoscaling', -'NodePoolDefaults', -'NodePoolLoggingConfig', -'NodePoolUpdateStrategy', -'NodeTaint', -'NodeTaints', -'NotificationConfig', -'Operation', -'OperationProgress', -'PodCIDROverprovisionConfig', -'PodSecurityPolicyConfig', -'PrivateClusterConfig', -'PrivateClusterMasterGlobalAccessConfig', -'PrivateIPv6GoogleAccess', -'ProtectConfig', -'RangeInfo', -'RayClusterLoggingConfig', -'RayClusterMonitoringConfig', -'RayOperatorConfig', -'RecurringTimeWindow', -'ReleaseChannel', -'ReservationAffinity', -'ResourceLabels', -'ResourceLimit', -'ResourceManagerTags', -'ResourceUsageExportConfig', -'RollbackNodePoolUpgradeRequest', -'SandboxConfig', -'SecondaryBootDisk', -'SecondaryBootDiskUpdateStrategy', -'SecretManagerConfig', -'SecurityBulletinEvent', -'SecurityPostureConfig', -'ServerConfig', -'ServiceExternalIPsConfig', -'SetAddonsConfigRequest', -'SetLabelsRequest', -'SetLegacyAbacRequest', -'SetLocationsRequest', -'SetLoggingServiceRequest', -'SetMaintenancePolicyRequest', -'SetMasterAuthRequest', -'SetMonitoringServiceRequest', -'SetNetworkPolicyRequest', -'SetNodePoolAutoscalingRequest', -'SetNodePoolManagementRequest', -'SetNodePoolSizeRequest', -'ShieldedInstanceConfig', -'ShieldedNodes', -'SoleTenantConfig', -'StackType', -'StartIPRotationRequest', -'StatefulHAConfig', -'StatusCondition', -'TimeWindow', -'TpuConfig', -'UpdateClusterRequest', -'UpdateMasterRequest', -'UpdateNodePoolRequest', -'UpgradeAvailableEvent', -'UpgradeEvent', -'UpgradeResourceType', -'UsableSubnetwork', -'UsableSubnetworkSecondaryRange', -'VerticalPodAutoscaling', -'VirtualNIC', -'WindowsNodeConfig', -'WindowsVersions', -'WorkloadALTSConfig', -'WorkloadCertificates', -'WorkloadConfig', -'WorkloadIdentityConfig', -'WorkloadMetadataConfig', -'WorkloadPolicyConfig', -) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_metadata.json deleted file mode 100644 index b925b82155e0..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_metadata.json +++ /dev/null @@ -1,373 +0,0 @@ - { - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "python", - "libraryPackage": "google.cloud.container_v1beta1", - "protoPackage": "google.container.v1beta1", - "schema": "1.0", - "services": { - "ClusterManager": { - "clients": { - "grpc": { - "libraryClient": "ClusterManagerClient", - "rpcs": { - "CancelOperation": { - "methods": [ - "cancel_operation" - ] - }, - "CheckAutopilotCompatibility": { - "methods": [ - "check_autopilot_compatibility" - ] - }, - "CompleteIPRotation": { - "methods": [ - "complete_ip_rotation" - ] - }, - "CompleteNodePoolUpgrade": { - "methods": [ - "complete_node_pool_upgrade" - ] - }, - "CreateCluster": { - "methods": [ - "create_cluster" - ] - }, - "CreateNodePool": { - "methods": [ - "create_node_pool" - ] - }, - "DeleteCluster": { - "methods": [ - "delete_cluster" - ] - }, - "DeleteNodePool": { - "methods": [ - "delete_node_pool" - ] - }, - "GetCluster": { - "methods": [ - "get_cluster" - ] - }, - "GetJSONWebKeys": { - "methods": [ - "get_json_web_keys" - ] - }, - "GetNodePool": { - "methods": [ - "get_node_pool" - ] - }, - "GetOperation": { - "methods": [ - "get_operation" - ] - }, - "GetServerConfig": { - "methods": [ - "get_server_config" - ] - }, - "ListClusters": { - "methods": [ - "list_clusters" - ] - }, - "ListLocations": { - "methods": [ - "list_locations" - ] - }, - "ListNodePools": { - "methods": [ - "list_node_pools" - ] - }, - "ListOperations": { - "methods": [ - "list_operations" - ] - }, - "ListUsableSubnetworks": { - "methods": [ - "list_usable_subnetworks" - ] - }, - "RollbackNodePoolUpgrade": { - "methods": [ - "rollback_node_pool_upgrade" - ] - }, - "SetAddonsConfig": { - "methods": [ - "set_addons_config" - ] - }, - "SetLabels": { - "methods": [ - "set_labels" - ] - }, - "SetLegacyAbac": { - "methods": [ - "set_legacy_abac" - ] - }, - "SetLocations": { - "methods": [ - "set_locations" - ] - }, - "SetLoggingService": { - "methods": [ - "set_logging_service" - ] - }, - "SetMaintenancePolicy": { - "methods": [ - "set_maintenance_policy" - ] - }, - "SetMasterAuth": { - "methods": [ - "set_master_auth" - ] - }, - "SetMonitoringService": { - "methods": [ - "set_monitoring_service" - ] - }, - "SetNetworkPolicy": { - "methods": [ - "set_network_policy" - ] - }, - "SetNodePoolAutoscaling": { - "methods": [ - "set_node_pool_autoscaling" - ] - }, - "SetNodePoolManagement": { - "methods": [ - "set_node_pool_management" - ] - }, - "SetNodePoolSize": { - "methods": [ - "set_node_pool_size" - ] - }, - "StartIPRotation": { - "methods": [ - "start_ip_rotation" - ] - }, - "UpdateCluster": { - "methods": [ - "update_cluster" - ] - }, - "UpdateMaster": { - "methods": [ - "update_master" - ] - }, - "UpdateNodePool": { - "methods": [ - "update_node_pool" - ] - } - } - }, - "grpc-async": { - "libraryClient": "ClusterManagerAsyncClient", - "rpcs": { - "CancelOperation": { - "methods": [ - "cancel_operation" - ] - }, - "CheckAutopilotCompatibility": { - "methods": [ - "check_autopilot_compatibility" - ] - }, - "CompleteIPRotation": { - "methods": [ - "complete_ip_rotation" - ] - }, - "CompleteNodePoolUpgrade": { - "methods": [ - "complete_node_pool_upgrade" - ] - }, - "CreateCluster": { - "methods": [ - "create_cluster" - ] - }, - "CreateNodePool": { - "methods": [ - "create_node_pool" - ] - }, - "DeleteCluster": { - "methods": [ - "delete_cluster" - ] - }, - "DeleteNodePool": { - "methods": [ - "delete_node_pool" - ] - }, - "GetCluster": { - "methods": [ - "get_cluster" - ] - }, - "GetJSONWebKeys": { - "methods": [ - "get_json_web_keys" - ] - }, - "GetNodePool": { - "methods": [ - "get_node_pool" - ] - }, - "GetOperation": { - "methods": [ - "get_operation" - ] - }, - "GetServerConfig": { - "methods": [ - "get_server_config" - ] - }, - "ListClusters": { - "methods": [ - "list_clusters" - ] - }, - "ListLocations": { - "methods": [ - "list_locations" - ] - }, - "ListNodePools": { - "methods": [ - "list_node_pools" - ] - }, - "ListOperations": { - "methods": [ - "list_operations" - ] - }, - "ListUsableSubnetworks": { - "methods": [ - "list_usable_subnetworks" - ] - }, - "RollbackNodePoolUpgrade": { - "methods": [ - "rollback_node_pool_upgrade" - ] - }, - "SetAddonsConfig": { - "methods": [ - "set_addons_config" - ] - }, - "SetLabels": { - "methods": [ - "set_labels" - ] - }, - "SetLegacyAbac": { - "methods": [ - "set_legacy_abac" - ] - }, - "SetLocations": { - "methods": [ - "set_locations" - ] - }, - "SetLoggingService": { - "methods": [ - "set_logging_service" - ] - }, - "SetMaintenancePolicy": { - "methods": [ - "set_maintenance_policy" - ] - }, - "SetMasterAuth": { - "methods": [ - "set_master_auth" - ] - }, - "SetMonitoringService": { - "methods": [ - "set_monitoring_service" - ] - }, - "SetNetworkPolicy": { - "methods": [ - "set_network_policy" - ] - }, - "SetNodePoolAutoscaling": { - "methods": [ - "set_node_pool_autoscaling" - ] - }, - "SetNodePoolManagement": { - "methods": [ - "set_node_pool_management" - ] - }, - "SetNodePoolSize": { - "methods": [ - "set_node_pool_size" - ] - }, - "StartIPRotation": { - "methods": [ - "start_ip_rotation" - ] - }, - "UpdateCluster": { - "methods": [ - "update_cluster" - ] - }, - "UpdateMaster": { - "methods": [ - "update_master" - ] - }, - "UpdateNodePool": { - "methods": [ - "update_node_pool" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_version.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_version.py deleted file mode 100644 index 558c8aab67c5..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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.0.0" # {x-release-please-version} diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/py.typed b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/py.typed deleted file mode 100644 index d5b0e29f91b4..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-container package uses inline types. diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/__init__.py deleted file mode 100644 index 8f6cf068242c..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/__init__.py deleted file mode 100644 index f3aa6cc7d359..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ClusterManagerClient -from .async_client import ClusterManagerAsyncClient - -__all__ = ( - 'ClusterManagerClient', - 'ClusterManagerAsyncClient', -) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/async_client.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/async_client.py deleted file mode 100644 index 403a15d2da94..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/async_client.py +++ /dev/null @@ -1,4885 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 logging as std_logging -from collections import OrderedDict -import re -from typing import Dict, Callable, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union -import warnings - -from google.cloud.container_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_async as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - - -try: - OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore - -from google.cloud.container_v1beta1.services.cluster_manager import pagers -from google.cloud.container_v1beta1.types import cluster_service -from google.rpc import status_pb2 # type: ignore -from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import ClusterManagerGrpcAsyncIOTransport -from .client import ClusterManagerClient - -try: - from google.api_core import client_logging # type: ignore - CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER -except ImportError: # pragma: NO COVER - CLIENT_LOGGING_SUPPORTED = False - -_LOGGER = std_logging.getLogger(__name__) - -class ClusterManagerAsyncClient: - """Google Kubernetes Engine Cluster Manager v1beta1""" - - _client: ClusterManagerClient - - # Copy defaults from the synchronous client for use here. - # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead. - DEFAULT_ENDPOINT = ClusterManagerClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = ClusterManagerClient.DEFAULT_MTLS_ENDPOINT - _DEFAULT_ENDPOINT_TEMPLATE = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE - _DEFAULT_UNIVERSE = ClusterManagerClient._DEFAULT_UNIVERSE - - topic_path = staticmethod(ClusterManagerClient.topic_path) - parse_topic_path = staticmethod(ClusterManagerClient.parse_topic_path) - common_billing_account_path = staticmethod(ClusterManagerClient.common_billing_account_path) - parse_common_billing_account_path = staticmethod(ClusterManagerClient.parse_common_billing_account_path) - common_folder_path = staticmethod(ClusterManagerClient.common_folder_path) - parse_common_folder_path = staticmethod(ClusterManagerClient.parse_common_folder_path) - common_organization_path = staticmethod(ClusterManagerClient.common_organization_path) - parse_common_organization_path = staticmethod(ClusterManagerClient.parse_common_organization_path) - common_project_path = staticmethod(ClusterManagerClient.common_project_path) - parse_common_project_path = staticmethod(ClusterManagerClient.parse_common_project_path) - common_location_path = staticmethod(ClusterManagerClient.common_location_path) - parse_common_location_path = staticmethod(ClusterManagerClient.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: - ClusterManagerAsyncClient: The constructed client. - """ - return ClusterManagerClient.from_service_account_info.__func__(ClusterManagerAsyncClient, 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: - ClusterManagerAsyncClient: The constructed client. - """ - return ClusterManagerClient.from_service_account_file.__func__(ClusterManagerAsyncClient, 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 ClusterManagerClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> ClusterManagerTransport: - """Returns the transport used by the client instance. - - Returns: - ClusterManagerTransport: The transport used by the client instance. - """ - return self._client.transport - - @property - def api_endpoint(self): - """Return the API endpoint used by the client instance. - - Returns: - str: The API endpoint used by the client instance. - """ - return self._client._api_endpoint - - @property - def universe_domain(self) -> str: - """Return the universe domain used by the client instance. - - Returns: - str: The universe domain used - by the client instance. - """ - return self._client._universe_domain - - get_transport_class = ClusterManagerClient.get_transport_class - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, ClusterManagerTransport, Callable[..., ClusterManagerTransport]]] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the cluster manager async 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 (Optional[Union[str,ClusterManagerTransport,Callable[..., ClusterManagerTransport]]]): - The transport to use, or a Callable that constructs and returns a new transport to use. - If a Callable is given, it will be called with the same set of initialization - arguments as used in the ClusterManagerTransport constructor. - 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. - - 1. The ``api_endpoint`` property can be used to override the - default endpoint provided by the client when ``transport`` is - not explicitly provided. Only if this property is not set and - ``transport`` was not explicitly provided, the endpoint is - determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment - variable, which have one of the following values: - "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). - - 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide a client certificate for mTLS 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. - - 3. The ``universe_domain`` property can be used to override the - default "googleapis.com" universe. Note that ``api_endpoint`` - property still takes precedence; and ``universe_domain`` is - currently not supported for mTLS. - - 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. - """ - self._client = ClusterManagerClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - - ) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG): # pragma: NO COVER - _LOGGER.debug( - "Created client `google.container_v1beta1.ClusterManagerAsyncClient`.", - extra = { - "serviceName": "google.container.v1beta1.ClusterManager", - "universeDomain": getattr(self._client._transport._credentials, "universe_domain", ""), - "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}", - "credentialsInfo": getattr(self.transport._credentials, "get_cred_info", lambda: None)(), - } if hasattr(self._client._transport, "_credentials") else { - "serviceName": "google.container.v1beta1.ClusterManager", - "credentialsType": None, - } - ) - - async def list_clusters(self, - request: Optional[Union[cluster_service.ListClustersRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListClustersResponse: - r"""Lists all clusters owned by a project in either the - specified zone or all zones. - - .. 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 import container_v1beta1 - - async def sample_list_clusters(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.ListClustersRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = await client.list_clusters(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.ListClustersRequest, dict]]): - The request object. ListClustersRequest lists clusters. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides, or "-" for all zones. This - field has been deprecated and replaced by the parent - field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.ListClustersResponse: - ListClustersResponse is the result of - ListClustersRequest. - - """ - # 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([project_id, zone]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListClustersRequest): - request = cluster_service.ListClustersRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.list_clusters] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_cluster(self, - request: Optional[Union[cluster_service.GetClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Cluster: - r"""Gets the details for a specific cluster. - - .. 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 import container_v1beta1 - - async def sample_get_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.GetClusterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.get_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.GetClusterRequest, dict]]): - The request object. GetClusterRequest gets the settings - of a cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster to retrieve. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Cluster: - A Google Kubernetes Engine cluster. - """ - # 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([project_id, zone, cluster_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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetClusterRequest): - request = cluster_service.GetClusterRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.get_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_cluster(self, - request: Optional[Union[cluster_service.CreateClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster: Optional[cluster_service.Cluster] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Creates a cluster, consisting of the specified number and type - of Google Compute Engine instances. - - By default, the cluster is created in the project's `default - network `__. - - One firewall is added for the cluster. After cluster creation, - the Kubelet creates routes for each node to allow the containers - on that node to communicate with all other instances in the - cluster. - - Finally, an entry is added to the project's global metadata - indicating which CIDR range the cluster is using. - - .. 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 import container_v1beta1 - - async def sample_create_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.CreateClusterRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = await client.create_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.CreateClusterRequest, dict]]): - The request object. CreateClusterRequest creates a - cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the parent field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster (:class:`google.cloud.container_v1beta1.types.Cluster`): - Required. A `cluster - resource `__ - - This corresponds to the ``cluster`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CreateClusterRequest): - request = cluster_service.CreateClusterRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster is not None: - request.cluster = cluster - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.create_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_cluster(self, - request: Optional[Union[cluster_service.UpdateClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - update: Optional[cluster_service.ClusterUpdate] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Updates the settings for a specific cluster. - - .. 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 import container_v1beta1 - - async def sample_update_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.UpdateClusterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.update_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.UpdateClusterRequest, dict]]): - The request object. UpdateClusterRequest updates the - settings of a cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update (:class:`google.cloud.container_v1beta1.types.ClusterUpdate`): - Required. A description of the - update. - - This corresponds to the ``update`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, update]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.UpdateClusterRequest): - request = cluster_service.UpdateClusterRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if update is not None: - request.update = update - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.update_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_node_pool(self, - request: Optional[Union[cluster_service.UpdateNodePoolRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Updates the version and/or image type of a specific - node pool. - - .. 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 import container_v1beta1 - - async def sample_update_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.UpdateNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - node_version="node_version_value", - image_type="image_type_value", - ) - - # Make the request - response = await client.update_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.UpdateNodePoolRequest, dict]]): - The request object. SetNodePoolVersionRequest updates the - version of a node pool. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.UpdateNodePoolRequest): - request = cluster_service.UpdateNodePoolRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.update_node_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_node_pool_autoscaling(self, - request: Optional[Union[cluster_service.SetNodePoolAutoscalingRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the autoscaling settings of a specific node - pool. - - .. 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 import container_v1beta1 - - async def sample_set_node_pool_autoscaling(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNodePoolAutoscalingRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = await client.set_node_pool_autoscaling(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.SetNodePoolAutoscalingRequest, dict]]): - The request object. SetNodePoolAutoscalingRequest sets - the autoscaler settings of a node pool. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNodePoolAutoscalingRequest): - request = cluster_service.SetNodePoolAutoscalingRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_node_pool_autoscaling] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_logging_service(self, - request: Optional[Union[cluster_service.SetLoggingServiceRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - logging_service: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the logging service for a specific cluster. - - .. 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 import container_v1beta1 - - async def sample_set_logging_service(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLoggingServiceRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - logging_service="logging_service_value", - ) - - # Make the request - response = await client.set_logging_service(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.SetLoggingServiceRequest, dict]]): - The request object. SetLoggingServiceRequest sets the - logging service of a cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - logging_service (:class:`str`): - Required. The logging service the cluster should use to - write logs. Currently available options: - - - ``logging.googleapis.com/kubernetes`` - The Cloud - Logging service with a Kubernetes-native resource - model - - ``logging.googleapis.com`` - The legacy Cloud Logging - service (no longer available as of GKE 1.15). - - ``none`` - no logs will be exported from the cluster. - - If left as an empty - string,\ ``logging.googleapis.com/kubernetes`` will be - used for GKE 1.14+ or ``logging.googleapis.com`` for - earlier versions. - - This corresponds to the ``logging_service`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, logging_service]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLoggingServiceRequest): - request = cluster_service.SetLoggingServiceRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if logging_service is not None: - request.logging_service = logging_service - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_logging_service] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_monitoring_service(self, - request: Optional[Union[cluster_service.SetMonitoringServiceRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - monitoring_service: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the monitoring service for a specific cluster. - - .. 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 import container_v1beta1 - - async def sample_set_monitoring_service(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetMonitoringServiceRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - monitoring_service="monitoring_service_value", - ) - - # Make the request - response = await client.set_monitoring_service(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.SetMonitoringServiceRequest, dict]]): - The request object. SetMonitoringServiceRequest sets the - monitoring service of a cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - monitoring_service (:class:`str`): - Required. The monitoring service the cluster should use - to write metrics. Currently available options: - - - "monitoring.googleapis.com/kubernetes" - The Cloud - Monitoring service with a Kubernetes-native resource - model - - ``monitoring.googleapis.com`` - The legacy Cloud - Monitoring service (no longer available as of GKE - 1.15). - - ``none`` - No metrics will be exported from the - cluster. - - If left as an empty - string,\ ``monitoring.googleapis.com/kubernetes`` will - be used for GKE 1.14+ or ``monitoring.googleapis.com`` - for earlier versions. - - This corresponds to the ``monitoring_service`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, monitoring_service]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetMonitoringServiceRequest): - request = cluster_service.SetMonitoringServiceRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if monitoring_service is not None: - request.monitoring_service = monitoring_service - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_monitoring_service] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_addons_config(self, - request: Optional[Union[cluster_service.SetAddonsConfigRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - addons_config: Optional[cluster_service.AddonsConfig] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the addons for a specific cluster. - - .. 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 import container_v1beta1 - - async def sample_set_addons_config(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetAddonsConfigRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.set_addons_config(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.SetAddonsConfigRequest, dict]]): - The request object. SetAddonsRequest sets the addons - associated with the cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - addons_config (:class:`google.cloud.container_v1beta1.types.AddonsConfig`): - Required. The desired configurations - for the various addons available to run - in the cluster. - - This corresponds to the ``addons_config`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, addons_config]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetAddonsConfigRequest): - request = cluster_service.SetAddonsConfigRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if addons_config is not None: - request.addons_config = addons_config - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_addons_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_locations(self, - request: Optional[Union[cluster_service.SetLocationsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - locations: Optional[MutableSequence[str]] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the locations for a specific cluster. Deprecated. Use - `projects.locations.clusters.update `__ - instead. - - .. 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 import container_v1beta1 - - async def sample_set_locations(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLocationsRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - locations=['locations_value1', 'locations_value2'], - ) - - # Make the request - response = await client.set_locations(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.SetLocationsRequest, dict]]): - The request object. SetLocationsRequest sets the - locations of the cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - locations (:class:`MutableSequence[str]`): - Required. The desired list of Google Compute Engine - `zones `__ - in which the cluster's nodes should be located. Changing - the locations a cluster is in will result in nodes being - either created or removed from the cluster, depending on - whether locations are being added or removed. - - This list must always include the cluster's primary - zone. - - This corresponds to the ``locations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - warnings.warn("ClusterManagerAsyncClient.set_locations is deprecated", - DeprecationWarning) - - # 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([project_id, zone, cluster_id, locations]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLocationsRequest): - request = cluster_service.SetLocationsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if locations: - request.locations.extend(locations) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_locations] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_master(self, - request: Optional[Union[cluster_service.UpdateMasterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - master_version: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Updates the master for a specific cluster. - - .. 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 import container_v1beta1 - - async def sample_update_master(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.UpdateMasterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - master_version="master_version_value", - ) - - # Make the request - response = await client.update_master(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.UpdateMasterRequest, dict]]): - The request object. UpdateMasterRequest updates the - master of the cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - master_version (:class:`str`): - Required. The Kubernetes version to - change the master to. - Users may specify either explicit - versions offered by Kubernetes Engine or - version aliases, which have the - following behavior: - - - "latest": picks the highest valid - Kubernetes version - - "1.X": picks the highest valid - patch+gke.N patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N - patch in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit - Kubernetes version - - "-": picks the default Kubernetes - version - - This corresponds to the ``master_version`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, master_version]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.UpdateMasterRequest): - request = cluster_service.UpdateMasterRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if master_version is not None: - request.master_version = master_version - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.update_master] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_master_auth(self, - request: Optional[Union[cluster_service.SetMasterAuthRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets master auth materials. Currently supports - changing the admin password or a specific cluster, - either via password generation or explicitly setting the - password. - - .. 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 import container_v1beta1 - - async def sample_set_master_auth(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetMasterAuthRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - action="SET_USERNAME", - ) - - # Make the request - response = await client.set_master_auth(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.SetMasterAuthRequest, dict]]): - The request object. SetMasterAuthRequest updates the - admin password of a cluster. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetMasterAuthRequest): - request = cluster_service.SetMasterAuthRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_master_auth] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def delete_cluster(self, - request: Optional[Union[cluster_service.DeleteClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Deletes the cluster, including the Kubernetes - endpoint and all worker nodes. - - Firewalls and routes that were configured during cluster - creation are also deleted. - - Other Google Compute Engine resources that might be in - use by the cluster, such as load balancer resources, are - not deleted if they weren't present when the cluster was - initially created. - - .. 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 import container_v1beta1 - - async def sample_delete_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.DeleteClusterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.delete_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.DeleteClusterRequest, dict]]): - The request object. DeleteClusterRequest deletes a - cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster to delete. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.DeleteClusterRequest): - request = cluster_service.DeleteClusterRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.delete_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_operations(self, - request: Optional[Union[cluster_service.ListOperationsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListOperationsResponse: - r"""Lists all operations in a project in the specified - zone or all zones. - - .. 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 import container_v1beta1 - - async def sample_list_operations(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.ListOperationsRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = await client.list_operations(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.ListOperationsRequest, dict]]): - The request object. ListOperationsRequest lists - operations. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - to return operations for, or ``-`` for all zones. This - field has been deprecated and replaced by the parent - field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.ListOperationsResponse: - ListOperationsResponse is the result - of ListOperationsRequest. - - """ - # 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([project_id, zone]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListOperationsRequest): - request = cluster_service.ListOperationsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.list_operations] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_operation(self, - request: Optional[Union[cluster_service.GetOperationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - operation_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Gets the specified operation. - - .. 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 import container_v1beta1 - - async def sample_get_operation(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.GetOperationRequest( - project_id="project_id_value", - zone="zone_value", - operation_id="operation_id_value", - ) - - # Make the request - response = await client.get_operation(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.GetOperationRequest, dict]]): - The request object. GetOperationRequest gets a single - operation. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation_id (:class:`str`): - Required. Deprecated. The server-assigned ``name`` of - the operation. This field has been deprecated and - replaced by the name field. - - This corresponds to the ``operation_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, operation_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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetOperationRequest): - request = cluster_service.GetOperationRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if operation_id is not None: - request.operation_id = operation_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.get_operation] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def cancel_operation(self, - request: Optional[Union[cluster_service.CancelOperationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - operation_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> None: - r"""Cancels the specified operation. - - .. 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 import container_v1beta1 - - async def sample_cancel_operation(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.CancelOperationRequest( - project_id="project_id_value", - zone="zone_value", - operation_id="operation_id_value", - ) - - # Make the request - await client.cancel_operation(request=request) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.CancelOperationRequest, dict]]): - The request object. CancelOperationRequest cancels a - single operation. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the operation resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation_id (:class:`str`): - Required. Deprecated. The server-assigned ``name`` of - the operation. This field has been deprecated and - replaced by the name field. - - This corresponds to the ``operation_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - # 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([project_id, zone, operation_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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CancelOperationRequest): - request = cluster_service.CancelOperationRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if operation_id is not None: - request.operation_id = operation_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.cancel_operation] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - async def get_server_config(self, - request: Optional[Union[cluster_service.GetServerConfigRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ServerConfig: - r"""Returns configuration info about the Google - Kubernetes Engine service. - - .. 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 import container_v1beta1 - - async def sample_get_server_config(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.GetServerConfigRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = await client.get_server_config(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.GetServerConfigRequest, dict]]): - The request object. Gets the current Kubernetes Engine - service configuration. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - to return operations for. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.ServerConfig: - Kubernetes Engine service - configuration. - - """ - # 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([project_id, zone]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetServerConfigRequest): - request = cluster_service.GetServerConfigRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.get_server_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_json_web_keys(self, - request: Optional[Union[cluster_service.GetJSONWebKeysRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.GetJSONWebKeysResponse: - r"""Gets the public component of the cluster signing keys - in JSON Web Key format. - - .. 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 import container_v1beta1 - - async def sample_get_json_web_keys(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.GetJSONWebKeysRequest( - ) - - # Make the request - response = await client.get_json_web_keys(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.GetJSONWebKeysRequest, dict]]): - The request object. GetJSONWebKeysRequest gets the public component of the - keys used by the cluster to sign token requests. This - will be the jwks_uri for the discover document returned - by getOpenIDConfig. See the OpenID Connect Discovery 1.0 - specification for details. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.GetJSONWebKeysResponse: - GetJSONWebKeysResponse is a valid - JSON Web Key Set as specififed in rfc - 7517 - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetJSONWebKeysRequest): - request = cluster_service.GetJSONWebKeysRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.get_json_web_keys] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_node_pools(self, - request: Optional[Union[cluster_service.ListNodePoolsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListNodePoolsResponse: - r"""Lists the node pools for a cluster. - - .. 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 import container_v1beta1 - - async def sample_list_node_pools(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.ListNodePoolsRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.list_node_pools(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.ListNodePoolsRequest, dict]]): - The request object. ListNodePoolsRequest lists the node - pool(s) for a cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the parent field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the parent field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.ListNodePoolsResponse: - ListNodePoolsResponse is the result - of ListNodePoolsRequest. - - """ - # 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([project_id, zone, cluster_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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListNodePoolsRequest): - request = cluster_service.ListNodePoolsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.list_node_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_node_pool(self, - request: Optional[Union[cluster_service.GetNodePoolRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.NodePool: - r"""Retrieves the requested node pool. - - .. 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 import container_v1beta1 - - async def sample_get_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.GetNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = await client.get_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.GetNodePoolRequest, dict]]): - The request object. GetNodePoolRequest retrieves a node - pool for a cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (:class:`str`): - Required. Deprecated. The name of the - node pool. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``node_pool_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.NodePool: - NodePool contains the name and - configuration for a cluster's node pool. - Node pools are a set of nodes (i.e. - VM's), with a common configuration and - specification, under the control of the - cluster master. They may have a set of - Kubernetes labels applied to them, which - may be used to reference them during pod - scheduling. They may also be resized up - or down, to accommodate the workload. - - """ - # 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([project_id, zone, cluster_id, node_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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetNodePoolRequest): - request = cluster_service.GetNodePoolRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.get_node_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_node_pool(self, - request: Optional[Union[cluster_service.CreateNodePoolRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool: Optional[cluster_service.NodePool] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Creates a node pool for a cluster. - - .. 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 import container_v1beta1 - - async def sample_create_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.CreateNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.create_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.CreateNodePoolRequest, dict]]): - The request object. CreateNodePoolRequest creates a node - pool for a cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the parent field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the parent field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool (:class:`google.cloud.container_v1beta1.types.NodePool`): - Required. The node pool to create. - This corresponds to the ``node_pool`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CreateNodePoolRequest): - request = cluster_service.CreateNodePoolRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool is not None: - request.node_pool = node_pool - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.create_node_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def delete_node_pool(self, - request: Optional[Union[cluster_service.DeleteNodePoolRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Deletes a node pool from a cluster. - - .. 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 import container_v1beta1 - - async def sample_delete_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.DeleteNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = await client.delete_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.DeleteNodePoolRequest, dict]]): - The request object. DeleteNodePoolRequest deletes a node - pool for a cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (:class:`str`): - Required. Deprecated. The name of the - node pool to delete. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``node_pool_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.DeleteNodePoolRequest): - request = cluster_service.DeleteNodePoolRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.delete_node_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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def complete_node_pool_upgrade(self, - request: Optional[Union[cluster_service.CompleteNodePoolUpgradeRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> None: - r"""CompleteNodePoolUpgrade will signal an on-going node - pool upgrade to complete. - - .. 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 import container_v1beta1 - - async def sample_complete_node_pool_upgrade(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.CompleteNodePoolUpgradeRequest( - ) - - # Make the request - await client.complete_node_pool_upgrade(request=request) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.CompleteNodePoolUpgradeRequest, dict]]): - The request object. CompleteNodePoolUpgradeRequest sets - the name of target node pool to complete - upgrade. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CompleteNodePoolUpgradeRequest): - request = cluster_service.CompleteNodePoolUpgradeRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.complete_node_pool_upgrade] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - async def rollback_node_pool_upgrade(self, - request: Optional[Union[cluster_service.RollbackNodePoolUpgradeRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Rolls back a previously Aborted or Failed NodePool - upgrade. This makes no changes if the last upgrade - successfully completed. - - .. 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 import container_v1beta1 - - async def sample_rollback_node_pool_upgrade(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.RollbackNodePoolUpgradeRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = await client.rollback_node_pool_upgrade(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.RollbackNodePoolUpgradeRequest, dict]]): - The request object. RollbackNodePoolUpgradeRequest - rollbacks the previously Aborted or - Failed NodePool upgrade. This will be an - no-op if the last upgrade successfully - completed. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster to rollback. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (:class:`str`): - Required. Deprecated. The name of the - node pool to rollback. This field has - been deprecated and replaced by the name - field. - - This corresponds to the ``node_pool_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.RollbackNodePoolUpgradeRequest): - request = cluster_service.RollbackNodePoolUpgradeRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.rollback_node_pool_upgrade] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_node_pool_management(self, - request: Optional[Union[cluster_service.SetNodePoolManagementRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - management: Optional[cluster_service.NodeManagement] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the NodeManagement options for a node pool. - - .. 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 import container_v1beta1 - - async def sample_set_node_pool_management(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNodePoolManagementRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = await client.set_node_pool_management(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.SetNodePoolManagementRequest, dict]]): - The request object. SetNodePoolManagementRequest sets the - node management properties of a node - pool. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster to update. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (:class:`str`): - Required. Deprecated. The name of the - node pool to update. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``node_pool_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - management (:class:`google.cloud.container_v1beta1.types.NodeManagement`): - Required. NodeManagement - configuration for the node pool. - - This corresponds to the ``management`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_pool_id, management]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNodePoolManagementRequest): - request = cluster_service.SetNodePoolManagementRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - if management is not None: - request.management = management - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_node_pool_management] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_labels(self, - request: Optional[Union[cluster_service.SetLabelsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - resource_labels: Optional[MutableMapping[str, str]] = None, - label_fingerprint: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets labels on a cluster. - - .. 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 import container_v1beta1 - - async def sample_set_labels(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLabelsRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - label_fingerprint="label_fingerprint_value", - ) - - # Make the request - response = await client.set_labels(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.SetLabelsRequest, dict]]): - The request object. SetLabelsRequest sets the Google - Cloud Platform labels on a Google - Container Engine cluster, which will in - turn set them for Google Compute Engine - resources used by that cluster - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - resource_labels (:class:`MutableMapping[str, str]`): - Required. The labels to set for that - cluster. - - This corresponds to the ``resource_labels`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - label_fingerprint (:class:`str`): - Required. The fingerprint of the previous set of labels - for this resource, used to detect conflicts. The - fingerprint is initially generated by Kubernetes Engine - and changes after every request to modify or update - labels. You must always provide an up-to-date - fingerprint hash when updating or changing labels. Make - a ``get()`` request to the resource to get the latest - fingerprint. - - This corresponds to the ``label_fingerprint`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, resource_labels, label_fingerprint]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLabelsRequest): - request = cluster_service.SetLabelsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if label_fingerprint is not None: - request.label_fingerprint = label_fingerprint - - if resource_labels: - request.resource_labels.update(resource_labels) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_labels] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_legacy_abac(self, - request: Optional[Union[cluster_service.SetLegacyAbacRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - enabled: Optional[bool] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Enables or disables the ABAC authorization mechanism - on a cluster. - - .. 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 import container_v1beta1 - - async def sample_set_legacy_abac(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLegacyAbacRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - enabled=True, - ) - - # Make the request - response = await client.set_legacy_abac(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.SetLegacyAbacRequest, dict]]): - The request object. SetLegacyAbacRequest enables or - disables the ABAC authorization - mechanism for a cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster to update. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - enabled (:class:`bool`): - Required. Whether ABAC authorization - will be enabled in the cluster. - - This corresponds to the ``enabled`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, enabled]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLegacyAbacRequest): - request = cluster_service.SetLegacyAbacRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if enabled is not None: - request.enabled = enabled - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_legacy_abac] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def start_ip_rotation(self, - request: Optional[Union[cluster_service.StartIPRotationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Starts master IP rotation. - - .. 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 import container_v1beta1 - - async def sample_start_ip_rotation(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.StartIPRotationRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.start_ip_rotation(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.StartIPRotationRequest, dict]]): - The request object. StartIPRotationRequest creates a new - IP for the cluster and then performs a - node upgrade on each node pool to point - to the new IP. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.StartIPRotationRequest): - request = cluster_service.StartIPRotationRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.start_ip_rotation] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def complete_ip_rotation(self, - request: Optional[Union[cluster_service.CompleteIPRotationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Completes master IP rotation. - - .. 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 import container_v1beta1 - - async def sample_complete_ip_rotation(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.CompleteIPRotationRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.complete_ip_rotation(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.CompleteIPRotationRequest, dict]]): - The request object. CompleteIPRotationRequest moves the - cluster master back into single-IP mode. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CompleteIPRotationRequest): - request = cluster_service.CompleteIPRotationRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.complete_ip_rotation] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_node_pool_size(self, - request: Optional[Union[cluster_service.SetNodePoolSizeRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""SetNodePoolSizeRequest sets the size of a node pool. The new - size will be used for all replicas, including future replicas - created by modifying - [NodePool.locations][google.container.v1beta1.NodePool.locations]. - - .. 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 import container_v1beta1 - - async def sample_set_node_pool_size(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNodePoolSizeRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - node_count=1070, - ) - - # Make the request - response = await client.set_node_pool_size(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.SetNodePoolSizeRequest, dict]]): - The request object. SetNodePoolSizeRequest sets the size - of a node pool. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNodePoolSizeRequest): - request = cluster_service.SetNodePoolSizeRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_node_pool_size] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_network_policy(self, - request: Optional[Union[cluster_service.SetNetworkPolicyRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - network_policy: Optional[cluster_service.NetworkPolicy] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Enables or disables Network Policy for a cluster. - - .. 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 import container_v1beta1 - - async def sample_set_network_policy(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNetworkPolicyRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.set_network_policy(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.SetNetworkPolicyRequest, dict]]): - The request object. SetNetworkPolicyRequest - enables/disables network policy for a - cluster. - project_id (:class:`str`): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - network_policy (:class:`google.cloud.container_v1beta1.types.NetworkPolicy`): - Required. Configuration options for - the NetworkPolicy feature. - - This corresponds to the ``network_policy`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, network_policy]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNetworkPolicyRequest): - request = cluster_service.SetNetworkPolicyRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if network_policy is not None: - request.network_policy = network_policy - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_network_policy] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def set_maintenance_policy(self, - request: Optional[Union[cluster_service.SetMaintenancePolicyRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - maintenance_policy: Optional[cluster_service.MaintenancePolicy] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the maintenance policy for a cluster. - - .. 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 import container_v1beta1 - - async def sample_set_maintenance_policy(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetMaintenancePolicyRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.set_maintenance_policy(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.SetMaintenancePolicyRequest, dict]]): - The request object. SetMaintenancePolicyRequest sets the - maintenance policy for a cluster. - project_id (:class:`str`): - Required. The Google Developers Console `project ID or - project - number `__. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (:class:`str`): - Required. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (:class:`str`): - Required. The name of the cluster to - update. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - maintenance_policy (:class:`google.cloud.container_v1beta1.types.MaintenancePolicy`): - Required. The maintenance policy to - be set for the cluster. An empty field - clears the existing maintenance policy. - - This corresponds to the ``maintenance_policy`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, maintenance_policy]) - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetMaintenancePolicyRequest): - request = cluster_service.SetMaintenancePolicyRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if maintenance_policy is not None: - request.maintenance_policy = maintenance_policy - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.set_maintenance_policy] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_usable_subnetworks(self, - request: Optional[Union[cluster_service.ListUsableSubnetworksRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> pagers.ListUsableSubnetworksAsyncPager: - r"""Lists subnetworks that can be used for creating - clusters in a project. - - .. 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 import container_v1beta1 - - async def sample_list_usable_subnetworks(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.ListUsableSubnetworksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_usable_subnetworks(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.ListUsableSubnetworksRequest, dict]]): - The request object. ListUsableSubnetworksRequest requests - the list of usable subnetworks. - available to a user for creating - clusters. - parent (:class:`str`): - Required. The parent project where subnetworks are - usable. Specified in the format ``projects/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.services.cluster_manager.pagers.ListUsableSubnetworksAsyncPager: - ListUsableSubnetworksResponse is the - response of - ListUsableSubnetworksRequest. - - 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListUsableSubnetworksRequest): - request = cluster_service.ListUsableSubnetworksRequest(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._client._transport._wrapped_methods[self._client._transport.list_usable_subnetworks] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # 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.ListUsableSubnetworksAsyncPager( - method=rpc, - request=request, - response=response, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def check_autopilot_compatibility(self, - request: Optional[Union[cluster_service.CheckAutopilotCompatibilityRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.CheckAutopilotCompatibilityResponse: - r"""Checks the cluster compatibility with Autopilot mode, - and returns a list of compatibility issues. - - .. 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 import container_v1beta1 - - async def sample_check_autopilot_compatibility(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.CheckAutopilotCompatibilityRequest( - ) - - # Make the request - response = await client.check_autopilot_compatibility(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityRequest, dict]]): - The request object. CheckAutopilotCompatibilityRequest - requests getting the blockers for the - given operation in the cluster. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityResponse: - CheckAutopilotCompatibilityResponse - has a list of compatibility issues. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CheckAutopilotCompatibilityRequest): - request = cluster_service.CheckAutopilotCompatibilityRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.check_autopilot_compatibility] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_locations(self, - request: Optional[Union[cluster_service.ListLocationsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListLocationsResponse: - r"""Fetches locations that offer Google Kubernetes - Engine. - - .. 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 import container_v1beta1 - - async def sample_list_locations(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.ListLocationsRequest( - parent="parent_value", - ) - - # Make the request - response = await client.list_locations(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.container_v1beta1.types.ListLocationsRequest, dict]]): - The request object. ListLocationsRequest is used to - request the locations that offer GKE. - parent (:class:`str`): - Required. Contains the name of the resource requested. - Specified in the format ``projects/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.ListLocationsResponse: - ListLocationsResponse returns the - list of all GKE locations and their - recommendation state. - - """ - # 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.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListLocationsRequest): - request = cluster_service.ListLocationsRequest(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._client._transport._wrapped_methods[self._client._transport.list_locations] - - # 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), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def __aenter__(self) -> "ClusterManagerAsyncClient": - 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__ = ( - "ClusterManagerAsyncClient", -) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/client.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/client.py deleted file mode 100644 index 8429099a5e51..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/client.py +++ /dev/null @@ -1,5189 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 logging as std_logging -import os -import re -from typing import Dict, Callable, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast -import warnings - -from google.cloud.container_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, None] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object, None] # type: ignore - -try: - from google.api_core import client_logging # type: ignore - CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER -except ImportError: # pragma: NO COVER - CLIENT_LOGGING_SUPPORTED = False - -_LOGGER = std_logging.getLogger(__name__) - -from google.cloud.container_v1beta1.services.cluster_manager import pagers -from google.cloud.container_v1beta1.types import cluster_service -from google.rpc import status_pb2 # type: ignore -from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import ClusterManagerGrpcTransport -from .transports.grpc_asyncio import ClusterManagerGrpcAsyncIOTransport - - -class ClusterManagerClientMeta(type): - """Metaclass for the ClusterManager 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[ClusterManagerTransport]] - _transport_registry["grpc"] = ClusterManagerGrpcTransport - _transport_registry["grpc_asyncio"] = ClusterManagerGrpcAsyncIOTransport - - def get_transport_class(cls, - label: Optional[str] = None, - ) -> Type[ClusterManagerTransport]: - """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 ClusterManagerClient(metaclass=ClusterManagerClientMeta): - """Google Kubernetes Engine Cluster Manager v1beta1""" - - @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") - - # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead. - DEFAULT_ENDPOINT = "container.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - _DEFAULT_ENDPOINT_TEMPLATE = "container.{UNIVERSE_DOMAIN}" - _DEFAULT_UNIVERSE = "googleapis.com" - - @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: - ClusterManagerClient: 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: - ClusterManagerClient: 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) -> ClusterManagerTransport: - """Returns the transport used by the client instance. - - Returns: - ClusterManagerTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def topic_path(project: str,topic: str,) -> str: - """Returns a fully-qualified topic string.""" - return "projects/{project}/topics/{topic}".format(project=project, topic=topic, ) - - @staticmethod - def parse_topic_path(path: str) -> Dict[str,str]: - """Parses a topic path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/topics/(?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): - """Deprecated. 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. - """ - - warnings.warn("get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.", - DeprecationWarning) - 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 - - @staticmethod - def _read_environment_variables(): - """Returns the environment variables used by the client. - - Returns: - Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE, - GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables. - - Raises: - ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not - any of ["true", "false"]. - google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT - is not any of ["auto", "never", "always"]. - """ - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false").lower() - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower() - universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN") - 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`") - return use_client_cert == "true", use_mtls_endpoint, universe_domain_env - - @staticmethod - def _get_client_cert_source(provided_cert_source, use_cert_flag): - """Return the client cert source to be used by the client. - - Args: - provided_cert_source (bytes): The client certificate source provided. - use_cert_flag (bool): A flag indicating whether to use the client certificate. - - Returns: - bytes or None: The client cert source to be used by the client. - """ - client_cert_source = None - if use_cert_flag: - if provided_cert_source: - client_cert_source = provided_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - return client_cert_source - - @staticmethod - def _get_api_endpoint(api_override, client_cert_source, universe_domain, use_mtls_endpoint): - """Return the API endpoint used by the client. - - Args: - api_override (str): The API endpoint override. If specified, this is always - the return value of this function and the other arguments are not used. - client_cert_source (bytes): The client certificate source used by the client. - universe_domain (str): The universe domain used by the client. - use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters. - Possible values are "always", "auto", or "never". - - Returns: - str: The API endpoint to be used by the client. - """ - if api_override is not None: - api_endpoint = api_override - elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): - _default_universe = ClusterManagerClient._DEFAULT_UNIVERSE - if universe_domain != _default_universe: - raise MutualTLSChannelError(f"mTLS is not supported in any universe other than {_default_universe}.") - api_endpoint = ClusterManagerClient.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=universe_domain) - return api_endpoint - - @staticmethod - def _get_universe_domain(client_universe_domain: Optional[str], universe_domain_env: Optional[str]) -> str: - """Return the universe domain used by the client. - - Args: - client_universe_domain (Optional[str]): The universe domain configured via the client options. - universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable. - - Returns: - str: The universe domain to be used by the client. - - Raises: - ValueError: If the universe domain is an empty string. - """ - universe_domain = ClusterManagerClient._DEFAULT_UNIVERSE - if client_universe_domain is not None: - universe_domain = client_universe_domain - elif universe_domain_env is not None: - universe_domain = universe_domain_env - if len(universe_domain.strip()) == 0: - raise ValueError("Universe Domain cannot be an empty string.") - return universe_domain - - def _validate_universe_domain(self): - """Validates client's and credentials' universe domains are consistent. - - Returns: - bool: True iff the configured universe domain is valid. - - Raises: - ValueError: If the configured universe domain is not valid. - """ - - # NOTE (b/349488459): universe validation is disabled until further notice. - return True - - @property - def api_endpoint(self): - """Return the API endpoint used by the client instance. - - Returns: - str: The API endpoint used by the client instance. - """ - return self._api_endpoint - - @property - def universe_domain(self) -> str: - """Return the universe domain used by the client instance. - - Returns: - str: The universe domain used by the client instance. - """ - return self._universe_domain - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, ClusterManagerTransport, Callable[..., ClusterManagerTransport]]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the cluster manager 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 (Optional[Union[str,ClusterManagerTransport,Callable[..., ClusterManagerTransport]]]): - The transport to use, or a Callable that constructs and returns a new transport. - If a Callable is given, it will be called with the same set of initialization - arguments as used in the ClusterManagerTransport constructor. - 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. - - 1. The ``api_endpoint`` property can be used to override the - default endpoint provided by the client when ``transport`` is - not explicitly provided. Only if this property is not set and - ``transport`` was not explicitly provided, the endpoint is - determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment - variable, which have one of the following values: - "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). - - 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide a client certificate for mTLS 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. - - 3. The ``universe_domain`` property can be used to override the - default "googleapis.com" universe. Note that the ``api_endpoint`` - property still takes precedence; and ``universe_domain`` is - currently not supported for mTLS. - - 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. - """ - self._client_options = client_options - if isinstance(self._client_options, dict): - self._client_options = client_options_lib.from_dict(self._client_options) - if self._client_options is None: - self._client_options = client_options_lib.ClientOptions() - self._client_options = cast(client_options_lib.ClientOptions, self._client_options) - - universe_domain_opt = getattr(self._client_options, 'universe_domain', None) - - self._use_client_cert, self._use_mtls_endpoint, self._universe_domain_env = ClusterManagerClient._read_environment_variables() - self._client_cert_source = ClusterManagerClient._get_client_cert_source(self._client_options.client_cert_source, self._use_client_cert) - self._universe_domain = ClusterManagerClient._get_universe_domain(universe_domain_opt, self._universe_domain_env) - self._api_endpoint = None # updated below, depending on `transport` - - # Initialize the universe domain validation. - self._is_universe_domain_valid = False - - if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER - # Setup logging. - client_logging.initialize_logging() - - api_key_value = getattr(self._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. - transport_provided = isinstance(transport, ClusterManagerTransport) - if transport_provided: - # transport is a ClusterManagerTransport instance. - if credentials or self._client_options.credentials_file or api_key_value: - raise ValueError("When providing a transport instance, " - "provide its credentials directly.") - if self._client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = cast(ClusterManagerTransport, transport) - self._api_endpoint = self._transport.host - - self._api_endpoint = (self._api_endpoint or - ClusterManagerClient._get_api_endpoint( - self._client_options.api_endpoint, - self._client_cert_source, - self._universe_domain, - self._use_mtls_endpoint)) - - if not transport_provided: - 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_init: Union[Type[ClusterManagerTransport], Callable[..., ClusterManagerTransport]] = ( - ClusterManagerClient.get_transport_class(transport) - if isinstance(transport, str) or transport is None - else cast(Callable[..., ClusterManagerTransport], transport) - ) - # initialize with the provided callable or the passed in class - self._transport = transport_init( - credentials=credentials, - credentials_file=self._client_options.credentials_file, - host=self._api_endpoint, - scopes=self._client_options.scopes, - client_cert_source_for_mtls=self._client_cert_source, - quota_project_id=self._client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=self._client_options.api_audience, - ) - - if "async" not in str(self._transport): - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG): # pragma: NO COVER - _LOGGER.debug( - "Created client `google.container_v1beta1.ClusterManagerClient`.", - extra = { - "serviceName": "google.container.v1beta1.ClusterManager", - "universeDomain": getattr(self._transport._credentials, "universe_domain", ""), - "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}", - "credentialsInfo": getattr(self.transport._credentials, "get_cred_info", lambda: None)(), - } if hasattr(self._transport, "_credentials") else { - "serviceName": "google.container.v1beta1.ClusterManager", - "credentialsType": None, - } - ) - - def list_clusters(self, - request: Optional[Union[cluster_service.ListClustersRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListClustersResponse: - r"""Lists all clusters owned by a project in either the - specified zone or all zones. - - .. 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 import container_v1beta1 - - def sample_list_clusters(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.ListClustersRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = client.list_clusters(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.ListClustersRequest, dict]): - The request object. ListClustersRequest lists clusters. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides, or "-" for all zones. This - field has been deprecated and replaced by the parent - field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.ListClustersResponse: - ListClustersResponse is the result of - ListClustersRequest. - - """ - # 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([project_id, zone]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListClustersRequest): - request = cluster_service.ListClustersRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_clusters] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_cluster(self, - request: Optional[Union[cluster_service.GetClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Cluster: - r"""Gets the details for a specific cluster. - - .. 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 import container_v1beta1 - - def sample_get_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.GetClusterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.get_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.GetClusterRequest, dict]): - The request object. GetClusterRequest gets the settings - of a cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster to retrieve. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Cluster: - A Google Kubernetes Engine cluster. - """ - # 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([project_id, zone, cluster_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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetClusterRequest): - request = cluster_service.GetClusterRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_cluster(self, - request: Optional[Union[cluster_service.CreateClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster: Optional[cluster_service.Cluster] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Creates a cluster, consisting of the specified number and type - of Google Compute Engine instances. - - By default, the cluster is created in the project's `default - network `__. - - One firewall is added for the cluster. After cluster creation, - the Kubelet creates routes for each node to allow the containers - on that node to communicate with all other instances in the - cluster. - - Finally, an entry is added to the project's global metadata - indicating which CIDR range the cluster is using. - - .. 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 import container_v1beta1 - - def sample_create_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.CreateClusterRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = client.create_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.CreateClusterRequest, dict]): - The request object. CreateClusterRequest creates a - cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the parent field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster (google.cloud.container_v1beta1.types.Cluster): - Required. A `cluster - resource `__ - - This corresponds to the ``cluster`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CreateClusterRequest): - request = cluster_service.CreateClusterRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster is not None: - request.cluster = cluster - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_cluster(self, - request: Optional[Union[cluster_service.UpdateClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - update: Optional[cluster_service.ClusterUpdate] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Updates the settings for a specific cluster. - - .. 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 import container_v1beta1 - - def sample_update_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.UpdateClusterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.update_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.UpdateClusterRequest, dict]): - The request object. UpdateClusterRequest updates the - settings of a cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update (google.cloud.container_v1beta1.types.ClusterUpdate): - Required. A description of the - update. - - This corresponds to the ``update`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, update]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.UpdateClusterRequest): - request = cluster_service.UpdateClusterRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if update is not None: - request.update = update - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_node_pool(self, - request: Optional[Union[cluster_service.UpdateNodePoolRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Updates the version and/or image type of a specific - node pool. - - .. 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 import container_v1beta1 - - def sample_update_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.UpdateNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - node_version="node_version_value", - image_type="image_type_value", - ) - - # Make the request - response = client.update_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.UpdateNodePoolRequest, dict]): - The request object. SetNodePoolVersionRequest updates the - version of a node pool. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.UpdateNodePoolRequest): - request = cluster_service.UpdateNodePoolRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_node_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_node_pool_autoscaling(self, - request: Optional[Union[cluster_service.SetNodePoolAutoscalingRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the autoscaling settings of a specific node - pool. - - .. 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 import container_v1beta1 - - def sample_set_node_pool_autoscaling(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNodePoolAutoscalingRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = client.set_node_pool_autoscaling(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.SetNodePoolAutoscalingRequest, dict]): - The request object. SetNodePoolAutoscalingRequest sets - the autoscaler settings of a node pool. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNodePoolAutoscalingRequest): - request = cluster_service.SetNodePoolAutoscalingRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_node_pool_autoscaling] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_logging_service(self, - request: Optional[Union[cluster_service.SetLoggingServiceRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - logging_service: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the logging service for a specific cluster. - - .. 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 import container_v1beta1 - - def sample_set_logging_service(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLoggingServiceRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - logging_service="logging_service_value", - ) - - # Make the request - response = client.set_logging_service(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.SetLoggingServiceRequest, dict]): - The request object. SetLoggingServiceRequest sets the - logging service of a cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - logging_service (str): - Required. The logging service the cluster should use to - write logs. Currently available options: - - - ``logging.googleapis.com/kubernetes`` - The Cloud - Logging service with a Kubernetes-native resource - model - - ``logging.googleapis.com`` - The legacy Cloud Logging - service (no longer available as of GKE 1.15). - - ``none`` - no logs will be exported from the cluster. - - If left as an empty - string,\ ``logging.googleapis.com/kubernetes`` will be - used for GKE 1.14+ or ``logging.googleapis.com`` for - earlier versions. - - This corresponds to the ``logging_service`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, logging_service]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLoggingServiceRequest): - request = cluster_service.SetLoggingServiceRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if logging_service is not None: - request.logging_service = logging_service - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_logging_service] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_monitoring_service(self, - request: Optional[Union[cluster_service.SetMonitoringServiceRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - monitoring_service: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the monitoring service for a specific cluster. - - .. 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 import container_v1beta1 - - def sample_set_monitoring_service(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetMonitoringServiceRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - monitoring_service="monitoring_service_value", - ) - - # Make the request - response = client.set_monitoring_service(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.SetMonitoringServiceRequest, dict]): - The request object. SetMonitoringServiceRequest sets the - monitoring service of a cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - monitoring_service (str): - Required. The monitoring service the cluster should use - to write metrics. Currently available options: - - - "monitoring.googleapis.com/kubernetes" - The Cloud - Monitoring service with a Kubernetes-native resource - model - - ``monitoring.googleapis.com`` - The legacy Cloud - Monitoring service (no longer available as of GKE - 1.15). - - ``none`` - No metrics will be exported from the - cluster. - - If left as an empty - string,\ ``monitoring.googleapis.com/kubernetes`` will - be used for GKE 1.14+ or ``monitoring.googleapis.com`` - for earlier versions. - - This corresponds to the ``monitoring_service`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, monitoring_service]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetMonitoringServiceRequest): - request = cluster_service.SetMonitoringServiceRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if monitoring_service is not None: - request.monitoring_service = monitoring_service - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_monitoring_service] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_addons_config(self, - request: Optional[Union[cluster_service.SetAddonsConfigRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - addons_config: Optional[cluster_service.AddonsConfig] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the addons for a specific cluster. - - .. 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 import container_v1beta1 - - def sample_set_addons_config(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetAddonsConfigRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.set_addons_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.SetAddonsConfigRequest, dict]): - The request object. SetAddonsRequest sets the addons - associated with the cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - addons_config (google.cloud.container_v1beta1.types.AddonsConfig): - Required. The desired configurations - for the various addons available to run - in the cluster. - - This corresponds to the ``addons_config`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, addons_config]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetAddonsConfigRequest): - request = cluster_service.SetAddonsConfigRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if addons_config is not None: - request.addons_config = addons_config - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_addons_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_locations(self, - request: Optional[Union[cluster_service.SetLocationsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - locations: Optional[MutableSequence[str]] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the locations for a specific cluster. Deprecated. Use - `projects.locations.clusters.update `__ - instead. - - .. 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 import container_v1beta1 - - def sample_set_locations(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLocationsRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - locations=['locations_value1', 'locations_value2'], - ) - - # Make the request - response = client.set_locations(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.SetLocationsRequest, dict]): - The request object. SetLocationsRequest sets the - locations of the cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - locations (MutableSequence[str]): - Required. The desired list of Google Compute Engine - `zones `__ - in which the cluster's nodes should be located. Changing - the locations a cluster is in will result in nodes being - either created or removed from the cluster, depending on - whether locations are being added or removed. - - This list must always include the cluster's primary - zone. - - This corresponds to the ``locations`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - warnings.warn("ClusterManagerClient.set_locations is deprecated", - DeprecationWarning) - - # 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([project_id, zone, cluster_id, locations]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLocationsRequest): - request = cluster_service.SetLocationsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if locations is not None: - request.locations = locations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_locations] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_master(self, - request: Optional[Union[cluster_service.UpdateMasterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - master_version: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Updates the master for a specific cluster. - - .. 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 import container_v1beta1 - - def sample_update_master(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.UpdateMasterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - master_version="master_version_value", - ) - - # Make the request - response = client.update_master(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.UpdateMasterRequest, dict]): - The request object. UpdateMasterRequest updates the - master of the cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster to upgrade. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - master_version (str): - Required. The Kubernetes version to - change the master to. - Users may specify either explicit - versions offered by Kubernetes Engine or - version aliases, which have the - following behavior: - - - "latest": picks the highest valid - Kubernetes version - - "1.X": picks the highest valid - patch+gke.N patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N - patch in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit - Kubernetes version - - "-": picks the default Kubernetes - version - - This corresponds to the ``master_version`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, master_version]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.UpdateMasterRequest): - request = cluster_service.UpdateMasterRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if master_version is not None: - request.master_version = master_version - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_master] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_master_auth(self, - request: Optional[Union[cluster_service.SetMasterAuthRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets master auth materials. Currently supports - changing the admin password or a specific cluster, - either via password generation or explicitly setting the - password. - - .. 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 import container_v1beta1 - - def sample_set_master_auth(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetMasterAuthRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - action="SET_USERNAME", - ) - - # Make the request - response = client.set_master_auth(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.SetMasterAuthRequest, dict]): - The request object. SetMasterAuthRequest updates the - admin password of a cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetMasterAuthRequest): - request = cluster_service.SetMasterAuthRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_master_auth] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def delete_cluster(self, - request: Optional[Union[cluster_service.DeleteClusterRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Deletes the cluster, including the Kubernetes - endpoint and all worker nodes. - - Firewalls and routes that were configured during cluster - creation are also deleted. - - Other Google Compute Engine resources that might be in - use by the cluster, such as load balancer resources, are - not deleted if they weren't present when the cluster was - initially created. - - .. 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 import container_v1beta1 - - def sample_delete_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.DeleteClusterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.delete_cluster(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.DeleteClusterRequest, dict]): - The request object. DeleteClusterRequest deletes a - cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster to delete. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.DeleteClusterRequest): - request = cluster_service.DeleteClusterRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_cluster] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_operations(self, - request: Optional[Union[cluster_service.ListOperationsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListOperationsResponse: - r"""Lists all operations in a project in the specified - zone or all zones. - - .. 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 import container_v1beta1 - - def sample_list_operations(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.ListOperationsRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = client.list_operations(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.ListOperationsRequest, dict]): - The request object. ListOperationsRequest lists - operations. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - to return operations for, or ``-`` for all zones. This - field has been deprecated and replaced by the parent - field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.ListOperationsResponse: - ListOperationsResponse is the result - of ListOperationsRequest. - - """ - # 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([project_id, zone]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListOperationsRequest): - request = cluster_service.ListOperationsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_operations] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_operation(self, - request: Optional[Union[cluster_service.GetOperationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - operation_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Gets the specified operation. - - .. 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 import container_v1beta1 - - def sample_get_operation(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.GetOperationRequest( - project_id="project_id_value", - zone="zone_value", - operation_id="operation_id_value", - ) - - # Make the request - response = client.get_operation(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.GetOperationRequest, dict]): - The request object. GetOperationRequest gets a single - operation. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation_id (str): - Required. Deprecated. The server-assigned ``name`` of - the operation. This field has been deprecated and - replaced by the name field. - - This corresponds to the ``operation_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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, operation_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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetOperationRequest): - request = cluster_service.GetOperationRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if operation_id is not None: - request.operation_id = operation_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_operation] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def cancel_operation(self, - request: Optional[Union[cluster_service.CancelOperationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - operation_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> None: - r"""Cancels the specified operation. - - .. 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 import container_v1beta1 - - def sample_cancel_operation(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.CancelOperationRequest( - project_id="project_id_value", - zone="zone_value", - operation_id="operation_id_value", - ) - - # Make the request - client.cancel_operation(request=request) - - Args: - request (Union[google.cloud.container_v1beta1.types.CancelOperationRequest, dict]): - The request object. CancelOperationRequest cancels a - single operation. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the operation resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation_id (str): - Required. Deprecated. The server-assigned ``name`` of - the operation. This field has been deprecated and - replaced by the name field. - - This corresponds to the ``operation_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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - # 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([project_id, zone, operation_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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CancelOperationRequest): - request = cluster_service.CancelOperationRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if operation_id is not None: - request.operation_id = operation_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.cancel_operation] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - def get_server_config(self, - request: Optional[Union[cluster_service.GetServerConfigRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ServerConfig: - r"""Returns configuration info about the Google - Kubernetes Engine service. - - .. 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 import container_v1beta1 - - def sample_get_server_config(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.GetServerConfigRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = client.get_server_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.GetServerConfigRequest, dict]): - The request object. Gets the current Kubernetes Engine - service configuration. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - to return operations for. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.ServerConfig: - Kubernetes Engine service - configuration. - - """ - # 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([project_id, zone]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetServerConfigRequest): - request = cluster_service.GetServerConfigRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_server_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_json_web_keys(self, - request: Optional[Union[cluster_service.GetJSONWebKeysRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.GetJSONWebKeysResponse: - r"""Gets the public component of the cluster signing keys - in JSON Web Key format. - - .. 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 import container_v1beta1 - - def sample_get_json_web_keys(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.GetJSONWebKeysRequest( - ) - - # Make the request - response = client.get_json_web_keys(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.GetJSONWebKeysRequest, dict]): - The request object. GetJSONWebKeysRequest gets the public component of the - keys used by the cluster to sign token requests. This - will be the jwks_uri for the discover document returned - by getOpenIDConfig. See the OpenID Connect Discovery 1.0 - specification for details. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.GetJSONWebKeysResponse: - GetJSONWebKeysResponse is a valid - JSON Web Key Set as specififed in rfc - 7517 - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetJSONWebKeysRequest): - request = cluster_service.GetJSONWebKeysRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_json_web_keys] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_node_pools(self, - request: Optional[Union[cluster_service.ListNodePoolsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListNodePoolsResponse: - r"""Lists the node pools for a cluster. - - .. 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 import container_v1beta1 - - def sample_list_node_pools(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.ListNodePoolsRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.list_node_pools(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.ListNodePoolsRequest, dict]): - The request object. ListNodePoolsRequest lists the node - pool(s) for a cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the parent field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the parent field. - - This corresponds to the ``cluster_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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.ListNodePoolsResponse: - ListNodePoolsResponse is the result - of ListNodePoolsRequest. - - """ - # 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([project_id, zone, cluster_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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListNodePoolsRequest): - request = cluster_service.ListNodePoolsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_node_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_node_pool(self, - request: Optional[Union[cluster_service.GetNodePoolRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.NodePool: - r"""Retrieves the requested node pool. - - .. 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 import container_v1beta1 - - def sample_get_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.GetNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = client.get_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.GetNodePoolRequest, dict]): - The request object. GetNodePoolRequest retrieves a node - pool for a cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (str): - Required. Deprecated. The name of the - node pool. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``node_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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.NodePool: - NodePool contains the name and - configuration for a cluster's node pool. - Node pools are a set of nodes (i.e. - VM's), with a common configuration and - specification, under the control of the - cluster master. They may have a set of - Kubernetes labels applied to them, which - may be used to reference them during pod - scheduling. They may also be resized up - or down, to accommodate the workload. - - """ - # 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([project_id, zone, cluster_id, node_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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.GetNodePoolRequest): - request = cluster_service.GetNodePoolRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_node_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_node_pool(self, - request: Optional[Union[cluster_service.CreateNodePoolRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool: Optional[cluster_service.NodePool] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Creates a node pool for a cluster. - - .. 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 import container_v1beta1 - - def sample_create_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.CreateNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.create_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.CreateNodePoolRequest, dict]): - The request object. CreateNodePoolRequest creates a node - pool for a cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the - parent field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the parent field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the parent field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool (google.cloud.container_v1beta1.types.NodePool): - Required. The node pool to create. - This corresponds to the ``node_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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CreateNodePoolRequest): - request = cluster_service.CreateNodePoolRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool is not None: - request.node_pool = node_pool - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_node_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def delete_node_pool(self, - request: Optional[Union[cluster_service.DeleteNodePoolRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Deletes a node pool from a cluster. - - .. 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 import container_v1beta1 - - def sample_delete_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.DeleteNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = client.delete_node_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.DeleteNodePoolRequest, dict]): - The request object. DeleteNodePoolRequest deletes a node - pool for a cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (str): - Required. Deprecated. The name of the - node pool to delete. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``node_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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.DeleteNodePoolRequest): - request = cluster_service.DeleteNodePoolRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_node_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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def complete_node_pool_upgrade(self, - request: Optional[Union[cluster_service.CompleteNodePoolUpgradeRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> None: - r"""CompleteNodePoolUpgrade will signal an on-going node - pool upgrade to complete. - - .. 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 import container_v1beta1 - - def sample_complete_node_pool_upgrade(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.CompleteNodePoolUpgradeRequest( - ) - - # Make the request - client.complete_node_pool_upgrade(request=request) - - Args: - request (Union[google.cloud.container_v1beta1.types.CompleteNodePoolUpgradeRequest, dict]): - The request object. CompleteNodePoolUpgradeRequest sets - the name of target node pool to complete - upgrade. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CompleteNodePoolUpgradeRequest): - request = cluster_service.CompleteNodePoolUpgradeRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.complete_node_pool_upgrade] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - def rollback_node_pool_upgrade(self, - request: Optional[Union[cluster_service.RollbackNodePoolUpgradeRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Rolls back a previously Aborted or Failed NodePool - upgrade. This makes no changes if the last upgrade - successfully completed. - - .. 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 import container_v1beta1 - - def sample_rollback_node_pool_upgrade(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.RollbackNodePoolUpgradeRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = client.rollback_node_pool_upgrade(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.RollbackNodePoolUpgradeRequest, dict]): - The request object. RollbackNodePoolUpgradeRequest - rollbacks the previously Aborted or - Failed NodePool upgrade. This will be an - no-op if the last upgrade successfully - completed. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster to rollback. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (str): - Required. Deprecated. The name of the - node pool to rollback. This field has - been deprecated and replaced by the name - field. - - This corresponds to the ``node_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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.RollbackNodePoolUpgradeRequest): - request = cluster_service.RollbackNodePoolUpgradeRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.rollback_node_pool_upgrade] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_node_pool_management(self, - request: Optional[Union[cluster_service.SetNodePoolManagementRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - node_pool_id: Optional[str] = None, - management: Optional[cluster_service.NodeManagement] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the NodeManagement options for a node pool. - - .. 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 import container_v1beta1 - - def sample_set_node_pool_management(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNodePoolManagementRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = client.set_node_pool_management(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.SetNodePoolManagementRequest, dict]): - The request object. SetNodePoolManagementRequest sets the - node management properties of a node - pool. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster to update. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - node_pool_id (str): - Required. Deprecated. The name of the - node pool to update. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``node_pool_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - management (google.cloud.container_v1beta1.types.NodeManagement): - Required. NodeManagement - configuration for the node pool. - - This corresponds to the ``management`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, node_pool_id, management]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNodePoolManagementRequest): - request = cluster_service.SetNodePoolManagementRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if node_pool_id is not None: - request.node_pool_id = node_pool_id - if management is not None: - request.management = management - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_node_pool_management] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_labels(self, - request: Optional[Union[cluster_service.SetLabelsRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - resource_labels: Optional[MutableMapping[str, str]] = None, - label_fingerprint: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets labels on a cluster. - - .. 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 import container_v1beta1 - - def sample_set_labels(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLabelsRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - label_fingerprint="label_fingerprint_value", - ) - - # Make the request - response = client.set_labels(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.SetLabelsRequest, dict]): - The request object. SetLabelsRequest sets the Google - Cloud Platform labels on a Google - Container Engine cluster, which will in - turn set them for Google Compute Engine - resources used by that cluster - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - resource_labels (MutableMapping[str, str]): - Required. The labels to set for that - cluster. - - This corresponds to the ``resource_labels`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - label_fingerprint (str): - Required. The fingerprint of the previous set of labels - for this resource, used to detect conflicts. The - fingerprint is initially generated by Kubernetes Engine - and changes after every request to modify or update - labels. You must always provide an up-to-date - fingerprint hash when updating or changing labels. Make - a ``get()`` request to the resource to get the latest - fingerprint. - - This corresponds to the ``label_fingerprint`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, resource_labels, label_fingerprint]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLabelsRequest): - request = cluster_service.SetLabelsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if resource_labels is not None: - request.resource_labels = resource_labels - if label_fingerprint is not None: - request.label_fingerprint = label_fingerprint - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_labels] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_legacy_abac(self, - request: Optional[Union[cluster_service.SetLegacyAbacRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - enabled: Optional[bool] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Enables or disables the ABAC authorization mechanism - on a cluster. - - .. 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 import container_v1beta1 - - def sample_set_legacy_abac(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLegacyAbacRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - enabled=True, - ) - - # Make the request - response = client.set_legacy_abac(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.SetLegacyAbacRequest, dict]): - The request object. SetLegacyAbacRequest enables or - disables the ABAC authorization - mechanism for a cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster to update. This field has been - deprecated and replaced by the name - field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - enabled (bool): - Required. Whether ABAC authorization - will be enabled in the cluster. - - This corresponds to the ``enabled`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, enabled]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetLegacyAbacRequest): - request = cluster_service.SetLegacyAbacRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if enabled is not None: - request.enabled = enabled - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_legacy_abac] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def start_ip_rotation(self, - request: Optional[Union[cluster_service.StartIPRotationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Starts master IP rotation. - - .. 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 import container_v1beta1 - - def sample_start_ip_rotation(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.StartIPRotationRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.start_ip_rotation(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.StartIPRotationRequest, dict]): - The request object. StartIPRotationRequest creates a new - IP for the cluster and then performs a - node upgrade on each node pool to point - to the new IP. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``cluster_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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.StartIPRotationRequest): - request = cluster_service.StartIPRotationRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.start_ip_rotation] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def complete_ip_rotation(self, - request: Optional[Union[cluster_service.CompleteIPRotationRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Completes master IP rotation. - - .. 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 import container_v1beta1 - - def sample_complete_ip_rotation(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.CompleteIPRotationRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.complete_ip_rotation(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.CompleteIPRotationRequest, dict]): - The request object. CompleteIPRotationRequest moves the - cluster master back into single-IP mode. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``cluster_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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CompleteIPRotationRequest): - request = cluster_service.CompleteIPRotationRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.complete_ip_rotation] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_node_pool_size(self, - request: Optional[Union[cluster_service.SetNodePoolSizeRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""SetNodePoolSizeRequest sets the size of a node pool. The new - size will be used for all replicas, including future replicas - created by modifying - [NodePool.locations][google.container.v1beta1.NodePool.locations]. - - .. 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 import container_v1beta1 - - def sample_set_node_pool_size(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNodePoolSizeRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - node_count=1070, - ) - - # Make the request - response = client.set_node_pool_size(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.SetNodePoolSizeRequest, dict]): - The request object. SetNodePoolSizeRequest sets the size - of a node pool. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNodePoolSizeRequest): - request = cluster_service.SetNodePoolSizeRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_node_pool_size] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_network_policy(self, - request: Optional[Union[cluster_service.SetNetworkPolicyRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - network_policy: Optional[cluster_service.NetworkPolicy] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Enables or disables Network Policy for a cluster. - - .. 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 import container_v1beta1 - - def sample_set_network_policy(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNetworkPolicyRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.set_network_policy(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.SetNetworkPolicyRequest, dict]): - The request object. SetNetworkPolicyRequest - enables/disables network policy for a - cluster. - project_id (str): - Required. Deprecated. The Google Developers Console - `project ID or project - number `__. - This field has been deprecated and replaced by the name - field. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. Deprecated. The name of the Google Compute - Engine - `zone `__ - in which the cluster resides. This field has been - deprecated and replaced by the name field. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated - and replaced by the name field. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - network_policy (google.cloud.container_v1beta1.types.NetworkPolicy): - Required. Configuration options for - the NetworkPolicy feature. - - This corresponds to the ``network_policy`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, network_policy]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetNetworkPolicyRequest): - request = cluster_service.SetNetworkPolicyRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if network_policy is not None: - request.network_policy = network_policy - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_network_policy] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def set_maintenance_policy(self, - request: Optional[Union[cluster_service.SetMaintenancePolicyRequest, dict]] = None, - *, - project_id: Optional[str] = None, - zone: Optional[str] = None, - cluster_id: Optional[str] = None, - maintenance_policy: Optional[cluster_service.MaintenancePolicy] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.Operation: - r"""Sets the maintenance policy for a cluster. - - .. 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 import container_v1beta1 - - def sample_set_maintenance_policy(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetMaintenancePolicyRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.set_maintenance_policy(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.SetMaintenancePolicyRequest, dict]): - The request object. SetMaintenancePolicyRequest sets the - maintenance policy for a cluster. - project_id (str): - Required. The Google Developers Console `project ID or - project - number `__. - - This corresponds to the ``project_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - zone (str): - Required. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. - - This corresponds to the ``zone`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - cluster_id (str): - Required. The name of the cluster to - update. - - This corresponds to the ``cluster_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - maintenance_policy (google.cloud.container_v1beta1.types.MaintenancePolicy): - Required. The maintenance policy to - be set for the cluster. An empty field - clears the existing maintenance policy. - - This corresponds to the ``maintenance_policy`` field - on the ``request`` instance; if ``request`` is provided, this - should not 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.Operation: - This operation resource represents - operations that may have happened or are - happening on the cluster. All fields are - output only. - - """ - # 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([project_id, zone, cluster_id, maintenance_policy]) - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.SetMaintenancePolicyRequest): - request = cluster_service.SetMaintenancePolicyRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if project_id is not None: - request.project_id = project_id - if zone is not None: - request.zone = zone - if cluster_id is not None: - request.cluster_id = cluster_id - if maintenance_policy is not None: - request.maintenance_policy = maintenance_policy - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.set_maintenance_policy] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_usable_subnetworks(self, - request: Optional[Union[cluster_service.ListUsableSubnetworksRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> pagers.ListUsableSubnetworksPager: - r"""Lists subnetworks that can be used for creating - clusters in a project. - - .. 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 import container_v1beta1 - - def sample_list_usable_subnetworks(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.ListUsableSubnetworksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_usable_subnetworks(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.ListUsableSubnetworksRequest, dict]): - The request object. ListUsableSubnetworksRequest requests - the list of usable subnetworks. - available to a user for creating - clusters. - parent (str): - Required. The parent project where subnetworks are - usable. Specified in the format ``projects/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.services.cluster_manager.pagers.ListUsableSubnetworksPager: - ListUsableSubnetworksResponse is the - response of - ListUsableSubnetworksRequest. - - 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListUsableSubnetworksRequest): - request = cluster_service.ListUsableSubnetworksRequest(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_usable_subnetworks] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # 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.ListUsableSubnetworksPager( - method=rpc, - request=request, - response=response, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def check_autopilot_compatibility(self, - request: Optional[Union[cluster_service.CheckAutopilotCompatibilityRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.CheckAutopilotCompatibilityResponse: - r"""Checks the cluster compatibility with Autopilot mode, - and returns a list of compatibility issues. - - .. 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 import container_v1beta1 - - def sample_check_autopilot_compatibility(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.CheckAutopilotCompatibilityRequest( - ) - - # Make the request - response = client.check_autopilot_compatibility(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityRequest, dict]): - The request object. CheckAutopilotCompatibilityRequest - requests getting the blockers for the - given operation in the cluster. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityResponse: - CheckAutopilotCompatibilityResponse - has a list of compatibility issues. - - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.CheckAutopilotCompatibilityRequest): - request = cluster_service.CheckAutopilotCompatibilityRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.check_autopilot_compatibility] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_locations(self, - request: Optional[Union[cluster_service.ListLocationsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> cluster_service.ListLocationsResponse: - r"""Fetches locations that offer Google Kubernetes - Engine. - - .. 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 import container_v1beta1 - - def sample_list_locations(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.ListLocationsRequest( - parent="parent_value", - ) - - # Make the request - response = client.list_locations(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.container_v1beta1.types.ListLocationsRequest, dict]): - The request object. ListLocationsRequest is used to - request the locations that offer GKE. - parent (str): - Required. Contains the name of the resource requested. - Specified in the format ``projects/*``. - - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.container_v1beta1.types.ListLocationsResponse: - ListLocationsResponse returns the - list of all GKE locations and their - recommendation state. - - """ - # 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.') - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, cluster_service.ListLocationsRequest): - request = cluster_service.ListLocationsRequest(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_locations] - - # 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), - )), - ) - - # Validate the universe domain. - self._validate_universe_domain() - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def __enter__(self) -> "ClusterManagerClient": - 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__ = ( - "ClusterManagerClient", -) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/pagers.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/pagers.py deleted file mode 100644 index fe4ef8628a0f..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/pagers.py +++ /dev/null @@ -1,166 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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.api_core import gapic_v1 -from google.api_core import retry as retries -from google.api_core import retry_async as retries_async -from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator, Union -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] - OptionalAsyncRetry = Union[retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object, None] # type: ignore - OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore - -from google.cloud.container_v1beta1.types import cluster_service - - -class ListUsableSubnetworksPager: - """A pager for iterating through ``list_usable_subnetworks`` requests. - - This class thinly wraps an initial - :class:`google.cloud.container_v1beta1.types.ListUsableSubnetworksResponse` object, and - provides an ``__iter__`` method to iterate through its - ``subnetworks`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListUsableSubnetworks`` requests and continue to iterate - through the ``subnetworks`` field on the - corresponding responses. - - All the usual :class:`google.cloud.container_v1beta1.types.ListUsableSubnetworksResponse` - 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[..., cluster_service.ListUsableSubnetworksResponse], - request: cluster_service.ListUsableSubnetworksRequest, - response: cluster_service.ListUsableSubnetworksResponse, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.container_v1beta1.types.ListUsableSubnetworksRequest): - The initial request object. - response (google.cloud.container_v1beta1.types.ListUsableSubnetworksResponse): - The initial response object. - 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, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - self._method = method - self._request = cluster_service.ListUsableSubnetworksRequest(request) - self._response = response - self._retry = retry - self._timeout = timeout - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[cluster_service.ListUsableSubnetworksResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, retry=self._retry, timeout=self._timeout, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[cluster_service.UsableSubnetwork]: - for page in self.pages: - yield from page.subnetworks - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListUsableSubnetworksAsyncPager: - """A pager for iterating through ``list_usable_subnetworks`` requests. - - This class thinly wraps an initial - :class:`google.cloud.container_v1beta1.types.ListUsableSubnetworksResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``subnetworks`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListUsableSubnetworks`` requests and continue to iterate - through the ``subnetworks`` field on the - corresponding responses. - - All the usual :class:`google.cloud.container_v1beta1.types.ListUsableSubnetworksResponse` - 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[cluster_service.ListUsableSubnetworksResponse]], - request: cluster_service.ListUsableSubnetworksRequest, - response: cluster_service.ListUsableSubnetworksResponse, - *, - retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.container_v1beta1.types.ListUsableSubnetworksRequest): - The initial request object. - response (google.cloud.container_v1beta1.types.ListUsableSubnetworksResponse): - The initial response object. - retry (google.api_core.retry.AsyncRetry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - self._method = method - self._request = cluster_service.ListUsableSubnetworksRequest(request) - self._response = response - self._retry = retry - self._timeout = timeout - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[cluster_service.ListUsableSubnetworksResponse]: - 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, retry=self._retry, timeout=self._timeout, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[cluster_service.UsableSubnetwork]: - async def async_generator(): - async for page in self.pages: - for response in page.subnetworks: - 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/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/README.rst b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/README.rst deleted file mode 100644 index 4b8234a968af..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/README.rst +++ /dev/null @@ -1,9 +0,0 @@ - -transport inheritance structure -_______________________________ - -`ClusterManagerTransport` is the ABC for all transports. -- public child `ClusterManagerGrpcTransport` for sync gRPC transport (defined in `grpc.py`). -- public child `ClusterManagerGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`). -- private child `_BaseClusterManagerRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`). -- public child `ClusterManagerRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`). diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/__init__.py deleted file mode 100644 index 5779d92b56f9..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ClusterManagerTransport -from .grpc import ClusterManagerGrpcTransport -from .grpc_asyncio import ClusterManagerGrpcAsyncIOTransport - - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[ClusterManagerTransport]] -_transport_registry['grpc'] = ClusterManagerGrpcTransport -_transport_registry['grpc_asyncio'] = ClusterManagerGrpcAsyncIOTransport - -__all__ = ( - 'ClusterManagerTransport', - 'ClusterManagerGrpcTransport', - 'ClusterManagerGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py deleted file mode 100644 index 4ab66ced7fa1..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py +++ /dev/null @@ -1,741 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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.container_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.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.container_v1beta1.types import cluster_service -from google.protobuf import empty_pb2 # type: ignore - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) - - -class ClusterManagerTransport(abc.ABC): - """Abstract transport class for ClusterManager.""" - - AUTH_SCOPES = ( - 'https://www.googleapis.com/auth/cloud-platform', - ) - - DEFAULT_HOST: str = 'container.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 (default: 'container.googleapis.com'). - 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 not hasattr(self, "_ignore_credentials"): - self._ignore_credentials: bool = False - - # 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 and not self._ignore_credentials: - 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 - - @property - def host(self): - return self._host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.list_clusters: gapic_v1.method.wrap_method( - self.list_clusters, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_cluster: gapic_v1.method.wrap_method( - self.get_cluster, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.create_cluster: gapic_v1.method.wrap_method( - self.create_cluster, - default_timeout=45.0, - client_info=client_info, - ), - self.update_cluster: gapic_v1.method.wrap_method( - self.update_cluster, - default_timeout=45.0, - client_info=client_info, - ), - self.update_node_pool: gapic_v1.method.wrap_method( - self.update_node_pool, - default_timeout=45.0, - client_info=client_info, - ), - self.set_node_pool_autoscaling: gapic_v1.method.wrap_method( - self.set_node_pool_autoscaling, - default_timeout=45.0, - client_info=client_info, - ), - self.set_logging_service: gapic_v1.method.wrap_method( - self.set_logging_service, - default_timeout=45.0, - client_info=client_info, - ), - self.set_monitoring_service: gapic_v1.method.wrap_method( - self.set_monitoring_service, - default_timeout=45.0, - client_info=client_info, - ), - self.set_addons_config: gapic_v1.method.wrap_method( - self.set_addons_config, - default_timeout=45.0, - client_info=client_info, - ), - self.set_locations: gapic_v1.method.wrap_method( - self.set_locations, - default_timeout=45.0, - client_info=client_info, - ), - self.update_master: gapic_v1.method.wrap_method( - self.update_master, - default_timeout=45.0, - client_info=client_info, - ), - self.set_master_auth: gapic_v1.method.wrap_method( - self.set_master_auth, - default_timeout=45.0, - client_info=client_info, - ), - self.delete_cluster: gapic_v1.method.wrap_method( - self.delete_cluster, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.list_operations: gapic_v1.method.wrap_method( - self.list_operations, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_operation: gapic_v1.method.wrap_method( - self.get_operation, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.cancel_operation: gapic_v1.method.wrap_method( - self.cancel_operation, - default_timeout=45.0, - client_info=client_info, - ), - self.get_server_config: gapic_v1.method.wrap_method( - self.get_server_config, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_json_web_keys: gapic_v1.method.wrap_method( - self.get_json_web_keys, - default_timeout=None, - client_info=client_info, - ), - self.list_node_pools: gapic_v1.method.wrap_method( - self.list_node_pools, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_node_pool: gapic_v1.method.wrap_method( - self.get_node_pool, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.create_node_pool: gapic_v1.method.wrap_method( - self.create_node_pool, - default_timeout=45.0, - client_info=client_info, - ), - self.delete_node_pool: gapic_v1.method.wrap_method( - self.delete_node_pool, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.complete_node_pool_upgrade: gapic_v1.method.wrap_method( - self.complete_node_pool_upgrade, - default_timeout=None, - client_info=client_info, - ), - self.rollback_node_pool_upgrade: gapic_v1.method.wrap_method( - self.rollback_node_pool_upgrade, - default_timeout=45.0, - client_info=client_info, - ), - self.set_node_pool_management: gapic_v1.method.wrap_method( - self.set_node_pool_management, - default_timeout=45.0, - client_info=client_info, - ), - self.set_labels: gapic_v1.method.wrap_method( - self.set_labels, - default_timeout=45.0, - client_info=client_info, - ), - self.set_legacy_abac: gapic_v1.method.wrap_method( - self.set_legacy_abac, - default_timeout=45.0, - client_info=client_info, - ), - self.start_ip_rotation: gapic_v1.method.wrap_method( - self.start_ip_rotation, - default_timeout=45.0, - client_info=client_info, - ), - self.complete_ip_rotation: gapic_v1.method.wrap_method( - self.complete_ip_rotation, - default_timeout=45.0, - client_info=client_info, - ), - self.set_node_pool_size: gapic_v1.method.wrap_method( - self.set_node_pool_size, - default_timeout=45.0, - client_info=client_info, - ), - self.set_network_policy: gapic_v1.method.wrap_method( - self.set_network_policy, - default_timeout=45.0, - client_info=client_info, - ), - self.set_maintenance_policy: gapic_v1.method.wrap_method( - self.set_maintenance_policy, - default_timeout=45.0, - client_info=client_info, - ), - self.list_usable_subnetworks: gapic_v1.method.wrap_method( - self.list_usable_subnetworks, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.check_autopilot_compatibility: gapic_v1.method.wrap_method( - self.check_autopilot_compatibility, - default_timeout=None, - client_info=client_info, - ), - self.list_locations: gapic_v1.method.wrap_method( - self.list_locations, - default_retry=retries.Retry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - 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 list_clusters(self) -> Callable[ - [cluster_service.ListClustersRequest], - Union[ - cluster_service.ListClustersResponse, - Awaitable[cluster_service.ListClustersResponse] - ]]: - raise NotImplementedError() - - @property - def get_cluster(self) -> Callable[ - [cluster_service.GetClusterRequest], - Union[ - cluster_service.Cluster, - Awaitable[cluster_service.Cluster] - ]]: - raise NotImplementedError() - - @property - def create_cluster(self) -> Callable[ - [cluster_service.CreateClusterRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def update_cluster(self) -> Callable[ - [cluster_service.UpdateClusterRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def update_node_pool(self) -> Callable[ - [cluster_service.UpdateNodePoolRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_node_pool_autoscaling(self) -> Callable[ - [cluster_service.SetNodePoolAutoscalingRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_logging_service(self) -> Callable[ - [cluster_service.SetLoggingServiceRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_monitoring_service(self) -> Callable[ - [cluster_service.SetMonitoringServiceRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_addons_config(self) -> Callable[ - [cluster_service.SetAddonsConfigRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_locations(self) -> Callable[ - [cluster_service.SetLocationsRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def update_master(self) -> Callable[ - [cluster_service.UpdateMasterRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_master_auth(self) -> Callable[ - [cluster_service.SetMasterAuthRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def delete_cluster(self) -> Callable[ - [cluster_service.DeleteClusterRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def list_operations(self) -> Callable[ - [cluster_service.ListOperationsRequest], - Union[ - cluster_service.ListOperationsResponse, - Awaitable[cluster_service.ListOperationsResponse] - ]]: - raise NotImplementedError() - - @property - def get_operation(self) -> Callable[ - [cluster_service.GetOperationRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def cancel_operation(self) -> Callable[ - [cluster_service.CancelOperationRequest], - Union[ - empty_pb2.Empty, - Awaitable[empty_pb2.Empty] - ]]: - raise NotImplementedError() - - @property - def get_server_config(self) -> Callable[ - [cluster_service.GetServerConfigRequest], - Union[ - cluster_service.ServerConfig, - Awaitable[cluster_service.ServerConfig] - ]]: - raise NotImplementedError() - - @property - def get_json_web_keys(self) -> Callable[ - [cluster_service.GetJSONWebKeysRequest], - Union[ - cluster_service.GetJSONWebKeysResponse, - Awaitable[cluster_service.GetJSONWebKeysResponse] - ]]: - raise NotImplementedError() - - @property - def list_node_pools(self) -> Callable[ - [cluster_service.ListNodePoolsRequest], - Union[ - cluster_service.ListNodePoolsResponse, - Awaitable[cluster_service.ListNodePoolsResponse] - ]]: - raise NotImplementedError() - - @property - def get_node_pool(self) -> Callable[ - [cluster_service.GetNodePoolRequest], - Union[ - cluster_service.NodePool, - Awaitable[cluster_service.NodePool] - ]]: - raise NotImplementedError() - - @property - def create_node_pool(self) -> Callable[ - [cluster_service.CreateNodePoolRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def delete_node_pool(self) -> Callable[ - [cluster_service.DeleteNodePoolRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def complete_node_pool_upgrade(self) -> Callable[ - [cluster_service.CompleteNodePoolUpgradeRequest], - Union[ - empty_pb2.Empty, - Awaitable[empty_pb2.Empty] - ]]: - raise NotImplementedError() - - @property - def rollback_node_pool_upgrade(self) -> Callable[ - [cluster_service.RollbackNodePoolUpgradeRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_node_pool_management(self) -> Callable[ - [cluster_service.SetNodePoolManagementRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_labels(self) -> Callable[ - [cluster_service.SetLabelsRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_legacy_abac(self) -> Callable[ - [cluster_service.SetLegacyAbacRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def start_ip_rotation(self) -> Callable[ - [cluster_service.StartIPRotationRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def complete_ip_rotation(self) -> Callable[ - [cluster_service.CompleteIPRotationRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_node_pool_size(self) -> Callable[ - [cluster_service.SetNodePoolSizeRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_network_policy(self) -> Callable[ - [cluster_service.SetNetworkPolicyRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def set_maintenance_policy(self) -> Callable[ - [cluster_service.SetMaintenancePolicyRequest], - Union[ - cluster_service.Operation, - Awaitable[cluster_service.Operation] - ]]: - raise NotImplementedError() - - @property - def list_usable_subnetworks(self) -> Callable[ - [cluster_service.ListUsableSubnetworksRequest], - Union[ - cluster_service.ListUsableSubnetworksResponse, - Awaitable[cluster_service.ListUsableSubnetworksResponse] - ]]: - raise NotImplementedError() - - @property - def check_autopilot_compatibility(self) -> Callable[ - [cluster_service.CheckAutopilotCompatibilityRequest], - Union[ - cluster_service.CheckAutopilotCompatibilityResponse, - Awaitable[cluster_service.CheckAutopilotCompatibilityResponse] - ]]: - raise NotImplementedError() - - @property - def list_locations(self) -> Callable[ - [cluster_service.ListLocationsRequest], - Union[ - cluster_service.ListLocationsResponse, - Awaitable[cluster_service.ListLocationsResponse] - ]]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ( - 'ClusterManagerTransport', -) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py deleted file mode 100644 index 68ec13dc2ea3..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py +++ /dev/null @@ -1,1274 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 json -import logging as std_logging -import pickle -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import grpc_helpers -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 -from google.protobuf.json_format import MessageToJson -import google.protobuf.message - -import grpc # type: ignore -import proto # type: ignore - -from google.cloud.container_v1beta1.types import cluster_service -from google.protobuf import empty_pb2 # type: ignore -from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO - -try: - from google.api_core import client_logging # type: ignore - CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER -except ImportError: # pragma: NO COVER - CLIENT_LOGGING_SUPPORTED = False - -_LOGGER = std_logging.getLogger(__name__) - - -class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER - def intercept_unary_unary(self, continuation, client_call_details, request): - logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG) - if logging_enabled: # pragma: NO COVER - request_metadata = client_call_details.metadata - if isinstance(request, proto.Message): - request_payload = type(request).to_json(request) - elif isinstance(request, google.protobuf.message.Message): - request_payload = MessageToJson(request) - else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" - - request_metadata = { - key: value.decode("utf-8") if isinstance(value, bytes) else value - for key, value in request_metadata - } - grpc_request = { - "payload": request_payload, - "requestMethod": "grpc", - "metadata": dict(request_metadata), - } - _LOGGER.debug( - f"Sending request for {client_call_details.method}", - extra = { - "serviceName": "google.container.v1beta1.ClusterManager", - "rpcName": client_call_details.method, - "request": grpc_request, - "metadata": grpc_request["metadata"], - }, - ) - - response = continuation(client_call_details, request) - if logging_enabled: # pragma: NO COVER - response_metadata = response.trailing_metadata() - # Convert gRPC metadata `` to list of tuples - metadata = dict([(k, str(v)) for k, v in response_metadata]) if response_metadata else None - result = response.result() - if isinstance(result, proto.Message): - response_payload = type(result).to_json(result) - elif isinstance(result, google.protobuf.message.Message): - response_payload = MessageToJson(result) - else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" - grpc_response = { - "payload": response_payload, - "metadata": metadata, - "status": "OK", - } - _LOGGER.debug( - f"Received response for {client_call_details.method}.", - extra = { - "serviceName": "google.container.v1beta1.ClusterManager", - "rpcName": client_call_details.method, - "response": grpc_response, - "metadata": grpc_response["metadata"], - }, - ) - return response - - -class ClusterManagerGrpcTransport(ClusterManagerTransport): - """gRPC backend transport for ClusterManager. - - Google Kubernetes Engine Cluster Manager v1beta1 - - 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 = 'container.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[Union[grpc.Channel, Callable[..., 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 (default: 'container.googleapis.com'). - 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 a ``channel`` instance 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 a ``channel`` instance is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if a ``channel`` instance is provided. - channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]): - A ``Channel`` instance through which to make calls, or a Callable - that constructs and returns one. If set to None, ``self.create_channel`` - is used to create the channel. If a Callable is given, it will be called - with the same arguments as used in ``self.create_channel``. - 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 a ``channel`` instance 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 a ``channel`` instance 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] = {} - - 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 isinstance(channel, grpc.Channel): - # Ignore credentials if a channel was passed. - credentials = None - self._ignore_credentials = True - # 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: - # initialize with the provided callable or the default channel - channel_init = channel or type(self).create_channel - self._grpc_channel = channel_init( - 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), - ], - ) - - self._interceptor = _LoggingClientInterceptor() - self._logged_channel = grpc.intercept_channel(self._grpc_channel, self._interceptor) - - # Wrap messages. This must be done after self._logged_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel(cls, - host: str = 'container.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 list_clusters(self) -> Callable[ - [cluster_service.ListClustersRequest], - cluster_service.ListClustersResponse]: - r"""Return a callable for the list clusters method over gRPC. - - Lists all clusters owned by a project in either the - specified zone or all zones. - - Returns: - Callable[[~.ListClustersRequest], - ~.ListClustersResponse]: - 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_clusters' not in self._stubs: - self._stubs['list_clusters'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/ListClusters', - request_serializer=cluster_service.ListClustersRequest.serialize, - response_deserializer=cluster_service.ListClustersResponse.deserialize, - ) - return self._stubs['list_clusters'] - - @property - def get_cluster(self) -> Callable[ - [cluster_service.GetClusterRequest], - cluster_service.Cluster]: - r"""Return a callable for the get cluster method over gRPC. - - Gets the details for a specific cluster. - - Returns: - Callable[[~.GetClusterRequest], - ~.Cluster]: - 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_cluster' not in self._stubs: - self._stubs['get_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/GetCluster', - request_serializer=cluster_service.GetClusterRequest.serialize, - response_deserializer=cluster_service.Cluster.deserialize, - ) - return self._stubs['get_cluster'] - - @property - def create_cluster(self) -> Callable[ - [cluster_service.CreateClusterRequest], - cluster_service.Operation]: - r"""Return a callable for the create cluster method over gRPC. - - Creates a cluster, consisting of the specified number and type - of Google Compute Engine instances. - - By default, the cluster is created in the project's `default - network `__. - - One firewall is added for the cluster. After cluster creation, - the Kubelet creates routes for each node to allow the containers - on that node to communicate with all other instances in the - cluster. - - Finally, an entry is added to the project's global metadata - indicating which CIDR range the cluster is using. - - Returns: - Callable[[~.CreateClusterRequest], - ~.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_cluster' not in self._stubs: - self._stubs['create_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/CreateCluster', - request_serializer=cluster_service.CreateClusterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['create_cluster'] - - @property - def update_cluster(self) -> Callable[ - [cluster_service.UpdateClusterRequest], - cluster_service.Operation]: - r"""Return a callable for the update cluster method over gRPC. - - Updates the settings for a specific cluster. - - Returns: - Callable[[~.UpdateClusterRequest], - ~.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_cluster' not in self._stubs: - self._stubs['update_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/UpdateCluster', - request_serializer=cluster_service.UpdateClusterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['update_cluster'] - - @property - def update_node_pool(self) -> Callable[ - [cluster_service.UpdateNodePoolRequest], - cluster_service.Operation]: - r"""Return a callable for the update node pool method over gRPC. - - Updates the version and/or image type of a specific - node pool. - - Returns: - Callable[[~.UpdateNodePoolRequest], - ~.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_node_pool' not in self._stubs: - self._stubs['update_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/UpdateNodePool', - request_serializer=cluster_service.UpdateNodePoolRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['update_node_pool'] - - @property - def set_node_pool_autoscaling(self) -> Callable[ - [cluster_service.SetNodePoolAutoscalingRequest], - cluster_service.Operation]: - r"""Return a callable for the set node pool autoscaling method over gRPC. - - Sets the autoscaling settings of a specific node - pool. - - Returns: - Callable[[~.SetNodePoolAutoscalingRequest], - ~.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 'set_node_pool_autoscaling' not in self._stubs: - self._stubs['set_node_pool_autoscaling'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetNodePoolAutoscaling', - request_serializer=cluster_service.SetNodePoolAutoscalingRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_node_pool_autoscaling'] - - @property - def set_logging_service(self) -> Callable[ - [cluster_service.SetLoggingServiceRequest], - cluster_service.Operation]: - r"""Return a callable for the set logging service method over gRPC. - - Sets the logging service for a specific cluster. - - Returns: - Callable[[~.SetLoggingServiceRequest], - ~.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 'set_logging_service' not in self._stubs: - self._stubs['set_logging_service'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetLoggingService', - request_serializer=cluster_service.SetLoggingServiceRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_logging_service'] - - @property - def set_monitoring_service(self) -> Callable[ - [cluster_service.SetMonitoringServiceRequest], - cluster_service.Operation]: - r"""Return a callable for the set monitoring service method over gRPC. - - Sets the monitoring service for a specific cluster. - - Returns: - Callable[[~.SetMonitoringServiceRequest], - ~.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 'set_monitoring_service' not in self._stubs: - self._stubs['set_monitoring_service'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetMonitoringService', - request_serializer=cluster_service.SetMonitoringServiceRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_monitoring_service'] - - @property - def set_addons_config(self) -> Callable[ - [cluster_service.SetAddonsConfigRequest], - cluster_service.Operation]: - r"""Return a callable for the set addons config method over gRPC. - - Sets the addons for a specific cluster. - - Returns: - Callable[[~.SetAddonsConfigRequest], - ~.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 'set_addons_config' not in self._stubs: - self._stubs['set_addons_config'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetAddonsConfig', - request_serializer=cluster_service.SetAddonsConfigRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_addons_config'] - - @property - def set_locations(self) -> Callable[ - [cluster_service.SetLocationsRequest], - cluster_service.Operation]: - r"""Return a callable for the set locations method over gRPC. - - Sets the locations for a specific cluster. Deprecated. Use - `projects.locations.clusters.update `__ - instead. - - Returns: - Callable[[~.SetLocationsRequest], - ~.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 'set_locations' not in self._stubs: - self._stubs['set_locations'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetLocations', - request_serializer=cluster_service.SetLocationsRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_locations'] - - @property - def update_master(self) -> Callable[ - [cluster_service.UpdateMasterRequest], - cluster_service.Operation]: - r"""Return a callable for the update master method over gRPC. - - Updates the master for a specific cluster. - - Returns: - Callable[[~.UpdateMasterRequest], - ~.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_master' not in self._stubs: - self._stubs['update_master'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/UpdateMaster', - request_serializer=cluster_service.UpdateMasterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['update_master'] - - @property - def set_master_auth(self) -> Callable[ - [cluster_service.SetMasterAuthRequest], - cluster_service.Operation]: - r"""Return a callable for the set master auth method over gRPC. - - Sets master auth materials. Currently supports - changing the admin password or a specific cluster, - either via password generation or explicitly setting the - password. - - Returns: - Callable[[~.SetMasterAuthRequest], - ~.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 'set_master_auth' not in self._stubs: - self._stubs['set_master_auth'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetMasterAuth', - request_serializer=cluster_service.SetMasterAuthRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_master_auth'] - - @property - def delete_cluster(self) -> Callable[ - [cluster_service.DeleteClusterRequest], - cluster_service.Operation]: - r"""Return a callable for the delete cluster method over gRPC. - - Deletes the cluster, including the Kubernetes - endpoint and all worker nodes. - - Firewalls and routes that were configured during cluster - creation are also deleted. - - Other Google Compute Engine resources that might be in - use by the cluster, such as load balancer resources, are - not deleted if they weren't present when the cluster was - initially created. - - Returns: - Callable[[~.DeleteClusterRequest], - ~.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_cluster' not in self._stubs: - self._stubs['delete_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/DeleteCluster', - request_serializer=cluster_service.DeleteClusterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['delete_cluster'] - - @property - def list_operations(self) -> Callable[ - [cluster_service.ListOperationsRequest], - cluster_service.ListOperationsResponse]: - r"""Return a callable for the list operations method over gRPC. - - Lists all operations in a project in the specified - zone or all zones. - - Returns: - Callable[[~.ListOperationsRequest], - ~.ListOperationsResponse]: - 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_operations' not in self._stubs: - self._stubs['list_operations'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/ListOperations', - request_serializer=cluster_service.ListOperationsRequest.serialize, - response_deserializer=cluster_service.ListOperationsResponse.deserialize, - ) - return self._stubs['list_operations'] - - @property - def get_operation(self) -> Callable[ - [cluster_service.GetOperationRequest], - cluster_service.Operation]: - r"""Return a callable for the get operation method over gRPC. - - Gets the specified operation. - - Returns: - Callable[[~.GetOperationRequest], - ~.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 'get_operation' not in self._stubs: - self._stubs['get_operation'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/GetOperation', - request_serializer=cluster_service.GetOperationRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['get_operation'] - - @property - def cancel_operation(self) -> Callable[ - [cluster_service.CancelOperationRequest], - empty_pb2.Empty]: - r"""Return a callable for the cancel operation method over gRPC. - - Cancels the specified operation. - - Returns: - Callable[[~.CancelOperationRequest], - ~.Empty]: - 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 'cancel_operation' not in self._stubs: - self._stubs['cancel_operation'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/CancelOperation', - request_serializer=cluster_service.CancelOperationRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['cancel_operation'] - - @property - def get_server_config(self) -> Callable[ - [cluster_service.GetServerConfigRequest], - cluster_service.ServerConfig]: - r"""Return a callable for the get server config method over gRPC. - - Returns configuration info about the Google - Kubernetes Engine service. - - Returns: - Callable[[~.GetServerConfigRequest], - ~.ServerConfig]: - 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_server_config' not in self._stubs: - self._stubs['get_server_config'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/GetServerConfig', - request_serializer=cluster_service.GetServerConfigRequest.serialize, - response_deserializer=cluster_service.ServerConfig.deserialize, - ) - return self._stubs['get_server_config'] - - @property - def get_json_web_keys(self) -> Callable[ - [cluster_service.GetJSONWebKeysRequest], - cluster_service.GetJSONWebKeysResponse]: - r"""Return a callable for the get json web keys method over gRPC. - - Gets the public component of the cluster signing keys - in JSON Web Key format. - - Returns: - Callable[[~.GetJSONWebKeysRequest], - ~.GetJSONWebKeysResponse]: - 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_json_web_keys' not in self._stubs: - self._stubs['get_json_web_keys'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/GetJSONWebKeys', - request_serializer=cluster_service.GetJSONWebKeysRequest.serialize, - response_deserializer=cluster_service.GetJSONWebKeysResponse.deserialize, - ) - return self._stubs['get_json_web_keys'] - - @property - def list_node_pools(self) -> Callable[ - [cluster_service.ListNodePoolsRequest], - cluster_service.ListNodePoolsResponse]: - r"""Return a callable for the list node pools method over gRPC. - - Lists the node pools for a cluster. - - Returns: - Callable[[~.ListNodePoolsRequest], - ~.ListNodePoolsResponse]: - 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_node_pools' not in self._stubs: - self._stubs['list_node_pools'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/ListNodePools', - request_serializer=cluster_service.ListNodePoolsRequest.serialize, - response_deserializer=cluster_service.ListNodePoolsResponse.deserialize, - ) - return self._stubs['list_node_pools'] - - @property - def get_node_pool(self) -> Callable[ - [cluster_service.GetNodePoolRequest], - cluster_service.NodePool]: - r"""Return a callable for the get node pool method over gRPC. - - Retrieves the requested node pool. - - Returns: - Callable[[~.GetNodePoolRequest], - ~.NodePool]: - 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_node_pool' not in self._stubs: - self._stubs['get_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/GetNodePool', - request_serializer=cluster_service.GetNodePoolRequest.serialize, - response_deserializer=cluster_service.NodePool.deserialize, - ) - return self._stubs['get_node_pool'] - - @property - def create_node_pool(self) -> Callable[ - [cluster_service.CreateNodePoolRequest], - cluster_service.Operation]: - r"""Return a callable for the create node pool method over gRPC. - - Creates a node pool for a cluster. - - Returns: - Callable[[~.CreateNodePoolRequest], - ~.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_node_pool' not in self._stubs: - self._stubs['create_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/CreateNodePool', - request_serializer=cluster_service.CreateNodePoolRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['create_node_pool'] - - @property - def delete_node_pool(self) -> Callable[ - [cluster_service.DeleteNodePoolRequest], - cluster_service.Operation]: - r"""Return a callable for the delete node pool method over gRPC. - - Deletes a node pool from a cluster. - - Returns: - Callable[[~.DeleteNodePoolRequest], - ~.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_node_pool' not in self._stubs: - self._stubs['delete_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/DeleteNodePool', - request_serializer=cluster_service.DeleteNodePoolRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['delete_node_pool'] - - @property - def complete_node_pool_upgrade(self) -> Callable[ - [cluster_service.CompleteNodePoolUpgradeRequest], - empty_pb2.Empty]: - r"""Return a callable for the complete node pool upgrade method over gRPC. - - CompleteNodePoolUpgrade will signal an on-going node - pool upgrade to complete. - - Returns: - Callable[[~.CompleteNodePoolUpgradeRequest], - ~.Empty]: - 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 'complete_node_pool_upgrade' not in self._stubs: - self._stubs['complete_node_pool_upgrade'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/CompleteNodePoolUpgrade', - request_serializer=cluster_service.CompleteNodePoolUpgradeRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['complete_node_pool_upgrade'] - - @property - def rollback_node_pool_upgrade(self) -> Callable[ - [cluster_service.RollbackNodePoolUpgradeRequest], - cluster_service.Operation]: - r"""Return a callable for the rollback node pool upgrade method over gRPC. - - Rolls back a previously Aborted or Failed NodePool - upgrade. This makes no changes if the last upgrade - successfully completed. - - Returns: - Callable[[~.RollbackNodePoolUpgradeRequest], - ~.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 'rollback_node_pool_upgrade' not in self._stubs: - self._stubs['rollback_node_pool_upgrade'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/RollbackNodePoolUpgrade', - request_serializer=cluster_service.RollbackNodePoolUpgradeRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['rollback_node_pool_upgrade'] - - @property - def set_node_pool_management(self) -> Callable[ - [cluster_service.SetNodePoolManagementRequest], - cluster_service.Operation]: - r"""Return a callable for the set node pool management method over gRPC. - - Sets the NodeManagement options for a node pool. - - Returns: - Callable[[~.SetNodePoolManagementRequest], - ~.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 'set_node_pool_management' not in self._stubs: - self._stubs['set_node_pool_management'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetNodePoolManagement', - request_serializer=cluster_service.SetNodePoolManagementRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_node_pool_management'] - - @property - def set_labels(self) -> Callable[ - [cluster_service.SetLabelsRequest], - cluster_service.Operation]: - r"""Return a callable for the set labels method over gRPC. - - Sets labels on a cluster. - - Returns: - Callable[[~.SetLabelsRequest], - ~.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 'set_labels' not in self._stubs: - self._stubs['set_labels'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetLabels', - request_serializer=cluster_service.SetLabelsRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_labels'] - - @property - def set_legacy_abac(self) -> Callable[ - [cluster_service.SetLegacyAbacRequest], - cluster_service.Operation]: - r"""Return a callable for the set legacy abac method over gRPC. - - Enables or disables the ABAC authorization mechanism - on a cluster. - - Returns: - Callable[[~.SetLegacyAbacRequest], - ~.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 'set_legacy_abac' not in self._stubs: - self._stubs['set_legacy_abac'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetLegacyAbac', - request_serializer=cluster_service.SetLegacyAbacRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_legacy_abac'] - - @property - def start_ip_rotation(self) -> Callable[ - [cluster_service.StartIPRotationRequest], - cluster_service.Operation]: - r"""Return a callable for the start ip rotation method over gRPC. - - Starts master IP rotation. - - Returns: - Callable[[~.StartIPRotationRequest], - ~.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 'start_ip_rotation' not in self._stubs: - self._stubs['start_ip_rotation'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/StartIPRotation', - request_serializer=cluster_service.StartIPRotationRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['start_ip_rotation'] - - @property - def complete_ip_rotation(self) -> Callable[ - [cluster_service.CompleteIPRotationRequest], - cluster_service.Operation]: - r"""Return a callable for the complete ip rotation method over gRPC. - - Completes master IP rotation. - - Returns: - Callable[[~.CompleteIPRotationRequest], - ~.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 'complete_ip_rotation' not in self._stubs: - self._stubs['complete_ip_rotation'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/CompleteIPRotation', - request_serializer=cluster_service.CompleteIPRotationRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['complete_ip_rotation'] - - @property - def set_node_pool_size(self) -> Callable[ - [cluster_service.SetNodePoolSizeRequest], - cluster_service.Operation]: - r"""Return a callable for the set node pool size method over gRPC. - - SetNodePoolSizeRequest sets the size of a node pool. The new - size will be used for all replicas, including future replicas - created by modifying - [NodePool.locations][google.container.v1beta1.NodePool.locations]. - - Returns: - Callable[[~.SetNodePoolSizeRequest], - ~.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 'set_node_pool_size' not in self._stubs: - self._stubs['set_node_pool_size'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetNodePoolSize', - request_serializer=cluster_service.SetNodePoolSizeRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_node_pool_size'] - - @property - def set_network_policy(self) -> Callable[ - [cluster_service.SetNetworkPolicyRequest], - cluster_service.Operation]: - r"""Return a callable for the set network policy method over gRPC. - - Enables or disables Network Policy for a cluster. - - Returns: - Callable[[~.SetNetworkPolicyRequest], - ~.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 'set_network_policy' not in self._stubs: - self._stubs['set_network_policy'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetNetworkPolicy', - request_serializer=cluster_service.SetNetworkPolicyRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_network_policy'] - - @property - def set_maintenance_policy(self) -> Callable[ - [cluster_service.SetMaintenancePolicyRequest], - cluster_service.Operation]: - r"""Return a callable for the set maintenance policy method over gRPC. - - Sets the maintenance policy for a cluster. - - Returns: - Callable[[~.SetMaintenancePolicyRequest], - ~.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 'set_maintenance_policy' not in self._stubs: - self._stubs['set_maintenance_policy'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetMaintenancePolicy', - request_serializer=cluster_service.SetMaintenancePolicyRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_maintenance_policy'] - - @property - def list_usable_subnetworks(self) -> Callable[ - [cluster_service.ListUsableSubnetworksRequest], - cluster_service.ListUsableSubnetworksResponse]: - r"""Return a callable for the list usable subnetworks method over gRPC. - - Lists subnetworks that can be used for creating - clusters in a project. - - Returns: - Callable[[~.ListUsableSubnetworksRequest], - ~.ListUsableSubnetworksResponse]: - 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_usable_subnetworks' not in self._stubs: - self._stubs['list_usable_subnetworks'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/ListUsableSubnetworks', - request_serializer=cluster_service.ListUsableSubnetworksRequest.serialize, - response_deserializer=cluster_service.ListUsableSubnetworksResponse.deserialize, - ) - return self._stubs['list_usable_subnetworks'] - - @property - def check_autopilot_compatibility(self) -> Callable[ - [cluster_service.CheckAutopilotCompatibilityRequest], - cluster_service.CheckAutopilotCompatibilityResponse]: - r"""Return a callable for the check autopilot compatibility method over gRPC. - - Checks the cluster compatibility with Autopilot mode, - and returns a list of compatibility issues. - - Returns: - Callable[[~.CheckAutopilotCompatibilityRequest], - ~.CheckAutopilotCompatibilityResponse]: - 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 'check_autopilot_compatibility' not in self._stubs: - self._stubs['check_autopilot_compatibility'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/CheckAutopilotCompatibility', - request_serializer=cluster_service.CheckAutopilotCompatibilityRequest.serialize, - response_deserializer=cluster_service.CheckAutopilotCompatibilityResponse.deserialize, - ) - return self._stubs['check_autopilot_compatibility'] - - @property - def list_locations(self) -> Callable[ - [cluster_service.ListLocationsRequest], - cluster_service.ListLocationsResponse]: - r"""Return a callable for the list locations method over gRPC. - - Fetches locations that offer Google Kubernetes - Engine. - - Returns: - Callable[[~.ListLocationsRequest], - ~.ListLocationsResponse]: - 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_locations' not in self._stubs: - self._stubs['list_locations'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/ListLocations', - request_serializer=cluster_service.ListLocationsRequest.serialize, - response_deserializer=cluster_service.ListLocationsResponse.deserialize, - ) - return self._stubs['list_locations'] - - def close(self): - self._logged_channel.close() - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ( - 'ClusterManagerGrpcTransport', -) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py deleted file mode 100644 index cde0c9fe6d26..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py +++ /dev/null @@ -1,1574 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 inspect -import json -import pickle -import logging as std_logging -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 exceptions as core_exceptions -from google.api_core import retry_async as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.protobuf.json_format import MessageToJson -import google.protobuf.message - -import grpc # type: ignore -import proto # type: ignore -from grpc.experimental import aio # type: ignore - -from google.cloud.container_v1beta1.types import cluster_service -from google.protobuf import empty_pb2 # type: ignore -from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO -from .grpc import ClusterManagerGrpcTransport - -try: - from google.api_core import client_logging # type: ignore - CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER -except ImportError: # pragma: NO COVER - CLIENT_LOGGING_SUPPORTED = False - -_LOGGER = std_logging.getLogger(__name__) - - -class _LoggingClientAIOInterceptor(grpc.aio.UnaryUnaryClientInterceptor): # pragma: NO COVER - async def intercept_unary_unary(self, continuation, client_call_details, request): - logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG) - if logging_enabled: # pragma: NO COVER - request_metadata = client_call_details.metadata - if isinstance(request, proto.Message): - request_payload = type(request).to_json(request) - elif isinstance(request, google.protobuf.message.Message): - request_payload = MessageToJson(request) - else: - request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" - - request_metadata = { - key: value.decode("utf-8") if isinstance(value, bytes) else value - for key, value in request_metadata - } - grpc_request = { - "payload": request_payload, - "requestMethod": "grpc", - "metadata": dict(request_metadata), - } - _LOGGER.debug( - f"Sending request for {client_call_details.method}", - extra = { - "serviceName": "google.container.v1beta1.ClusterManager", - "rpcName": str(client_call_details.method), - "request": grpc_request, - "metadata": grpc_request["metadata"], - }, - ) - response = await continuation(client_call_details, request) - if logging_enabled: # pragma: NO COVER - response_metadata = await response.trailing_metadata() - # Convert gRPC metadata `` to list of tuples - metadata = dict([(k, str(v)) for k, v in response_metadata]) if response_metadata else None - result = await response - if isinstance(result, proto.Message): - response_payload = type(result).to_json(result) - elif isinstance(result, google.protobuf.message.Message): - response_payload = MessageToJson(result) - else: - response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" - grpc_response = { - "payload": response_payload, - "metadata": metadata, - "status": "OK", - } - _LOGGER.debug( - f"Received response to rpc {client_call_details.method}.", - extra = { - "serviceName": "google.container.v1beta1.ClusterManager", - "rpcName": str(client_call_details.method), - "response": grpc_response, - "metadata": grpc_response["metadata"], - }, - ) - return response - - -class ClusterManagerGrpcAsyncIOTransport(ClusterManagerTransport): - """gRPC AsyncIO backend transport for ClusterManager. - - Google Kubernetes Engine Cluster Manager v1beta1 - - 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 = 'container.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`. - 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 = 'container.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[Union[aio.Channel, Callable[..., 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 (default: 'container.googleapis.com'). - 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 a ``channel`` instance 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 a ``channel`` instance 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[Union[aio.Channel, Callable[..., aio.Channel]]]): - A ``Channel`` instance through which to make calls, or a Callable - that constructs and returns one. If set to None, ``self.create_channel`` - is used to create the channel. If a Callable is given, it will be called - with the same arguments as used in ``self.create_channel``. - 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 a ``channel`` instance 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 a ``channel`` instance 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] = {} - - 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 isinstance(channel, aio.Channel): - # Ignore credentials if a channel was passed. - credentials = None - self._ignore_credentials = True - # 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: - # initialize with the provided callable or the default channel - channel_init = channel or type(self).create_channel - self._grpc_channel = channel_init( - 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), - ], - ) - - self._interceptor = _LoggingClientAIOInterceptor() - self._grpc_channel._unary_unary_interceptors.append(self._interceptor) - self._logged_channel = self._grpc_channel - self._wrap_with_kind = "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters - # Wrap messages. This must be done after self._logged_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 list_clusters(self) -> Callable[ - [cluster_service.ListClustersRequest], - Awaitable[cluster_service.ListClustersResponse]]: - r"""Return a callable for the list clusters method over gRPC. - - Lists all clusters owned by a project in either the - specified zone or all zones. - - Returns: - Callable[[~.ListClustersRequest], - Awaitable[~.ListClustersResponse]]: - 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_clusters' not in self._stubs: - self._stubs['list_clusters'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/ListClusters', - request_serializer=cluster_service.ListClustersRequest.serialize, - response_deserializer=cluster_service.ListClustersResponse.deserialize, - ) - return self._stubs['list_clusters'] - - @property - def get_cluster(self) -> Callable[ - [cluster_service.GetClusterRequest], - Awaitable[cluster_service.Cluster]]: - r"""Return a callable for the get cluster method over gRPC. - - Gets the details for a specific cluster. - - Returns: - Callable[[~.GetClusterRequest], - Awaitable[~.Cluster]]: - 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_cluster' not in self._stubs: - self._stubs['get_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/GetCluster', - request_serializer=cluster_service.GetClusterRequest.serialize, - response_deserializer=cluster_service.Cluster.deserialize, - ) - return self._stubs['get_cluster'] - - @property - def create_cluster(self) -> Callable[ - [cluster_service.CreateClusterRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the create cluster method over gRPC. - - Creates a cluster, consisting of the specified number and type - of Google Compute Engine instances. - - By default, the cluster is created in the project's `default - network `__. - - One firewall is added for the cluster. After cluster creation, - the Kubelet creates routes for each node to allow the containers - on that node to communicate with all other instances in the - cluster. - - Finally, an entry is added to the project's global metadata - indicating which CIDR range the cluster is using. - - Returns: - Callable[[~.CreateClusterRequest], - 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_cluster' not in self._stubs: - self._stubs['create_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/CreateCluster', - request_serializer=cluster_service.CreateClusterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['create_cluster'] - - @property - def update_cluster(self) -> Callable[ - [cluster_service.UpdateClusterRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the update cluster method over gRPC. - - Updates the settings for a specific cluster. - - Returns: - Callable[[~.UpdateClusterRequest], - 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_cluster' not in self._stubs: - self._stubs['update_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/UpdateCluster', - request_serializer=cluster_service.UpdateClusterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['update_cluster'] - - @property - def update_node_pool(self) -> Callable[ - [cluster_service.UpdateNodePoolRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the update node pool method over gRPC. - - Updates the version and/or image type of a specific - node pool. - - Returns: - Callable[[~.UpdateNodePoolRequest], - 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_node_pool' not in self._stubs: - self._stubs['update_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/UpdateNodePool', - request_serializer=cluster_service.UpdateNodePoolRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['update_node_pool'] - - @property - def set_node_pool_autoscaling(self) -> Callable[ - [cluster_service.SetNodePoolAutoscalingRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set node pool autoscaling method over gRPC. - - Sets the autoscaling settings of a specific node - pool. - - Returns: - Callable[[~.SetNodePoolAutoscalingRequest], - 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 'set_node_pool_autoscaling' not in self._stubs: - self._stubs['set_node_pool_autoscaling'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetNodePoolAutoscaling', - request_serializer=cluster_service.SetNodePoolAutoscalingRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_node_pool_autoscaling'] - - @property - def set_logging_service(self) -> Callable[ - [cluster_service.SetLoggingServiceRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set logging service method over gRPC. - - Sets the logging service for a specific cluster. - - Returns: - Callable[[~.SetLoggingServiceRequest], - 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 'set_logging_service' not in self._stubs: - self._stubs['set_logging_service'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetLoggingService', - request_serializer=cluster_service.SetLoggingServiceRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_logging_service'] - - @property - def set_monitoring_service(self) -> Callable[ - [cluster_service.SetMonitoringServiceRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set monitoring service method over gRPC. - - Sets the monitoring service for a specific cluster. - - Returns: - Callable[[~.SetMonitoringServiceRequest], - 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 'set_monitoring_service' not in self._stubs: - self._stubs['set_monitoring_service'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetMonitoringService', - request_serializer=cluster_service.SetMonitoringServiceRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_monitoring_service'] - - @property - def set_addons_config(self) -> Callable[ - [cluster_service.SetAddonsConfigRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set addons config method over gRPC. - - Sets the addons for a specific cluster. - - Returns: - Callable[[~.SetAddonsConfigRequest], - 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 'set_addons_config' not in self._stubs: - self._stubs['set_addons_config'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetAddonsConfig', - request_serializer=cluster_service.SetAddonsConfigRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_addons_config'] - - @property - def set_locations(self) -> Callable[ - [cluster_service.SetLocationsRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set locations method over gRPC. - - Sets the locations for a specific cluster. Deprecated. Use - `projects.locations.clusters.update `__ - instead. - - Returns: - Callable[[~.SetLocationsRequest], - 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 'set_locations' not in self._stubs: - self._stubs['set_locations'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetLocations', - request_serializer=cluster_service.SetLocationsRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_locations'] - - @property - def update_master(self) -> Callable[ - [cluster_service.UpdateMasterRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the update master method over gRPC. - - Updates the master for a specific cluster. - - Returns: - Callable[[~.UpdateMasterRequest], - 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_master' not in self._stubs: - self._stubs['update_master'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/UpdateMaster', - request_serializer=cluster_service.UpdateMasterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['update_master'] - - @property - def set_master_auth(self) -> Callable[ - [cluster_service.SetMasterAuthRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set master auth method over gRPC. - - Sets master auth materials. Currently supports - changing the admin password or a specific cluster, - either via password generation or explicitly setting the - password. - - Returns: - Callable[[~.SetMasterAuthRequest], - 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 'set_master_auth' not in self._stubs: - self._stubs['set_master_auth'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetMasterAuth', - request_serializer=cluster_service.SetMasterAuthRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_master_auth'] - - @property - def delete_cluster(self) -> Callable[ - [cluster_service.DeleteClusterRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the delete cluster method over gRPC. - - Deletes the cluster, including the Kubernetes - endpoint and all worker nodes. - - Firewalls and routes that were configured during cluster - creation are also deleted. - - Other Google Compute Engine resources that might be in - use by the cluster, such as load balancer resources, are - not deleted if they weren't present when the cluster was - initially created. - - Returns: - Callable[[~.DeleteClusterRequest], - 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_cluster' not in self._stubs: - self._stubs['delete_cluster'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/DeleteCluster', - request_serializer=cluster_service.DeleteClusterRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['delete_cluster'] - - @property - def list_operations(self) -> Callable[ - [cluster_service.ListOperationsRequest], - Awaitable[cluster_service.ListOperationsResponse]]: - r"""Return a callable for the list operations method over gRPC. - - Lists all operations in a project in the specified - zone or all zones. - - Returns: - Callable[[~.ListOperationsRequest], - Awaitable[~.ListOperationsResponse]]: - 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_operations' not in self._stubs: - self._stubs['list_operations'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/ListOperations', - request_serializer=cluster_service.ListOperationsRequest.serialize, - response_deserializer=cluster_service.ListOperationsResponse.deserialize, - ) - return self._stubs['list_operations'] - - @property - def get_operation(self) -> Callable[ - [cluster_service.GetOperationRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the get operation method over gRPC. - - Gets the specified operation. - - Returns: - Callable[[~.GetOperationRequest], - 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 'get_operation' not in self._stubs: - self._stubs['get_operation'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/GetOperation', - request_serializer=cluster_service.GetOperationRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['get_operation'] - - @property - def cancel_operation(self) -> Callable[ - [cluster_service.CancelOperationRequest], - Awaitable[empty_pb2.Empty]]: - r"""Return a callable for the cancel operation method over gRPC. - - Cancels the specified operation. - - Returns: - Callable[[~.CancelOperationRequest], - Awaitable[~.Empty]]: - 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 'cancel_operation' not in self._stubs: - self._stubs['cancel_operation'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/CancelOperation', - request_serializer=cluster_service.CancelOperationRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['cancel_operation'] - - @property - def get_server_config(self) -> Callable[ - [cluster_service.GetServerConfigRequest], - Awaitable[cluster_service.ServerConfig]]: - r"""Return a callable for the get server config method over gRPC. - - Returns configuration info about the Google - Kubernetes Engine service. - - Returns: - Callable[[~.GetServerConfigRequest], - Awaitable[~.ServerConfig]]: - 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_server_config' not in self._stubs: - self._stubs['get_server_config'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/GetServerConfig', - request_serializer=cluster_service.GetServerConfigRequest.serialize, - response_deserializer=cluster_service.ServerConfig.deserialize, - ) - return self._stubs['get_server_config'] - - @property - def get_json_web_keys(self) -> Callable[ - [cluster_service.GetJSONWebKeysRequest], - Awaitable[cluster_service.GetJSONWebKeysResponse]]: - r"""Return a callable for the get json web keys method over gRPC. - - Gets the public component of the cluster signing keys - in JSON Web Key format. - - Returns: - Callable[[~.GetJSONWebKeysRequest], - Awaitable[~.GetJSONWebKeysResponse]]: - 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_json_web_keys' not in self._stubs: - self._stubs['get_json_web_keys'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/GetJSONWebKeys', - request_serializer=cluster_service.GetJSONWebKeysRequest.serialize, - response_deserializer=cluster_service.GetJSONWebKeysResponse.deserialize, - ) - return self._stubs['get_json_web_keys'] - - @property - def list_node_pools(self) -> Callable[ - [cluster_service.ListNodePoolsRequest], - Awaitable[cluster_service.ListNodePoolsResponse]]: - r"""Return a callable for the list node pools method over gRPC. - - Lists the node pools for a cluster. - - Returns: - Callable[[~.ListNodePoolsRequest], - Awaitable[~.ListNodePoolsResponse]]: - 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_node_pools' not in self._stubs: - self._stubs['list_node_pools'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/ListNodePools', - request_serializer=cluster_service.ListNodePoolsRequest.serialize, - response_deserializer=cluster_service.ListNodePoolsResponse.deserialize, - ) - return self._stubs['list_node_pools'] - - @property - def get_node_pool(self) -> Callable[ - [cluster_service.GetNodePoolRequest], - Awaitable[cluster_service.NodePool]]: - r"""Return a callable for the get node pool method over gRPC. - - Retrieves the requested node pool. - - Returns: - Callable[[~.GetNodePoolRequest], - Awaitable[~.NodePool]]: - 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_node_pool' not in self._stubs: - self._stubs['get_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/GetNodePool', - request_serializer=cluster_service.GetNodePoolRequest.serialize, - response_deserializer=cluster_service.NodePool.deserialize, - ) - return self._stubs['get_node_pool'] - - @property - def create_node_pool(self) -> Callable[ - [cluster_service.CreateNodePoolRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the create node pool method over gRPC. - - Creates a node pool for a cluster. - - Returns: - Callable[[~.CreateNodePoolRequest], - 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_node_pool' not in self._stubs: - self._stubs['create_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/CreateNodePool', - request_serializer=cluster_service.CreateNodePoolRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['create_node_pool'] - - @property - def delete_node_pool(self) -> Callable[ - [cluster_service.DeleteNodePoolRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the delete node pool method over gRPC. - - Deletes a node pool from a cluster. - - Returns: - Callable[[~.DeleteNodePoolRequest], - 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_node_pool' not in self._stubs: - self._stubs['delete_node_pool'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/DeleteNodePool', - request_serializer=cluster_service.DeleteNodePoolRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['delete_node_pool'] - - @property - def complete_node_pool_upgrade(self) -> Callable[ - [cluster_service.CompleteNodePoolUpgradeRequest], - Awaitable[empty_pb2.Empty]]: - r"""Return a callable for the complete node pool upgrade method over gRPC. - - CompleteNodePoolUpgrade will signal an on-going node - pool upgrade to complete. - - Returns: - Callable[[~.CompleteNodePoolUpgradeRequest], - Awaitable[~.Empty]]: - 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 'complete_node_pool_upgrade' not in self._stubs: - self._stubs['complete_node_pool_upgrade'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/CompleteNodePoolUpgrade', - request_serializer=cluster_service.CompleteNodePoolUpgradeRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['complete_node_pool_upgrade'] - - @property - def rollback_node_pool_upgrade(self) -> Callable[ - [cluster_service.RollbackNodePoolUpgradeRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the rollback node pool upgrade method over gRPC. - - Rolls back a previously Aborted or Failed NodePool - upgrade. This makes no changes if the last upgrade - successfully completed. - - Returns: - Callable[[~.RollbackNodePoolUpgradeRequest], - 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 'rollback_node_pool_upgrade' not in self._stubs: - self._stubs['rollback_node_pool_upgrade'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/RollbackNodePoolUpgrade', - request_serializer=cluster_service.RollbackNodePoolUpgradeRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['rollback_node_pool_upgrade'] - - @property - def set_node_pool_management(self) -> Callable[ - [cluster_service.SetNodePoolManagementRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set node pool management method over gRPC. - - Sets the NodeManagement options for a node pool. - - Returns: - Callable[[~.SetNodePoolManagementRequest], - 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 'set_node_pool_management' not in self._stubs: - self._stubs['set_node_pool_management'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetNodePoolManagement', - request_serializer=cluster_service.SetNodePoolManagementRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_node_pool_management'] - - @property - def set_labels(self) -> Callable[ - [cluster_service.SetLabelsRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set labels method over gRPC. - - Sets labels on a cluster. - - Returns: - Callable[[~.SetLabelsRequest], - 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 'set_labels' not in self._stubs: - self._stubs['set_labels'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetLabels', - request_serializer=cluster_service.SetLabelsRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_labels'] - - @property - def set_legacy_abac(self) -> Callable[ - [cluster_service.SetLegacyAbacRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set legacy abac method over gRPC. - - Enables or disables the ABAC authorization mechanism - on a cluster. - - Returns: - Callable[[~.SetLegacyAbacRequest], - 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 'set_legacy_abac' not in self._stubs: - self._stubs['set_legacy_abac'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetLegacyAbac', - request_serializer=cluster_service.SetLegacyAbacRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_legacy_abac'] - - @property - def start_ip_rotation(self) -> Callable[ - [cluster_service.StartIPRotationRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the start ip rotation method over gRPC. - - Starts master IP rotation. - - Returns: - Callable[[~.StartIPRotationRequest], - 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 'start_ip_rotation' not in self._stubs: - self._stubs['start_ip_rotation'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/StartIPRotation', - request_serializer=cluster_service.StartIPRotationRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['start_ip_rotation'] - - @property - def complete_ip_rotation(self) -> Callable[ - [cluster_service.CompleteIPRotationRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the complete ip rotation method over gRPC. - - Completes master IP rotation. - - Returns: - Callable[[~.CompleteIPRotationRequest], - 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 'complete_ip_rotation' not in self._stubs: - self._stubs['complete_ip_rotation'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/CompleteIPRotation', - request_serializer=cluster_service.CompleteIPRotationRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['complete_ip_rotation'] - - @property - def set_node_pool_size(self) -> Callable[ - [cluster_service.SetNodePoolSizeRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set node pool size method over gRPC. - - SetNodePoolSizeRequest sets the size of a node pool. The new - size will be used for all replicas, including future replicas - created by modifying - [NodePool.locations][google.container.v1beta1.NodePool.locations]. - - Returns: - Callable[[~.SetNodePoolSizeRequest], - 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 'set_node_pool_size' not in self._stubs: - self._stubs['set_node_pool_size'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetNodePoolSize', - request_serializer=cluster_service.SetNodePoolSizeRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_node_pool_size'] - - @property - def set_network_policy(self) -> Callable[ - [cluster_service.SetNetworkPolicyRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set network policy method over gRPC. - - Enables or disables Network Policy for a cluster. - - Returns: - Callable[[~.SetNetworkPolicyRequest], - 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 'set_network_policy' not in self._stubs: - self._stubs['set_network_policy'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetNetworkPolicy', - request_serializer=cluster_service.SetNetworkPolicyRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_network_policy'] - - @property - def set_maintenance_policy(self) -> Callable[ - [cluster_service.SetMaintenancePolicyRequest], - Awaitable[cluster_service.Operation]]: - r"""Return a callable for the set maintenance policy method over gRPC. - - Sets the maintenance policy for a cluster. - - Returns: - Callable[[~.SetMaintenancePolicyRequest], - 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 'set_maintenance_policy' not in self._stubs: - self._stubs['set_maintenance_policy'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/SetMaintenancePolicy', - request_serializer=cluster_service.SetMaintenancePolicyRequest.serialize, - response_deserializer=cluster_service.Operation.deserialize, - ) - return self._stubs['set_maintenance_policy'] - - @property - def list_usable_subnetworks(self) -> Callable[ - [cluster_service.ListUsableSubnetworksRequest], - Awaitable[cluster_service.ListUsableSubnetworksResponse]]: - r"""Return a callable for the list usable subnetworks method over gRPC. - - Lists subnetworks that can be used for creating - clusters in a project. - - Returns: - Callable[[~.ListUsableSubnetworksRequest], - Awaitable[~.ListUsableSubnetworksResponse]]: - 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_usable_subnetworks' not in self._stubs: - self._stubs['list_usable_subnetworks'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/ListUsableSubnetworks', - request_serializer=cluster_service.ListUsableSubnetworksRequest.serialize, - response_deserializer=cluster_service.ListUsableSubnetworksResponse.deserialize, - ) - return self._stubs['list_usable_subnetworks'] - - @property - def check_autopilot_compatibility(self) -> Callable[ - [cluster_service.CheckAutopilotCompatibilityRequest], - Awaitable[cluster_service.CheckAutopilotCompatibilityResponse]]: - r"""Return a callable for the check autopilot compatibility method over gRPC. - - Checks the cluster compatibility with Autopilot mode, - and returns a list of compatibility issues. - - Returns: - Callable[[~.CheckAutopilotCompatibilityRequest], - Awaitable[~.CheckAutopilotCompatibilityResponse]]: - 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 'check_autopilot_compatibility' not in self._stubs: - self._stubs['check_autopilot_compatibility'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/CheckAutopilotCompatibility', - request_serializer=cluster_service.CheckAutopilotCompatibilityRequest.serialize, - response_deserializer=cluster_service.CheckAutopilotCompatibilityResponse.deserialize, - ) - return self._stubs['check_autopilot_compatibility'] - - @property - def list_locations(self) -> Callable[ - [cluster_service.ListLocationsRequest], - Awaitable[cluster_service.ListLocationsResponse]]: - r"""Return a callable for the list locations method over gRPC. - - Fetches locations that offer Google Kubernetes - Engine. - - Returns: - Callable[[~.ListLocationsRequest], - Awaitable[~.ListLocationsResponse]]: - 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_locations' not in self._stubs: - self._stubs['list_locations'] = self._logged_channel.unary_unary( - '/google.container.v1beta1.ClusterManager/ListLocations', - request_serializer=cluster_service.ListLocationsRequest.serialize, - response_deserializer=cluster_service.ListLocationsResponse.deserialize, - ) - return self._stubs['list_locations'] - - def _prep_wrapped_messages(self, client_info): - """ Precompute the wrapped methods, overriding the base class method to use async wrappers.""" - self._wrapped_methods = { - self.list_clusters: self._wrap_method( - self.list_clusters, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_cluster: self._wrap_method( - self.get_cluster, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.create_cluster: self._wrap_method( - self.create_cluster, - default_timeout=45.0, - client_info=client_info, - ), - self.update_cluster: self._wrap_method( - self.update_cluster, - default_timeout=45.0, - client_info=client_info, - ), - self.update_node_pool: self._wrap_method( - self.update_node_pool, - default_timeout=45.0, - client_info=client_info, - ), - self.set_node_pool_autoscaling: self._wrap_method( - self.set_node_pool_autoscaling, - default_timeout=45.0, - client_info=client_info, - ), - self.set_logging_service: self._wrap_method( - self.set_logging_service, - default_timeout=45.0, - client_info=client_info, - ), - self.set_monitoring_service: self._wrap_method( - self.set_monitoring_service, - default_timeout=45.0, - client_info=client_info, - ), - self.set_addons_config: self._wrap_method( - self.set_addons_config, - default_timeout=45.0, - client_info=client_info, - ), - self.set_locations: self._wrap_method( - self.set_locations, - default_timeout=45.0, - client_info=client_info, - ), - self.update_master: self._wrap_method( - self.update_master, - default_timeout=45.0, - client_info=client_info, - ), - self.set_master_auth: self._wrap_method( - self.set_master_auth, - default_timeout=45.0, - client_info=client_info, - ), - self.delete_cluster: self._wrap_method( - self.delete_cluster, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.list_operations: self._wrap_method( - self.list_operations, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_operation: self._wrap_method( - self.get_operation, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.cancel_operation: self._wrap_method( - self.cancel_operation, - default_timeout=45.0, - client_info=client_info, - ), - self.get_server_config: self._wrap_method( - self.get_server_config, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_json_web_keys: self._wrap_method( - self.get_json_web_keys, - default_timeout=None, - client_info=client_info, - ), - self.list_node_pools: self._wrap_method( - self.list_node_pools, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.get_node_pool: self._wrap_method( - self.get_node_pool, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.create_node_pool: self._wrap_method( - self.create_node_pool, - default_timeout=45.0, - client_info=client_info, - ), - self.delete_node_pool: self._wrap_method( - self.delete_node_pool, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.complete_node_pool_upgrade: self._wrap_method( - self.complete_node_pool_upgrade, - default_timeout=None, - client_info=client_info, - ), - self.rollback_node_pool_upgrade: self._wrap_method( - self.rollback_node_pool_upgrade, - default_timeout=45.0, - client_info=client_info, - ), - self.set_node_pool_management: self._wrap_method( - self.set_node_pool_management, - default_timeout=45.0, - client_info=client_info, - ), - self.set_labels: self._wrap_method( - self.set_labels, - default_timeout=45.0, - client_info=client_info, - ), - self.set_legacy_abac: self._wrap_method( - self.set_legacy_abac, - default_timeout=45.0, - client_info=client_info, - ), - self.start_ip_rotation: self._wrap_method( - self.start_ip_rotation, - default_timeout=45.0, - client_info=client_info, - ), - self.complete_ip_rotation: self._wrap_method( - self.complete_ip_rotation, - default_timeout=45.0, - client_info=client_info, - ), - self.set_node_pool_size: self._wrap_method( - self.set_node_pool_size, - default_timeout=45.0, - client_info=client_info, - ), - self.set_network_policy: self._wrap_method( - self.set_network_policy, - default_timeout=45.0, - client_info=client_info, - ), - self.set_maintenance_policy: self._wrap_method( - self.set_maintenance_policy, - default_timeout=45.0, - client_info=client_info, - ), - self.list_usable_subnetworks: self._wrap_method( - self.list_usable_subnetworks, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - self.check_autopilot_compatibility: self._wrap_method( - self.check_autopilot_compatibility, - default_timeout=None, - client_info=client_info, - ), - self.list_locations: self._wrap_method( - self.list_locations, - default_retry=retries.AsyncRetry( - initial=0.1, - maximum=60.0, - multiplier=1.3, - predicate=retries.if_exception_type( - core_exceptions.DeadlineExceeded, - core_exceptions.ServiceUnavailable, - ), - deadline=20.0, - ), - default_timeout=20.0, - client_info=client_info, - ), - } - - def _wrap_method(self, func, *args, **kwargs): - if self._wrap_with_kind: # pragma: NO COVER - kwargs["kind"] = self.kind - return gapic_v1.method_async.wrap_method(func, *args, **kwargs) - - def close(self): - return self._logged_channel.close() - - @property - def kind(self) -> str: - return "grpc_asyncio" - - -__all__ = ( - 'ClusterManagerGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/__init__.py deleted file mode 100644 index 5940cad92069..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/__init__.py +++ /dev/null @@ -1,400 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 .cluster_service import ( - AcceleratorConfig, - AdditionalNodeNetworkConfig, - AdditionalPodNetworkConfig, - AdditionalPodRangesConfig, - AddonsConfig, - AdvancedDatapathObservabilityConfig, - AdvancedMachineFeatures, - AuthenticatorGroupsConfig, - Autopilot, - AutopilotCompatibilityIssue, - AutopilotConversionStatus, - AutoprovisioningNodePoolDefaults, - AutoUpgradeOptions, - BestEffortProvisioning, - BinaryAuthorization, - BlueGreenSettings, - CancelOperationRequest, - CheckAutopilotCompatibilityRequest, - CheckAutopilotCompatibilityResponse, - ClientCertificateConfig, - CloudRunConfig, - Cluster, - ClusterAutoscaling, - ClusterTelemetry, - ClusterUpdate, - CompleteIPRotationRequest, - CompleteNodePoolUpgradeRequest, - CompliancePostureConfig, - ConfidentialNodes, - ConfigConnectorConfig, - ContainerdConfig, - CostManagementConfig, - CreateClusterRequest, - CreateNodePoolRequest, - DailyMaintenanceWindow, - DatabaseEncryption, - DefaultSnatStatus, - DeleteClusterRequest, - DeleteNodePoolRequest, - DnsCacheConfig, - DNSConfig, - EnterpriseConfig, - EphemeralStorageConfig, - EphemeralStorageLocalSsdConfig, - FastSocket, - Fleet, - GatewayAPIConfig, - GcePersistentDiskCsiDriverConfig, - GcfsConfig, - GcpFilestoreCsiDriverConfig, - GcsFuseCsiDriverConfig, - GetClusterRequest, - GetJSONWebKeysRequest, - GetJSONWebKeysResponse, - GetNodePoolRequest, - GetOpenIDConfigRequest, - GetOpenIDConfigResponse, - GetOperationRequest, - GetServerConfigRequest, - GkeBackupAgentConfig, - GPUDriverInstallationConfig, - GPUSharingConfig, - HorizontalPodAutoscaling, - HostMaintenancePolicy, - HttpLoadBalancing, - IdentityServiceConfig, - ILBSubsettingConfig, - IntraNodeVisibilityConfig, - IPAllocationPolicy, - IstioConfig, - Jwk, - K8sBetaAPIConfig, - KalmConfig, - KubernetesDashboard, - LegacyAbac, - LinuxNodeConfig, - ListClustersRequest, - ListClustersResponse, - ListLocationsRequest, - ListLocationsResponse, - ListNodePoolsRequest, - ListNodePoolsResponse, - ListOperationsRequest, - ListOperationsResponse, - ListUsableSubnetworksRequest, - ListUsableSubnetworksResponse, - LocalNvmeSsdBlockConfig, - Location, - LoggingComponentConfig, - LoggingConfig, - LoggingVariantConfig, - MaintenanceExclusionOptions, - MaintenancePolicy, - MaintenanceWindow, - ManagedPrometheusConfig, - Master, - MasterAuth, - MasterAuthorizedNetworksConfig, - MaxPodsConstraint, - MeshCertificates, - MonitoringComponentConfig, - MonitoringConfig, - NetworkConfig, - NetworkPolicy, - NetworkPolicyConfig, - NetworkTags, - NodeConfig, - NodeConfigDefaults, - NodeKubeletConfig, - NodeLabels, - NodeManagement, - NodeNetworkConfig, - NodePool, - NodePoolAutoConfig, - NodePoolAutoscaling, - NodePoolDefaults, - NodePoolLoggingConfig, - NodeTaint, - NodeTaints, - NotificationConfig, - Operation, - OperationProgress, - PodCIDROverprovisionConfig, - PodSecurityPolicyConfig, - PrivateClusterConfig, - PrivateClusterMasterGlobalAccessConfig, - ProtectConfig, - RangeInfo, - RayClusterLoggingConfig, - RayClusterMonitoringConfig, - RayOperatorConfig, - RecurringTimeWindow, - ReleaseChannel, - ReservationAffinity, - ResourceLabels, - ResourceLimit, - ResourceManagerTags, - ResourceUsageExportConfig, - RollbackNodePoolUpgradeRequest, - SandboxConfig, - SecondaryBootDisk, - SecondaryBootDiskUpdateStrategy, - SecretManagerConfig, - SecurityBulletinEvent, - SecurityPostureConfig, - ServerConfig, - ServiceExternalIPsConfig, - SetAddonsConfigRequest, - SetLabelsRequest, - SetLegacyAbacRequest, - SetLocationsRequest, - SetLoggingServiceRequest, - SetMaintenancePolicyRequest, - SetMasterAuthRequest, - SetMonitoringServiceRequest, - SetNetworkPolicyRequest, - SetNodePoolAutoscalingRequest, - SetNodePoolManagementRequest, - SetNodePoolSizeRequest, - ShieldedInstanceConfig, - ShieldedNodes, - SoleTenantConfig, - StartIPRotationRequest, - StatefulHAConfig, - StatusCondition, - TimeWindow, - TpuConfig, - UpdateClusterRequest, - UpdateMasterRequest, - UpdateNodePoolRequest, - UpgradeAvailableEvent, - UpgradeEvent, - UsableSubnetwork, - UsableSubnetworkSecondaryRange, - VerticalPodAutoscaling, - VirtualNIC, - WindowsNodeConfig, - WindowsVersions, - WorkloadALTSConfig, - WorkloadCertificates, - WorkloadConfig, - WorkloadIdentityConfig, - WorkloadMetadataConfig, - WorkloadPolicyConfig, - DatapathProvider, - InTransitEncryptionConfig, - NodePoolUpdateStrategy, - PrivateIPv6GoogleAccess, - StackType, - UpgradeResourceType, -) - -__all__ = ( - 'AcceleratorConfig', - 'AdditionalNodeNetworkConfig', - 'AdditionalPodNetworkConfig', - 'AdditionalPodRangesConfig', - 'AddonsConfig', - 'AdvancedDatapathObservabilityConfig', - 'AdvancedMachineFeatures', - 'AuthenticatorGroupsConfig', - 'Autopilot', - 'AutopilotCompatibilityIssue', - 'AutopilotConversionStatus', - 'AutoprovisioningNodePoolDefaults', - 'AutoUpgradeOptions', - 'BestEffortProvisioning', - 'BinaryAuthorization', - 'BlueGreenSettings', - 'CancelOperationRequest', - 'CheckAutopilotCompatibilityRequest', - 'CheckAutopilotCompatibilityResponse', - 'ClientCertificateConfig', - 'CloudRunConfig', - 'Cluster', - 'ClusterAutoscaling', - 'ClusterTelemetry', - 'ClusterUpdate', - 'CompleteIPRotationRequest', - 'CompleteNodePoolUpgradeRequest', - 'CompliancePostureConfig', - 'ConfidentialNodes', - 'ConfigConnectorConfig', - 'ContainerdConfig', - 'CostManagementConfig', - 'CreateClusterRequest', - 'CreateNodePoolRequest', - 'DailyMaintenanceWindow', - 'DatabaseEncryption', - 'DefaultSnatStatus', - 'DeleteClusterRequest', - 'DeleteNodePoolRequest', - 'DnsCacheConfig', - 'DNSConfig', - 'EnterpriseConfig', - 'EphemeralStorageConfig', - 'EphemeralStorageLocalSsdConfig', - 'FastSocket', - 'Fleet', - 'GatewayAPIConfig', - 'GcePersistentDiskCsiDriverConfig', - 'GcfsConfig', - 'GcpFilestoreCsiDriverConfig', - 'GcsFuseCsiDriverConfig', - 'GetClusterRequest', - 'GetJSONWebKeysRequest', - 'GetJSONWebKeysResponse', - 'GetNodePoolRequest', - 'GetOpenIDConfigRequest', - 'GetOpenIDConfigResponse', - 'GetOperationRequest', - 'GetServerConfigRequest', - 'GkeBackupAgentConfig', - 'GPUDriverInstallationConfig', - 'GPUSharingConfig', - 'HorizontalPodAutoscaling', - 'HostMaintenancePolicy', - 'HttpLoadBalancing', - 'IdentityServiceConfig', - 'ILBSubsettingConfig', - 'IntraNodeVisibilityConfig', - 'IPAllocationPolicy', - 'IstioConfig', - 'Jwk', - 'K8sBetaAPIConfig', - 'KalmConfig', - 'KubernetesDashboard', - 'LegacyAbac', - 'LinuxNodeConfig', - 'ListClustersRequest', - 'ListClustersResponse', - 'ListLocationsRequest', - 'ListLocationsResponse', - 'ListNodePoolsRequest', - 'ListNodePoolsResponse', - 'ListOperationsRequest', - 'ListOperationsResponse', - 'ListUsableSubnetworksRequest', - 'ListUsableSubnetworksResponse', - 'LocalNvmeSsdBlockConfig', - 'Location', - 'LoggingComponentConfig', - 'LoggingConfig', - 'LoggingVariantConfig', - 'MaintenanceExclusionOptions', - 'MaintenancePolicy', - 'MaintenanceWindow', - 'ManagedPrometheusConfig', - 'Master', - 'MasterAuth', - 'MasterAuthorizedNetworksConfig', - 'MaxPodsConstraint', - 'MeshCertificates', - 'MonitoringComponentConfig', - 'MonitoringConfig', - 'NetworkConfig', - 'NetworkPolicy', - 'NetworkPolicyConfig', - 'NetworkTags', - 'NodeConfig', - 'NodeConfigDefaults', - 'NodeKubeletConfig', - 'NodeLabels', - 'NodeManagement', - 'NodeNetworkConfig', - 'NodePool', - 'NodePoolAutoConfig', - 'NodePoolAutoscaling', - 'NodePoolDefaults', - 'NodePoolLoggingConfig', - 'NodeTaint', - 'NodeTaints', - 'NotificationConfig', - 'Operation', - 'OperationProgress', - 'PodCIDROverprovisionConfig', - 'PodSecurityPolicyConfig', - 'PrivateClusterConfig', - 'PrivateClusterMasterGlobalAccessConfig', - 'ProtectConfig', - 'RangeInfo', - 'RayClusterLoggingConfig', - 'RayClusterMonitoringConfig', - 'RayOperatorConfig', - 'RecurringTimeWindow', - 'ReleaseChannel', - 'ReservationAffinity', - 'ResourceLabels', - 'ResourceLimit', - 'ResourceManagerTags', - 'ResourceUsageExportConfig', - 'RollbackNodePoolUpgradeRequest', - 'SandboxConfig', - 'SecondaryBootDisk', - 'SecondaryBootDiskUpdateStrategy', - 'SecretManagerConfig', - 'SecurityBulletinEvent', - 'SecurityPostureConfig', - 'ServerConfig', - 'ServiceExternalIPsConfig', - 'SetAddonsConfigRequest', - 'SetLabelsRequest', - 'SetLegacyAbacRequest', - 'SetLocationsRequest', - 'SetLoggingServiceRequest', - 'SetMaintenancePolicyRequest', - 'SetMasterAuthRequest', - 'SetMonitoringServiceRequest', - 'SetNetworkPolicyRequest', - 'SetNodePoolAutoscalingRequest', - 'SetNodePoolManagementRequest', - 'SetNodePoolSizeRequest', - 'ShieldedInstanceConfig', - 'ShieldedNodes', - 'SoleTenantConfig', - 'StartIPRotationRequest', - 'StatefulHAConfig', - 'StatusCondition', - 'TimeWindow', - 'TpuConfig', - 'UpdateClusterRequest', - 'UpdateMasterRequest', - 'UpdateNodePoolRequest', - 'UpgradeAvailableEvent', - 'UpgradeEvent', - 'UsableSubnetwork', - 'UsableSubnetworkSecondaryRange', - 'VerticalPodAutoscaling', - 'VirtualNIC', - 'WindowsNodeConfig', - 'WindowsVersions', - 'WorkloadALTSConfig', - 'WorkloadCertificates', - 'WorkloadConfig', - 'WorkloadIdentityConfig', - 'WorkloadMetadataConfig', - 'WorkloadPolicyConfig', - 'DatapathProvider', - 'InTransitEncryptionConfig', - 'NodePoolUpdateStrategy', - 'PrivateIPv6GoogleAccess', - 'StackType', - 'UpgradeResourceType', -) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/cluster_service.py b/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/cluster_service.py deleted file mode 100644 index f2a6a595d649..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/google/cloud/container_v1beta1/types/cluster_service.py +++ /dev/null @@ -1,10986 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 __future__ import annotations - -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 -from google.rpc import code_pb2 # type: ignore -from google.rpc import status_pb2 # type: ignore -from google.type import date_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.container.v1beta1', - manifest={ - 'PrivateIPv6GoogleAccess', - 'UpgradeResourceType', - 'NodePoolUpdateStrategy', - 'DatapathProvider', - 'StackType', - 'InTransitEncryptionConfig', - 'LinuxNodeConfig', - 'WindowsNodeConfig', - 'NodeKubeletConfig', - 'NodeConfig', - 'AdvancedMachineFeatures', - 'NodeNetworkConfig', - 'AdditionalNodeNetworkConfig', - 'AdditionalPodNetworkConfig', - 'ShieldedInstanceConfig', - 'SandboxConfig', - 'EphemeralStorageConfig', - 'LocalNvmeSsdBlockConfig', - 'EphemeralStorageLocalSsdConfig', - 'GcfsConfig', - 'ReservationAffinity', - 'SoleTenantConfig', - 'ContainerdConfig', - 'HostMaintenancePolicy', - 'NodeTaint', - 'NodeTaints', - 'NodeLabels', - 'ResourceLabels', - 'NetworkTags', - 'MasterAuth', - 'ClientCertificateConfig', - 'AddonsConfig', - 'HttpLoadBalancing', - 'HorizontalPodAutoscaling', - 'KubernetesDashboard', - 'NetworkPolicyConfig', - 'DnsCacheConfig', - 'KalmConfig', - 'GkeBackupAgentConfig', - 'StatefulHAConfig', - 'ConfigConnectorConfig', - 'GcePersistentDiskCsiDriverConfig', - 'GcpFilestoreCsiDriverConfig', - 'GcsFuseCsiDriverConfig', - 'RayOperatorConfig', - 'PrivateClusterMasterGlobalAccessConfig', - 'PrivateClusterConfig', - 'IstioConfig', - 'CloudRunConfig', - 'MasterAuthorizedNetworksConfig', - 'LegacyAbac', - 'NetworkPolicy', - 'PodCIDROverprovisionConfig', - 'IPAllocationPolicy', - 'BinaryAuthorization', - 'PodSecurityPolicyConfig', - 'AuthenticatorGroupsConfig', - 'ClusterTelemetry', - 'Cluster', - 'CompliancePostureConfig', - 'K8sBetaAPIConfig', - 'WorkloadConfig', - 'ProtectConfig', - 'SecurityPostureConfig', - 'NodePoolDefaults', - 'NodeConfigDefaults', - 'NodePoolAutoConfig', - 'ClusterUpdate', - 'AdditionalPodRangesConfig', - 'RangeInfo', - 'Operation', - 'OperationProgress', - 'CreateClusterRequest', - 'GetClusterRequest', - 'UpdateClusterRequest', - 'UpdateNodePoolRequest', - 'SetNodePoolAutoscalingRequest', - 'SetLoggingServiceRequest', - 'SetMonitoringServiceRequest', - 'SetAddonsConfigRequest', - 'SetLocationsRequest', - 'UpdateMasterRequest', - 'SetMasterAuthRequest', - 'DeleteClusterRequest', - 'ListClustersRequest', - 'ListClustersResponse', - 'GetOperationRequest', - 'ListOperationsRequest', - 'CancelOperationRequest', - 'ListOperationsResponse', - 'GetServerConfigRequest', - 'ServerConfig', - 'BestEffortProvisioning', - 'WindowsVersions', - 'CreateNodePoolRequest', - 'DeleteNodePoolRequest', - 'ListNodePoolsRequest', - 'GetNodePoolRequest', - 'BlueGreenSettings', - 'NodePool', - 'NodeManagement', - 'AutoUpgradeOptions', - 'MaintenancePolicy', - 'MaintenanceWindow', - 'TimeWindow', - 'MaintenanceExclusionOptions', - 'RecurringTimeWindow', - 'DailyMaintenanceWindow', - 'SetNodePoolManagementRequest', - 'SetNodePoolSizeRequest', - 'CompleteNodePoolUpgradeRequest', - 'RollbackNodePoolUpgradeRequest', - 'ListNodePoolsResponse', - 'ClusterAutoscaling', - 'AutoprovisioningNodePoolDefaults', - 'ResourceLimit', - 'NodePoolAutoscaling', - 'SetLabelsRequest', - 'SetLegacyAbacRequest', - 'StartIPRotationRequest', - 'CompleteIPRotationRequest', - 'AcceleratorConfig', - 'GPUSharingConfig', - 'GPUDriverInstallationConfig', - 'ManagedPrometheusConfig', - 'WorkloadMetadataConfig', - 'SetNetworkPolicyRequest', - 'SetMaintenancePolicyRequest', - 'ListLocationsRequest', - 'ListLocationsResponse', - 'Location', - 'StatusCondition', - 'NetworkConfig', - 'GatewayAPIConfig', - 'ServiceExternalIPsConfig', - 'ListUsableSubnetworksRequest', - 'ListUsableSubnetworksResponse', - 'UsableSubnetworkSecondaryRange', - 'UsableSubnetwork', - 'VerticalPodAutoscaling', - 'DefaultSnatStatus', - 'IntraNodeVisibilityConfig', - 'ILBSubsettingConfig', - 'DNSConfig', - 'MaxPodsConstraint', - 'WorkloadIdentityConfig', - 'WorkloadALTSConfig', - 'WorkloadCertificates', - 'MeshCertificates', - 'DatabaseEncryption', - 'ResourceUsageExportConfig', - 'ShieldedNodes', - 'VirtualNIC', - 'FastSocket', - 'GetOpenIDConfigRequest', - 'GetOpenIDConfigResponse', - 'GetJSONWebKeysRequest', - 'Jwk', - 'GetJSONWebKeysResponse', - 'CheckAutopilotCompatibilityRequest', - 'AutopilotCompatibilityIssue', - 'CheckAutopilotCompatibilityResponse', - 'ReleaseChannel', - 'CostManagementConfig', - 'TpuConfig', - 'Master', - 'AutopilotConversionStatus', - 'Autopilot', - 'WorkloadPolicyConfig', - 'NotificationConfig', - 'ConfidentialNodes', - 'UpgradeEvent', - 'UpgradeAvailableEvent', - 'SecurityBulletinEvent', - 'IdentityServiceConfig', - 'LoggingConfig', - 'LoggingComponentConfig', - 'RayClusterLoggingConfig', - 'MonitoringConfig', - 'AdvancedDatapathObservabilityConfig', - 'RayClusterMonitoringConfig', - 'NodePoolLoggingConfig', - 'LoggingVariantConfig', - 'MonitoringComponentConfig', - 'Fleet', - 'ResourceManagerTags', - 'EnterpriseConfig', - 'SecretManagerConfig', - 'SecondaryBootDisk', - 'SecondaryBootDiskUpdateStrategy', - }, -) - - -class PrivateIPv6GoogleAccess(proto.Enum): - r"""PrivateIPv6GoogleAccess controls whether and how the pods can - communicate with Google Services through gRPC over IPv6. - - Values: - PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED (0): - Default value. Same as DISABLED - PRIVATE_IPV6_GOOGLE_ACCESS_DISABLED (1): - No private access to or from Google Services - PRIVATE_IPV6_GOOGLE_ACCESS_TO_GOOGLE (2): - Enables private IPv6 access to Google - Services from GKE - PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL (3): - Enables private IPv6 access to and from - Google Services - """ - PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED = 0 - PRIVATE_IPV6_GOOGLE_ACCESS_DISABLED = 1 - PRIVATE_IPV6_GOOGLE_ACCESS_TO_GOOGLE = 2 - PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL = 3 - - -class UpgradeResourceType(proto.Enum): - r"""UpgradeResourceType is the resource type that is upgrading. - It is used in upgrade notifications. - - Values: - UPGRADE_RESOURCE_TYPE_UNSPECIFIED (0): - Default value. This shouldn't be used. - MASTER (1): - Master / control plane - NODE_POOL (2): - Node pool - """ - UPGRADE_RESOURCE_TYPE_UNSPECIFIED = 0 - MASTER = 1 - NODE_POOL = 2 - - -class NodePoolUpdateStrategy(proto.Enum): - r"""Strategy used for node pool update. - - Values: - NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED (0): - Default value if unset. GKE internally - defaults the update strategy to SURGE for - unspecified strategies. - BLUE_GREEN (2): - blue-green upgrade. - SURGE (3): - SURGE is the traditional way of upgrading a node pool. - max_surge and max_unavailable determines the level of - upgrade parallelism. - """ - NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED = 0 - BLUE_GREEN = 2 - SURGE = 3 - - -class DatapathProvider(proto.Enum): - r"""The datapath provider selects the implementation of the - Kubernetes networking model for service resolution and network - policy enforcement. - - Values: - DATAPATH_PROVIDER_UNSPECIFIED (0): - Default value. - LEGACY_DATAPATH (1): - Use the IPTables implementation based on - kube-proxy. - ADVANCED_DATAPATH (2): - Use the eBPF based GKE Dataplane V2 with additional - features. See the `GKE Dataplane V2 - documentation `__ - for more. - """ - DATAPATH_PROVIDER_UNSPECIFIED = 0 - LEGACY_DATAPATH = 1 - ADVANCED_DATAPATH = 2 - - -class StackType(proto.Enum): - r"""Possible values for IP stack type - - Values: - STACK_TYPE_UNSPECIFIED (0): - By default, the clusters will be IPV4 only - IPV4 (1): - The value used if the cluster is a IPV4 only - IPV4_IPV6 (2): - The value used if the cluster is a dual stack - cluster - """ - STACK_TYPE_UNSPECIFIED = 0 - IPV4 = 1 - IPV4_IPV6 = 2 - - -class InTransitEncryptionConfig(proto.Enum): - r"""Options for in-transit encryption. - - Values: - IN_TRANSIT_ENCRYPTION_CONFIG_UNSPECIFIED (0): - Unspecified, will be inferred as default - - IN_TRANSIT_ENCRYPTION_UNSPECIFIED. - IN_TRANSIT_ENCRYPTION_DISABLED (1): - In-transit encryption is disabled. - IN_TRANSIT_ENCRYPTION_INTER_NODE_TRANSPARENT (2): - Data in-transit is encrypted using inter-node - transparent encryption. - """ - IN_TRANSIT_ENCRYPTION_CONFIG_UNSPECIFIED = 0 - IN_TRANSIT_ENCRYPTION_DISABLED = 1 - IN_TRANSIT_ENCRYPTION_INTER_NODE_TRANSPARENT = 2 - - -class LinuxNodeConfig(proto.Message): - r"""Parameters that can be configured on Linux nodes. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - sysctls (MutableMapping[str, str]): - The Linux kernel parameters to be applied to the nodes and - all pods running on the nodes. - - The following parameters are supported. - - net.core.busy_poll net.core.busy_read - net.core.netdev_max_backlog net.core.rmem_max - net.core.wmem_default net.core.wmem_max net.core.optmem_max - net.core.somaxconn net.ipv4.tcp_rmem net.ipv4.tcp_wmem - net.ipv4.tcp_tw_reuse - cgroup_mode (google.cloud.container_v1beta1.types.LinuxNodeConfig.CgroupMode): - cgroup_mode specifies the cgroup mode to be used on the - node. - hugepages (google.cloud.container_v1beta1.types.LinuxNodeConfig.HugepagesConfig): - Optional. Amounts for 2M and 1G hugepages - - This field is a member of `oneof`_ ``_hugepages``. - """ - class CgroupMode(proto.Enum): - r"""Possible cgroup modes that can be used. - - Values: - CGROUP_MODE_UNSPECIFIED (0): - CGROUP_MODE_UNSPECIFIED is when unspecified cgroup - configuration is used. The default for the GKE node OS image - will be used. - CGROUP_MODE_V1 (1): - CGROUP_MODE_V1 specifies to use cgroupv1 for the cgroup - configuration on the node image. - CGROUP_MODE_V2 (2): - CGROUP_MODE_V2 specifies to use cgroupv2 for the cgroup - configuration on the node image. - """ - CGROUP_MODE_UNSPECIFIED = 0 - CGROUP_MODE_V1 = 1 - CGROUP_MODE_V2 = 2 - - class HugepagesConfig(proto.Message): - r"""Hugepages amount in both 2m and 1g size - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - hugepage_size2m (int): - Optional. Amount of 2M hugepages - - This field is a member of `oneof`_ ``_hugepage_size2m``. - hugepage_size1g (int): - Optional. Amount of 1G hugepages - - This field is a member of `oneof`_ ``_hugepage_size1g``. - """ - - hugepage_size2m: int = proto.Field( - proto.INT32, - number=1, - optional=True, - ) - hugepage_size1g: int = proto.Field( - proto.INT32, - number=2, - optional=True, - ) - - sysctls: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=1, - ) - cgroup_mode: CgroupMode = proto.Field( - proto.ENUM, - number=2, - enum=CgroupMode, - ) - hugepages: HugepagesConfig = proto.Field( - proto.MESSAGE, - number=3, - optional=True, - message=HugepagesConfig, - ) - - -class WindowsNodeConfig(proto.Message): - r"""Parameters that can be configured on Windows nodes. - Windows Node Config that define the parameters that will be used - to configure the Windows node pool settings - - Attributes: - os_version (google.cloud.container_v1beta1.types.WindowsNodeConfig.OSVersion): - OSVersion specifies the Windows node config - to be used on the node - """ - class OSVersion(proto.Enum): - r"""Possible OS version that can be used. - - Values: - OS_VERSION_UNSPECIFIED (0): - When OSVersion is not specified - OS_VERSION_LTSC2019 (1): - LTSC2019 specifies to use LTSC2019 as the - Windows Servercore Base Image - OS_VERSION_LTSC2022 (2): - LTSC2022 specifies to use LTSC2022 as the - Windows Servercore Base Image - """ - OS_VERSION_UNSPECIFIED = 0 - OS_VERSION_LTSC2019 = 1 - OS_VERSION_LTSC2022 = 2 - - os_version: OSVersion = proto.Field( - proto.ENUM, - number=1, - enum=OSVersion, - ) - - -class NodeKubeletConfig(proto.Message): - r"""Node kubelet configs. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - cpu_manager_policy (str): - Control the CPU management policy on the node. See - https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/ - - The following values are allowed. - - - "none": the default, which represents the existing - scheduling behavior. - - "static": allows pods with certain resource - characteristics to be granted increased CPU affinity and - exclusivity on the node. The default value is 'none' if - unspecified. - cpu_cfs_quota (google.protobuf.wrappers_pb2.BoolValue): - Enable CPU CFS quota enforcement for - containers that specify CPU limits. - This option is enabled by default which makes - kubelet use CFS quota - (https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt) - to enforce container CPU limits. Otherwise, CPU - limits will not be enforced at all. - - Disable this option to mitigate CPU throttling - problems while still having your pods to be in - Guaranteed QoS class by specifying the CPU - limits. - - The default value is 'true' if unspecified. - cpu_cfs_quota_period (str): - Set the CPU CFS quota period value 'cpu.cfs_period_us'. - - The string must be a sequence of decimal numbers, each with - optional fraction and a unit suffix, such as "300ms". Valid - time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". - The value must be a positive duration. - pod_pids_limit (int): - Set the Pod PID limits. See - https://kubernetes.io/docs/concepts/policy/pid-limiting/#pod-pid-limits - - Controls the maximum number of processes allowed - to run in a pod. The value must be greater than - or equal to 1024 and less than 4194304. - insecure_kubelet_readonly_port_enabled (bool): - Enable or disable Kubelet read only port. - - This field is a member of `oneof`_ ``_insecure_kubelet_readonly_port_enabled``. - """ - - cpu_manager_policy: str = proto.Field( - proto.STRING, - number=1, - ) - cpu_cfs_quota: wrappers_pb2.BoolValue = proto.Field( - proto.MESSAGE, - number=2, - message=wrappers_pb2.BoolValue, - ) - cpu_cfs_quota_period: str = proto.Field( - proto.STRING, - number=3, - ) - pod_pids_limit: int = proto.Field( - proto.INT64, - number=4, - ) - insecure_kubelet_readonly_port_enabled: bool = proto.Field( - proto.BOOL, - number=7, - optional=True, - ) - - -class NodeConfig(proto.Message): - r"""Parameters that describe the nodes in a cluster. - - GKE Autopilot clusters do not recognize parameters in - ``NodeConfig``. Use - [AutoprovisioningNodePoolDefaults][google.container.v1beta1.AutoprovisioningNodePoolDefaults] - instead. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - machine_type (str): - The name of a Google Compute Engine `machine - type `__. - - If unspecified, the default machine type is ``e2-medium``. - disk_size_gb (int): - Size of the disk attached to each node, - specified in GB. The smallest allowed disk size - is 10GB. - - If unspecified, the default disk size is 100GB. - oauth_scopes (MutableSequence[str]): - The set of Google API scopes to be made available on all of - the node VMs under the "default" service account. - - The following scopes are recommended, but not required, and - by default are not included: - - - ``https://www.googleapis.com/auth/compute`` is required - for mounting persistent storage on your nodes. - - ``https://www.googleapis.com/auth/devstorage.read_only`` - is required for communicating with **gcr.io** (the - `Google Container - Registry `__). - - If unspecified, no scopes are added, unless Cloud Logging or - Cloud Monitoring are enabled, in which case their required - scopes will be added. - service_account (str): - The Google Cloud Platform Service Account to - be used by the node VMs. Specify the email - address of the Service Account; otherwise, if no - Service Account is specified, the "default" - service account is used. - metadata (MutableMapping[str, str]): - The metadata key/value pairs assigned to instances in the - cluster. - - Keys must conform to the regexp ``[a-zA-Z0-9-_]+`` and be - less than 128 bytes in length. These are reflected as part - of a URL in the metadata server. Additionally, to avoid - ambiguity, keys must not conflict with any other metadata - keys for the project or be one of the reserved keys: - - - "cluster-location" - - "cluster-name" - - "cluster-uid" - - "configure-sh" - - "containerd-configure-sh" - - "enable-oslogin" - - "gci-ensure-gke-docker" - - "gci-metrics-enabled" - - "gci-update-strategy" - - "instance-template" - - "kube-env" - - "startup-script" - - "user-data" - - "disable-address-manager" - - "windows-startup-script-ps1" - - "common-psm1" - - "k8s-node-setup-psm1" - - "install-ssh-psm1" - - "user-profile-psm1" - - Values are free-form strings, and only have meaning as - interpreted by the image running in the instance. The only - restriction placed on them is that each value's size must be - less than or equal to 32 KB. - - The total size of all keys and values must be less than 512 - KB. - image_type (str): - The image type to use for this node. Note - that for a given image type, the latest version - of it will be used. Please see - https://cloud.google.com/kubernetes-engine/docs/concepts/node-images - for available image types. - labels (MutableMapping[str, str]): - The map of Kubernetes labels (key/value - pairs) to be applied to each node. These will - added in addition to any default label(s) that - Kubernetes may apply to the node. - In case of conflict in label keys, the applied - set may differ depending on the Kubernetes - version -- it's best to assume the behavior is - undefined and conflicts should be avoided. - For more information, including usage and the - valid values, see: - - https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ - local_ssd_count (int): - The number of local SSD disks to be attached - to the node. - The limit for this value is dependent upon the - maximum number of disks available on a machine - per zone. See: - - https://cloud.google.com/compute/docs/disks/local-ssd - for more information. - tags (MutableSequence[str]): - The list of instance tags applied to all - nodes. Tags are used to identify valid sources - or targets for network firewalls and are - specified by the client during cluster or node - pool creation. Each tag within the list must - comply with RFC1035. - preemptible (bool): - Whether the nodes are created as preemptible - VM instances. See: - https://cloud.google.com/compute/docs/instances/preemptible - for more information about preemptible VM - instances. - accelerators (MutableSequence[google.cloud.container_v1beta1.types.AcceleratorConfig]): - A list of hardware accelerators to be - attached to each node. See - https://cloud.google.com/compute/docs/gpus for - more information about support for GPUs. - sandbox_config (google.cloud.container_v1beta1.types.SandboxConfig): - Sandbox configuration for this node. - node_group (str): - Setting this field will assign instances of this pool to run - on the specified node group. This is useful for running - workloads on `sole tenant - nodes `__. - reservation_affinity (google.cloud.container_v1beta1.types.ReservationAffinity): - The optional reservation affinity. Setting this field will - apply the specified `Zonal Compute - Reservation `__ - to this node pool. - disk_type (str): - Type of the disk attached to each node (e.g. - 'pd-standard', 'pd-ssd' or 'pd-balanced') - - If unspecified, the default disk type is - 'pd-standard' - min_cpu_platform (str): - Minimum CPU platform to be used by this instance. The - instance may be scheduled on the specified or newer CPU - platform. Applicable values are the friendly names of CPU - platforms, such as ``minCpuPlatform: "Intel Haswell"`` or - ``minCpuPlatform: "Intel Sandy Bridge"``. For more - information, read `how to specify min CPU - platform `__. - workload_metadata_config (google.cloud.container_v1beta1.types.WorkloadMetadataConfig): - The workload metadata configuration for this - node. - taints (MutableSequence[google.cloud.container_v1beta1.types.NodeTaint]): - List of kubernetes taints to be applied to - each node. - For more information, including usage and the - valid values, see: - - https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ - boot_disk_kms_key (str): - The Customer Managed Encryption Key used to encrypt the boot - disk attached to each node in the node pool. This should be - of the form - projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. - For more information about protecting resources with Cloud - KMS Keys please see: - https://cloud.google.com/compute/docs/disks/customer-managed-encryption - shielded_instance_config (google.cloud.container_v1beta1.types.ShieldedInstanceConfig): - Shielded Instance options. - linux_node_config (google.cloud.container_v1beta1.types.LinuxNodeConfig): - Parameters that can be configured on Linux - nodes. - kubelet_config (google.cloud.container_v1beta1.types.NodeKubeletConfig): - Node kubelet configs. - ephemeral_storage_config (google.cloud.container_v1beta1.types.EphemeralStorageConfig): - Parameters for the ephemeral storage - filesystem. If unspecified, ephemeral storage is - backed by the boot disk. - gcfs_config (google.cloud.container_v1beta1.types.GcfsConfig): - GCFS (Google Container File System) configs. - advanced_machine_features (google.cloud.container_v1beta1.types.AdvancedMachineFeatures): - Advanced features for the Compute Engine VM. - gvnic (google.cloud.container_v1beta1.types.VirtualNIC): - Enable or disable gvnic on the node pool. - spot (bool): - Spot flag for enabling Spot VM, which is a - rebrand of the existing preemptible flag. - confidential_nodes (google.cloud.container_v1beta1.types.ConfidentialNodes): - Confidential nodes config. - All the nodes in the node pool will be - Confidential VM once enabled. - fast_socket (google.cloud.container_v1beta1.types.FastSocket): - Enable or disable NCCL fast socket for the - node pool. - - This field is a member of `oneof`_ ``_fast_socket``. - resource_labels (MutableMapping[str, str]): - The resource labels for the node pool to use - to annotate any related Google Compute Engine - resources. - logging_config (google.cloud.container_v1beta1.types.NodePoolLoggingConfig): - Logging configuration. - windows_node_config (google.cloud.container_v1beta1.types.WindowsNodeConfig): - Parameters that can be configured on Windows - nodes. - local_nvme_ssd_block_config (google.cloud.container_v1beta1.types.LocalNvmeSsdBlockConfig): - Parameters for using raw-block Local NVMe - SSDs. - ephemeral_storage_local_ssd_config (google.cloud.container_v1beta1.types.EphemeralStorageLocalSsdConfig): - Parameters for the node ephemeral storage using Local SSDs. - If unspecified, ephemeral storage is backed by the boot - disk. This field is functionally equivalent to the - ephemeral_storage_config - sole_tenant_config (google.cloud.container_v1beta1.types.SoleTenantConfig): - Parameters for node pools to be backed by - shared sole tenant node groups. - containerd_config (google.cloud.container_v1beta1.types.ContainerdConfig): - Parameters for containerd customization. - host_maintenance_policy (google.cloud.container_v1beta1.types.HostMaintenancePolicy): - HostMaintenancePolicy contains the desired - maintenance policy for the Google Compute Engine - hosts. - resource_manager_tags (google.cloud.container_v1beta1.types.ResourceManagerTags): - A map of resource manager tag keys and values - to be attached to the nodes. - enable_confidential_storage (bool): - Optional. Reserved for future use. - secondary_boot_disks (MutableSequence[google.cloud.container_v1beta1.types.SecondaryBootDisk]): - List of secondary boot disks attached to the - nodes. - secondary_boot_disk_update_strategy (google.cloud.container_v1beta1.types.SecondaryBootDiskUpdateStrategy): - Secondary boot disk update strategy. - - This field is a member of `oneof`_ ``_secondary_boot_disk_update_strategy``. - """ - - machine_type: str = proto.Field( - proto.STRING, - number=1, - ) - disk_size_gb: int = proto.Field( - proto.INT32, - number=2, - ) - oauth_scopes: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - service_account: str = proto.Field( - proto.STRING, - number=9, - ) - metadata: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - image_type: str = proto.Field( - proto.STRING, - number=5, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=6, - ) - local_ssd_count: int = proto.Field( - proto.INT32, - number=7, - ) - tags: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=8, - ) - preemptible: bool = proto.Field( - proto.BOOL, - number=10, - ) - accelerators: MutableSequence['AcceleratorConfig'] = proto.RepeatedField( - proto.MESSAGE, - number=11, - message='AcceleratorConfig', - ) - sandbox_config: 'SandboxConfig' = proto.Field( - proto.MESSAGE, - number=17, - message='SandboxConfig', - ) - node_group: str = proto.Field( - proto.STRING, - number=18, - ) - reservation_affinity: 'ReservationAffinity' = proto.Field( - proto.MESSAGE, - number=19, - message='ReservationAffinity', - ) - disk_type: str = proto.Field( - proto.STRING, - number=12, - ) - min_cpu_platform: str = proto.Field( - proto.STRING, - number=13, - ) - workload_metadata_config: 'WorkloadMetadataConfig' = proto.Field( - proto.MESSAGE, - number=14, - message='WorkloadMetadataConfig', - ) - taints: MutableSequence['NodeTaint'] = proto.RepeatedField( - proto.MESSAGE, - number=15, - message='NodeTaint', - ) - boot_disk_kms_key: str = proto.Field( - proto.STRING, - number=23, - ) - shielded_instance_config: 'ShieldedInstanceConfig' = proto.Field( - proto.MESSAGE, - number=20, - message='ShieldedInstanceConfig', - ) - linux_node_config: 'LinuxNodeConfig' = proto.Field( - proto.MESSAGE, - number=21, - message='LinuxNodeConfig', - ) - kubelet_config: 'NodeKubeletConfig' = proto.Field( - proto.MESSAGE, - number=22, - message='NodeKubeletConfig', - ) - ephemeral_storage_config: 'EphemeralStorageConfig' = proto.Field( - proto.MESSAGE, - number=24, - message='EphemeralStorageConfig', - ) - gcfs_config: 'GcfsConfig' = proto.Field( - proto.MESSAGE, - number=25, - message='GcfsConfig', - ) - advanced_machine_features: 'AdvancedMachineFeatures' = proto.Field( - proto.MESSAGE, - number=26, - message='AdvancedMachineFeatures', - ) - gvnic: 'VirtualNIC' = proto.Field( - proto.MESSAGE, - number=29, - message='VirtualNIC', - ) - spot: bool = proto.Field( - proto.BOOL, - number=32, - ) - confidential_nodes: 'ConfidentialNodes' = proto.Field( - proto.MESSAGE, - number=35, - message='ConfidentialNodes', - ) - fast_socket: 'FastSocket' = proto.Field( - proto.MESSAGE, - number=36, - optional=True, - message='FastSocket', - ) - resource_labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=37, - ) - logging_config: 'NodePoolLoggingConfig' = proto.Field( - proto.MESSAGE, - number=38, - message='NodePoolLoggingConfig', - ) - windows_node_config: 'WindowsNodeConfig' = proto.Field( - proto.MESSAGE, - number=39, - message='WindowsNodeConfig', - ) - local_nvme_ssd_block_config: 'LocalNvmeSsdBlockConfig' = proto.Field( - proto.MESSAGE, - number=40, - message='LocalNvmeSsdBlockConfig', - ) - ephemeral_storage_local_ssd_config: 'EphemeralStorageLocalSsdConfig' = proto.Field( - proto.MESSAGE, - number=41, - message='EphemeralStorageLocalSsdConfig', - ) - sole_tenant_config: 'SoleTenantConfig' = proto.Field( - proto.MESSAGE, - number=42, - message='SoleTenantConfig', - ) - containerd_config: 'ContainerdConfig' = proto.Field( - proto.MESSAGE, - number=43, - message='ContainerdConfig', - ) - host_maintenance_policy: 'HostMaintenancePolicy' = proto.Field( - proto.MESSAGE, - number=44, - message='HostMaintenancePolicy', - ) - resource_manager_tags: 'ResourceManagerTags' = proto.Field( - proto.MESSAGE, - number=45, - message='ResourceManagerTags', - ) - enable_confidential_storage: bool = proto.Field( - proto.BOOL, - number=46, - ) - secondary_boot_disks: MutableSequence['SecondaryBootDisk'] = proto.RepeatedField( - proto.MESSAGE, - number=48, - message='SecondaryBootDisk', - ) - secondary_boot_disk_update_strategy: 'SecondaryBootDiskUpdateStrategy' = proto.Field( - proto.MESSAGE, - number=50, - optional=True, - message='SecondaryBootDiskUpdateStrategy', - ) - - -class AdvancedMachineFeatures(proto.Message): - r"""Specifies options for controlling advanced machine features. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - threads_per_core (int): - The number of threads per physical core. To - disable simultaneous multithreading (SMT) set - this to 1. If unset, the maximum number of - threads supported per core by the underlying - processor is assumed. - - This field is a member of `oneof`_ ``_threads_per_core``. - enable_nested_virtualization (bool): - Whether or not to enable nested - virtualization (defaults to false). - - This field is a member of `oneof`_ ``_enable_nested_virtualization``. - """ - - threads_per_core: int = proto.Field( - proto.INT64, - number=1, - optional=True, - ) - enable_nested_virtualization: bool = proto.Field( - proto.BOOL, - number=2, - optional=True, - ) - - -class NodeNetworkConfig(proto.Message): - r"""Parameters for node pool-level network config. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - create_pod_range (bool): - Input only. Whether to create a new range for pod IPs in - this node pool. Defaults are provided for ``pod_range`` and - ``pod_ipv4_cidr_block`` if they are not specified. - - If neither ``create_pod_range`` or ``pod_range`` are - specified, the cluster-level default - (``ip_allocation_policy.cluster_ipv4_cidr_block``) is used. - - Only applicable if ``ip_allocation_policy.use_ip_aliases`` - is true. - - This field cannot be changed after the node pool has been - created. - pod_range (str): - The ID of the secondary range for pod IPs. If - ``create_pod_range`` is true, this ID is used for the new - range. If ``create_pod_range`` is false, uses an existing - secondary range with this ID. - - Only applicable if ``ip_allocation_policy.use_ip_aliases`` - is true. - - This field cannot be changed after the node pool has been - created. - pod_ipv4_cidr_block (str): - The IP address range for pod IPs in this node pool. - - Only applicable if ``create_pod_range`` is true. - - Set to blank to have a range chosen with the default size. - - Set to /netmask (e.g. ``/14``) to have a range chosen with a - specific netmask. - - Set to a - `CIDR `__ - notation (e.g. ``10.96.0.0/14``) to pick a specific range to - use. - - Only applicable if ``ip_allocation_policy.use_ip_aliases`` - is true. - - This field cannot be changed after the node pool has been - created. - enable_private_nodes (bool): - Whether nodes have internal IP addresses only. If - enable_private_nodes is not specified, then the value is - derived from - [cluster.privateClusterConfig.enablePrivateNodes][google.container.v1beta1.PrivateClusterConfig.enablePrivateNodes] - - This field is a member of `oneof`_ ``_enable_private_nodes``. - network_performance_config (google.cloud.container_v1beta1.types.NodeNetworkConfig.NetworkPerformanceConfig): - Network bandwidth tier configuration. - - This field is a member of `oneof`_ ``_network_performance_config``. - pod_cidr_overprovision_config (google.cloud.container_v1beta1.types.PodCIDROverprovisionConfig): - [PRIVATE FIELD] Pod CIDR size overprovisioning config for - the nodepool. - - Pod CIDR size per node depends on max_pods_per_node. By - default, the value of max_pods_per_node is rounded off to - next power of 2 and we then double that to get the size of - pod CIDR block per node. Example: max_pods_per_node of 30 - would result in 64 IPs (/26). - - This config can disable the doubling of IPs (we still round - off to next power of 2) Example: max_pods_per_node of 30 - will result in 32 IPs (/27) when overprovisioning is - disabled. - additional_node_network_configs (MutableSequence[google.cloud.container_v1beta1.types.AdditionalNodeNetworkConfig]): - We specify the additional node networks for - this node pool using this list. Each node - network corresponds to an additional interface - additional_pod_network_configs (MutableSequence[google.cloud.container_v1beta1.types.AdditionalPodNetworkConfig]): - We specify the additional pod networks for - this node pool using this list. Each pod network - corresponds to an additional alias IP range for - the node - pod_ipv4_range_utilization (float): - Output only. The utilization of the IPv4 range for the pod. - The ratio is Usage/[Total number of IPs in the secondary - range], Usage=numNodes\ *numZones*\ podIPsPerNode. - """ - - class NetworkPerformanceConfig(proto.Message): - r"""Configuration of all network bandwidth tiers - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - total_egress_bandwidth_tier (google.cloud.container_v1beta1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier): - Specifies the total network bandwidth tier - for the NodePool. - - This field is a member of `oneof`_ ``_total_egress_bandwidth_tier``. - external_ip_egress_bandwidth_tier (google.cloud.container_v1beta1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier): - Specifies the network bandwidth tier for the - NodePool for traffic to external/public IP - addresses. - - This field is a member of `oneof`_ ``_external_ip_egress_bandwidth_tier``. - """ - class Tier(proto.Enum): - r"""Node network tier - - Values: - TIER_UNSPECIFIED (0): - Default value - TIER_1 (1): - Higher bandwidth, actual values based on VM - size. - """ - TIER_UNSPECIFIED = 0 - TIER_1 = 1 - - total_egress_bandwidth_tier: 'NodeNetworkConfig.NetworkPerformanceConfig.Tier' = proto.Field( - proto.ENUM, - number=1, - optional=True, - enum='NodeNetworkConfig.NetworkPerformanceConfig.Tier', - ) - external_ip_egress_bandwidth_tier: 'NodeNetworkConfig.NetworkPerformanceConfig.Tier' = proto.Field( - proto.ENUM, - number=2, - optional=True, - enum='NodeNetworkConfig.NetworkPerformanceConfig.Tier', - ) - - create_pod_range: bool = proto.Field( - proto.BOOL, - number=4, - ) - pod_range: str = proto.Field( - proto.STRING, - number=5, - ) - pod_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=6, - ) - enable_private_nodes: bool = proto.Field( - proto.BOOL, - number=9, - optional=True, - ) - network_performance_config: NetworkPerformanceConfig = proto.Field( - proto.MESSAGE, - number=11, - optional=True, - message=NetworkPerformanceConfig, - ) - pod_cidr_overprovision_config: 'PodCIDROverprovisionConfig' = proto.Field( - proto.MESSAGE, - number=13, - message='PodCIDROverprovisionConfig', - ) - additional_node_network_configs: MutableSequence['AdditionalNodeNetworkConfig'] = proto.RepeatedField( - proto.MESSAGE, - number=14, - message='AdditionalNodeNetworkConfig', - ) - additional_pod_network_configs: MutableSequence['AdditionalPodNetworkConfig'] = proto.RepeatedField( - proto.MESSAGE, - number=15, - message='AdditionalPodNetworkConfig', - ) - pod_ipv4_range_utilization: float = proto.Field( - proto.DOUBLE, - number=16, - ) - - -class AdditionalNodeNetworkConfig(proto.Message): - r"""AdditionalNodeNetworkConfig is the configuration for - additional node networks within the NodeNetworkConfig message - - Attributes: - network (str): - Name of the VPC where the additional - interface belongs - subnetwork (str): - Name of the subnetwork where the additional - interface belongs - """ - - network: str = proto.Field( - proto.STRING, - number=1, - ) - subnetwork: str = proto.Field( - proto.STRING, - number=2, - ) - - -class AdditionalPodNetworkConfig(proto.Message): - r"""AdditionalPodNetworkConfig is the configuration for - additional pod networks within the NodeNetworkConfig message - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - subnetwork (str): - Name of the subnetwork where the additional - pod network belongs. - secondary_pod_range (str): - The name of the secondary range on the subnet - which provides IP address for this pod range. - max_pods_per_node (google.cloud.container_v1beta1.types.MaxPodsConstraint): - The maximum number of pods per node which use - this pod network. - - This field is a member of `oneof`_ ``_max_pods_per_node``. - """ - - subnetwork: str = proto.Field( - proto.STRING, - number=1, - ) - secondary_pod_range: str = proto.Field( - proto.STRING, - number=2, - ) - max_pods_per_node: 'MaxPodsConstraint' = proto.Field( - proto.MESSAGE, - number=3, - optional=True, - message='MaxPodsConstraint', - ) - - -class ShieldedInstanceConfig(proto.Message): - r"""A set of Shielded Instance options. - - Attributes: - enable_secure_boot (bool): - Defines whether the instance has Secure Boot - enabled. - Secure Boot helps ensure that the system only - runs authentic software by verifying the digital - signature of all boot components, and halting - the boot process if signature verification - fails. - enable_integrity_monitoring (bool): - Defines whether the instance has integrity - monitoring enabled. - Enables monitoring and attestation of the boot - integrity of the instance. The attestation is - performed against the integrity policy baseline. - This baseline is initially derived from the - implicitly trusted boot image when the instance - is created. - """ - - enable_secure_boot: bool = proto.Field( - proto.BOOL, - number=1, - ) - enable_integrity_monitoring: bool = proto.Field( - proto.BOOL, - number=2, - ) - - -class SandboxConfig(proto.Message): - r"""SandboxConfig contains configurations of the sandbox to use - for the node. - - Attributes: - sandbox_type (str): - Type of the sandbox to use for the node (e.g. - 'gvisor') - type_ (google.cloud.container_v1beta1.types.SandboxConfig.Type): - Type of the sandbox to use for the node. - """ - class Type(proto.Enum): - r"""Possible types of sandboxes. - - Values: - UNSPECIFIED (0): - Default value. This should not be used. - GVISOR (1): - Run sandbox using gvisor. - """ - UNSPECIFIED = 0 - GVISOR = 1 - - sandbox_type: str = proto.Field( - proto.STRING, - number=1, - ) - type_: Type = proto.Field( - proto.ENUM, - number=2, - enum=Type, - ) - - -class EphemeralStorageConfig(proto.Message): - r"""EphemeralStorageConfig contains configuration for the - ephemeral storage filesystem. - - Attributes: - local_ssd_count (int): - Number of local SSDs to use to back ephemeral storage. Uses - NVMe interfaces. The limit for this value is dependent upon - the maximum number of disk available on a machine per zone. - See: https://cloud.google.com/compute/docs/disks/local-ssd - for more information. - - A zero (or unset) value has different meanings depending on - machine type being used: - - 1. For pre-Gen3 machines, which support flexible numbers of - local ssds, zero (or unset) means to disable using local - SSDs as ephemeral storage. - 2. For Gen3 machines which dictate a specific number of - local ssds, zero (or unset) means to use the default - number of local ssds that goes with that machine type. - For example, for a c3-standard-8-lssd machine, 2 local - ssds would be provisioned. For c3-standard-8 (which - doesn't support local ssds), 0 will be provisioned. See - https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds - for more info. - """ - - local_ssd_count: int = proto.Field( - proto.INT32, - number=1, - ) - - -class LocalNvmeSsdBlockConfig(proto.Message): - r"""LocalNvmeSsdBlockConfig contains configuration for using - raw-block local NVMe SSDs - - Attributes: - local_ssd_count (int): - Number of local NVMe SSDs to use. The limit for this value - is dependent upon the maximum number of disk available on a - machine per zone. See: - https://cloud.google.com/compute/docs/disks/local-ssd for - more information. - - A zero (or unset) value has different meanings depending on - machine type being used: - - 1. For pre-Gen3 machines, which support flexible numbers of - local ssds, zero (or unset) means to disable using local - SSDs as ephemeral storage. - 2. For Gen3 machines which dictate a specific number of - local ssds, zero (or unset) means to use the default - number of local ssds that goes with that machine type. - For example, for a c3-standard-8-lssd machine, 2 local - ssds would be provisioned. For c3-standard-8 (which - doesn't support local ssds), 0 will be provisioned. See - https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds - for more info. - """ - - local_ssd_count: int = proto.Field( - proto.INT32, - number=1, - ) - - -class EphemeralStorageLocalSsdConfig(proto.Message): - r"""EphemeralStorageLocalSsdConfig contains configuration for the - node ephemeral storage using Local SSDs. - - Attributes: - local_ssd_count (int): - Number of local SSDs to use to back ephemeral storage. Uses - NVMe interfaces. - - A zero (or unset) value has different meanings depending on - machine type being used: - - 1. For pre-Gen3 machines, which support flexible numbers of - local ssds, zero (or unset) means to disable using local - SSDs as ephemeral storage. The limit for this value is - dependent upon the maximum number of disk available on a - machine per zone. See: - https://cloud.google.com/compute/docs/disks/local-ssd for - more information. - 2. For Gen3 machines which dictate a specific number of - local ssds, zero (or unset) means to use the default - number of local ssds that goes with that machine type. - For example, for a c3-standard-8-lssd machine, 2 local - ssds would be provisioned. For c3-standard-8 (which - doesn't support local ssds), 0 will be provisioned. See - https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds - for more info. - """ - - local_ssd_count: int = proto.Field( - proto.INT32, - number=1, - ) - - -class GcfsConfig(proto.Message): - r"""GcfsConfig contains configurations of Google Container File - System. - - Attributes: - enabled (bool): - Whether to use GCFS. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class ReservationAffinity(proto.Message): - r"""`ReservationAffinity `__ - is the configuration of desired reservation which instances could - take capacity from. - - Attributes: - consume_reservation_type (google.cloud.container_v1beta1.types.ReservationAffinity.Type): - Corresponds to the type of reservation - consumption. - key (str): - Corresponds to the label key of a reservation resource. To - target a SPECIFIC_RESERVATION by name, specify - "compute.googleapis.com/reservation-name" as the key and - specify the name of your reservation as its value. - values (MutableSequence[str]): - Corresponds to the label value(s) of - reservation resource(s). - """ - class Type(proto.Enum): - r"""Indicates whether to consume capacity from a reservation or - not. - - Values: - UNSPECIFIED (0): - Default value. This should not be used. - NO_RESERVATION (1): - Do not consume from any reserved capacity. - ANY_RESERVATION (2): - Consume any reservation available. - SPECIFIC_RESERVATION (3): - Must consume from a specific reservation. - Must specify key value fields for specifying the - reservations. - """ - UNSPECIFIED = 0 - NO_RESERVATION = 1 - ANY_RESERVATION = 2 - SPECIFIC_RESERVATION = 3 - - consume_reservation_type: Type = proto.Field( - proto.ENUM, - number=1, - enum=Type, - ) - key: str = proto.Field( - proto.STRING, - number=2, - ) - values: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class SoleTenantConfig(proto.Message): - r"""SoleTenantConfig contains the NodeAffinities to specify what - shared sole tenant node groups should back the node pool. - - Attributes: - node_affinities (MutableSequence[google.cloud.container_v1beta1.types.SoleTenantConfig.NodeAffinity]): - NodeAffinities used to match to a shared sole - tenant node group. - """ - - class NodeAffinity(proto.Message): - r"""Specifies the NodeAffinity key, values, and affinity operator - according to `shared sole tenant node group - affinities `__. - - Attributes: - key (str): - Key for NodeAffinity. - operator (google.cloud.container_v1beta1.types.SoleTenantConfig.NodeAffinity.Operator): - Operator for NodeAffinity. - values (MutableSequence[str]): - Values for NodeAffinity. - """ - class Operator(proto.Enum): - r"""Operator allows user to specify affinity or anti-affinity for - the given key values. - - Values: - OPERATOR_UNSPECIFIED (0): - Invalid or unspecified affinity operator. - IN (1): - Affinity operator. - NOT_IN (2): - Anti-affinity operator. - """ - OPERATOR_UNSPECIFIED = 0 - IN = 1 - NOT_IN = 2 - - key: str = proto.Field( - proto.STRING, - number=1, - ) - operator: 'SoleTenantConfig.NodeAffinity.Operator' = proto.Field( - proto.ENUM, - number=2, - enum='SoleTenantConfig.NodeAffinity.Operator', - ) - values: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - node_affinities: MutableSequence[NodeAffinity] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=NodeAffinity, - ) - - -class ContainerdConfig(proto.Message): - r"""ContainerdConfig contains configuration to customize - containerd. - - Attributes: - private_registry_access_config (google.cloud.container_v1beta1.types.ContainerdConfig.PrivateRegistryAccessConfig): - PrivateRegistryAccessConfig is used to - configure access configuration for private - container registries. - """ - - class PrivateRegistryAccessConfig(proto.Message): - r"""PrivateRegistryAccessConfig contains access configuration for - private container registries. - - Attributes: - enabled (bool): - Private registry access is enabled. - certificate_authority_domain_config (MutableSequence[google.cloud.container_v1beta1.types.ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig]): - Private registry access configuration. - """ - - class CertificateAuthorityDomainConfig(proto.Message): - r"""CertificateAuthorityDomainConfig configures one or more fully - qualified domain names (FQDN) to a specific certificate. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - fqdns (MutableSequence[str]): - List of fully qualified domain names (FQDN). - Specifying port is supported. - Wilcards are NOT supported. - Examples: - - - my.customdomain.com - - 10.0.1.2:5000 - gcp_secret_manager_certificate_config (google.cloud.container_v1beta1.types.ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig.GCPSecretManagerCertificateConfig): - Google Secret Manager (GCP) certificate - configuration. - - This field is a member of `oneof`_ ``certificate_config``. - """ - - class GCPSecretManagerCertificateConfig(proto.Message): - r"""GCPSecretManagerCertificateConfig configures a secret from `Google - Secret Manager `__. - - Attributes: - secret_uri (str): - Secret URI, in the form - "projects/$PROJECT_ID/secrets/$SECRET_NAME/versions/$VERSION". - Version can be fixed (e.g. "2") or "latest". - """ - - secret_uri: str = proto.Field( - proto.STRING, - number=1, - ) - - fqdns: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - gcp_secret_manager_certificate_config: 'ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig.GCPSecretManagerCertificateConfig' = proto.Field( - proto.MESSAGE, - number=2, - oneof='certificate_config', - message='ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig.GCPSecretManagerCertificateConfig', - ) - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - certificate_authority_domain_config: MutableSequence['ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='ContainerdConfig.PrivateRegistryAccessConfig.CertificateAuthorityDomainConfig', - ) - - private_registry_access_config: PrivateRegistryAccessConfig = proto.Field( - proto.MESSAGE, - number=1, - message=PrivateRegistryAccessConfig, - ) - - -class HostMaintenancePolicy(proto.Message): - r"""HostMaintenancePolicy contains the maintenance policy for the - hosts on which the GKE VMs run on. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - maintenance_interval (google.cloud.container_v1beta1.types.HostMaintenancePolicy.MaintenanceInterval): - Specifies the frequency of planned - maintenance events. - - This field is a member of `oneof`_ ``_maintenance_interval``. - opportunistic_maintenance_strategy (google.cloud.container_v1beta1.types.HostMaintenancePolicy.OpportunisticMaintenanceStrategy): - Strategy that will trigger maintenance on - behalf of the customer. - - This field is a member of `oneof`_ ``maintenance_strategy``. - """ - class MaintenanceInterval(proto.Enum): - r"""Allows selecting how infrastructure upgrades should be - applied to the cluster or node pool. - - Values: - MAINTENANCE_INTERVAL_UNSPECIFIED (0): - The maintenance interval is not explicitly - specified. - AS_NEEDED (1): - Nodes are eligible to receive infrastructure - and hypervisor updates as they become available. - This may result in more maintenance operations - (live migrations or terminations) for the node - than the PERIODIC option. - PERIODIC (2): - Nodes receive infrastructure and hypervisor updates on a - periodic basis, minimizing the number of maintenance - operations (live migrations or terminations) on an - individual VM. This may mean underlying VMs will take longer - to receive an update than if it was configured for - AS_NEEDED. Security updates will still be applied as soon as - they are available. - """ - MAINTENANCE_INTERVAL_UNSPECIFIED = 0 - AS_NEEDED = 1 - PERIODIC = 2 - - class OpportunisticMaintenanceStrategy(proto.Message): - r"""Strategy that will trigger maintenance on behalf of the - customer. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - node_idle_time_window (google.protobuf.duration_pb2.Duration): - The amount of time that a node can remain - idle (no customer owned workloads running), - before triggering maintenance. - - This field is a member of `oneof`_ ``_node_idle_time_window``. - maintenance_availability_window (google.protobuf.duration_pb2.Duration): - The window of time that opportunistic maintenance can run. - Example: A setting of 14 days implies that opportunistic - maintenance can only be ran in the 2 weeks leading up to the - scheduled maintenance date. Setting 28 days allows - opportunistic maintenance to run at any time in the - scheduled maintenance window (all ``PERIODIC`` maintenance - is set 28 days in advance). - - This field is a member of `oneof`_ ``_maintenance_availability_window``. - min_nodes_per_pool (int): - The minimum nodes required to be available in - a pool. Blocks maintenance if it would cause the - number of running nodes to dip below this value. - - This field is a member of `oneof`_ ``_min_nodes_per_pool``. - """ - - node_idle_time_window: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=1, - optional=True, - message=duration_pb2.Duration, - ) - maintenance_availability_window: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=2, - optional=True, - message=duration_pb2.Duration, - ) - min_nodes_per_pool: int = proto.Field( - proto.INT64, - number=3, - optional=True, - ) - - maintenance_interval: MaintenanceInterval = proto.Field( - proto.ENUM, - number=1, - optional=True, - enum=MaintenanceInterval, - ) - opportunistic_maintenance_strategy: OpportunisticMaintenanceStrategy = proto.Field( - proto.MESSAGE, - number=2, - oneof='maintenance_strategy', - message=OpportunisticMaintenanceStrategy, - ) - - -class NodeTaint(proto.Message): - r"""Kubernetes taint is composed of three fields: key, value, and - effect. Effect can only be one of three types: NoSchedule, - PreferNoSchedule or NoExecute. - - See - `here `__ - for more information, including usage and the valid values. - - Attributes: - key (str): - Key for taint. - value (str): - Value for taint. - effect (google.cloud.container_v1beta1.types.NodeTaint.Effect): - Effect for taint. - """ - class Effect(proto.Enum): - r"""Possible values for Effect in taint. - - Values: - EFFECT_UNSPECIFIED (0): - Not set - NO_SCHEDULE (1): - NoSchedule - PREFER_NO_SCHEDULE (2): - PreferNoSchedule - NO_EXECUTE (3): - NoExecute - """ - EFFECT_UNSPECIFIED = 0 - NO_SCHEDULE = 1 - PREFER_NO_SCHEDULE = 2 - NO_EXECUTE = 3 - - key: str = proto.Field( - proto.STRING, - number=1, - ) - value: str = proto.Field( - proto.STRING, - number=2, - ) - effect: Effect = proto.Field( - proto.ENUM, - number=3, - enum=Effect, - ) - - -class NodeTaints(proto.Message): - r"""Collection of Kubernetes `node - taints `__. - - Attributes: - taints (MutableSequence[google.cloud.container_v1beta1.types.NodeTaint]): - List of node taints. - """ - - taints: MutableSequence['NodeTaint'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='NodeTaint', - ) - - -class NodeLabels(proto.Message): - r"""Collection of node-level `Kubernetes - labels `__. - - Attributes: - labels (MutableMapping[str, str]): - Map of node label keys and node label values. - """ - - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=1, - ) - - -class ResourceLabels(proto.Message): - r"""Collection of `GCP - labels `__. - - Attributes: - labels (MutableMapping[str, str]): - Map of node label keys and node label values. - """ - - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=1, - ) - - -class NetworkTags(proto.Message): - r"""Collection of Compute Engine network tags that can be applied to a - node's underlying VM instance. (See ``tags`` field in - ```NodeConfig`` `__). - - Attributes: - tags (MutableSequence[str]): - List of network tags. - """ - - tags: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - - -class MasterAuth(proto.Message): - r"""The authentication information for accessing the master - endpoint. Authentication can be done using HTTP basic auth or - using client certificates. - - Attributes: - username (str): - The username to use for HTTP basic - authentication to the master endpoint. For - clusters v1.6.0 and later, basic authentication - can be disabled by leaving username unspecified - (or setting it to the empty string). - - Warning: basic authentication is deprecated, and - will be removed in GKE control plane versions - 1.19 and newer. For a list of recommended - authentication methods, see: - - https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication - password (str): - The password to use for HTTP basic - authentication to the master endpoint. Because - the master endpoint is open to the Internet, you - should create a strong password. If a password - is provided for cluster creation, username must - be non-empty. - - Warning: basic authentication is deprecated, and - will be removed in GKE control plane versions - 1.19 and newer. For a list of recommended - authentication methods, see: - - https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication - client_certificate_config (google.cloud.container_v1beta1.types.ClientCertificateConfig): - Configuration for client certificate - authentication on the cluster. For clusters - before v1.12, if no configuration is specified, - a client certificate is issued. - cluster_ca_certificate (str): - Output only. Base64-encoded public - certificate that is the root of trust for the - cluster. - client_certificate (str): - Output only. Base64-encoded public - certificate used by clients to authenticate to - the cluster endpoint. - client_key (str): - Output only. Base64-encoded private key used - by clients to authenticate to the cluster - endpoint. - """ - - username: str = proto.Field( - proto.STRING, - number=1, - ) - password: str = proto.Field( - proto.STRING, - number=2, - ) - client_certificate_config: 'ClientCertificateConfig' = proto.Field( - proto.MESSAGE, - number=3, - message='ClientCertificateConfig', - ) - cluster_ca_certificate: str = proto.Field( - proto.STRING, - number=100, - ) - client_certificate: str = proto.Field( - proto.STRING, - number=101, - ) - client_key: str = proto.Field( - proto.STRING, - number=102, - ) - - -class ClientCertificateConfig(proto.Message): - r"""Configuration for client certificates on the cluster. - - Attributes: - issue_client_certificate (bool): - Issue a client certificate. - """ - - issue_client_certificate: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class AddonsConfig(proto.Message): - r"""Configuration for the addons that can be automatically spun - up in the cluster, enabling additional functionality. - - Attributes: - http_load_balancing (google.cloud.container_v1beta1.types.HttpLoadBalancing): - Configuration for the HTTP (L7) load - balancing controller addon, which makes it easy - to set up HTTP load balancers for services in a - cluster. - horizontal_pod_autoscaling (google.cloud.container_v1beta1.types.HorizontalPodAutoscaling): - Configuration for the horizontal pod - autoscaling feature, which increases or - decreases the number of replica pods a - replication controller has based on the resource - usage of the existing pods. - kubernetes_dashboard (google.cloud.container_v1beta1.types.KubernetesDashboard): - Configuration for the Kubernetes Dashboard. - This addon is deprecated, and will be disabled - in 1.15. It is recommended to use the Cloud - Console to manage and monitor your Kubernetes - clusters, workloads and applications. For more - information, see: - - https://cloud.google.com/kubernetes-engine/docs/concepts/dashboards - network_policy_config (google.cloud.container_v1beta1.types.NetworkPolicyConfig): - Configuration for NetworkPolicy. This only - tracks whether the addon is enabled or not on - the Master, it does not track whether network - policy is enabled for the nodes. - istio_config (google.cloud.container_v1beta1.types.IstioConfig): - Configuration for Istio, an open platform to - connect, manage, and secure microservices. - cloud_run_config (google.cloud.container_v1beta1.types.CloudRunConfig): - Configuration for the Cloud Run addon. The ``IstioConfig`` - addon must be enabled in order to enable Cloud Run addon. - This option can only be enabled at cluster creation time. - dns_cache_config (google.cloud.container_v1beta1.types.DnsCacheConfig): - Configuration for NodeLocalDNS, a dns cache - running on cluster nodes - config_connector_config (google.cloud.container_v1beta1.types.ConfigConnectorConfig): - Configuration for the ConfigConnector add-on, - a Kubernetes extension to manage hosted GCP - services through the Kubernetes API - gce_persistent_disk_csi_driver_config (google.cloud.container_v1beta1.types.GcePersistentDiskCsiDriverConfig): - Configuration for the Compute Engine - Persistent Disk CSI driver. - kalm_config (google.cloud.container_v1beta1.types.KalmConfig): - Configuration for the KALM addon, which - manages the lifecycle of k8s applications. - gcp_filestore_csi_driver_config (google.cloud.container_v1beta1.types.GcpFilestoreCsiDriverConfig): - Configuration for the GCP Filestore CSI - driver. - gke_backup_agent_config (google.cloud.container_v1beta1.types.GkeBackupAgentConfig): - Configuration for the Backup for GKE agent - addon. - gcs_fuse_csi_driver_config (google.cloud.container_v1beta1.types.GcsFuseCsiDriverConfig): - Configuration for the Cloud Storage Fuse CSI - driver. - stateful_ha_config (google.cloud.container_v1beta1.types.StatefulHAConfig): - Optional. Configuration for the StatefulHA - add-on. - ray_operator_config (google.cloud.container_v1beta1.types.RayOperatorConfig): - Optional. Configuration for Ray Operator - addon. - """ - - http_load_balancing: 'HttpLoadBalancing' = proto.Field( - proto.MESSAGE, - number=1, - message='HttpLoadBalancing', - ) - horizontal_pod_autoscaling: 'HorizontalPodAutoscaling' = proto.Field( - proto.MESSAGE, - number=2, - message='HorizontalPodAutoscaling', - ) - kubernetes_dashboard: 'KubernetesDashboard' = proto.Field( - proto.MESSAGE, - number=3, - message='KubernetesDashboard', - ) - network_policy_config: 'NetworkPolicyConfig' = proto.Field( - proto.MESSAGE, - number=4, - message='NetworkPolicyConfig', - ) - istio_config: 'IstioConfig' = proto.Field( - proto.MESSAGE, - number=5, - message='IstioConfig', - ) - cloud_run_config: 'CloudRunConfig' = proto.Field( - proto.MESSAGE, - number=7, - message='CloudRunConfig', - ) - dns_cache_config: 'DnsCacheConfig' = proto.Field( - proto.MESSAGE, - number=8, - message='DnsCacheConfig', - ) - config_connector_config: 'ConfigConnectorConfig' = proto.Field( - proto.MESSAGE, - number=10, - message='ConfigConnectorConfig', - ) - gce_persistent_disk_csi_driver_config: 'GcePersistentDiskCsiDriverConfig' = proto.Field( - proto.MESSAGE, - number=11, - message='GcePersistentDiskCsiDriverConfig', - ) - kalm_config: 'KalmConfig' = proto.Field( - proto.MESSAGE, - number=12, - message='KalmConfig', - ) - gcp_filestore_csi_driver_config: 'GcpFilestoreCsiDriverConfig' = proto.Field( - proto.MESSAGE, - number=14, - message='GcpFilestoreCsiDriverConfig', - ) - gke_backup_agent_config: 'GkeBackupAgentConfig' = proto.Field( - proto.MESSAGE, - number=16, - message='GkeBackupAgentConfig', - ) - gcs_fuse_csi_driver_config: 'GcsFuseCsiDriverConfig' = proto.Field( - proto.MESSAGE, - number=17, - message='GcsFuseCsiDriverConfig', - ) - stateful_ha_config: 'StatefulHAConfig' = proto.Field( - proto.MESSAGE, - number=18, - message='StatefulHAConfig', - ) - ray_operator_config: 'RayOperatorConfig' = proto.Field( - proto.MESSAGE, - number=21, - message='RayOperatorConfig', - ) - - -class HttpLoadBalancing(proto.Message): - r"""Configuration options for the HTTP (L7) load balancing - controller addon, which makes it easy to set up HTTP load - balancers for services in a cluster. - - Attributes: - disabled (bool): - Whether the HTTP Load Balancing controller is - enabled in the cluster. When enabled, it runs a - small pod in the cluster that manages the load - balancers. - """ - - disabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class HorizontalPodAutoscaling(proto.Message): - r"""Configuration options for the horizontal pod autoscaling - feature, which increases or decreases the number of replica pods - a replication controller has based on the resource usage of the - existing pods. - - Attributes: - disabled (bool): - Whether the Horizontal Pod Autoscaling - feature is enabled in the cluster. When enabled, - it ensures that metrics are collected into - Stackdriver Monitoring. - """ - - disabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class KubernetesDashboard(proto.Message): - r"""Configuration for the Kubernetes Dashboard. - - Attributes: - disabled (bool): - Whether the Kubernetes Dashboard is enabled - for this cluster. - """ - - disabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class NetworkPolicyConfig(proto.Message): - r"""Configuration for NetworkPolicy. This only tracks whether the - addon is enabled or not on the Master, it does not track whether - network policy is enabled for the nodes. - - Attributes: - disabled (bool): - Whether NetworkPolicy is enabled for this - cluster. - """ - - disabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class DnsCacheConfig(proto.Message): - r"""Configuration for NodeLocal DNSCache - - Attributes: - enabled (bool): - Whether NodeLocal DNSCache is enabled for - this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class KalmConfig(proto.Message): - r"""Configuration options for the KALM addon. - - Attributes: - enabled (bool): - Whether KALM is enabled for this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class GkeBackupAgentConfig(proto.Message): - r"""Configuration for the Backup for GKE Agent. - - Attributes: - enabled (bool): - Whether the Backup for GKE agent is enabled - for this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class StatefulHAConfig(proto.Message): - r"""Configuration for the Stateful HA add-on. - - Attributes: - enabled (bool): - Whether the Stateful HA add-on is enabled for - this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class ConfigConnectorConfig(proto.Message): - r"""Configuration options for the Config Connector add-on. - - Attributes: - enabled (bool): - Whether Cloud Connector is enabled for this - cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class GcePersistentDiskCsiDriverConfig(proto.Message): - r"""Configuration for the Compute Engine PD CSI driver. - - Attributes: - enabled (bool): - Whether the Compute Engine PD CSI driver is - enabled for this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class GcpFilestoreCsiDriverConfig(proto.Message): - r"""Configuration for the GCP Filestore CSI driver. - - Attributes: - enabled (bool): - Whether the GCP Filestore CSI driver is - enabled for this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class GcsFuseCsiDriverConfig(proto.Message): - r"""Configuration for the Cloud Storage Fuse CSI driver. - - Attributes: - enabled (bool): - Whether the Cloud Storage Fuse CSI driver is - enabled for this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class RayOperatorConfig(proto.Message): - r"""Configuration options for the Ray Operator add-on. - - Attributes: - enabled (bool): - Whether the Ray addon is enabled for this - cluster. - ray_cluster_logging_config (google.cloud.container_v1beta1.types.RayClusterLoggingConfig): - Optional. Logging configuration for Ray - clusters. - ray_cluster_monitoring_config (google.cloud.container_v1beta1.types.RayClusterMonitoringConfig): - Optional. Monitoring configuration for Ray - clusters. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - ray_cluster_logging_config: 'RayClusterLoggingConfig' = proto.Field( - proto.MESSAGE, - number=2, - message='RayClusterLoggingConfig', - ) - ray_cluster_monitoring_config: 'RayClusterMonitoringConfig' = proto.Field( - proto.MESSAGE, - number=3, - message='RayClusterMonitoringConfig', - ) - - -class PrivateClusterMasterGlobalAccessConfig(proto.Message): - r"""Configuration for controlling master global access settings. - - Attributes: - enabled (bool): - Whenever master is accessible globally or - not. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class PrivateClusterConfig(proto.Message): - r"""Configuration options for private clusters. - - Attributes: - enable_private_nodes (bool): - Whether nodes have internal IP addresses - only. If enabled, all nodes are given only RFC - 1918 private addresses and communicate with the - master via private networking. - enable_private_endpoint (bool): - Whether the master's internal IP address is - used as the cluster endpoint. - master_ipv4_cidr_block (str): - The IP range in CIDR notation to use for the - hosted master network. This range will be used - for assigning internal IP addresses to the - master or set of masters, as well as the ILB - VIP. This range must not overlap with any other - ranges in use within the cluster's network. - private_endpoint (str): - Output only. The internal IP address of this - cluster's master endpoint. - public_endpoint (str): - Output only. The external IP address of this - cluster's master endpoint. - peering_name (str): - Output only. The peering name in the customer - VPC used by this cluster. - master_global_access_config (google.cloud.container_v1beta1.types.PrivateClusterMasterGlobalAccessConfig): - Controls master global access settings. - private_endpoint_subnetwork (str): - Subnet to provision the master's private endpoint during - cluster creation. Specified in - projects/\ */regions/*/subnetworks/\* format. - """ - - enable_private_nodes: bool = proto.Field( - proto.BOOL, - number=1, - ) - enable_private_endpoint: bool = proto.Field( - proto.BOOL, - number=2, - ) - master_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=3, - ) - private_endpoint: str = proto.Field( - proto.STRING, - number=4, - ) - public_endpoint: str = proto.Field( - proto.STRING, - number=5, - ) - peering_name: str = proto.Field( - proto.STRING, - number=7, - ) - master_global_access_config: 'PrivateClusterMasterGlobalAccessConfig' = proto.Field( - proto.MESSAGE, - number=8, - message='PrivateClusterMasterGlobalAccessConfig', - ) - private_endpoint_subnetwork: str = proto.Field( - proto.STRING, - number=10, - ) - - -class IstioConfig(proto.Message): - r"""Configuration options for Istio addon. - - Attributes: - disabled (bool): - Whether Istio is enabled for this cluster. - auth (google.cloud.container_v1beta1.types.IstioConfig.IstioAuthMode): - The specified Istio auth mode, either none, - or mutual TLS. - """ - class IstioAuthMode(proto.Enum): - r"""Istio auth mode, - https://istio.io/docs/concepts/security/mutual-tls.html - - Values: - AUTH_NONE (0): - auth not enabled - AUTH_MUTUAL_TLS (1): - auth mutual TLS enabled - """ - AUTH_NONE = 0 - AUTH_MUTUAL_TLS = 1 - - disabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - auth: IstioAuthMode = proto.Field( - proto.ENUM, - number=2, - enum=IstioAuthMode, - ) - - -class CloudRunConfig(proto.Message): - r"""Configuration options for the Cloud Run feature. - - Attributes: - disabled (bool): - Whether Cloud Run addon is enabled for this - cluster. - load_balancer_type (google.cloud.container_v1beta1.types.CloudRunConfig.LoadBalancerType): - Which load balancer type is installed for - Cloud Run. - """ - class LoadBalancerType(proto.Enum): - r"""Load balancer type of ingress service of Cloud Run. - - Values: - LOAD_BALANCER_TYPE_UNSPECIFIED (0): - Load balancer type for Cloud Run is - unspecified. - LOAD_BALANCER_TYPE_EXTERNAL (1): - Install external load balancer for Cloud Run. - LOAD_BALANCER_TYPE_INTERNAL (2): - Install internal load balancer for Cloud Run. - """ - LOAD_BALANCER_TYPE_UNSPECIFIED = 0 - LOAD_BALANCER_TYPE_EXTERNAL = 1 - LOAD_BALANCER_TYPE_INTERNAL = 2 - - disabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - load_balancer_type: LoadBalancerType = proto.Field( - proto.ENUM, - number=3, - enum=LoadBalancerType, - ) - - -class MasterAuthorizedNetworksConfig(proto.Message): - r"""Configuration options for the master authorized networks - feature. Enabled master authorized networks will disallow all - external traffic to access Kubernetes master through HTTPS - except traffic from the given CIDR blocks, Google Compute Engine - Public IPs and Google Prod IPs. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - enabled (bool): - Whether or not master authorized networks is - enabled. - cidr_blocks (MutableSequence[google.cloud.container_v1beta1.types.MasterAuthorizedNetworksConfig.CidrBlock]): - cidr_blocks define up to 10 external networks that could - access Kubernetes master through HTTPS. - gcp_public_cidrs_access_enabled (bool): - Whether master is accessbile via Google - Compute Engine Public IP addresses. - - This field is a member of `oneof`_ ``_gcp_public_cidrs_access_enabled``. - """ - - class CidrBlock(proto.Message): - r"""CidrBlock contains an optional name and one CIDR block. - - Attributes: - display_name (str): - display_name is an optional field for users to identify CIDR - blocks. - cidr_block (str): - cidr_block must be specified in CIDR notation. - """ - - display_name: str = proto.Field( - proto.STRING, - number=1, - ) - cidr_block: str = proto.Field( - proto.STRING, - number=2, - ) - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - cidr_blocks: MutableSequence[CidrBlock] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message=CidrBlock, - ) - gcp_public_cidrs_access_enabled: bool = proto.Field( - proto.BOOL, - number=3, - optional=True, - ) - - -class LegacyAbac(proto.Message): - r"""Configuration for the legacy Attribute Based Access Control - authorization mode. - - Attributes: - enabled (bool): - Whether the ABAC authorizer is enabled for - this cluster. When enabled, identities in the - system, including service accounts, nodes, and - controllers, will have statically granted - permissions beyond those provided by the RBAC - configuration or IAM. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class NetworkPolicy(proto.Message): - r"""Configuration options for the NetworkPolicy feature. - https://kubernetes.io/docs/concepts/services-networking/networkpolicies/ - - Attributes: - provider (google.cloud.container_v1beta1.types.NetworkPolicy.Provider): - The selected network policy provider. - enabled (bool): - Whether network policy is enabled on the - cluster. - """ - class Provider(proto.Enum): - r"""Allowed Network Policy providers. - - Values: - PROVIDER_UNSPECIFIED (0): - Not set - CALICO (1): - Tigera (Calico Felix). - """ - PROVIDER_UNSPECIFIED = 0 - CALICO = 1 - - provider: Provider = proto.Field( - proto.ENUM, - number=1, - enum=Provider, - ) - enabled: bool = proto.Field( - proto.BOOL, - number=2, - ) - - -class PodCIDROverprovisionConfig(proto.Message): - r"""[PRIVATE FIELD] Config for pod CIDR size overprovisioning. - - Attributes: - disable (bool): - Whether Pod CIDR overprovisioning is - disabled. Note: Pod CIDR overprovisioning is - enabled by default. - """ - - disable: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class IPAllocationPolicy(proto.Message): - r"""Configuration for controlling how IPs are allocated in the - cluster. - - Attributes: - use_ip_aliases (bool): - Whether alias IPs will be used for pod IPs in the cluster. - This is used in conjunction with use_routes. It cannot be - true if use_routes is true. If both use_ip_aliases and - use_routes are false, then the server picks the default IP - allocation mode - create_subnetwork (bool): - Whether a new subnetwork will be created automatically for - the cluster. - - This field is only applicable when ``use_ip_aliases`` is - true. - subnetwork_name (str): - A custom subnetwork name to be used if ``create_subnetwork`` - is true. If this field is empty, then an automatic name will - be chosen for the new subnetwork. - cluster_ipv4_cidr (str): - This field is deprecated, use cluster_ipv4_cidr_block. - node_ipv4_cidr (str): - This field is deprecated, use node_ipv4_cidr_block. - services_ipv4_cidr (str): - This field is deprecated, use services_ipv4_cidr_block. - cluster_secondary_range_name (str): - The name of the secondary range to be used for the cluster - CIDR block. The secondary range will be used for pod IP - addresses. This must be an existing secondary range - associated with the cluster subnetwork. - - This field is only applicable with use_ip_aliases and - create_subnetwork is false. - services_secondary_range_name (str): - The name of the secondary range to be used as for the - services CIDR block. The secondary range will be used for - service ClusterIPs. This must be an existing secondary range - associated with the cluster subnetwork. - - This field is only applicable with use_ip_aliases and - create_subnetwork is false. - cluster_ipv4_cidr_block (str): - The IP address range for the cluster pod IPs. If this field - is set, then ``cluster.cluster_ipv4_cidr`` must be left - blank. - - This field is only applicable when ``use_ip_aliases`` is - true. - - Set to blank to have a range chosen with the default size. - - Set to /netmask (e.g. ``/14``) to have a range chosen with a - specific netmask. - - Set to a - `CIDR `__ - notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private - networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, - ``192.168.0.0/16``) to pick a specific range to use. - node_ipv4_cidr_block (str): - The IP address range of the instance IPs in this cluster. - - This is applicable only if ``create_subnetwork`` is true. - - Set to blank to have a range chosen with the default size. - - Set to /netmask (e.g. ``/14``) to have a range chosen with a - specific netmask. - - Set to a - `CIDR `__ - notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private - networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, - ``192.168.0.0/16``) to pick a specific range to use. - services_ipv4_cidr_block (str): - The IP address range of the services IPs in this cluster. If - blank, a range will be automatically chosen with the default - size. - - This field is only applicable when ``use_ip_aliases`` is - true. - - Set to blank to have a range chosen with the default size. - - Set to /netmask (e.g. ``/14``) to have a range chosen with a - specific netmask. - - Set to a - `CIDR `__ - notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private - networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, - ``192.168.0.0/16``) to pick a specific range to use. - allow_route_overlap (bool): - If true, allow allocation of cluster CIDR ranges that - overlap with certain kinds of network routes. By default we - do not allow cluster CIDR ranges to intersect with any user - declared routes. With allow_route_overlap == true, we allow - overlapping with CIDR ranges that are larger than the - cluster CIDR range. - - If this field is set to true, then cluster and services - CIDRs must be fully-specified (e.g. ``10.96.0.0/14``, but - not ``/14``), which means: - - 1) When ``use_ip_aliases`` is true, - ``cluster_ipv4_cidr_block`` and - ``services_ipv4_cidr_block`` must be fully-specified. - 2) When ``use_ip_aliases`` is false, - ``cluster.cluster_ipv4_cidr`` muse be fully-specified. - tpu_ipv4_cidr_block (str): - The IP address range of the Cloud TPUs in this cluster. If - unspecified, a range will be automatically chosen with the - default size. - - This field is only applicable when ``use_ip_aliases`` is - true. - - If unspecified, the range will use the default size. - - Set to /netmask (e.g. ``/14``) to have a range chosen with a - specific netmask. - - Set to a - `CIDR `__ - notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private - networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``, - ``192.168.0.0/16``) to pick a specific range to use. This - field is deprecated, use cluster.tpu_config.ipv4_cidr_block - instead. - use_routes (bool): - Whether routes will be used for pod IPs in the cluster. This - is used in conjunction with use_ip_aliases. It cannot be - true if use_ip_aliases is true. If both use_ip_aliases and - use_routes are false, then the server picks the default IP - allocation mode - stack_type (google.cloud.container_v1beta1.types.IPAllocationPolicy.StackType): - IP stack type - ipv6_access_type (google.cloud.container_v1beta1.types.IPAllocationPolicy.IPv6AccessType): - The ipv6 access type (internal or external) when - create_subnetwork is true - pod_cidr_overprovision_config (google.cloud.container_v1beta1.types.PodCIDROverprovisionConfig): - [PRIVATE FIELD] Pod CIDR size overprovisioning config for - the cluster. - - Pod CIDR size per node depends on max_pods_per_node. By - default, the value of max_pods_per_node is doubled and then - rounded off to next power of 2 to get the size of pod CIDR - block per node. Example: max_pods_per_node of 30 would - result in 64 IPs (/26). - - This config can disable the doubling of IPs (we still round - off to next power of 2) Example: max_pods_per_node of 30 - will result in 32 IPs (/27) when overprovisioning is - disabled. - subnet_ipv6_cidr_block (str): - Output only. The subnet's IPv6 CIDR block - used by nodes and pods. - services_ipv6_cidr_block (str): - Output only. The services IPv6 CIDR block for - the cluster. - additional_pod_ranges_config (google.cloud.container_v1beta1.types.AdditionalPodRangesConfig): - Output only. The additional pod ranges that - are added to the cluster. These pod ranges can - be used by new node pools to allocate pod IPs - automatically. Once the range is removed it will - not show up in IPAllocationPolicy. - default_pod_ipv4_range_utilization (float): - Output only. The utilization of the cluster default IPv4 - range for the pod. The ratio is Usage/[Total number of IPs - in the secondary range], - Usage=numNodes\ *numZones*\ podIPsPerNode. - """ - class StackType(proto.Enum): - r"""Possible values for IP stack type - - Values: - STACK_TYPE_UNSPECIFIED (0): - By default, the clusters will be IPV4 only - IPV4 (1): - The value used if the cluster is a IPV4 only - IPV4_IPV6 (2): - The value used if the cluster is a dual stack - cluster - """ - STACK_TYPE_UNSPECIFIED = 0 - IPV4 = 1 - IPV4_IPV6 = 2 - - class IPv6AccessType(proto.Enum): - r"""IPv6 access type - - Values: - IPV6_ACCESS_TYPE_UNSPECIFIED (0): - Default value, will be defaulted as type - external. - INTERNAL (1): - Access type internal (all v6 addresses are - internal IPs) - EXTERNAL (2): - Access type external (all v6 addresses are - external IPs) - """ - IPV6_ACCESS_TYPE_UNSPECIFIED = 0 - INTERNAL = 1 - EXTERNAL = 2 - - use_ip_aliases: bool = proto.Field( - proto.BOOL, - number=1, - ) - create_subnetwork: bool = proto.Field( - proto.BOOL, - number=2, - ) - subnetwork_name: str = proto.Field( - proto.STRING, - number=3, - ) - cluster_ipv4_cidr: str = proto.Field( - proto.STRING, - number=4, - ) - node_ipv4_cidr: str = proto.Field( - proto.STRING, - number=5, - ) - services_ipv4_cidr: str = proto.Field( - proto.STRING, - number=6, - ) - cluster_secondary_range_name: str = proto.Field( - proto.STRING, - number=7, - ) - services_secondary_range_name: str = proto.Field( - proto.STRING, - number=8, - ) - cluster_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=9, - ) - node_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=10, - ) - services_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=11, - ) - allow_route_overlap: bool = proto.Field( - proto.BOOL, - number=12, - ) - tpu_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=13, - ) - use_routes: bool = proto.Field( - proto.BOOL, - number=15, - ) - stack_type: StackType = proto.Field( - proto.ENUM, - number=16, - enum=StackType, - ) - ipv6_access_type: IPv6AccessType = proto.Field( - proto.ENUM, - number=17, - enum=IPv6AccessType, - ) - pod_cidr_overprovision_config: 'PodCIDROverprovisionConfig' = proto.Field( - proto.MESSAGE, - number=21, - message='PodCIDROverprovisionConfig', - ) - subnet_ipv6_cidr_block: str = proto.Field( - proto.STRING, - number=22, - ) - services_ipv6_cidr_block: str = proto.Field( - proto.STRING, - number=23, - ) - additional_pod_ranges_config: 'AdditionalPodRangesConfig' = proto.Field( - proto.MESSAGE, - number=24, - message='AdditionalPodRangesConfig', - ) - default_pod_ipv4_range_utilization: float = proto.Field( - proto.DOUBLE, - number=25, - ) - - -class BinaryAuthorization(proto.Message): - r"""Configuration for Binary Authorization. - - Attributes: - enabled (bool): - This field is deprecated. Leave this unset and instead - configure BinaryAuthorization using evaluation_mode. If - evaluation_mode is set to anything other than - EVALUATION_MODE_UNSPECIFIED, this field is ignored. - evaluation_mode (google.cloud.container_v1beta1.types.BinaryAuthorization.EvaluationMode): - Mode of operation for binauthz policy - evaluation. If unspecified, defaults to - DISABLED. - policy_bindings (MutableSequence[google.cloud.container_v1beta1.types.BinaryAuthorization.PolicyBinding]): - Optional. Binauthz policies that apply to - this cluster. - """ - class EvaluationMode(proto.Enum): - r"""Binary Authorization mode of operation. - - Values: - EVALUATION_MODE_UNSPECIFIED (0): - Default value - DISABLED (1): - Disable BinaryAuthorization - PROJECT_SINGLETON_POLICY_ENFORCE (2): - Enforce Kubernetes admission requests with - BinaryAuthorization using the project's - singleton policy. This is equivalent to setting - the enabled boolean to true. - POLICY_BINDINGS (5): - Use Binary Authorization Continuous Validation with the - policies specified in policy_bindings. - POLICY_BINDINGS_AND_PROJECT_SINGLETON_POLICY_ENFORCE (6): - Use Binary Authorization Continuous Validation with the - policies specified in policy_bindings and enforce Kubernetes - admission requests with Binary Authorization using the - project's singleton policy. - """ - EVALUATION_MODE_UNSPECIFIED = 0 - DISABLED = 1 - PROJECT_SINGLETON_POLICY_ENFORCE = 2 - POLICY_BINDINGS = 5 - POLICY_BINDINGS_AND_PROJECT_SINGLETON_POLICY_ENFORCE = 6 - - class PolicyBinding(proto.Message): - r"""Binauthz policy that applies to this cluster. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - name (str): - The relative resource name of the binauthz platform policy - to evaluate. GKE platform policies have the following - format: - ``projects/{project_number}/platforms/gke/policies/{policy_id}``. - - This field is a member of `oneof`_ ``_name``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - optional=True, - ) - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - evaluation_mode: EvaluationMode = proto.Field( - proto.ENUM, - number=2, - enum=EvaluationMode, - ) - policy_bindings: MutableSequence[PolicyBinding] = proto.RepeatedField( - proto.MESSAGE, - number=5, - message=PolicyBinding, - ) - - -class PodSecurityPolicyConfig(proto.Message): - r"""Configuration for the PodSecurityPolicy feature. - - Attributes: - enabled (bool): - Enable the PodSecurityPolicy controller for - this cluster. If enabled, pods must be valid - under a PodSecurityPolicy to be created. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class AuthenticatorGroupsConfig(proto.Message): - r"""Configuration for returning group information from - authenticators. - - Attributes: - enabled (bool): - Whether this cluster should return group - membership lookups during authentication using a - group of security groups. - security_group (str): - The name of the security group-of-groups to - be used. Only relevant if enabled = true. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - security_group: str = proto.Field( - proto.STRING, - number=2, - ) - - -class ClusterTelemetry(proto.Message): - r"""Telemetry integration for the cluster. - - Attributes: - type_ (google.cloud.container_v1beta1.types.ClusterTelemetry.Type): - Type of the integration. - """ - class Type(proto.Enum): - r"""Type of the integration. - - Values: - UNSPECIFIED (0): - Not set. - DISABLED (1): - Monitoring integration is disabled. - ENABLED (2): - Monitoring integration is enabled. - SYSTEM_ONLY (3): - Only system components are monitored and - logged. - """ - UNSPECIFIED = 0 - DISABLED = 1 - ENABLED = 2 - SYSTEM_ONLY = 3 - - type_: Type = proto.Field( - proto.ENUM, - number=1, - enum=Type, - ) - - -class Cluster(proto.Message): - r"""A Google Kubernetes Engine cluster. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - name (str): - The name of this cluster. The name must be unique within - this project and location (e.g. zone or region), and can be - up to 40 characters with the following restrictions: - - - Lowercase letters, numbers, and hyphens only. - - Must start with a letter. - - Must end with a number or a letter. - description (str): - An optional description of this cluster. - initial_node_count (int): - The number of nodes to create in this cluster. You must - ensure that your Compute Engine `resource - quota `__ is - sufficient for this number of instances. You must also have - available firewall and routes quota. For requests, this - field should only be used in lieu of a "node_pool" object, - since this configuration (along with the "node_config") will - be used to create a "NodePool" object with an auto-generated - name. Do not use this and a node_pool at the same time. - - This field is deprecated, use node_pool.initial_node_count - instead. - node_config (google.cloud.container_v1beta1.types.NodeConfig): - Parameters used in creating the cluster's nodes. For - requests, this field should only be used in lieu of a - "node_pool" object, since this configuration (along with the - "initial_node_count") will be used to create a "NodePool" - object with an auto-generated name. Do not use this and a - node_pool at the same time. For responses, this field will - be populated with the node configuration of the first node - pool. (For configuration of each node pool, see - ``node_pool.config``) - - If unspecified, the defaults are used. This field is - deprecated, use node_pool.config instead. - master_auth (google.cloud.container_v1beta1.types.MasterAuth): - The authentication information for accessing the master - endpoint. If unspecified, the defaults are used: For - clusters before v1.12, if master_auth is unspecified, - ``username`` will be set to "admin", a random password will - be generated, and a client certificate will be issued. - logging_service (str): - The logging service the cluster should use to write logs. - Currently available options: - - - ``logging.googleapis.com/kubernetes`` - The Cloud Logging - service with a Kubernetes-native resource model - - ``logging.googleapis.com`` - The legacy Cloud Logging - service (no longer available as of GKE 1.15). - - ``none`` - no logs will be exported from the cluster. - - If left as an empty - string,\ ``logging.googleapis.com/kubernetes`` will be used - for GKE 1.14+ or ``logging.googleapis.com`` for earlier - versions. - monitoring_service (str): - The monitoring service the cluster should use to write - metrics. Currently available options: - - - "monitoring.googleapis.com/kubernetes" - The Cloud - Monitoring service with a Kubernetes-native resource - model - - ``monitoring.googleapis.com`` - The legacy Cloud - Monitoring service (no longer available as of GKE 1.15). - - ``none`` - No metrics will be exported from the cluster. - - If left as an empty - string,\ ``monitoring.googleapis.com/kubernetes`` will be - used for GKE 1.14+ or ``monitoring.googleapis.com`` for - earlier versions. - network (str): - The name of the Google Compute Engine - `network `__ - to which the cluster is connected. If left unspecified, the - ``default`` network will be used. On output this shows the - network ID instead of the name. - cluster_ipv4_cidr (str): - The IP address range of the container pods in this cluster, - in - `CIDR `__ - notation (e.g. ``10.96.0.0/14``). Leave blank to have one - automatically chosen or specify a ``/14`` block in - ``10.0.0.0/8``. - addons_config (google.cloud.container_v1beta1.types.AddonsConfig): - Configurations for the various addons - available to run in the cluster. - subnetwork (str): - The name of the Google Compute Engine - `subnetwork `__ - to which the cluster is connected. On output this shows the - subnetwork ID instead of the name. - node_pools (MutableSequence[google.cloud.container_v1beta1.types.NodePool]): - The node pools associated with this cluster. This field - should not be set if "node_config" or "initial_node_count" - are specified. - locations (MutableSequence[str]): - The list of Google Compute Engine - `zones `__ - in which the cluster's nodes should be located. - - This field provides a default value if - `NodePool.Locations `__ - are not specified during node pool creation. - - Warning: changing cluster locations will update the - `NodePool.Locations `__ - of all node pools and will result in nodes being added - and/or removed. - enable_kubernetes_alpha (bool): - Kubernetes alpha features are enabled on this - cluster. This includes alpha API groups (e.g. - v1beta1) and features that may not be production - ready in the kubernetes version of the master - and nodes. The cluster has no SLA for uptime and - master/node upgrades are disabled. Alpha enabled - clusters are automatically deleted thirty days - after creation. - enable_k8s_beta_apis (google.cloud.container_v1beta1.types.K8sBetaAPIConfig): - Kubernetes open source beta apis enabled on - the cluster. Only beta apis. - resource_labels (MutableMapping[str, str]): - The resource labels for the cluster to use to - annotate any related Google Compute Engine - resources. - label_fingerprint (str): - The fingerprint of the set of labels for this - cluster. - legacy_abac (google.cloud.container_v1beta1.types.LegacyAbac): - Configuration for the legacy ABAC - authorization mode. - network_policy (google.cloud.container_v1beta1.types.NetworkPolicy): - Configuration options for the NetworkPolicy - feature. - ip_allocation_policy (google.cloud.container_v1beta1.types.IPAllocationPolicy): - Configuration for cluster IP allocation. - master_authorized_networks_config (google.cloud.container_v1beta1.types.MasterAuthorizedNetworksConfig): - The configuration options for master - authorized networks feature. - maintenance_policy (google.cloud.container_v1beta1.types.MaintenancePolicy): - Configure the maintenance policy for this - cluster. - binary_authorization (google.cloud.container_v1beta1.types.BinaryAuthorization): - Configuration for Binary Authorization. - pod_security_policy_config (google.cloud.container_v1beta1.types.PodSecurityPolicyConfig): - Configuration for the PodSecurityPolicy - feature. - autoscaling (google.cloud.container_v1beta1.types.ClusterAutoscaling): - Cluster-level autoscaling configuration. - network_config (google.cloud.container_v1beta1.types.NetworkConfig): - Configuration for cluster networking. - private_cluster (bool): - If this is a private cluster setup. Private clusters are - clusters that, by default have no external IP addresses on - the nodes and where nodes and the master communicate over - private IP addresses. This field is deprecated, use - private_cluster_config.enable_private_nodes instead. - master_ipv4_cidr_block (str): - The IP prefix in CIDR notation to use for the hosted master - network. This prefix will be used for assigning private IP - addresses to the master or set of masters, as well as the - ILB VIP. This field is deprecated, use - private_cluster_config.master_ipv4_cidr_block instead. - default_max_pods_constraint (google.cloud.container_v1beta1.types.MaxPodsConstraint): - The default constraint on the maximum number - of pods that can be run simultaneously on a node - in the node pool of this cluster. Only honored - if cluster created with IP Alias support. - resource_usage_export_config (google.cloud.container_v1beta1.types.ResourceUsageExportConfig): - Configuration for exporting resource usages. - Resource usage export is disabled when this - config unspecified. - authenticator_groups_config (google.cloud.container_v1beta1.types.AuthenticatorGroupsConfig): - Configuration controlling RBAC group - membership information. - private_cluster_config (google.cloud.container_v1beta1.types.PrivateClusterConfig): - Configuration for private cluster. - vertical_pod_autoscaling (google.cloud.container_v1beta1.types.VerticalPodAutoscaling): - Cluster-level Vertical Pod Autoscaling - configuration. - shielded_nodes (google.cloud.container_v1beta1.types.ShieldedNodes): - Shielded Nodes configuration. - release_channel (google.cloud.container_v1beta1.types.ReleaseChannel): - Release channel configuration. If left - unspecified on cluster creation and a version is - specified, the cluster is enrolled in the most - mature release channel where the version is - available (first checking STABLE, then REGULAR, - and finally RAPID). Otherwise, if no release - channel configuration and no version is - specified, the cluster is enrolled in the - REGULAR channel with its default version. - workload_identity_config (google.cloud.container_v1beta1.types.WorkloadIdentityConfig): - Configuration for the use of Kubernetes - Service Accounts in GCP IAM policies. - workload_certificates (google.cloud.container_v1beta1.types.WorkloadCertificates): - Configuration for issuance of mTLS keys and - certificates to Kubernetes pods. - mesh_certificates (google.cloud.container_v1beta1.types.MeshCertificates): - Configuration for issuance of mTLS keys and - certificates to Kubernetes pods. - workload_alts_config (google.cloud.container_v1beta1.types.WorkloadALTSConfig): - Configuration for direct-path (via ALTS) with - workload identity. - cost_management_config (google.cloud.container_v1beta1.types.CostManagementConfig): - Configuration for the fine-grained cost - management feature. - cluster_telemetry (google.cloud.container_v1beta1.types.ClusterTelemetry): - Telemetry integration for the cluster. - tpu_config (google.cloud.container_v1beta1.types.TpuConfig): - Configuration for Cloud TPU support; - notification_config (google.cloud.container_v1beta1.types.NotificationConfig): - Notification configuration of the cluster. - confidential_nodes (google.cloud.container_v1beta1.types.ConfidentialNodes): - Configuration of Confidential Nodes. - All the nodes in the cluster will be - Confidential VM once enabled. - identity_service_config (google.cloud.container_v1beta1.types.IdentityServiceConfig): - Configuration for Identity Service component. - self_link (str): - Output only. Server-defined URL for the - resource. - zone (str): - Output only. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field is deprecated, use - location instead. - endpoint (str): - Output only. The IP address of this cluster's master - endpoint. The endpoint can be accessed from the internet at - ``https://username:password@endpoint/``. - - See the ``masterAuth`` property of this resource for - username and password information. - initial_cluster_version (str): - The initial Kubernetes version for this - cluster. Valid versions are those found in - validMasterVersions returned by getServerConfig. - The version can be upgraded over time; such - upgrades are reflected in currentMasterVersion - and currentNodeVersion. - - Users may specify either explicit versions - offered by Kubernetes Engine or version aliases, - which have the following behavior: - - - "latest": picks the highest valid Kubernetes - version - - "1.X": picks the highest valid patch+gke.N - patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N patch - in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit Kubernetes - version - - "","-": picks the default Kubernetes version - current_master_version (str): - Output only. The current software version of - the master endpoint. - current_node_version (str): - Output only. Deprecated, use - `NodePool.version `__ - instead. The current version of the node software - components. If they are currently at multiple versions - because they're in the process of being upgraded, this - reflects the minimum version of all nodes. - create_time (str): - Output only. The time the cluster was created, in - `RFC3339 `__ text - format. - status (google.cloud.container_v1beta1.types.Cluster.Status): - Output only. The current status of this - cluster. - status_message (str): - Output only. Deprecated. Use conditions - instead. Additional information about the - current status of this cluster, if available. - node_ipv4_cidr_size (int): - Output only. The size of the address space on each node for - hosting containers. This is provisioned from within the - ``container_ipv4_cidr`` range. This field will only be set - when cluster is in route-based network mode. - services_ipv4_cidr (str): - Output only. The IP address range of the Kubernetes services - in this cluster, in - `CIDR `__ - notation (e.g. ``1.2.3.4/29``). Service addresses are - typically put in the last ``/16`` from the container CIDR. - instance_group_urls (MutableSequence[str]): - Output only. Deprecated. Use node_pools.instance_group_urls. - current_node_count (int): - Output only. The number of nodes currently in - the cluster. Deprecated. Call Kubernetes API - directly to retrieve node information. - expire_time (str): - Output only. The time the cluster will be automatically - deleted in - `RFC3339 `__ text - format. - location (str): - Output only. The name of the Google Compute Engine - `zone `__ - or - `region `__ - in which the cluster resides. - enable_tpu (bool): - Enable the ability to use Cloud TPUs in this cluster. This - field is deprecated, use tpu_config.enabled instead. - tpu_ipv4_cidr_block (str): - Output only. The IP address range of the Cloud TPUs in this - cluster, in - `CIDR `__ - notation (e.g. ``1.2.3.4/29``). - database_encryption (google.cloud.container_v1beta1.types.DatabaseEncryption): - Configuration of etcd encryption. - conditions (MutableSequence[google.cloud.container_v1beta1.types.StatusCondition]): - Which conditions caused the current cluster - state. - master (google.cloud.container_v1beta1.types.Master): - Configuration for master components. - autopilot (google.cloud.container_v1beta1.types.Autopilot): - Autopilot configuration for the cluster. - id (str): - Output only. Unique id for the cluster. - node_pool_defaults (google.cloud.container_v1beta1.types.NodePoolDefaults): - Default NodePool settings for the entire - cluster. These settings are overridden if - specified on the specific NodePool object. - - This field is a member of `oneof`_ ``_node_pool_defaults``. - logging_config (google.cloud.container_v1beta1.types.LoggingConfig): - Logging configuration for the cluster. - monitoring_config (google.cloud.container_v1beta1.types.MonitoringConfig): - Monitoring configuration for the cluster. - node_pool_auto_config (google.cloud.container_v1beta1.types.NodePoolAutoConfig): - Node pool configs that apply to all - auto-provisioned node pools in autopilot - clusters and node auto-provisioning enabled - clusters. - protect_config (google.cloud.container_v1beta1.types.ProtectConfig): - Deprecated: Use SecurityPostureConfig - instead. Enable/Disable Protect API features for - the cluster. - - This field is a member of `oneof`_ ``_protect_config``. - etag (str): - This checksum is computed by the server based - on the value of cluster fields, and may be sent - on update requests to ensure the client has an - up-to-date value before proceeding. - fleet (google.cloud.container_v1beta1.types.Fleet): - Fleet information for the cluster. - security_posture_config (google.cloud.container_v1beta1.types.SecurityPostureConfig): - Enable/Disable Security Posture API features - for the cluster. - enterprise_config (google.cloud.container_v1beta1.types.EnterpriseConfig): - GKE Enterprise Configuration. - secret_manager_config (google.cloud.container_v1beta1.types.SecretManagerConfig): - Secret CSI driver configuration. - compliance_posture_config (google.cloud.container_v1beta1.types.CompliancePostureConfig): - Enable/Disable Compliance Posture features - for the cluster. - satisfies_pzs (bool): - Output only. Reserved for future use. - - This field is a member of `oneof`_ ``_satisfies_pzs``. - satisfies_pzi (bool): - Output only. Reserved for future use. - - This field is a member of `oneof`_ ``_satisfies_pzi``. - """ - class Status(proto.Enum): - r"""The current status of the cluster. - - Values: - STATUS_UNSPECIFIED (0): - Not set. - PROVISIONING (1): - The PROVISIONING state indicates the cluster - is being created. - RUNNING (2): - The RUNNING state indicates the cluster has - been created and is fully usable. - RECONCILING (3): - The RECONCILING state indicates that some work is actively - being done on the cluster, such as upgrading the master or - node software. Details can be found in the ``statusMessage`` - field. - STOPPING (4): - The STOPPING state indicates the cluster is - being deleted. - ERROR (5): - The ERROR state indicates the cluster may be unusable. - Details can be found in the ``statusMessage`` field. - DEGRADED (6): - The DEGRADED state indicates the cluster requires user - action to restore full functionality. Details can be found - in the ``statusMessage`` field. - """ - STATUS_UNSPECIFIED = 0 - PROVISIONING = 1 - RUNNING = 2 - RECONCILING = 3 - STOPPING = 4 - ERROR = 5 - DEGRADED = 6 - - name: str = proto.Field( - proto.STRING, - number=1, - ) - description: str = proto.Field( - proto.STRING, - number=2, - ) - initial_node_count: int = proto.Field( - proto.INT32, - number=3, - ) - node_config: 'NodeConfig' = proto.Field( - proto.MESSAGE, - number=4, - message='NodeConfig', - ) - master_auth: 'MasterAuth' = proto.Field( - proto.MESSAGE, - number=5, - message='MasterAuth', - ) - logging_service: str = proto.Field( - proto.STRING, - number=6, - ) - monitoring_service: str = proto.Field( - proto.STRING, - number=7, - ) - network: str = proto.Field( - proto.STRING, - number=8, - ) - cluster_ipv4_cidr: str = proto.Field( - proto.STRING, - number=9, - ) - addons_config: 'AddonsConfig' = proto.Field( - proto.MESSAGE, - number=10, - message='AddonsConfig', - ) - subnetwork: str = proto.Field( - proto.STRING, - number=11, - ) - node_pools: MutableSequence['NodePool'] = proto.RepeatedField( - proto.MESSAGE, - number=12, - message='NodePool', - ) - locations: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=13, - ) - enable_kubernetes_alpha: bool = proto.Field( - proto.BOOL, - number=14, - ) - enable_k8s_beta_apis: 'K8sBetaAPIConfig' = proto.Field( - proto.MESSAGE, - number=143, - message='K8sBetaAPIConfig', - ) - resource_labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=15, - ) - label_fingerprint: str = proto.Field( - proto.STRING, - number=16, - ) - legacy_abac: 'LegacyAbac' = proto.Field( - proto.MESSAGE, - number=18, - message='LegacyAbac', - ) - network_policy: 'NetworkPolicy' = proto.Field( - proto.MESSAGE, - number=19, - message='NetworkPolicy', - ) - ip_allocation_policy: 'IPAllocationPolicy' = proto.Field( - proto.MESSAGE, - number=20, - message='IPAllocationPolicy', - ) - master_authorized_networks_config: 'MasterAuthorizedNetworksConfig' = proto.Field( - proto.MESSAGE, - number=22, - message='MasterAuthorizedNetworksConfig', - ) - maintenance_policy: 'MaintenancePolicy' = proto.Field( - proto.MESSAGE, - number=23, - message='MaintenancePolicy', - ) - binary_authorization: 'BinaryAuthorization' = proto.Field( - proto.MESSAGE, - number=24, - message='BinaryAuthorization', - ) - pod_security_policy_config: 'PodSecurityPolicyConfig' = proto.Field( - proto.MESSAGE, - number=25, - message='PodSecurityPolicyConfig', - ) - autoscaling: 'ClusterAutoscaling' = proto.Field( - proto.MESSAGE, - number=26, - message='ClusterAutoscaling', - ) - network_config: 'NetworkConfig' = proto.Field( - proto.MESSAGE, - number=27, - message='NetworkConfig', - ) - private_cluster: bool = proto.Field( - proto.BOOL, - number=28, - ) - master_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=29, - ) - default_max_pods_constraint: 'MaxPodsConstraint' = proto.Field( - proto.MESSAGE, - number=30, - message='MaxPodsConstraint', - ) - resource_usage_export_config: 'ResourceUsageExportConfig' = proto.Field( - proto.MESSAGE, - number=33, - message='ResourceUsageExportConfig', - ) - authenticator_groups_config: 'AuthenticatorGroupsConfig' = proto.Field( - proto.MESSAGE, - number=34, - message='AuthenticatorGroupsConfig', - ) - private_cluster_config: 'PrivateClusterConfig' = proto.Field( - proto.MESSAGE, - number=37, - message='PrivateClusterConfig', - ) - vertical_pod_autoscaling: 'VerticalPodAutoscaling' = proto.Field( - proto.MESSAGE, - number=39, - message='VerticalPodAutoscaling', - ) - shielded_nodes: 'ShieldedNodes' = proto.Field( - proto.MESSAGE, - number=40, - message='ShieldedNodes', - ) - release_channel: 'ReleaseChannel' = proto.Field( - proto.MESSAGE, - number=41, - message='ReleaseChannel', - ) - workload_identity_config: 'WorkloadIdentityConfig' = proto.Field( - proto.MESSAGE, - number=43, - message='WorkloadIdentityConfig', - ) - workload_certificates: 'WorkloadCertificates' = proto.Field( - proto.MESSAGE, - number=52, - message='WorkloadCertificates', - ) - mesh_certificates: 'MeshCertificates' = proto.Field( - proto.MESSAGE, - number=67, - message='MeshCertificates', - ) - workload_alts_config: 'WorkloadALTSConfig' = proto.Field( - proto.MESSAGE, - number=53, - message='WorkloadALTSConfig', - ) - cost_management_config: 'CostManagementConfig' = proto.Field( - proto.MESSAGE, - number=45, - message='CostManagementConfig', - ) - cluster_telemetry: 'ClusterTelemetry' = proto.Field( - proto.MESSAGE, - number=46, - message='ClusterTelemetry', - ) - tpu_config: 'TpuConfig' = proto.Field( - proto.MESSAGE, - number=47, - message='TpuConfig', - ) - notification_config: 'NotificationConfig' = proto.Field( - proto.MESSAGE, - number=49, - message='NotificationConfig', - ) - confidential_nodes: 'ConfidentialNodes' = proto.Field( - proto.MESSAGE, - number=50, - message='ConfidentialNodes', - ) - identity_service_config: 'IdentityServiceConfig' = proto.Field( - proto.MESSAGE, - number=54, - message='IdentityServiceConfig', - ) - self_link: str = proto.Field( - proto.STRING, - number=100, - ) - zone: str = proto.Field( - proto.STRING, - number=101, - ) - endpoint: str = proto.Field( - proto.STRING, - number=102, - ) - initial_cluster_version: str = proto.Field( - proto.STRING, - number=103, - ) - current_master_version: str = proto.Field( - proto.STRING, - number=104, - ) - current_node_version: str = proto.Field( - proto.STRING, - number=105, - ) - create_time: str = proto.Field( - proto.STRING, - number=106, - ) - status: Status = proto.Field( - proto.ENUM, - number=107, - enum=Status, - ) - status_message: str = proto.Field( - proto.STRING, - number=108, - ) - node_ipv4_cidr_size: int = proto.Field( - proto.INT32, - number=109, - ) - services_ipv4_cidr: str = proto.Field( - proto.STRING, - number=110, - ) - instance_group_urls: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=111, - ) - current_node_count: int = proto.Field( - proto.INT32, - number=112, - ) - expire_time: str = proto.Field( - proto.STRING, - number=113, - ) - location: str = proto.Field( - proto.STRING, - number=114, - ) - enable_tpu: bool = proto.Field( - proto.BOOL, - number=115, - ) - tpu_ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=116, - ) - database_encryption: 'DatabaseEncryption' = proto.Field( - proto.MESSAGE, - number=38, - message='DatabaseEncryption', - ) - conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( - proto.MESSAGE, - number=118, - message='StatusCondition', - ) - master: 'Master' = proto.Field( - proto.MESSAGE, - number=124, - message='Master', - ) - autopilot: 'Autopilot' = proto.Field( - proto.MESSAGE, - number=128, - message='Autopilot', - ) - id: str = proto.Field( - proto.STRING, - number=129, - ) - node_pool_defaults: 'NodePoolDefaults' = proto.Field( - proto.MESSAGE, - number=131, - optional=True, - message='NodePoolDefaults', - ) - logging_config: 'LoggingConfig' = proto.Field( - proto.MESSAGE, - number=132, - message='LoggingConfig', - ) - monitoring_config: 'MonitoringConfig' = proto.Field( - proto.MESSAGE, - number=133, - message='MonitoringConfig', - ) - node_pool_auto_config: 'NodePoolAutoConfig' = proto.Field( - proto.MESSAGE, - number=136, - message='NodePoolAutoConfig', - ) - protect_config: 'ProtectConfig' = proto.Field( - proto.MESSAGE, - number=137, - optional=True, - message='ProtectConfig', - ) - etag: str = proto.Field( - proto.STRING, - number=139, - ) - fleet: 'Fleet' = proto.Field( - proto.MESSAGE, - number=140, - message='Fleet', - ) - security_posture_config: 'SecurityPostureConfig' = proto.Field( - proto.MESSAGE, - number=145, - message='SecurityPostureConfig', - ) - enterprise_config: 'EnterpriseConfig' = proto.Field( - proto.MESSAGE, - number=149, - message='EnterpriseConfig', - ) - secret_manager_config: 'SecretManagerConfig' = proto.Field( - proto.MESSAGE, - number=150, - message='SecretManagerConfig', - ) - compliance_posture_config: 'CompliancePostureConfig' = proto.Field( - proto.MESSAGE, - number=151, - message='CompliancePostureConfig', - ) - satisfies_pzs: bool = proto.Field( - proto.BOOL, - number=152, - optional=True, - ) - satisfies_pzi: bool = proto.Field( - proto.BOOL, - number=153, - optional=True, - ) - - -class CompliancePostureConfig(proto.Message): - r"""CompliancePostureConfig defines the settings needed to - enable/disable features for the Compliance Posture. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - mode (google.cloud.container_v1beta1.types.CompliancePostureConfig.Mode): - Defines the enablement mode for Compliance - Posture. - - This field is a member of `oneof`_ ``_mode``. - compliance_standards (MutableSequence[google.cloud.container_v1beta1.types.CompliancePostureConfig.ComplianceStandard]): - List of enabled compliance standards. - """ - class Mode(proto.Enum): - r"""Mode defines enablement mode for Compliance Posture. - - Values: - MODE_UNSPECIFIED (0): - Default value not specified. - DISABLED (1): - Disables Compliance Posture features on the - cluster. - ENABLED (2): - Enables Compliance Posture features on the - cluster. - """ - MODE_UNSPECIFIED = 0 - DISABLED = 1 - ENABLED = 2 - - class ComplianceStandard(proto.Message): - r"""Defines the details of a compliance standard. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - standard (str): - Name of the compliance standard. - - This field is a member of `oneof`_ ``_standard``. - """ - - standard: str = proto.Field( - proto.STRING, - number=1, - optional=True, - ) - - mode: Mode = proto.Field( - proto.ENUM, - number=1, - optional=True, - enum=Mode, - ) - compliance_standards: MutableSequence[ComplianceStandard] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message=ComplianceStandard, - ) - - -class K8sBetaAPIConfig(proto.Message): - r"""Kubernetes open source beta apis enabled on the cluster. - - Attributes: - enabled_apis (MutableSequence[str]): - api name, e.g. - storage.k8s.io/v1beta1/csistoragecapacities. - """ - - enabled_apis: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - - -class WorkloadConfig(proto.Message): - r"""WorkloadConfig defines the flags to enable or disable the - workload configurations for the cluster. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - audit_mode (google.cloud.container_v1beta1.types.WorkloadConfig.Mode): - Sets which mode of auditing should be used - for the cluster's workloads. - - This field is a member of `oneof`_ ``_audit_mode``. - """ - class Mode(proto.Enum): - r"""Mode defines how to audit the workload configs. - - Values: - MODE_UNSPECIFIED (0): - Default value meaning that no mode has been - specified. - DISABLED (1): - This disables Workload Configuration auditing - on the cluster, meaning that nothing is - surfaced. - BASIC (4): - Applies the default set of policy auditing to - a cluster's workloads. - BASELINE (2): - Surfaces configurations that are not in line - with the Pod Security Standard Baseline policy. - RESTRICTED (3): - Surfaces configurations that are not in line - with the Pod Security Standard Restricted - policy. - """ - MODE_UNSPECIFIED = 0 - DISABLED = 1 - BASIC = 4 - BASELINE = 2 - RESTRICTED = 3 - - audit_mode: Mode = proto.Field( - proto.ENUM, - number=1, - optional=True, - enum=Mode, - ) - - -class ProtectConfig(proto.Message): - r"""ProtectConfig defines the flags needed to enable/disable - features for the Protect API. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - workload_config (google.cloud.container_v1beta1.types.WorkloadConfig): - WorkloadConfig defines which actions are - enabled for a cluster's workload configurations. - - This field is a member of `oneof`_ ``_workload_config``. - workload_vulnerability_mode (google.cloud.container_v1beta1.types.ProtectConfig.WorkloadVulnerabilityMode): - Sets which mode to use for Protect workload - vulnerability scanning feature. - - This field is a member of `oneof`_ ``_workload_vulnerability_mode``. - """ - class WorkloadVulnerabilityMode(proto.Enum): - r"""WorkloadVulnerabilityMode defines mode to perform - vulnerability scanning. - - Values: - WORKLOAD_VULNERABILITY_MODE_UNSPECIFIED (0): - Default value not specified. - DISABLED (1): - Disables Workload Vulnerability Scanning - feature on the cluster. - BASIC (2): - Applies basic vulnerability scanning settings - for cluster workloads. - """ - WORKLOAD_VULNERABILITY_MODE_UNSPECIFIED = 0 - DISABLED = 1 - BASIC = 2 - - workload_config: 'WorkloadConfig' = proto.Field( - proto.MESSAGE, - number=1, - optional=True, - message='WorkloadConfig', - ) - workload_vulnerability_mode: WorkloadVulnerabilityMode = proto.Field( - proto.ENUM, - number=2, - optional=True, - enum=WorkloadVulnerabilityMode, - ) - - -class SecurityPostureConfig(proto.Message): - r"""SecurityPostureConfig defines the flags needed to - enable/disable features for the Security Posture API. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - mode (google.cloud.container_v1beta1.types.SecurityPostureConfig.Mode): - Sets which mode to use for Security Posture - features. - - This field is a member of `oneof`_ ``_mode``. - vulnerability_mode (google.cloud.container_v1beta1.types.SecurityPostureConfig.VulnerabilityMode): - Sets which mode to use for vulnerability - scanning. - - This field is a member of `oneof`_ ``_vulnerability_mode``. - """ - class Mode(proto.Enum): - r"""Mode defines enablement mode for GKE Security posture - features. - - Values: - MODE_UNSPECIFIED (0): - Default value not specified. - DISABLED (1): - Disables Security Posture features on the - cluster. - BASIC (2): - Applies Security Posture features on the - cluster. - ENTERPRISE (3): - Applies the Security Posture off cluster - Enterprise level features. - """ - MODE_UNSPECIFIED = 0 - DISABLED = 1 - BASIC = 2 - ENTERPRISE = 3 - - class VulnerabilityMode(proto.Enum): - r"""VulnerabilityMode defines enablement mode for vulnerability - scanning. - - Values: - VULNERABILITY_MODE_UNSPECIFIED (0): - Default value not specified. - VULNERABILITY_DISABLED (1): - Disables vulnerability scanning on the - cluster. - VULNERABILITY_BASIC (2): - Applies basic vulnerability scanning on the - cluster. - VULNERABILITY_ENTERPRISE (3): - Applies the Security Posture's vulnerability - on cluster Enterprise level features. - """ - VULNERABILITY_MODE_UNSPECIFIED = 0 - VULNERABILITY_DISABLED = 1 - VULNERABILITY_BASIC = 2 - VULNERABILITY_ENTERPRISE = 3 - - mode: Mode = proto.Field( - proto.ENUM, - number=1, - optional=True, - enum=Mode, - ) - vulnerability_mode: VulnerabilityMode = proto.Field( - proto.ENUM, - number=2, - optional=True, - enum=VulnerabilityMode, - ) - - -class NodePoolDefaults(proto.Message): - r"""Subset of Nodepool message that has defaults. - - Attributes: - node_config_defaults (google.cloud.container_v1beta1.types.NodeConfigDefaults): - Subset of NodeConfig message that has - defaults. - """ - - node_config_defaults: 'NodeConfigDefaults' = proto.Field( - proto.MESSAGE, - number=1, - message='NodeConfigDefaults', - ) - - -class NodeConfigDefaults(proto.Message): - r"""Subset of NodeConfig message that has defaults. - - Attributes: - gcfs_config (google.cloud.container_v1beta1.types.GcfsConfig): - GCFS (Google Container File System, also - known as Riptide) options. - logging_config (google.cloud.container_v1beta1.types.NodePoolLoggingConfig): - Logging configuration for node pools. - containerd_config (google.cloud.container_v1beta1.types.ContainerdConfig): - Parameters for containerd customization. - host_maintenance_policy (google.cloud.container_v1beta1.types.HostMaintenancePolicy): - HostMaintenancePolicy contains the desired - maintenance policy for the Google Compute Engine - hosts. - node_kubelet_config (google.cloud.container_v1beta1.types.NodeKubeletConfig): - NodeKubeletConfig controls the defaults for new node-pools. - - Currently only ``insecure_kubelet_readonly_port_enabled`` - can be set here. - """ - - gcfs_config: 'GcfsConfig' = proto.Field( - proto.MESSAGE, - number=1, - message='GcfsConfig', - ) - logging_config: 'NodePoolLoggingConfig' = proto.Field( - proto.MESSAGE, - number=3, - message='NodePoolLoggingConfig', - ) - containerd_config: 'ContainerdConfig' = proto.Field( - proto.MESSAGE, - number=4, - message='ContainerdConfig', - ) - host_maintenance_policy: 'HostMaintenancePolicy' = proto.Field( - proto.MESSAGE, - number=5, - message='HostMaintenancePolicy', - ) - node_kubelet_config: 'NodeKubeletConfig' = proto.Field( - proto.MESSAGE, - number=6, - message='NodeKubeletConfig', - ) - - -class NodePoolAutoConfig(proto.Message): - r"""node pool configs that apply to all auto-provisioned node - pools in autopilot clusters and node auto-provisioning enabled - clusters - - Attributes: - network_tags (google.cloud.container_v1beta1.types.NetworkTags): - The list of instance tags applied to all - nodes. Tags are used to identify valid sources - or targets for network firewalls and are - specified by the client during cluster creation. - Each tag within the list must comply with - RFC1035. - resource_manager_tags (google.cloud.container_v1beta1.types.ResourceManagerTags): - Resource manager tag keys and values to be - attached to the nodes for managing Compute - Engine firewalls using Network Firewall - Policies. - node_kubelet_config (google.cloud.container_v1beta1.types.NodeKubeletConfig): - NodeKubeletConfig controls the defaults for autoprovisioned - node-pools. - - Currently only ``insecure_kubelet_readonly_port_enabled`` - can be set here. - """ - - network_tags: 'NetworkTags' = proto.Field( - proto.MESSAGE, - number=1, - message='NetworkTags', - ) - resource_manager_tags: 'ResourceManagerTags' = proto.Field( - proto.MESSAGE, - number=2, - message='ResourceManagerTags', - ) - node_kubelet_config: 'NodeKubeletConfig' = proto.Field( - proto.MESSAGE, - number=3, - message='NodeKubeletConfig', - ) - - -class ClusterUpdate(proto.Message): - r"""ClusterUpdate describes an update to the cluster. Exactly one - update can be applied to a cluster with each request, so at most - one field can be provided. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - desired_node_version (str): - The Kubernetes version to change the nodes to - (typically an upgrade). - - Users may specify either explicit versions - offered by Kubernetes Engine or version aliases, - which have the following behavior: - - - "latest": picks the highest valid Kubernetes - version - - "1.X": picks the highest valid patch+gke.N - patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N patch - in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit Kubernetes - version - - "-": picks the Kubernetes master version - desired_monitoring_service (str): - The monitoring service the cluster should use to write - metrics. Currently available options: - - - "monitoring.googleapis.com/kubernetes" - The Cloud - Monitoring service with a Kubernetes-native resource - model - - ``monitoring.googleapis.com`` - The legacy Cloud - Monitoring service (no longer available as of GKE 1.15). - - ``none`` - No metrics will be exported from the cluster. - - If left as an empty - string,\ ``monitoring.googleapis.com/kubernetes`` will be - used for GKE 1.14+ or ``monitoring.googleapis.com`` for - earlier versions. - desired_addons_config (google.cloud.container_v1beta1.types.AddonsConfig): - Configurations for the various addons - available to run in the cluster. - desired_node_pool_id (str): - The node pool to be upgraded. This field is mandatory if - "desired_node_version", "desired_image_family", - "desired_node_pool_autoscaling", or - "desired_workload_metadata_config" is specified and there is - more than one node pool on the cluster. - desired_image_type (str): - The desired image type for the node pool. NOTE: Set the - "desired_node_pool" field as well. - desired_node_pool_autoscaling (google.cloud.container_v1beta1.types.NodePoolAutoscaling): - Autoscaler configuration for the node pool specified in - desired_node_pool_id. If there is only one pool in the - cluster and desired_node_pool_id is not provided then the - change applies to that single node pool. - desired_locations (MutableSequence[str]): - The desired list of Google Compute Engine - `zones `__ - in which the cluster's nodes should be located. - - This list must always include the cluster's primary zone. - - Warning: changing cluster locations will update the - locations of all node pools and will result in nodes being - added and/or removed. - desired_master_authorized_networks_config (google.cloud.container_v1beta1.types.MasterAuthorizedNetworksConfig): - The desired configuration options for master - authorized networks feature. - desired_pod_security_policy_config (google.cloud.container_v1beta1.types.PodSecurityPolicyConfig): - The desired configuration options for the - PodSecurityPolicy feature. - desired_cluster_autoscaling (google.cloud.container_v1beta1.types.ClusterAutoscaling): - Cluster-level autoscaling configuration. - desired_binary_authorization (google.cloud.container_v1beta1.types.BinaryAuthorization): - The desired configuration options for the - Binary Authorization feature. - desired_logging_service (str): - The logging service the cluster should use to write logs. - Currently available options: - - - ``logging.googleapis.com/kubernetes`` - The Cloud Logging - service with a Kubernetes-native resource model - - ``logging.googleapis.com`` - The legacy Cloud Logging - service (no longer available as of GKE 1.15). - - ``none`` - no logs will be exported from the cluster. - - If left as an empty - string,\ ``logging.googleapis.com/kubernetes`` will be used - for GKE 1.14+ or ``logging.googleapis.com`` for earlier - versions. - desired_resource_usage_export_config (google.cloud.container_v1beta1.types.ResourceUsageExportConfig): - The desired configuration for exporting - resource usage. - desired_vertical_pod_autoscaling (google.cloud.container_v1beta1.types.VerticalPodAutoscaling): - Cluster-level Vertical Pod Autoscaling - configuration. - desired_private_cluster_config (google.cloud.container_v1beta1.types.PrivateClusterConfig): - The desired private cluster configuration. - master_global_access_config is the only field that can be - changed via this field. See also - [ClusterUpdate.desired_enable_private_endpoint][google.container.v1beta1.ClusterUpdate.desired_enable_private_endpoint] - for modifying other fields within - [PrivateClusterConfig][google.container.v1beta1.PrivateClusterConfig]. - desired_intra_node_visibility_config (google.cloud.container_v1beta1.types.IntraNodeVisibilityConfig): - The desired config of Intra-node visibility. - desired_default_snat_status (google.cloud.container_v1beta1.types.DefaultSnatStatus): - The desired status of whether to disable - default sNAT for this cluster. - desired_cluster_telemetry (google.cloud.container_v1beta1.types.ClusterTelemetry): - The desired telemetry integration for the - cluster. - desired_release_channel (google.cloud.container_v1beta1.types.ReleaseChannel): - The desired release channel configuration. - private_cluster_config (google.cloud.container_v1beta1.types.PrivateClusterConfig): - The desired private cluster configuration. Has no effect. - Use - [desired_private_cluster_config][google.container.v1beta1.ClusterUpdate.desired_private_cluster_config] - instead. - desired_tpu_config (google.cloud.container_v1beta1.types.TpuConfig): - The desired Cloud TPU configuration. - desired_l4ilb_subsetting_config (google.cloud.container_v1beta1.types.ILBSubsettingConfig): - The desired L4 Internal Load Balancer - Subsetting configuration. - desired_datapath_provider (google.cloud.container_v1beta1.types.DatapathProvider): - The desired datapath provider for the - cluster. - desired_private_ipv6_google_access (google.cloud.container_v1beta1.types.PrivateIPv6GoogleAccess): - The desired state of IPv6 connectivity to - Google Services. - desired_notification_config (google.cloud.container_v1beta1.types.NotificationConfig): - The desired notification configuration. - desired_master_version (str): - The Kubernetes version to change the master - to. The only valid value is the latest supported - version. - - Users may specify either explicit versions - offered by Kubernetes Engine or version aliases, - which have the following behavior: - - - "latest": picks the highest valid Kubernetes - version - - "1.X": picks the highest valid patch+gke.N - patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N patch - in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit Kubernetes - version - - "-": picks the default Kubernetes version - desired_gcfs_config (google.cloud.container_v1beta1.types.GcfsConfig): - The desired GCFS config for the cluster. - desired_database_encryption (google.cloud.container_v1beta1.types.DatabaseEncryption): - Configuration of etcd encryption. - desired_workload_identity_config (google.cloud.container_v1beta1.types.WorkloadIdentityConfig): - Configuration for Workload Identity. - desired_workload_certificates (google.cloud.container_v1beta1.types.WorkloadCertificates): - Configuration for issuance of mTLS keys and - certificates to Kubernetes pods. - desired_mesh_certificates (google.cloud.container_v1beta1.types.MeshCertificates): - Configuration for issuance of mTLS keys and - certificates to Kubernetes pods. - desired_workload_alts_config (google.cloud.container_v1beta1.types.WorkloadALTSConfig): - Configuration for direct-path (via ALTS) with - workload identity. - desired_shielded_nodes (google.cloud.container_v1beta1.types.ShieldedNodes): - Configuration for Shielded Nodes. - desired_cost_management_config (google.cloud.container_v1beta1.types.CostManagementConfig): - The desired configuration for the - fine-grained cost management feature. - desired_master (google.cloud.container_v1beta1.types.Master): - Configuration for master components. - desired_dns_config (google.cloud.container_v1beta1.types.DNSConfig): - DNSConfig contains clusterDNS config for this - cluster. - desired_service_external_ips_config (google.cloud.container_v1beta1.types.ServiceExternalIPsConfig): - ServiceExternalIPsConfig specifies the config - for the use of Services with ExternalIPs field. - desired_authenticator_groups_config (google.cloud.container_v1beta1.types.AuthenticatorGroupsConfig): - AuthenticatorGroupsConfig specifies the - config for the cluster security groups settings. - desired_logging_config (google.cloud.container_v1beta1.types.LoggingConfig): - The desired logging configuration. - desired_monitoring_config (google.cloud.container_v1beta1.types.MonitoringConfig): - The desired monitoring configuration. - desired_identity_service_config (google.cloud.container_v1beta1.types.IdentityServiceConfig): - The desired Identity Service component - configuration. - desired_enable_private_endpoint (bool): - Enable/Disable private endpoint for the - cluster's master. - - This field is a member of `oneof`_ ``_desired_enable_private_endpoint``. - desired_node_pool_auto_config_network_tags (google.cloud.container_v1beta1.types.NetworkTags): - The desired network tags that apply to all - auto-provisioned node pools in autopilot - clusters and node auto-provisioning enabled - clusters. - desired_protect_config (google.cloud.container_v1beta1.types.ProtectConfig): - Deprecated: Use DesiredSecurityPostureConfig - instead. Enable/Disable Protect API features for - the cluster. - - This field is a member of `oneof`_ ``_desired_protect_config``. - desired_gateway_api_config (google.cloud.container_v1beta1.types.GatewayAPIConfig): - The desired config of Gateway API on this - cluster. - etag (str): - The current etag of the cluster. - If an etag is provided and does not match the - current etag of the cluster, update will be - blocked and an ABORTED error will be returned. - desired_node_pool_logging_config (google.cloud.container_v1beta1.types.NodePoolLoggingConfig): - The desired node pool logging configuration - defaults for the cluster. - desired_fleet (google.cloud.container_v1beta1.types.Fleet): - The desired fleet configuration for the - cluster. - desired_stack_type (google.cloud.container_v1beta1.types.StackType): - The desired stack type of the cluster. - If a stack type is provided and does not match - the current stack type of the cluster, update - will attempt to change the stack type to the new - type. - additional_pod_ranges_config (google.cloud.container_v1beta1.types.AdditionalPodRangesConfig): - The additional pod ranges to be added to the - cluster. These pod ranges can be used by node - pools to allocate pod IPs. - removed_additional_pod_ranges_config (google.cloud.container_v1beta1.types.AdditionalPodRangesConfig): - The additional pod ranges that are to be removed from the - cluster. The pod ranges specified here must have been - specified earlier in the 'additional_pod_ranges_config' - argument. - enable_k8s_beta_apis (google.cloud.container_v1beta1.types.K8sBetaAPIConfig): - Kubernetes open source beta apis enabled on - the cluster. Only beta apis - desired_security_posture_config (google.cloud.container_v1beta1.types.SecurityPostureConfig): - Enable/Disable Security Posture API features - for the cluster. - desired_network_performance_config (google.cloud.container_v1beta1.types.NetworkConfig.ClusterNetworkPerformanceConfig): - The desired network performance config. - desired_enable_fqdn_network_policy (bool): - Enable/Disable FQDN Network Policy for the - cluster. - - This field is a member of `oneof`_ ``_desired_enable_fqdn_network_policy``. - desired_autopilot_workload_policy_config (google.cloud.container_v1beta1.types.WorkloadPolicyConfig): - The desired workload policy configuration for - the autopilot cluster. - desired_k8s_beta_apis (google.cloud.container_v1beta1.types.K8sBetaAPIConfig): - Beta APIs enabled for cluster. - desired_host_maintenance_policy (google.cloud.container_v1beta1.types.HostMaintenancePolicy): - HostMaintenancePolicy contains the desired - maintenance policy for the Google Compute Engine - hosts. - desired_containerd_config (google.cloud.container_v1beta1.types.ContainerdConfig): - The desired containerd config for the - cluster. - desired_enable_multi_networking (bool): - Enable/Disable Multi-Networking for the - cluster - - This field is a member of `oneof`_ ``_desired_enable_multi_networking``. - desired_node_pool_auto_config_resource_manager_tags (google.cloud.container_v1beta1.types.ResourceManagerTags): - The desired resource manager tags that apply - to all auto-provisioned node pools in autopilot - clusters and node auto-provisioning enabled - clusters. - desired_in_transit_encryption_config (google.cloud.container_v1beta1.types.InTransitEncryptionConfig): - Specify the details of in-transit encryption. - Now named inter-node transparent encryption. - - This field is a member of `oneof`_ ``_desired_in_transit_encryption_config``. - desired_enable_cilium_clusterwide_network_policy (bool): - Enable/Disable Cilium Clusterwide Network - Policy for the cluster. - - This field is a member of `oneof`_ ``_desired_enable_cilium_clusterwide_network_policy``. - desired_secret_manager_config (google.cloud.container_v1beta1.types.SecretManagerConfig): - Enable/Disable Secret Manager Config. - - This field is a member of `oneof`_ ``_desired_secret_manager_config``. - desired_node_kubelet_config (google.cloud.container_v1beta1.types.NodeKubeletConfig): - The desired node kubelet config for the - cluster. - desired_node_pool_auto_config_kubelet_config (google.cloud.container_v1beta1.types.NodeKubeletConfig): - The desired node kubelet config for all - auto-provisioned node pools in autopilot - clusters and node auto-provisioning enabled - clusters. - """ - - desired_node_version: str = proto.Field( - proto.STRING, - number=4, - ) - desired_monitoring_service: str = proto.Field( - proto.STRING, - number=5, - ) - desired_addons_config: 'AddonsConfig' = proto.Field( - proto.MESSAGE, - number=6, - message='AddonsConfig', - ) - desired_node_pool_id: str = proto.Field( - proto.STRING, - number=7, - ) - desired_image_type: str = proto.Field( - proto.STRING, - number=8, - ) - desired_node_pool_autoscaling: 'NodePoolAutoscaling' = proto.Field( - proto.MESSAGE, - number=9, - message='NodePoolAutoscaling', - ) - desired_locations: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=10, - ) - desired_master_authorized_networks_config: 'MasterAuthorizedNetworksConfig' = proto.Field( - proto.MESSAGE, - number=12, - message='MasterAuthorizedNetworksConfig', - ) - desired_pod_security_policy_config: 'PodSecurityPolicyConfig' = proto.Field( - proto.MESSAGE, - number=14, - message='PodSecurityPolicyConfig', - ) - desired_cluster_autoscaling: 'ClusterAutoscaling' = proto.Field( - proto.MESSAGE, - number=15, - message='ClusterAutoscaling', - ) - desired_binary_authorization: 'BinaryAuthorization' = proto.Field( - proto.MESSAGE, - number=16, - message='BinaryAuthorization', - ) - desired_logging_service: str = proto.Field( - proto.STRING, - number=19, - ) - desired_resource_usage_export_config: 'ResourceUsageExportConfig' = proto.Field( - proto.MESSAGE, - number=21, - message='ResourceUsageExportConfig', - ) - desired_vertical_pod_autoscaling: 'VerticalPodAutoscaling' = proto.Field( - proto.MESSAGE, - number=22, - message='VerticalPodAutoscaling', - ) - desired_private_cluster_config: 'PrivateClusterConfig' = proto.Field( - proto.MESSAGE, - number=25, - message='PrivateClusterConfig', - ) - desired_intra_node_visibility_config: 'IntraNodeVisibilityConfig' = proto.Field( - proto.MESSAGE, - number=26, - message='IntraNodeVisibilityConfig', - ) - desired_default_snat_status: 'DefaultSnatStatus' = proto.Field( - proto.MESSAGE, - number=28, - message='DefaultSnatStatus', - ) - desired_cluster_telemetry: 'ClusterTelemetry' = proto.Field( - proto.MESSAGE, - number=30, - message='ClusterTelemetry', - ) - desired_release_channel: 'ReleaseChannel' = proto.Field( - proto.MESSAGE, - number=31, - message='ReleaseChannel', - ) - private_cluster_config: 'PrivateClusterConfig' = proto.Field( - proto.MESSAGE, - number=37, - message='PrivateClusterConfig', - ) - desired_tpu_config: 'TpuConfig' = proto.Field( - proto.MESSAGE, - number=38, - message='TpuConfig', - ) - desired_l4ilb_subsetting_config: 'ILBSubsettingConfig' = proto.Field( - proto.MESSAGE, - number=39, - message='ILBSubsettingConfig', - ) - desired_datapath_provider: 'DatapathProvider' = proto.Field( - proto.ENUM, - number=50, - enum='DatapathProvider', - ) - desired_private_ipv6_google_access: 'PrivateIPv6GoogleAccess' = proto.Field( - proto.ENUM, - number=51, - enum='PrivateIPv6GoogleAccess', - ) - desired_notification_config: 'NotificationConfig' = proto.Field( - proto.MESSAGE, - number=55, - message='NotificationConfig', - ) - desired_master_version: str = proto.Field( - proto.STRING, - number=100, - ) - desired_gcfs_config: 'GcfsConfig' = proto.Field( - proto.MESSAGE, - number=109, - message='GcfsConfig', - ) - desired_database_encryption: 'DatabaseEncryption' = proto.Field( - proto.MESSAGE, - number=46, - message='DatabaseEncryption', - ) - desired_workload_identity_config: 'WorkloadIdentityConfig' = proto.Field( - proto.MESSAGE, - number=47, - message='WorkloadIdentityConfig', - ) - desired_workload_certificates: 'WorkloadCertificates' = proto.Field( - proto.MESSAGE, - number=61, - message='WorkloadCertificates', - ) - desired_mesh_certificates: 'MeshCertificates' = proto.Field( - proto.MESSAGE, - number=67, - message='MeshCertificates', - ) - desired_workload_alts_config: 'WorkloadALTSConfig' = proto.Field( - proto.MESSAGE, - number=62, - message='WorkloadALTSConfig', - ) - desired_shielded_nodes: 'ShieldedNodes' = proto.Field( - proto.MESSAGE, - number=48, - message='ShieldedNodes', - ) - desired_cost_management_config: 'CostManagementConfig' = proto.Field( - proto.MESSAGE, - number=49, - message='CostManagementConfig', - ) - desired_master: 'Master' = proto.Field( - proto.MESSAGE, - number=52, - message='Master', - ) - desired_dns_config: 'DNSConfig' = proto.Field( - proto.MESSAGE, - number=53, - message='DNSConfig', - ) - desired_service_external_ips_config: 'ServiceExternalIPsConfig' = proto.Field( - proto.MESSAGE, - number=60, - message='ServiceExternalIPsConfig', - ) - desired_authenticator_groups_config: 'AuthenticatorGroupsConfig' = proto.Field( - proto.MESSAGE, - number=63, - message='AuthenticatorGroupsConfig', - ) - desired_logging_config: 'LoggingConfig' = proto.Field( - proto.MESSAGE, - number=64, - message='LoggingConfig', - ) - desired_monitoring_config: 'MonitoringConfig' = proto.Field( - proto.MESSAGE, - number=65, - message='MonitoringConfig', - ) - desired_identity_service_config: 'IdentityServiceConfig' = proto.Field( - proto.MESSAGE, - number=66, - message='IdentityServiceConfig', - ) - desired_enable_private_endpoint: bool = proto.Field( - proto.BOOL, - number=71, - optional=True, - ) - desired_node_pool_auto_config_network_tags: 'NetworkTags' = proto.Field( - proto.MESSAGE, - number=110, - message='NetworkTags', - ) - desired_protect_config: 'ProtectConfig' = proto.Field( - proto.MESSAGE, - number=112, - optional=True, - message='ProtectConfig', - ) - desired_gateway_api_config: 'GatewayAPIConfig' = proto.Field( - proto.MESSAGE, - number=114, - message='GatewayAPIConfig', - ) - etag: str = proto.Field( - proto.STRING, - number=115, - ) - desired_node_pool_logging_config: 'NodePoolLoggingConfig' = proto.Field( - proto.MESSAGE, - number=116, - message='NodePoolLoggingConfig', - ) - desired_fleet: 'Fleet' = proto.Field( - proto.MESSAGE, - number=117, - message='Fleet', - ) - desired_stack_type: 'StackType' = proto.Field( - proto.ENUM, - number=119, - enum='StackType', - ) - additional_pod_ranges_config: 'AdditionalPodRangesConfig' = proto.Field( - proto.MESSAGE, - number=120, - message='AdditionalPodRangesConfig', - ) - removed_additional_pod_ranges_config: 'AdditionalPodRangesConfig' = proto.Field( - proto.MESSAGE, - number=121, - message='AdditionalPodRangesConfig', - ) - enable_k8s_beta_apis: 'K8sBetaAPIConfig' = proto.Field( - proto.MESSAGE, - number=122, - message='K8sBetaAPIConfig', - ) - desired_security_posture_config: 'SecurityPostureConfig' = proto.Field( - proto.MESSAGE, - number=124, - message='SecurityPostureConfig', - ) - desired_network_performance_config: 'NetworkConfig.ClusterNetworkPerformanceConfig' = proto.Field( - proto.MESSAGE, - number=125, - message='NetworkConfig.ClusterNetworkPerformanceConfig', - ) - desired_enable_fqdn_network_policy: bool = proto.Field( - proto.BOOL, - number=126, - optional=True, - ) - desired_autopilot_workload_policy_config: 'WorkloadPolicyConfig' = proto.Field( - proto.MESSAGE, - number=128, - message='WorkloadPolicyConfig', - ) - desired_k8s_beta_apis: 'K8sBetaAPIConfig' = proto.Field( - proto.MESSAGE, - number=131, - message='K8sBetaAPIConfig', - ) - desired_host_maintenance_policy: 'HostMaintenancePolicy' = proto.Field( - proto.MESSAGE, - number=132, - message='HostMaintenancePolicy', - ) - desired_containerd_config: 'ContainerdConfig' = proto.Field( - proto.MESSAGE, - number=134, - message='ContainerdConfig', - ) - desired_enable_multi_networking: bool = proto.Field( - proto.BOOL, - number=135, - optional=True, - ) - desired_node_pool_auto_config_resource_manager_tags: 'ResourceManagerTags' = proto.Field( - proto.MESSAGE, - number=136, - message='ResourceManagerTags', - ) - desired_in_transit_encryption_config: 'InTransitEncryptionConfig' = proto.Field( - proto.ENUM, - number=137, - optional=True, - enum='InTransitEncryptionConfig', - ) - desired_enable_cilium_clusterwide_network_policy: bool = proto.Field( - proto.BOOL, - number=138, - optional=True, - ) - desired_secret_manager_config: 'SecretManagerConfig' = proto.Field( - proto.MESSAGE, - number=139, - optional=True, - message='SecretManagerConfig', - ) - desired_node_kubelet_config: 'NodeKubeletConfig' = proto.Field( - proto.MESSAGE, - number=141, - message='NodeKubeletConfig', - ) - desired_node_pool_auto_config_kubelet_config: 'NodeKubeletConfig' = proto.Field( - proto.MESSAGE, - number=142, - message='NodeKubeletConfig', - ) - - -class AdditionalPodRangesConfig(proto.Message): - r"""AdditionalPodRangesConfig is the configuration for additional - pod secondary ranges supporting the ClusterUpdate message. - - Attributes: - pod_range_names (MutableSequence[str]): - Name for pod secondary ipv4 range which has - the actual range defined ahead. - pod_range_info (MutableSequence[google.cloud.container_v1beta1.types.RangeInfo]): - Output only. Information for additional pod - range. - """ - - pod_range_names: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - pod_range_info: MutableSequence['RangeInfo'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='RangeInfo', - ) - - -class RangeInfo(proto.Message): - r"""RangeInfo contains the range name and the range utilization - by this cluster. - - Attributes: - range_name (str): - Output only. Name of a range. - utilization (float): - Output only. The utilization of the range. - """ - - range_name: str = proto.Field( - proto.STRING, - number=1, - ) - utilization: float = proto.Field( - proto.DOUBLE, - number=2, - ) - - -class Operation(proto.Message): - r"""This operation resource represents operations that may have - happened or are happening on the cluster. All fields are output - only. - - Attributes: - name (str): - Output only. The server-assigned ID for the - operation. - zone (str): - Output only. The name of the Google Compute Engine - `zone `__ - in which the operation is taking place. This field is - deprecated, use location instead. - operation_type (google.cloud.container_v1beta1.types.Operation.Type): - Output only. The operation type. - status (google.cloud.container_v1beta1.types.Operation.Status): - Output only. The current status of the - operation. - detail (str): - Output only. Detailed operation progress, if - available. - status_message (str): - Output only. If an error has occurred, a - textual description of the error. Deprecated. - Use field error instead. - self_link (str): - Output only. Server-defined URI for the operation. Example: - ``https://container.googleapis.com/v1alpha1/projects/123/locations/us-central1/operations/operation-123``. - target_link (str): - Output only. Server-defined URI for the target of the - operation. The format of this is a URI to the resource being - modified (such as a cluster, node pool, or node). For node - pool repairs, there may be multiple nodes being repaired, - but only one will be the target. - - Examples: - - - - - ``https://container.googleapis.com/v1/projects/123/locations/us-central1/clusters/my-cluster`` - - ``https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np`` - - ``https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np/node/my-node`` - location (str): - Output only. The name of the Google Compute Engine - `zone `__ - or - `region `__ - in which the cluster resides. - start_time (str): - Output only. The time the operation started, in - `RFC3339 `__ text - format. - end_time (str): - Output only. The time the operation completed, in - `RFC3339 `__ text - format. - progress (google.cloud.container_v1beta1.types.OperationProgress): - Output only. Progress information for an - operation. - cluster_conditions (MutableSequence[google.cloud.container_v1beta1.types.StatusCondition]): - Which conditions caused the current cluster - state. Deprecated. Use field error instead. - nodepool_conditions (MutableSequence[google.cloud.container_v1beta1.types.StatusCondition]): - Which conditions caused the current node pool - state. Deprecated. Use field error instead. - error (google.rpc.status_pb2.Status): - The error result of the operation in case of - failure. - """ - class Status(proto.Enum): - r"""Current status of the operation. - - Values: - STATUS_UNSPECIFIED (0): - Not set. - PENDING (1): - The operation has been created. - RUNNING (2): - The operation is currently running. - DONE (3): - The operation is done, either cancelled or - completed. - ABORTING (4): - The operation is aborting. - """ - STATUS_UNSPECIFIED = 0 - PENDING = 1 - RUNNING = 2 - DONE = 3 - ABORTING = 4 - - class Type(proto.Enum): - r"""Operation type categorizes the operation. - - Values: - TYPE_UNSPECIFIED (0): - Not set. - CREATE_CLUSTER (1): - The cluster is being created. The cluster should be assumed - to be unusable until the operation finishes. - - In the event of the operation failing, the cluster will - enter the [ERROR state][Cluster.Status.ERROR] and eventually - be deleted. - DELETE_CLUSTER (2): - The cluster is being deleted. The cluster should be assumed - to be unusable as soon as this operation starts. - - In the event of the operation failing, the cluster will - enter the [ERROR state][Cluster.Status.ERROR] and the - deletion will be automatically retried until completed. - UPGRADE_MASTER (3): - The [cluster - version][google.container.v1beta1.ClusterUpdate.desired_master_version] - is being updated. Note that this includes "upgrades" to the - same version, which are simply a recreation. This also - includes - `auto-upgrades `__. - For more details, see `documentation on cluster - upgrades `__. - UPGRADE_NODES (4): - A node pool is being updated. Despite calling this an - "upgrade", this includes most forms of updates to node - pools. This also includes - `auto-upgrades `__. - - This operation sets the - [progress][google.container.v1beta1.Operation.progress] - field and may be - [canceled][google.container.v1beta1.ClusterManager.CancelOperation]. - - The upgrade strategy depends on `node pool - configuration `__. - The nodes are generally still usable during this operation. - REPAIR_CLUSTER (5): - A problem has been detected with the control plane and is - being repaired. This operation type is initiated by GKE. For - more details, see `documentation on - repairs `__. - UPDATE_CLUSTER (6): - The cluster is being updated. This is a broad category of - operations and includes operations that only change metadata - as well as those that must recreate the entire cluster. If - the control plane must be recreated, this will cause - temporary downtime for zonal clusters. - - Some features require recreating the nodes as well. Those - will be recreated as separate operations and the update may - not be completely functional until the node pools - recreations finish. Node recreations will generally follow - `maintenance - policies `__. - - Some GKE-initiated operations use this type. This includes - certain types of auto-upgrades and incident mitigations. - CREATE_NODE_POOL (7): - A node pool is being created. The node pool should be - assumed to be unusable until this operation finishes. In the - event of an error, the node pool may be partially created. - - If enabled, `node - autoprovisioning `__ - may have automatically initiated such operations. - DELETE_NODE_POOL (8): - The node pool is being deleted. The node pool - should be assumed to be unusable as soon as this - operation starts. - SET_NODE_POOL_MANAGEMENT (9): - The node pool's - [manamagent][google.container.v1beta1.NodePool.management] - field is being updated. These operations only update - metadata and may be concurrent with most other operations. - AUTO_REPAIR_NODES (10): - A problem has been detected with nodes and `they are being - repaired `__. - This operation type is initiated by GKE, typically - automatically. This operation may be concurrent with other - operations and there may be multiple repairs occurring on - the same node pool. - AUTO_UPGRADE_NODES (11): - Unused. Automatic node upgrade uses - [UPGRADE_NODES][google.container.v1beta1.Operation.Type.UPGRADE_NODES]. - SET_LABELS (12): - Unused. Updating labels uses - [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. - SET_MASTER_AUTH (13): - Unused. Updating master auth uses - [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. - SET_NODE_POOL_SIZE (14): - The node pool is being resized. With the - exception of resizing to or from size zero, the - node pool is generally usable during this - operation. - SET_NETWORK_POLICY (15): - Unused. Updating network policy uses - [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. - SET_MAINTENANCE_POLICY (16): - Unused. Updating maintenance policy uses - [UPDATE_CLUSTER][google.container.v1beta1.Operation.Type.UPDATE_CLUSTER]. - RESIZE_CLUSTER (18): - The control plane is being resized. This operation type is - initiated by GKE. These operations are often performed - preemptively to ensure that the control plane has sufficient - resources and is not typically an indication of issues. For - more details, see `documentation on - resizes `__. - FLEET_FEATURE_UPGRADE (19): - Fleet features of GKE Enterprise are being - upgraded. The cluster should be assumed to be - blocked for other upgrades until the operation - finishes. - """ - TYPE_UNSPECIFIED = 0 - CREATE_CLUSTER = 1 - DELETE_CLUSTER = 2 - UPGRADE_MASTER = 3 - UPGRADE_NODES = 4 - REPAIR_CLUSTER = 5 - UPDATE_CLUSTER = 6 - CREATE_NODE_POOL = 7 - DELETE_NODE_POOL = 8 - SET_NODE_POOL_MANAGEMENT = 9 - AUTO_REPAIR_NODES = 10 - AUTO_UPGRADE_NODES = 11 - SET_LABELS = 12 - SET_MASTER_AUTH = 13 - SET_NODE_POOL_SIZE = 14 - SET_NETWORK_POLICY = 15 - SET_MAINTENANCE_POLICY = 16 - RESIZE_CLUSTER = 18 - FLEET_FEATURE_UPGRADE = 19 - - name: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - operation_type: Type = proto.Field( - proto.ENUM, - number=3, - enum=Type, - ) - status: Status = proto.Field( - proto.ENUM, - number=4, - enum=Status, - ) - detail: str = proto.Field( - proto.STRING, - number=8, - ) - status_message: str = proto.Field( - proto.STRING, - number=5, - ) - self_link: str = proto.Field( - proto.STRING, - number=6, - ) - target_link: str = proto.Field( - proto.STRING, - number=7, - ) - location: str = proto.Field( - proto.STRING, - number=9, - ) - start_time: str = proto.Field( - proto.STRING, - number=10, - ) - end_time: str = proto.Field( - proto.STRING, - number=11, - ) - progress: 'OperationProgress' = proto.Field( - proto.MESSAGE, - number=12, - message='OperationProgress', - ) - cluster_conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( - proto.MESSAGE, - number=13, - message='StatusCondition', - ) - nodepool_conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( - proto.MESSAGE, - number=14, - message='StatusCondition', - ) - error: status_pb2.Status = proto.Field( - proto.MESSAGE, - number=15, - message=status_pb2.Status, - ) - - -class OperationProgress(proto.Message): - r"""Information about operation (or operation stage) progress. - - Attributes: - name (str): - A non-parameterized string describing an - operation stage. Unset for single-stage - operations. - status (google.cloud.container_v1beta1.types.Operation.Status): - Status of an operation stage. - Unset for single-stage operations. - metrics (MutableSequence[google.cloud.container_v1beta1.types.OperationProgress.Metric]): - Progress metric bundle, for example: metrics: [{name: "nodes - done", int_value: 15}, {name: "nodes total", int_value: 32}] - or metrics: [{name: "progress", double_value: 0.56}, {name: - "progress scale", double_value: 1.0}] - stages (MutableSequence[google.cloud.container_v1beta1.types.OperationProgress]): - Substages of an operation or a stage. - """ - - class Metric(proto.Message): - r"""Progress metric is (string, int|float|string) pair. - - 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): - Required. Metric name, e.g., "nodes total", - "percent done". - int_value (int): - For metrics with integer value. - - This field is a member of `oneof`_ ``value``. - double_value (float): - For metrics with floating point value. - - This field is a member of `oneof`_ ``value``. - string_value (str): - For metrics with custom values (ratios, - visual progress, etc.). - - This field is a member of `oneof`_ ``value``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - int_value: int = proto.Field( - proto.INT64, - number=2, - oneof='value', - ) - double_value: float = proto.Field( - proto.DOUBLE, - number=3, - oneof='value', - ) - string_value: str = proto.Field( - proto.STRING, - number=4, - oneof='value', - ) - - name: str = proto.Field( - proto.STRING, - number=1, - ) - status: 'Operation.Status' = proto.Field( - proto.ENUM, - number=2, - enum='Operation.Status', - ) - metrics: MutableSequence[Metric] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message=Metric, - ) - stages: MutableSequence['OperationProgress'] = proto.RepeatedField( - proto.MESSAGE, - number=4, - message='OperationProgress', - ) - - -class CreateClusterRequest(proto.Message): - r"""CreateClusterRequest creates a cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the parent - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the parent field. - cluster (google.cloud.container_v1beta1.types.Cluster): - Required. A `cluster - resource `__ - parent (str): - The parent (project and location) where the cluster will be - created. Specified in the format ``projects/*/locations/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster: 'Cluster' = proto.Field( - proto.MESSAGE, - number=3, - message='Cluster', - ) - parent: str = proto.Field( - proto.STRING, - number=5, - ) - - -class GetClusterRequest(proto.Message): - r"""GetClusterRequest gets the settings of a cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to retrieve. This field has been deprecated and - replaced by the name field. - name (str): - The name (project, location, cluster) of the cluster to - retrieve. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - name: str = proto.Field( - proto.STRING, - number=5, - ) - - -class UpdateClusterRequest(proto.Message): - r"""UpdateClusterRequest updates the settings of a cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to upgrade. This field has been deprecated and - replaced by the name field. - update (google.cloud.container_v1beta1.types.ClusterUpdate): - Required. A description of the update. - name (str): - The name (project, location, cluster) of the cluster to - update. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - update: 'ClusterUpdate' = proto.Field( - proto.MESSAGE, - number=4, - message='ClusterUpdate', - ) - name: str = proto.Field( - proto.STRING, - number=5, - ) - - -class UpdateNodePoolRequest(proto.Message): - r"""SetNodePoolVersionRequest updates the version of a node pool. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to upgrade. This field has been deprecated and - replaced by the name field. - node_pool_id (str): - Required. Deprecated. The name of the node - pool to upgrade. This field has been deprecated - and replaced by the name field. - node_version (str): - Required. The Kubernetes version to change - the nodes to (typically an upgrade). - - Users may specify either explicit versions - offered by Kubernetes Engine or version aliases, - which have the following behavior: - - - "latest": picks the highest valid Kubernetes - version - - "1.X": picks the highest valid patch+gke.N - patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N patch - in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit Kubernetes - version - - "-": picks the Kubernetes master version - image_type (str): - Required. The desired image type for the node - pool. Please see - https://cloud.google.com/kubernetes-engine/docs/concepts/node-images - for available image types. - locations (MutableSequence[str]): - The desired list of Google Compute Engine - `zones `__ - in which the node pool's nodes should be located. Changing - the locations for a node pool will result in nodes being - either created or removed from the node pool, depending on - whether locations are being added or removed. - workload_metadata_config (google.cloud.container_v1beta1.types.WorkloadMetadataConfig): - The desired workload metadata config for the - node pool. - name (str): - The name (project, location, cluster, node pool) of the node - pool to update. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - upgrade_settings (google.cloud.container_v1beta1.types.NodePool.UpgradeSettings): - Upgrade settings control disruption and speed - of the upgrade. - tags (google.cloud.container_v1beta1.types.NetworkTags): - The desired network tags to be applied to all nodes in the - node pool. If this field is not present, the tags will not - be changed. Otherwise, the existing network tags will be - *replaced* with the provided tags. - taints (google.cloud.container_v1beta1.types.NodeTaints): - The desired node taints to be applied to all nodes in the - node pool. If this field is not present, the taints will not - be changed. Otherwise, the existing node taints will be - *replaced* with the provided taints. - labels (google.cloud.container_v1beta1.types.NodeLabels): - The desired node labels to be applied to all nodes in the - node pool. If this field is not present, the labels will not - be changed. Otherwise, the existing node labels will be - *replaced* with the provided labels. - linux_node_config (google.cloud.container_v1beta1.types.LinuxNodeConfig): - Parameters that can be configured on Linux - nodes. - kubelet_config (google.cloud.container_v1beta1.types.NodeKubeletConfig): - Node kubelet configs. - node_network_config (google.cloud.container_v1beta1.types.NodeNetworkConfig): - Node network config. - gcfs_config (google.cloud.container_v1beta1.types.GcfsConfig): - GCFS config. - confidential_nodes (google.cloud.container_v1beta1.types.ConfidentialNodes): - Confidential nodes config. - All the nodes in the node pool will be - Confidential VM once enabled. - gvnic (google.cloud.container_v1beta1.types.VirtualNIC): - Enable or disable gvnic on the node pool. - etag (str): - The current etag of the node pool. - If an etag is provided and does not match the - current etag of the node pool, update will be - blocked and an ABORTED error will be returned. - fast_socket (google.cloud.container_v1beta1.types.FastSocket): - Enable or disable NCCL fast socket for the - node pool. - logging_config (google.cloud.container_v1beta1.types.NodePoolLoggingConfig): - Logging configuration. - resource_labels (google.cloud.container_v1beta1.types.ResourceLabels): - The resource labels for the node pool to use - to annotate any related Google Compute Engine - resources. - windows_node_config (google.cloud.container_v1beta1.types.WindowsNodeConfig): - Parameters that can be configured on Windows - nodes. - accelerators (MutableSequence[google.cloud.container_v1beta1.types.AcceleratorConfig]): - A list of hardware accelerators to be - attached to each node. See - https://cloud.google.com/compute/docs/gpus for - more information about support for GPUs. - machine_type (str): - Optional. The desired machine type for nodes - in the node pool. Initiates an upgrade operation - that migrates the nodes in the node pool to the - specified machine type. - disk_type (str): - Optional. The desired disk type for nodes in - the node pool. Initiates an upgrade operation - that migrates the nodes in the node pool to the - specified disk type. - disk_size_gb (int): - Optional. The desired disk size for nodes in - the node pool. Initiates an upgrade operation - that migrates the nodes in the node pool to the - specified disk size. - resource_manager_tags (google.cloud.container_v1beta1.types.ResourceManagerTags): - Desired resource manager tag keys and values - to be attached to the nodes for managing Compute - Engine firewalls using Network Firewall - Policies. Existing tags will be replaced with - new values. - containerd_config (google.cloud.container_v1beta1.types.ContainerdConfig): - The desired containerd config for nodes in - the node pool. Initiates an upgrade operation - that recreates the nodes with the new config. - queued_provisioning (google.cloud.container_v1beta1.types.NodePool.QueuedProvisioning): - Specifies the configuration of queued - provisioning. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - node_version: str = proto.Field( - proto.STRING, - number=5, - ) - image_type: str = proto.Field( - proto.STRING, - number=6, - ) - locations: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=13, - ) - workload_metadata_config: 'WorkloadMetadataConfig' = proto.Field( - proto.MESSAGE, - number=14, - message='WorkloadMetadataConfig', - ) - name: str = proto.Field( - proto.STRING, - number=8, - ) - upgrade_settings: 'NodePool.UpgradeSettings' = proto.Field( - proto.MESSAGE, - number=15, - message='NodePool.UpgradeSettings', - ) - tags: 'NetworkTags' = proto.Field( - proto.MESSAGE, - number=16, - message='NetworkTags', - ) - taints: 'NodeTaints' = proto.Field( - proto.MESSAGE, - number=17, - message='NodeTaints', - ) - labels: 'NodeLabels' = proto.Field( - proto.MESSAGE, - number=18, - message='NodeLabels', - ) - linux_node_config: 'LinuxNodeConfig' = proto.Field( - proto.MESSAGE, - number=19, - message='LinuxNodeConfig', - ) - kubelet_config: 'NodeKubeletConfig' = proto.Field( - proto.MESSAGE, - number=20, - message='NodeKubeletConfig', - ) - node_network_config: 'NodeNetworkConfig' = proto.Field( - proto.MESSAGE, - number=21, - message='NodeNetworkConfig', - ) - gcfs_config: 'GcfsConfig' = proto.Field( - proto.MESSAGE, - number=22, - message='GcfsConfig', - ) - confidential_nodes: 'ConfidentialNodes' = proto.Field( - proto.MESSAGE, - number=23, - message='ConfidentialNodes', - ) - gvnic: 'VirtualNIC' = proto.Field( - proto.MESSAGE, - number=29, - message='VirtualNIC', - ) - etag: str = proto.Field( - proto.STRING, - number=30, - ) - fast_socket: 'FastSocket' = proto.Field( - proto.MESSAGE, - number=31, - message='FastSocket', - ) - logging_config: 'NodePoolLoggingConfig' = proto.Field( - proto.MESSAGE, - number=32, - message='NodePoolLoggingConfig', - ) - resource_labels: 'ResourceLabels' = proto.Field( - proto.MESSAGE, - number=33, - message='ResourceLabels', - ) - windows_node_config: 'WindowsNodeConfig' = proto.Field( - proto.MESSAGE, - number=34, - message='WindowsNodeConfig', - ) - accelerators: MutableSequence['AcceleratorConfig'] = proto.RepeatedField( - proto.MESSAGE, - number=35, - message='AcceleratorConfig', - ) - machine_type: str = proto.Field( - proto.STRING, - number=36, - ) - disk_type: str = proto.Field( - proto.STRING, - number=37, - ) - disk_size_gb: int = proto.Field( - proto.INT64, - number=38, - ) - resource_manager_tags: 'ResourceManagerTags' = proto.Field( - proto.MESSAGE, - number=39, - message='ResourceManagerTags', - ) - containerd_config: 'ContainerdConfig' = proto.Field( - proto.MESSAGE, - number=40, - message='ContainerdConfig', - ) - queued_provisioning: 'NodePool.QueuedProvisioning' = proto.Field( - proto.MESSAGE, - number=42, - message='NodePool.QueuedProvisioning', - ) - - -class SetNodePoolAutoscalingRequest(proto.Message): - r"""SetNodePoolAutoscalingRequest sets the autoscaler settings of - a node pool. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to upgrade. This field has been deprecated and - replaced by the name field. - node_pool_id (str): - Required. Deprecated. The name of the node - pool to upgrade. This field has been deprecated - and replaced by the name field. - autoscaling (google.cloud.container_v1beta1.types.NodePoolAutoscaling): - Required. Autoscaling configuration for the - node pool. - name (str): - The name (project, location, cluster, node pool) of the node - pool to set autoscaler settings. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - autoscaling: 'NodePoolAutoscaling' = proto.Field( - proto.MESSAGE, - number=5, - message='NodePoolAutoscaling', - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class SetLoggingServiceRequest(proto.Message): - r"""SetLoggingServiceRequest sets the logging service of a - cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to upgrade. This field has been deprecated and - replaced by the name field. - logging_service (str): - Required. The logging service the cluster should use to - write logs. Currently available options: - - - ``logging.googleapis.com/kubernetes`` - The Cloud Logging - service with a Kubernetes-native resource model - - ``logging.googleapis.com`` - The legacy Cloud Logging - service (no longer available as of GKE 1.15). - - ``none`` - no logs will be exported from the cluster. - - If left as an empty - string,\ ``logging.googleapis.com/kubernetes`` will be used - for GKE 1.14+ or ``logging.googleapis.com`` for earlier - versions. - name (str): - The name (project, location, cluster) of the cluster to set - logging. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - logging_service: str = proto.Field( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=5, - ) - - -class SetMonitoringServiceRequest(proto.Message): - r"""SetMonitoringServiceRequest sets the monitoring service of a - cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to upgrade. This field has been deprecated and - replaced by the name field. - monitoring_service (str): - Required. The monitoring service the cluster should use to - write metrics. Currently available options: - - - "monitoring.googleapis.com/kubernetes" - The Cloud - Monitoring service with a Kubernetes-native resource - model - - ``monitoring.googleapis.com`` - The legacy Cloud - Monitoring service (no longer available as of GKE 1.15). - - ``none`` - No metrics will be exported from the cluster. - - If left as an empty - string,\ ``monitoring.googleapis.com/kubernetes`` will be - used for GKE 1.14+ or ``monitoring.googleapis.com`` for - earlier versions. - name (str): - The name (project, location, cluster) of the cluster to set - monitoring. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - monitoring_service: str = proto.Field( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class SetAddonsConfigRequest(proto.Message): - r"""SetAddonsRequest sets the addons associated with the cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to upgrade. This field has been deprecated and - replaced by the name field. - addons_config (google.cloud.container_v1beta1.types.AddonsConfig): - Required. The desired configurations for the - various addons available to run in the cluster. - name (str): - The name (project, location, cluster) of the cluster to set - addons. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - addons_config: 'AddonsConfig' = proto.Field( - proto.MESSAGE, - number=4, - message='AddonsConfig', - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class SetLocationsRequest(proto.Message): - r"""SetLocationsRequest sets the locations of the cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to upgrade. This field has been deprecated and - replaced by the name field. - locations (MutableSequence[str]): - Required. The desired list of Google Compute Engine - `zones `__ - in which the cluster's nodes should be located. Changing the - locations a cluster is in will result in nodes being either - created or removed from the cluster, depending on whether - locations are being added or removed. - - This list must always include the cluster's primary zone. - name (str): - The name (project, location, cluster) of the cluster to set - locations. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - locations: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class UpdateMasterRequest(proto.Message): - r"""UpdateMasterRequest updates the master of the cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to upgrade. This field has been deprecated and - replaced by the name field. - master_version (str): - Required. The Kubernetes version to change - the master to. - Users may specify either explicit versions - offered by Kubernetes Engine or version aliases, - which have the following behavior: - - - "latest": picks the highest valid Kubernetes - version - - "1.X": picks the highest valid patch+gke.N - patch in the 1.X version - - "1.X.Y": picks the highest valid gke.N patch - in the 1.X.Y version - - "1.X.Y-gke.N": picks an explicit Kubernetes - version - - "-": picks the default Kubernetes version - name (str): - The name (project, location, cluster) of the cluster to - update. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - master_version: str = proto.Field( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=7, - ) - - -class SetMasterAuthRequest(proto.Message): - r"""SetMasterAuthRequest updates the admin password of a cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to upgrade. This field has been deprecated and - replaced by the name field. - action (google.cloud.container_v1beta1.types.SetMasterAuthRequest.Action): - Required. The exact form of action to be - taken on the master auth. - update (google.cloud.container_v1beta1.types.MasterAuth): - Required. A description of the update. - name (str): - The name (project, location, cluster) of the cluster to set - auth. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - class Action(proto.Enum): - r"""Operation type: what type update to perform. - - Values: - UNKNOWN (0): - Operation is unknown and will error out. - SET_PASSWORD (1): - Set the password to a user generated value. - GENERATE_PASSWORD (2): - Generate a new password and set it to that. - SET_USERNAME (3): - Set the username. If an empty username is - provided, basic authentication is disabled for - the cluster. If a non-empty username is - provided, basic authentication is enabled, with - either a provided password or a generated one. - """ - UNKNOWN = 0 - SET_PASSWORD = 1 - GENERATE_PASSWORD = 2 - SET_USERNAME = 3 - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - action: Action = proto.Field( - proto.ENUM, - number=4, - enum=Action, - ) - update: 'MasterAuth' = proto.Field( - proto.MESSAGE, - number=5, - message='MasterAuth', - ) - name: str = proto.Field( - proto.STRING, - number=7, - ) - - -class DeleteClusterRequest(proto.Message): - r"""DeleteClusterRequest deletes a cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to delete. This field has been deprecated and - replaced by the name field. - name (str): - The name (project, location, cluster) of the cluster to - delete. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - name: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListClustersRequest(proto.Message): - r"""ListClustersRequest lists clusters. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the parent - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides, or "-" for all zones. This - field has been deprecated and replaced by the parent field. - parent (str): - The parent (project and location) where the clusters will be - listed. Specified in the format ``projects/*/locations/*``. - Location "-" matches all zones and all regions. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - parent: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListClustersResponse(proto.Message): - r"""ListClustersResponse is the result of ListClustersRequest. - - Attributes: - clusters (MutableSequence[google.cloud.container_v1beta1.types.Cluster]): - A list of clusters in the project in the - specified zone, or across all ones. - missing_zones (MutableSequence[str]): - If any zones are listed here, the list of - clusters returned may be missing those zones. - """ - - clusters: MutableSequence['Cluster'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='Cluster', - ) - missing_zones: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=2, - ) - - -class GetOperationRequest(proto.Message): - r"""GetOperationRequest gets a single operation. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - operation_id (str): - Required. Deprecated. The server-assigned ``name`` of the - operation. This field has been deprecated and replaced by - the name field. - name (str): - The name (project, location, operation id) of the operation - to get. Specified in the format - ``projects/*/locations/*/operations/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - operation_id: str = proto.Field( - proto.STRING, - number=3, - ) - name: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListOperationsRequest(proto.Message): - r"""ListOperationsRequest lists operations. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the parent - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - to return operations for, or ``-`` for all zones. This field - has been deprecated and replaced by the parent field. - parent (str): - The parent (project and location) where the operations will - be listed. Specified in the format - ``projects/*/locations/*``. Location "-" matches all zones - and all regions. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - parent: str = proto.Field( - proto.STRING, - number=4, - ) - - -class CancelOperationRequest(proto.Message): - r"""CancelOperationRequest cancels a single operation. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the operation resides. This field has been - deprecated and replaced by the name field. - operation_id (str): - Required. Deprecated. The server-assigned ``name`` of the - operation. This field has been deprecated and replaced by - the name field. - name (str): - The name (project, location, operation id) of the operation - to cancel. Specified in the format - ``projects/*/locations/*/operations/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - operation_id: str = proto.Field( - proto.STRING, - number=3, - ) - name: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListOperationsResponse(proto.Message): - r"""ListOperationsResponse is the result of - ListOperationsRequest. - - Attributes: - operations (MutableSequence[google.cloud.container_v1beta1.types.Operation]): - A list of operations in the project in the - specified zone. - missing_zones (MutableSequence[str]): - If any zones are listed here, the list of - operations returned may be missing the - operations from those zones. - """ - - operations: MutableSequence['Operation'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='Operation', - ) - missing_zones: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=2, - ) - - -class GetServerConfigRequest(proto.Message): - r"""Gets the current Kubernetes Engine service configuration. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - to return operations for. This field has been deprecated and - replaced by the name field. - name (str): - The name (project and location) of the server config to get, - specified in the format ``projects/*/locations/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - name: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ServerConfig(proto.Message): - r"""Kubernetes Engine service configuration. - - Attributes: - default_cluster_version (str): - Version of Kubernetes the service deploys by - default. - valid_node_versions (MutableSequence[str]): - List of valid node upgrade target versions, - in descending order. - default_image_type (str): - Default image type. - valid_image_types (MutableSequence[str]): - List of valid image types. - valid_master_versions (MutableSequence[str]): - List of valid master versions, in descending - order. - channels (MutableSequence[google.cloud.container_v1beta1.types.ServerConfig.ReleaseChannelConfig]): - List of release channel configurations. - windows_version_maps (MutableMapping[str, google.cloud.container_v1beta1.types.WindowsVersions]): - Maps of Kubernetes version and supported - Windows server versions. - """ - - class ReleaseChannelConfig(proto.Message): - r"""ReleaseChannelConfig exposes configuration for a release - channel. - - Attributes: - channel (google.cloud.container_v1beta1.types.ReleaseChannel.Channel): - The release channel this configuration - applies to. - default_version (str): - The default version for newly created - clusters on the channel. - available_versions (MutableSequence[google.cloud.container_v1beta1.types.ServerConfig.ReleaseChannelConfig.AvailableVersion]): - Deprecated. This field has been deprecated and replaced with - the valid_versions field. - valid_versions (MutableSequence[str]): - List of valid versions for the channel. - """ - - class AvailableVersion(proto.Message): - r"""Deprecated. - - Attributes: - version (str): - Kubernetes version. - reason (str): - Reason for availability. - """ - - version: str = proto.Field( - proto.STRING, - number=1, - ) - reason: str = proto.Field( - proto.STRING, - number=2, - ) - - channel: 'ReleaseChannel.Channel' = proto.Field( - proto.ENUM, - number=1, - enum='ReleaseChannel.Channel', - ) - default_version: str = proto.Field( - proto.STRING, - number=2, - ) - available_versions: MutableSequence['ServerConfig.ReleaseChannelConfig.AvailableVersion'] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message='ServerConfig.ReleaseChannelConfig.AvailableVersion', - ) - valid_versions: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - - default_cluster_version: str = proto.Field( - proto.STRING, - number=1, - ) - valid_node_versions: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - default_image_type: str = proto.Field( - proto.STRING, - number=4, - ) - valid_image_types: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=5, - ) - valid_master_versions: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=6, - ) - channels: MutableSequence[ReleaseChannelConfig] = proto.RepeatedField( - proto.MESSAGE, - number=9, - message=ReleaseChannelConfig, - ) - windows_version_maps: MutableMapping[str, 'WindowsVersions'] = proto.MapField( - proto.STRING, - proto.MESSAGE, - number=10, - message='WindowsVersions', - ) - - -class BestEffortProvisioning(proto.Message): - r"""Best effort provisioning. - - Attributes: - enabled (bool): - When this is enabled, cluster/node pool - creations will ignore non-fatal errors like - stockout to best provision as many nodes as - possible right now and eventually bring up all - target number of nodes - min_provision_nodes (int): - Minimum number of nodes to be provisioned to - be considered as succeeded, and the rest of - nodes will be provisioned gradually and - eventually when stockout issue has been - resolved. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - min_provision_nodes: int = proto.Field( - proto.INT32, - number=2, - ) - - -class WindowsVersions(proto.Message): - r"""Windows server versions. - - Attributes: - windows_versions (MutableSequence[google.cloud.container_v1beta1.types.WindowsVersions.WindowsVersion]): - List of Windows server versions. - """ - - class WindowsVersion(proto.Message): - r"""Windows server version. - - Attributes: - image_type (str): - Windows server image type - os_version (str): - Windows server build number - support_end_date (google.type.date_pb2.Date): - Mainstream support end date - """ - - image_type: str = proto.Field( - proto.STRING, - number=1, - ) - os_version: str = proto.Field( - proto.STRING, - number=2, - ) - support_end_date: date_pb2.Date = proto.Field( - proto.MESSAGE, - number=3, - message=date_pb2.Date, - ) - - windows_versions: MutableSequence[WindowsVersion] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=WindowsVersion, - ) - - -class CreateNodePoolRequest(proto.Message): - r"""CreateNodePoolRequest creates a node pool for a cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the parent - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the parent field. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated and - replaced by the parent field. - node_pool (google.cloud.container_v1beta1.types.NodePool): - Required. The node pool to create. - parent (str): - The parent (project, location, cluster name) where the node - pool will be created. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool: 'NodePool' = proto.Field( - proto.MESSAGE, - number=4, - message='NodePool', - ) - parent: str = proto.Field( - proto.STRING, - number=6, - ) - - -class DeleteNodePoolRequest(proto.Message): - r"""DeleteNodePoolRequest deletes a node pool for a cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated and - replaced by the name field. - node_pool_id (str): - Required. Deprecated. The name of the node - pool to delete. This field has been deprecated - and replaced by the name field. - name (str): - The name (project, location, cluster, node pool id) of the - node pool to delete. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class ListNodePoolsRequest(proto.Message): - r"""ListNodePoolsRequest lists the node pool(s) for a cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the parent - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the parent field. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated and - replaced by the parent field. - parent (str): - The parent (project, location, cluster name) where the node - pools will be listed. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - parent: str = proto.Field( - proto.STRING, - number=5, - ) - - -class GetNodePoolRequest(proto.Message): - r"""GetNodePoolRequest retrieves a node pool for a cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated and - replaced by the name field. - node_pool_id (str): - Required. Deprecated. The name of the node - pool. This field has been deprecated and - replaced by the name field. - name (str): - The name (project, location, cluster, node pool id) of the - node pool to get. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class BlueGreenSettings(proto.Message): - r"""Settings for blue-green upgrade. - - 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: - standard_rollout_policy (google.cloud.container_v1beta1.types.BlueGreenSettings.StandardRolloutPolicy): - Standard policy for the blue-green upgrade. - - This field is a member of `oneof`_ ``rollout_policy``. - autoscaled_rollout_policy (google.cloud.container_v1beta1.types.BlueGreenSettings.AutoscaledRolloutPolicy): - Autoscaled policy for cluster autoscaler - enabled blue-green upgrade. - - This field is a member of `oneof`_ ``rollout_policy``. - node_pool_soak_duration (google.protobuf.duration_pb2.Duration): - Time needed after draining entire blue pool. - After this period, blue pool will be cleaned up. - - This field is a member of `oneof`_ ``_node_pool_soak_duration``. - """ - - class StandardRolloutPolicy(proto.Message): - r"""Standard rollout policy is the default policy for blue-green. - - 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: - batch_percentage (float): - Percentage of the blue pool nodes to drain in a batch. The - range of this field should be (0.0, 1.0]. - - This field is a member of `oneof`_ ``update_batch_size``. - batch_node_count (int): - Number of blue nodes to drain in a batch. - - This field is a member of `oneof`_ ``update_batch_size``. - batch_soak_duration (google.protobuf.duration_pb2.Duration): - Soak time after each batch gets drained. - Default to zero. - - This field is a member of `oneof`_ ``_batch_soak_duration``. - """ - - batch_percentage: float = proto.Field( - proto.FLOAT, - number=1, - oneof='update_batch_size', - ) - batch_node_count: int = proto.Field( - proto.INT32, - number=2, - oneof='update_batch_size', - ) - batch_soak_duration: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=3, - optional=True, - message=duration_pb2.Duration, - ) - - class AutoscaledRolloutPolicy(proto.Message): - r"""Autoscaled rollout policy uses cluster autoscaler during - blue-green upgrades to scale both the green and blue pools. - - """ - - standard_rollout_policy: StandardRolloutPolicy = proto.Field( - proto.MESSAGE, - number=1, - oneof='rollout_policy', - message=StandardRolloutPolicy, - ) - autoscaled_rollout_policy: AutoscaledRolloutPolicy = proto.Field( - proto.MESSAGE, - number=3, - oneof='rollout_policy', - message=AutoscaledRolloutPolicy, - ) - node_pool_soak_duration: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=2, - optional=True, - message=duration_pb2.Duration, - ) - - -class NodePool(proto.Message): - r"""NodePool contains the name and configuration for a cluster's - node pool. Node pools are a set of nodes (i.e. VM's), with a - common configuration and specification, under the control of the - cluster master. They may have a set of Kubernetes labels applied - to them, which may be used to reference them during pod - scheduling. They may also be resized up or down, to accommodate - the workload. - - Attributes: - name (str): - The name of the node pool. - config (google.cloud.container_v1beta1.types.NodeConfig): - The node configuration of the pool. - initial_node_count (int): - The initial node count for the pool. You must ensure that - your Compute Engine `resource - quota `__ is - sufficient for this number of instances. You must also have - available firewall and routes quota. - locations (MutableSequence[str]): - The list of Google Compute Engine - `zones `__ - in which the NodePool's nodes should be located. - - If this value is unspecified during node pool creation, the - `Cluster.Locations `__ - value will be used, instead. - - Warning: changing node pool locations will result in nodes - being added and/or removed. - network_config (google.cloud.container_v1beta1.types.NodeNetworkConfig): - Networking configuration for this NodePool. - If specified, it overrides the cluster-level - defaults. - self_link (str): - Output only. Server-defined URL for the - resource. - version (str): - The version of Kubernetes running on this NodePool's nodes. - If unspecified, it defaults as described - `here `__. - instance_group_urls (MutableSequence[str]): - Output only. The resource URLs of the `managed instance - groups `__ - associated with this node pool. During the node pool - blue-green upgrade operation, the URLs contain both blue and - green resources. - status (google.cloud.container_v1beta1.types.NodePool.Status): - Output only. The status of the nodes in this - pool instance. - status_message (str): - Output only. Deprecated. Use conditions - instead. Additional information about the - current status of this node pool instance, if - available. - autoscaling (google.cloud.container_v1beta1.types.NodePoolAutoscaling): - Autoscaler configuration for this NodePool. - Autoscaler is enabled only if a valid - configuration is present. - management (google.cloud.container_v1beta1.types.NodeManagement): - NodeManagement configuration for this - NodePool. - max_pods_constraint (google.cloud.container_v1beta1.types.MaxPodsConstraint): - The constraint on the maximum number of pods - that can be run simultaneously on a node in the - node pool. - conditions (MutableSequence[google.cloud.container_v1beta1.types.StatusCondition]): - Which conditions caused the current node pool - state. - pod_ipv4_cidr_size (int): - Output only. The pod CIDR block size per node - in this node pool. - upgrade_settings (google.cloud.container_v1beta1.types.NodePool.UpgradeSettings): - Upgrade settings control disruption and speed - of the upgrade. - placement_policy (google.cloud.container_v1beta1.types.NodePool.PlacementPolicy): - Specifies the node placement policy. - update_info (google.cloud.container_v1beta1.types.NodePool.UpdateInfo): - Output only. Update info contains relevant - information during a node pool update. - etag (str): - This checksum is computed by the server based - on the value of node pool fields, and may be - sent on update requests to ensure the client has - an up-to-date value before proceeding. - queued_provisioning (google.cloud.container_v1beta1.types.NodePool.QueuedProvisioning): - Specifies the configuration of queued - provisioning. - best_effort_provisioning (google.cloud.container_v1beta1.types.BestEffortProvisioning): - Enable best effort provisioning for nodes - """ - class Status(proto.Enum): - r"""The current status of the node pool instance. - - Values: - STATUS_UNSPECIFIED (0): - Not set. - PROVISIONING (1): - The PROVISIONING state indicates the node - pool is being created. - RUNNING (2): - The RUNNING state indicates the node pool has - been created and is fully usable. - RUNNING_WITH_ERROR (3): - The RUNNING_WITH_ERROR state indicates the node pool has - been created and is partially usable. Some error state has - occurred and some functionality may be impaired. Customer - may need to reissue a request or trigger a new update. - RECONCILING (4): - The RECONCILING state indicates that some work is actively - being done on the node pool, such as upgrading node - software. Details can be found in the ``statusMessage`` - field. - STOPPING (5): - The STOPPING state indicates the node pool is - being deleted. - ERROR (6): - The ERROR state indicates the node pool may be unusable. - Details can be found in the ``statusMessage`` field. - """ - STATUS_UNSPECIFIED = 0 - PROVISIONING = 1 - RUNNING = 2 - RUNNING_WITH_ERROR = 3 - RECONCILING = 4 - STOPPING = 5 - ERROR = 6 - - class UpgradeSettings(proto.Message): - r"""These upgrade settings control the level of parallelism and the - level of disruption caused by an upgrade. - - maxUnavailable controls the number of nodes that can be - simultaneously unavailable. - - maxSurge controls the number of additional nodes that can be added - to the node pool temporarily for the time of the upgrade to increase - the number of available nodes. - - (maxUnavailable + maxSurge) determines the level of parallelism (how - many nodes are being upgraded at the same time). - - Note: upgrades inevitably introduce some disruption since workloads - need to be moved from old nodes to new, upgraded ones. Even if - maxUnavailable=0, this holds true. (Disruption stays within the - limits of PodDisruptionBudget, if it is configured.) - - Consider a hypothetical node pool with 5 nodes having maxSurge=2, - maxUnavailable=1. This means the upgrade process upgrades 3 nodes - simultaneously. It creates 2 additional (upgraded) nodes, then it - brings down 3 old (not yet upgraded) nodes at the same time. This - ensures that there are always at least 4 nodes available. - - These upgrade settings configure the upgrade strategy for the node - pool. Use strategy to switch between the strategies applied to the - node pool. - - If the strategy is SURGE, use max_surge and max_unavailable to - control the level of parallelism and the level of disruption caused - by upgrade. - - 1. maxSurge controls the number of additional nodes that can be - added to the node pool temporarily for the time of the upgrade to - increase the number of available nodes. - 2. maxUnavailable controls the number of nodes that can be - simultaneously unavailable. - 3. (maxUnavailable + maxSurge) determines the level of parallelism - (how many nodes are being upgraded at the same time). - - If the strategy is BLUE_GREEN, use blue_green_settings to configure - the blue-green upgrade related settings. - - 1. standard_rollout_policy is the default policy. The policy is used - to control the way blue pool gets drained. The draining is - executed in the batch mode. The batch size could be specified as - either percentage of the node pool size or the number of nodes. - batch_soak_duration is the soak time after each batch gets - drained. - 2. node_pool_soak_duration is the soak time after all blue nodes are - drained. After this period, the blue pool nodes will be deleted. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - max_surge (int): - The maximum number of nodes that can be - created beyond the current size of the node pool - during the upgrade process. - max_unavailable (int): - The maximum number of nodes that can be - simultaneously unavailable during the upgrade - process. A node is considered available if its - status is Ready. - strategy (google.cloud.container_v1beta1.types.NodePoolUpdateStrategy): - Update strategy of the node pool. - - This field is a member of `oneof`_ ``_strategy``. - blue_green_settings (google.cloud.container_v1beta1.types.BlueGreenSettings): - Settings for blue-green upgrade strategy. - - This field is a member of `oneof`_ ``_blue_green_settings``. - """ - - max_surge: int = proto.Field( - proto.INT32, - number=1, - ) - max_unavailable: int = proto.Field( - proto.INT32, - number=2, - ) - strategy: 'NodePoolUpdateStrategy' = proto.Field( - proto.ENUM, - number=3, - optional=True, - enum='NodePoolUpdateStrategy', - ) - blue_green_settings: 'BlueGreenSettings' = proto.Field( - proto.MESSAGE, - number=4, - optional=True, - message='BlueGreenSettings', - ) - - class UpdateInfo(proto.Message): - r"""UpdateInfo contains resource (instance groups, etc), status - and other intermediate information relevant to a node pool - upgrade. - - Attributes: - blue_green_info (google.cloud.container_v1beta1.types.NodePool.UpdateInfo.BlueGreenInfo): - Information of a blue-green upgrade. - """ - - class BlueGreenInfo(proto.Message): - r"""Information relevant to blue-green upgrade. - - Attributes: - phase (google.cloud.container_v1beta1.types.NodePool.UpdateInfo.BlueGreenInfo.Phase): - Current blue-green upgrade phase. - blue_instance_group_urls (MutableSequence[str]): - The resource URLs of the [managed instance groups] - (/compute/docs/instance-groups/creating-groups-of-managed-instances) - associated with blue pool. - green_instance_group_urls (MutableSequence[str]): - The resource URLs of the [managed instance groups] - (/compute/docs/instance-groups/creating-groups-of-managed-instances) - associated with green pool. - blue_pool_deletion_start_time (str): - Time to start deleting blue pool to complete blue-green - upgrade, in - `RFC3339 `__ text - format. - green_pool_version (str): - Version of green pool. - """ - class Phase(proto.Enum): - r"""Phase represents the different stages blue-green upgrade is - running in. - - Values: - PHASE_UNSPECIFIED (0): - Unspecified phase. - UPDATE_STARTED (1): - blue-green upgrade has been initiated. - CREATING_GREEN_POOL (2): - Start creating green pool nodes. - CORDONING_BLUE_POOL (3): - Start cordoning blue pool nodes. - WAITING_TO_DRAIN_BLUE_POOL (8): - Start waiting after cordoning the blue pool - and before draining it. - DRAINING_BLUE_POOL (4): - Start draining blue pool nodes. - NODE_POOL_SOAKING (5): - Start soaking time after draining entire blue - pool. - DELETING_BLUE_POOL (6): - Start deleting blue nodes. - ROLLBACK_STARTED (7): - Rollback has been initiated. - """ - PHASE_UNSPECIFIED = 0 - UPDATE_STARTED = 1 - CREATING_GREEN_POOL = 2 - CORDONING_BLUE_POOL = 3 - WAITING_TO_DRAIN_BLUE_POOL = 8 - DRAINING_BLUE_POOL = 4 - NODE_POOL_SOAKING = 5 - DELETING_BLUE_POOL = 6 - ROLLBACK_STARTED = 7 - - phase: 'NodePool.UpdateInfo.BlueGreenInfo.Phase' = proto.Field( - proto.ENUM, - number=1, - enum='NodePool.UpdateInfo.BlueGreenInfo.Phase', - ) - blue_instance_group_urls: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=2, - ) - green_instance_group_urls: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - blue_pool_deletion_start_time: str = proto.Field( - proto.STRING, - number=4, - ) - green_pool_version: str = proto.Field( - proto.STRING, - number=5, - ) - - blue_green_info: 'NodePool.UpdateInfo.BlueGreenInfo' = proto.Field( - proto.MESSAGE, - number=1, - message='NodePool.UpdateInfo.BlueGreenInfo', - ) - - class PlacementPolicy(proto.Message): - r"""PlacementPolicy defines the placement policy used by the node - pool. - - Attributes: - type_ (google.cloud.container_v1beta1.types.NodePool.PlacementPolicy.Type): - The type of placement. - tpu_topology (str): - TPU placement topology for pod slice node pool. - https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies - policy_name (str): - If set, refers to the name of a custom - resource policy supplied by the user. The - resource policy must be in the same project and - region as the node pool. If not found, - InvalidArgument error is returned. - """ - class Type(proto.Enum): - r"""Type defines the type of placement policy. - - Values: - TYPE_UNSPECIFIED (0): - TYPE_UNSPECIFIED specifies no requirements on nodes - placement. - COMPACT (1): - COMPACT specifies node placement in the same - availability domain to ensure low communication - latency. - """ - TYPE_UNSPECIFIED = 0 - COMPACT = 1 - - type_: 'NodePool.PlacementPolicy.Type' = proto.Field( - proto.ENUM, - number=1, - enum='NodePool.PlacementPolicy.Type', - ) - tpu_topology: str = proto.Field( - proto.STRING, - number=2, - ) - policy_name: str = proto.Field( - proto.STRING, - number=3, - ) - - class QueuedProvisioning(proto.Message): - r"""QueuedProvisioning defines the queued provisioning used by - the node pool. - - Attributes: - enabled (bool): - Denotes that this nodepool is QRM specific, - meaning nodes can be only obtained through - queuing via the Cluster Autoscaler - ProvisioningRequest API. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - name: str = proto.Field( - proto.STRING, - number=1, - ) - config: 'NodeConfig' = proto.Field( - proto.MESSAGE, - number=2, - message='NodeConfig', - ) - initial_node_count: int = proto.Field( - proto.INT32, - number=3, - ) - locations: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=13, - ) - network_config: 'NodeNetworkConfig' = proto.Field( - proto.MESSAGE, - number=14, - message='NodeNetworkConfig', - ) - self_link: str = proto.Field( - proto.STRING, - number=100, - ) - version: str = proto.Field( - proto.STRING, - number=101, - ) - instance_group_urls: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=102, - ) - status: Status = proto.Field( - proto.ENUM, - number=103, - enum=Status, - ) - status_message: str = proto.Field( - proto.STRING, - number=104, - ) - autoscaling: 'NodePoolAutoscaling' = proto.Field( - proto.MESSAGE, - number=4, - message='NodePoolAutoscaling', - ) - management: 'NodeManagement' = proto.Field( - proto.MESSAGE, - number=5, - message='NodeManagement', - ) - max_pods_constraint: 'MaxPodsConstraint' = proto.Field( - proto.MESSAGE, - number=6, - message='MaxPodsConstraint', - ) - conditions: MutableSequence['StatusCondition'] = proto.RepeatedField( - proto.MESSAGE, - number=105, - message='StatusCondition', - ) - pod_ipv4_cidr_size: int = proto.Field( - proto.INT32, - number=7, - ) - upgrade_settings: UpgradeSettings = proto.Field( - proto.MESSAGE, - number=107, - message=UpgradeSettings, - ) - placement_policy: PlacementPolicy = proto.Field( - proto.MESSAGE, - number=108, - message=PlacementPolicy, - ) - update_info: UpdateInfo = proto.Field( - proto.MESSAGE, - number=109, - message=UpdateInfo, - ) - etag: str = proto.Field( - proto.STRING, - number=110, - ) - queued_provisioning: QueuedProvisioning = proto.Field( - proto.MESSAGE, - number=112, - message=QueuedProvisioning, - ) - best_effort_provisioning: 'BestEffortProvisioning' = proto.Field( - proto.MESSAGE, - number=113, - message='BestEffortProvisioning', - ) - - -class NodeManagement(proto.Message): - r"""NodeManagement defines the set of node management services - turned on for the node pool. - - Attributes: - auto_upgrade (bool): - Whether the nodes will be automatically - upgraded. - auto_repair (bool): - Whether the nodes will be automatically - repaired. - upgrade_options (google.cloud.container_v1beta1.types.AutoUpgradeOptions): - Specifies the Auto Upgrade knobs for the node - pool. - """ - - auto_upgrade: bool = proto.Field( - proto.BOOL, - number=1, - ) - auto_repair: bool = proto.Field( - proto.BOOL, - number=2, - ) - upgrade_options: 'AutoUpgradeOptions' = proto.Field( - proto.MESSAGE, - number=10, - message='AutoUpgradeOptions', - ) - - -class AutoUpgradeOptions(proto.Message): - r"""AutoUpgradeOptions defines the set of options for the user to - control how the Auto Upgrades will proceed. - - Attributes: - auto_upgrade_start_time (str): - Output only. This field is set when upgrades are about to - commence with the approximate start time for the upgrades, - in `RFC3339 `__ text - format. - description (str): - Output only. This field is set when upgrades - are about to commence with the description of - the upgrade. - """ - - auto_upgrade_start_time: str = proto.Field( - proto.STRING, - number=1, - ) - description: str = proto.Field( - proto.STRING, - number=2, - ) - - -class MaintenancePolicy(proto.Message): - r"""MaintenancePolicy defines the maintenance policy to be used - for the cluster. - - Attributes: - window (google.cloud.container_v1beta1.types.MaintenanceWindow): - Specifies the maintenance window in which - maintenance may be performed. - resource_version (str): - A hash identifying the version of this policy, so that - updates to fields of the policy won't accidentally undo - intermediate changes (and so that users of the API unaware - of some fields won't accidentally remove other fields). Make - a ``get()`` request to the cluster to get the current - resource version and include it with requests to set the - policy. - """ - - window: 'MaintenanceWindow' = proto.Field( - proto.MESSAGE, - number=1, - message='MaintenanceWindow', - ) - resource_version: str = proto.Field( - proto.STRING, - number=3, - ) - - -class MaintenanceWindow(proto.Message): - r"""MaintenanceWindow defines the maintenance window to be used - for the cluster. - - 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: - daily_maintenance_window (google.cloud.container_v1beta1.types.DailyMaintenanceWindow): - DailyMaintenanceWindow specifies a daily - maintenance operation window. - - This field is a member of `oneof`_ ``policy``. - recurring_window (google.cloud.container_v1beta1.types.RecurringTimeWindow): - RecurringWindow specifies some number of - recurring time periods for maintenance to occur. - The time windows may be overlapping. If no - maintenance windows are set, maintenance can - occur at any time. - - This field is a member of `oneof`_ ``policy``. - maintenance_exclusions (MutableMapping[str, google.cloud.container_v1beta1.types.TimeWindow]): - Exceptions to maintenance window. - Non-emergency maintenance should not occur in - these windows. - """ - - daily_maintenance_window: 'DailyMaintenanceWindow' = proto.Field( - proto.MESSAGE, - number=2, - oneof='policy', - message='DailyMaintenanceWindow', - ) - recurring_window: 'RecurringTimeWindow' = proto.Field( - proto.MESSAGE, - number=3, - oneof='policy', - message='RecurringTimeWindow', - ) - maintenance_exclusions: MutableMapping[str, 'TimeWindow'] = proto.MapField( - proto.STRING, - proto.MESSAGE, - number=4, - message='TimeWindow', - ) - - -class TimeWindow(proto.Message): - r"""Represents an arbitrary window of time. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - maintenance_exclusion_options (google.cloud.container_v1beta1.types.MaintenanceExclusionOptions): - MaintenanceExclusionOptions provides - maintenance exclusion related options. - - This field is a member of `oneof`_ ``options``. - start_time (google.protobuf.timestamp_pb2.Timestamp): - The time that the window first starts. - end_time (google.protobuf.timestamp_pb2.Timestamp): - The time that the window ends. The end time - should take place after the start time. - """ - - maintenance_exclusion_options: 'MaintenanceExclusionOptions' = proto.Field( - proto.MESSAGE, - number=3, - oneof='options', - message='MaintenanceExclusionOptions', - ) - start_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, - ) - - -class MaintenanceExclusionOptions(proto.Message): - r"""Represents the Maintenance exclusion option. - - Attributes: - scope (google.cloud.container_v1beta1.types.MaintenanceExclusionOptions.Scope): - Scope specifies the upgrade scope which - upgrades are blocked by the exclusion. - """ - class Scope(proto.Enum): - r"""Scope of exclusion. - - Values: - NO_UPGRADES (0): - NO_UPGRADES excludes all upgrades, including patch upgrades - and minor upgrades across control planes and nodes. This is - the default exclusion behavior. - NO_MINOR_UPGRADES (1): - NO_MINOR_UPGRADES excludes all minor upgrades for the - cluster, only patches are allowed. - NO_MINOR_OR_NODE_UPGRADES (2): - NO_MINOR_OR_NODE_UPGRADES excludes all minor upgrades for - the cluster, and also exclude all node pool upgrades. Only - control plane patches are allowed. - """ - NO_UPGRADES = 0 - NO_MINOR_UPGRADES = 1 - NO_MINOR_OR_NODE_UPGRADES = 2 - - scope: Scope = proto.Field( - proto.ENUM, - number=1, - enum=Scope, - ) - - -class RecurringTimeWindow(proto.Message): - r"""Represents an arbitrary window of time that recurs. - - Attributes: - window (google.cloud.container_v1beta1.types.TimeWindow): - The window of the first recurrence. - recurrence (str): - An RRULE - (https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for - how this window reccurs. They go on for the span of time - between the start and end time. - - For example, to have something repeat every weekday, you'd - use: ``FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR`` - - To repeat some window daily (equivalent to the - DailyMaintenanceWindow): ``FREQ=DAILY`` - - For the first weekend of every month: - ``FREQ=MONTHLY;BYSETPOS=1;BYDAY=SA,SU`` - - This specifies how frequently the window starts. Eg, if you - wanted to have a 9-5 UTC-4 window every weekday, you'd use - something like: - - :: - - start time = 2019-01-01T09:00:00-0400 - end time = 2019-01-01T17:00:00-0400 - recurrence = FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR - - Windows can span multiple days. Eg, to make the window - encompass every weekend from midnight Saturday till the last - minute of Sunday UTC: - - :: - - start time = 2019-01-05T00:00:00Z - end time = 2019-01-07T23:59:00Z - recurrence = FREQ=WEEKLY;BYDAY=SA - - Note the start and end time's specific dates are largely - arbitrary except to specify duration of the window and when - it first starts. The FREQ values of HOURLY, MINUTELY, and - SECONDLY are not supported. - """ - - window: 'TimeWindow' = proto.Field( - proto.MESSAGE, - number=1, - message='TimeWindow', - ) - recurrence: str = proto.Field( - proto.STRING, - number=2, - ) - - -class DailyMaintenanceWindow(proto.Message): - r"""Time window specified for daily maintenance operations. - - Attributes: - start_time (str): - Time within the maintenance window to start the maintenance - operations. It must be in format "HH:MM", where HH : [00-23] - and MM : [00-59] GMT. - duration (str): - Output only. Duration of the time window, - automatically chosen to be smallest possible in - the given scenario. - """ - - start_time: str = proto.Field( - proto.STRING, - number=2, - ) - duration: str = proto.Field( - proto.STRING, - number=3, - ) - - -class SetNodePoolManagementRequest(proto.Message): - r"""SetNodePoolManagementRequest sets the node management - properties of a node pool. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to update. This field has been deprecated and - replaced by the name field. - node_pool_id (str): - Required. Deprecated. The name of the node - pool to update. This field has been deprecated - and replaced by the name field. - management (google.cloud.container_v1beta1.types.NodeManagement): - Required. NodeManagement configuration for - the node pool. - name (str): - The name (project, location, cluster, node pool id) of the - node pool to set management properties. Specified in the - format ``projects/*/locations/*/clusters/*/nodePools/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - management: 'NodeManagement' = proto.Field( - proto.MESSAGE, - number=5, - message='NodeManagement', - ) - name: str = proto.Field( - proto.STRING, - number=7, - ) - - -class SetNodePoolSizeRequest(proto.Message): - r"""SetNodePoolSizeRequest sets the size of a node pool. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to update. This field has been deprecated and - replaced by the name field. - node_pool_id (str): - Required. Deprecated. The name of the node - pool to update. This field has been deprecated - and replaced by the name field. - node_count (int): - Required. The desired node count for the - pool. - name (str): - The name (project, location, cluster, node pool id) of the - node pool to set size. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - node_count: int = proto.Field( - proto.INT32, - number=5, - ) - name: str = proto.Field( - proto.STRING, - number=7, - ) - - -class CompleteNodePoolUpgradeRequest(proto.Message): - r"""CompleteNodePoolUpgradeRequest sets the name of target node - pool to complete upgrade. - - Attributes: - name (str): - The name (project, location, cluster, node pool id) of the - node pool to complete upgrade. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class RollbackNodePoolUpgradeRequest(proto.Message): - r"""RollbackNodePoolUpgradeRequest rollbacks the previously - Aborted or Failed NodePool upgrade. This will be an no-op if the - last upgrade successfully completed. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to rollback. This field has been deprecated and - replaced by the name field. - node_pool_id (str): - Required. Deprecated. The name of the node - pool to rollback. This field has been deprecated - and replaced by the name field. - name (str): - The name (project, location, cluster, node pool id) of the - node poll to rollback upgrade. Specified in the format - ``projects/*/locations/*/clusters/*/nodePools/*``. - respect_pdb (bool): - Option for rollback to ignore the - PodDisruptionBudget. Default value is false. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - node_pool_id: str = proto.Field( - proto.STRING, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - respect_pdb: bool = proto.Field( - proto.BOOL, - number=7, - ) - - -class ListNodePoolsResponse(proto.Message): - r"""ListNodePoolsResponse is the result of ListNodePoolsRequest. - - Attributes: - node_pools (MutableSequence[google.cloud.container_v1beta1.types.NodePool]): - A list of node pools for a cluster. - """ - - node_pools: MutableSequence['NodePool'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='NodePool', - ) - - -class ClusterAutoscaling(proto.Message): - r"""ClusterAutoscaling contains global, per-cluster information - required by Cluster Autoscaler to automatically adjust the size - of the cluster and create/delete - node pools based on the current needs. - - Attributes: - enable_node_autoprovisioning (bool): - Enables automatic node pool creation and - deletion. - resource_limits (MutableSequence[google.cloud.container_v1beta1.types.ResourceLimit]): - Contains global constraints regarding minimum - and maximum amount of resources in the cluster. - autoscaling_profile (google.cloud.container_v1beta1.types.ClusterAutoscaling.AutoscalingProfile): - Defines autoscaling behaviour. - autoprovisioning_node_pool_defaults (google.cloud.container_v1beta1.types.AutoprovisioningNodePoolDefaults): - AutoprovisioningNodePoolDefaults contains - defaults for a node pool created by NAP. - autoprovisioning_locations (MutableSequence[str]): - The list of Google Compute Engine - `zones `__ - in which the NodePool's nodes can be created by NAP. - """ - class AutoscalingProfile(proto.Enum): - r"""Defines possible options for autoscaling_profile field. - - Values: - PROFILE_UNSPECIFIED (0): - No change to autoscaling configuration. - OPTIMIZE_UTILIZATION (1): - Prioritize optimizing utilization of - resources. - BALANCED (2): - Use default (balanced) autoscaling - configuration. - """ - PROFILE_UNSPECIFIED = 0 - OPTIMIZE_UTILIZATION = 1 - BALANCED = 2 - - enable_node_autoprovisioning: bool = proto.Field( - proto.BOOL, - number=1, - ) - resource_limits: MutableSequence['ResourceLimit'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='ResourceLimit', - ) - autoscaling_profile: AutoscalingProfile = proto.Field( - proto.ENUM, - number=3, - enum=AutoscalingProfile, - ) - autoprovisioning_node_pool_defaults: 'AutoprovisioningNodePoolDefaults' = proto.Field( - proto.MESSAGE, - number=4, - message='AutoprovisioningNodePoolDefaults', - ) - autoprovisioning_locations: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=5, - ) - - -class AutoprovisioningNodePoolDefaults(proto.Message): - r"""AutoprovisioningNodePoolDefaults contains defaults for a node - pool created by NAP. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - oauth_scopes (MutableSequence[str]): - The set of Google API scopes to be made available on all of - the node VMs under the "default" service account. - - The following scopes are recommended, but not required, and - by default are not included: - - - ``https://www.googleapis.com/auth/compute`` is required - for mounting persistent storage on your nodes. - - ``https://www.googleapis.com/auth/devstorage.read_only`` - is required for communicating with **gcr.io** (the - `Google Container - Registry `__). - - If unspecified, no scopes are added, unless Cloud Logging or - Cloud Monitoring are enabled, in which case their required - scopes will be added. - service_account (str): - The Google Cloud Platform Service Account to - be used by the node VMs. Specify the email - address of the Service Account; otherwise, if no - Service Account is specified, the "default" - service account is used. - upgrade_settings (google.cloud.container_v1beta1.types.NodePool.UpgradeSettings): - Upgrade settings control disruption and speed - of the upgrade. - management (google.cloud.container_v1beta1.types.NodeManagement): - NodeManagement configuration for this - NodePool. - min_cpu_platform (str): - Deprecated. Minimum CPU platform to be used for NAP created - node pools. The instance may be scheduled on the specified - or newer CPU platform. Applicable values are the friendly - names of CPU platforms, such as minCpuPlatform: Intel - Haswell or minCpuPlatform: Intel Sandy Bridge. For more - information, read `how to specify min CPU - platform `__. - This field is deprecated, min_cpu_platform should be - specified using - ``cloud.google.com/requested-min-cpu-platform`` label - selector on the pod. To unset the min cpu platform field - pass "automatic" as field value. - disk_size_gb (int): - Size of the disk attached to each node, - specified in GB. The smallest allowed disk size - is 10GB. - - If unspecified, the default disk size is 100GB. - disk_type (str): - Type of the disk attached to each node (e.g. - 'pd-standard', 'pd-ssd' or 'pd-balanced') - - If unspecified, the default disk type is - 'pd-standard' - shielded_instance_config (google.cloud.container_v1beta1.types.ShieldedInstanceConfig): - Shielded Instance options. - boot_disk_kms_key (str): - The Customer Managed Encryption Key used to encrypt the boot - disk attached to each node in the node pool. This should be - of the form - projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. - For more information about protecting resources with Cloud - KMS Keys please see: - https://cloud.google.com/compute/docs/disks/customer-managed-encryption - image_type (str): - The image type to use for NAP created node. - Please see - https://cloud.google.com/kubernetes-engine/docs/concepts/node-images - for available image types. - insecure_kubelet_readonly_port_enabled (bool): - Enable or disable Kubelet read only port. - - This field is a member of `oneof`_ ``_insecure_kubelet_readonly_port_enabled``. - """ - - oauth_scopes: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - service_account: str = proto.Field( - proto.STRING, - number=2, - ) - upgrade_settings: 'NodePool.UpgradeSettings' = proto.Field( - proto.MESSAGE, - number=3, - message='NodePool.UpgradeSettings', - ) - management: 'NodeManagement' = proto.Field( - proto.MESSAGE, - number=4, - message='NodeManagement', - ) - min_cpu_platform: str = proto.Field( - proto.STRING, - number=5, - ) - disk_size_gb: int = proto.Field( - proto.INT32, - number=6, - ) - disk_type: str = proto.Field( - proto.STRING, - number=7, - ) - shielded_instance_config: 'ShieldedInstanceConfig' = proto.Field( - proto.MESSAGE, - number=8, - message='ShieldedInstanceConfig', - ) - boot_disk_kms_key: str = proto.Field( - proto.STRING, - number=9, - ) - image_type: str = proto.Field( - proto.STRING, - number=10, - ) - insecure_kubelet_readonly_port_enabled: bool = proto.Field( - proto.BOOL, - number=13, - optional=True, - ) - - -class ResourceLimit(proto.Message): - r"""Contains information about amount of some resource in the - cluster. For memory, value should be in GB. - - Attributes: - resource_type (str): - Resource name "cpu", "memory" or gpu-specific - string. - minimum (int): - Minimum amount of the resource in the - cluster. - maximum (int): - Maximum amount of the resource in the - cluster. - """ - - resource_type: str = proto.Field( - proto.STRING, - number=1, - ) - minimum: int = proto.Field( - proto.INT64, - number=2, - ) - maximum: int = proto.Field( - proto.INT64, - number=3, - ) - - -class NodePoolAutoscaling(proto.Message): - r"""NodePoolAutoscaling contains information required by cluster - autoscaler to adjust the size of the node pool to the current - cluster usage. - - Attributes: - enabled (bool): - Is autoscaling enabled for this node pool. - min_node_count (int): - Minimum number of nodes for one location in the NodePool. - Must be >= 1 and <= max_node_count. - max_node_count (int): - Maximum number of nodes for one location in the NodePool. - Must be >= min_node_count. There has to be enough quota to - scale up the cluster. - autoprovisioned (bool): - Can this node pool be deleted automatically. - location_policy (google.cloud.container_v1beta1.types.NodePoolAutoscaling.LocationPolicy): - Location policy used when scaling up a - nodepool. - total_min_node_count (int): - Minimum number of nodes in the node pool. Must be greater - than 1 less than total_max_node_count. The - total_*_node_count fields are mutually exclusive with the - \*_node_count fields. - total_max_node_count (int): - Maximum number of nodes in the node pool. Must be greater - than total_min_node_count. There has to be enough quota to - scale up the cluster. The total_*_node_count fields are - mutually exclusive with the \*_node_count fields. - """ - class LocationPolicy(proto.Enum): - r"""Location policy specifies how zones are picked when scaling - up the nodepool. - - Values: - LOCATION_POLICY_UNSPECIFIED (0): - Not set. - BALANCED (1): - BALANCED is a best effort policy that aims to - balance the sizes of different zones. - ANY (2): - ANY policy picks zones that have the highest - capacity available. - """ - LOCATION_POLICY_UNSPECIFIED = 0 - BALANCED = 1 - ANY = 2 - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - min_node_count: int = proto.Field( - proto.INT32, - number=2, - ) - max_node_count: int = proto.Field( - proto.INT32, - number=3, - ) - autoprovisioned: bool = proto.Field( - proto.BOOL, - number=4, - ) - location_policy: LocationPolicy = proto.Field( - proto.ENUM, - number=5, - enum=LocationPolicy, - ) - total_min_node_count: int = proto.Field( - proto.INT32, - number=6, - ) - total_max_node_count: int = proto.Field( - proto.INT32, - number=7, - ) - - -class SetLabelsRequest(proto.Message): - r"""SetLabelsRequest sets the Google Cloud Platform labels on a - Google Container Engine cluster, which will in turn set them for - Google Compute Engine resources used by that cluster - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated and - replaced by the name field. - resource_labels (MutableMapping[str, str]): - Required. The labels to set for that cluster. - label_fingerprint (str): - Required. The fingerprint of the previous set of labels for - this resource, used to detect conflicts. The fingerprint is - initially generated by Kubernetes Engine and changes after - every request to modify or update labels. You must always - provide an up-to-date fingerprint hash when updating or - changing labels. Make a ``get()`` request to the resource to - get the latest fingerprint. - name (str): - The name (project, location, cluster name) of the cluster to - set labels. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - resource_labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - label_fingerprint: str = proto.Field( - proto.STRING, - number=5, - ) - name: str = proto.Field( - proto.STRING, - number=7, - ) - - -class SetLegacyAbacRequest(proto.Message): - r"""SetLegacyAbacRequest enables or disables the ABAC - authorization mechanism for a cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the cluster - to update. This field has been deprecated and - replaced by the name field. - enabled (bool): - Required. Whether ABAC authorization will be - enabled in the cluster. - name (str): - The name (project, location, cluster name) of the cluster to - set legacy abac. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - enabled: bool = proto.Field( - proto.BOOL, - number=4, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class StartIPRotationRequest(proto.Message): - r"""StartIPRotationRequest creates a new IP for the cluster and - then performs a node upgrade on each node pool to point to the - new IP. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated and - replaced by the name field. - name (str): - The name (project, location, cluster name) of the cluster to - start IP rotation. Specified in the format - ``projects/*/locations/*/clusters/*``. - rotate_credentials (bool): - Whether to rotate credentials during IP - rotation. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - rotate_credentials: bool = proto.Field( - proto.BOOL, - number=7, - ) - - -class CompleteIPRotationRequest(proto.Message): - r"""CompleteIPRotationRequest moves the cluster master back into - single-IP mode. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated and - replaced by the name field. - name (str): - The name (project, location, cluster name) of the cluster to - complete IP rotation. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - name: str = proto.Field( - proto.STRING, - number=7, - ) - - -class AcceleratorConfig(proto.Message): - r"""AcceleratorConfig represents a Hardware Accelerator request. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - accelerator_count (int): - The number of the accelerator cards exposed - to an instance. - accelerator_type (str): - The accelerator type resource name. List of supported - accelerators - `here `__ - gpu_partition_size (str): - Size of partitions to create on the GPU. Valid values are - described in the NVIDIA `mig user - guide `__. - max_time_shared_clients_per_gpu (int): - The number of time-shared GPU resources to - expose for each physical GPU. - gpu_sharing_config (google.cloud.container_v1beta1.types.GPUSharingConfig): - The configuration for GPU sharing options. - - This field is a member of `oneof`_ ``_gpu_sharing_config``. - gpu_driver_installation_config (google.cloud.container_v1beta1.types.GPUDriverInstallationConfig): - The configuration for auto installation of - GPU driver. - - This field is a member of `oneof`_ ``_gpu_driver_installation_config``. - """ - - accelerator_count: int = proto.Field( - proto.INT64, - number=1, - ) - accelerator_type: str = proto.Field( - proto.STRING, - number=2, - ) - gpu_partition_size: str = proto.Field( - proto.STRING, - number=3, - ) - max_time_shared_clients_per_gpu: int = proto.Field( - proto.INT64, - number=4, - ) - gpu_sharing_config: 'GPUSharingConfig' = proto.Field( - proto.MESSAGE, - number=5, - optional=True, - message='GPUSharingConfig', - ) - gpu_driver_installation_config: 'GPUDriverInstallationConfig' = proto.Field( - proto.MESSAGE, - number=6, - optional=True, - message='GPUDriverInstallationConfig', - ) - - -class GPUSharingConfig(proto.Message): - r"""GPUSharingConfig represents the GPU sharing configuration for - Hardware Accelerators. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - max_shared_clients_per_gpu (int): - The max number of containers that can share a - physical GPU. - gpu_sharing_strategy (google.cloud.container_v1beta1.types.GPUSharingConfig.GPUSharingStrategy): - The type of GPU sharing strategy to enable on - the GPU node. - - This field is a member of `oneof`_ ``_gpu_sharing_strategy``. - """ - class GPUSharingStrategy(proto.Enum): - r"""The type of GPU sharing strategy currently provided. - - Values: - GPU_SHARING_STRATEGY_UNSPECIFIED (0): - Default value. - TIME_SHARING (1): - GPUs are time-shared between containers. - MPS (2): - GPUs are shared between containers with - NVIDIA MPS. - """ - GPU_SHARING_STRATEGY_UNSPECIFIED = 0 - TIME_SHARING = 1 - MPS = 2 - - max_shared_clients_per_gpu: int = proto.Field( - proto.INT64, - number=1, - ) - gpu_sharing_strategy: GPUSharingStrategy = proto.Field( - proto.ENUM, - number=2, - optional=True, - enum=GPUSharingStrategy, - ) - - -class GPUDriverInstallationConfig(proto.Message): - r"""GPUDriverInstallationConfig specifies the version of GPU - driver to be auto installed. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - gpu_driver_version (google.cloud.container_v1beta1.types.GPUDriverInstallationConfig.GPUDriverVersion): - Mode for how the GPU driver is installed. - - This field is a member of `oneof`_ ``_gpu_driver_version``. - """ - class GPUDriverVersion(proto.Enum): - r"""The GPU driver version to install. - - Values: - GPU_DRIVER_VERSION_UNSPECIFIED (0): - Default value is to not install any GPU - driver. - INSTALLATION_DISABLED (1): - Disable GPU driver auto installation and - needs manual installation - DEFAULT (2): - "Default" GPU driver in COS and Ubuntu. - LATEST (3): - "Latest" GPU driver in COS. - """ - GPU_DRIVER_VERSION_UNSPECIFIED = 0 - INSTALLATION_DISABLED = 1 - DEFAULT = 2 - LATEST = 3 - - gpu_driver_version: GPUDriverVersion = proto.Field( - proto.ENUM, - number=1, - optional=True, - enum=GPUDriverVersion, - ) - - -class ManagedPrometheusConfig(proto.Message): - r"""ManagedPrometheusConfig defines the configuration for - Google Cloud Managed Service for Prometheus. - - Attributes: - enabled (bool): - Enable Managed Collection. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class WorkloadMetadataConfig(proto.Message): - r"""WorkloadMetadataConfig defines the metadata configuration to - expose to workloads on the node pool. - - Attributes: - node_metadata (google.cloud.container_v1beta1.types.WorkloadMetadataConfig.NodeMetadata): - NodeMetadata is the configuration for how to - expose metadata to the workloads running on the - node. - mode (google.cloud.container_v1beta1.types.WorkloadMetadataConfig.Mode): - Mode is the configuration for how to expose - metadata to workloads running on the node pool. - """ - class NodeMetadata(proto.Enum): - r"""NodeMetadata is the configuration for if and how to expose - the node metadata to the workload running on the node. - - Values: - UNSPECIFIED (0): - Not set. - SECURE (1): - Prevent workloads not in hostNetwork from - accessing certain VM metadata, specifically - kube-env, which contains Kubelet credentials, - and the instance identity token. - - Metadata concealment is a temporary security - solution available while the bootstrapping - process for cluster nodes is being redesigned - with significant security improvements. This - feature is scheduled to be deprecated in the - future and later removed. - EXPOSE (2): - Expose all VM metadata to pods. - GKE_METADATA_SERVER (3): - Run the GKE Metadata Server on this node. The - GKE Metadata Server exposes a metadata API to - workloads that is compatible with the V1 Compute - Metadata APIs exposed by the Compute Engine and - App Engine Metadata Servers. This feature can - only be enabled if Workload Identity is enabled - at the cluster level. - """ - UNSPECIFIED = 0 - SECURE = 1 - EXPOSE = 2 - GKE_METADATA_SERVER = 3 - - class Mode(proto.Enum): - r"""Mode is the configuration for how to expose metadata to - workloads running on the node. - - Values: - MODE_UNSPECIFIED (0): - Not set. - GCE_METADATA (1): - Expose all Compute Engine metadata to pods. - GKE_METADATA (2): - Run the GKE Metadata Server on this node. The - GKE Metadata Server exposes a metadata API to - workloads that is compatible with the V1 Compute - Metadata APIs exposed by the Compute Engine and - App Engine Metadata Servers. This feature can - only be enabled if Workload Identity is enabled - at the cluster level. - """ - MODE_UNSPECIFIED = 0 - GCE_METADATA = 1 - GKE_METADATA = 2 - - node_metadata: NodeMetadata = proto.Field( - proto.ENUM, - number=1, - enum=NodeMetadata, - ) - mode: Mode = proto.Field( - proto.ENUM, - number=2, - enum=Mode, - ) - - -class SetNetworkPolicyRequest(proto.Message): - r"""SetNetworkPolicyRequest enables/disables network policy for a - cluster. - - Attributes: - project_id (str): - Required. Deprecated. The Google Developers Console `project - ID or project - number `__. - This field has been deprecated and replaced by the name - field. - zone (str): - Required. Deprecated. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. This field has been deprecated - and replaced by the name field. - cluster_id (str): - Required. Deprecated. The name of the - cluster. This field has been deprecated and - replaced by the name field. - network_policy (google.cloud.container_v1beta1.types.NetworkPolicy): - Required. Configuration options for the - NetworkPolicy feature. - name (str): - The name (project, location, cluster name) of the cluster to - set networking policy. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - network_policy: 'NetworkPolicy' = proto.Field( - proto.MESSAGE, - number=4, - message='NetworkPolicy', - ) - name: str = proto.Field( - proto.STRING, - number=6, - ) - - -class SetMaintenancePolicyRequest(proto.Message): - r"""SetMaintenancePolicyRequest sets the maintenance policy for a - cluster. - - Attributes: - project_id (str): - Required. The Google Developers Console `project ID or - project - number `__. - zone (str): - Required. The name of the Google Compute Engine - `zone `__ - in which the cluster resides. - cluster_id (str): - Required. The name of the cluster to update. - maintenance_policy (google.cloud.container_v1beta1.types.MaintenancePolicy): - Required. The maintenance policy to be set - for the cluster. An empty field clears the - existing maintenance policy. - name (str): - The name (project, location, cluster name) of the cluster to - set maintenance policy. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - project_id: str = proto.Field( - proto.STRING, - number=1, - ) - zone: str = proto.Field( - proto.STRING, - number=2, - ) - cluster_id: str = proto.Field( - proto.STRING, - number=3, - ) - maintenance_policy: 'MaintenancePolicy' = proto.Field( - proto.MESSAGE, - number=4, - message='MaintenancePolicy', - ) - name: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListLocationsRequest(proto.Message): - r"""ListLocationsRequest is used to request the locations that - offer GKE. - - Attributes: - parent (str): - Required. Contains the name of the resource requested. - Specified in the format ``projects/*``. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListLocationsResponse(proto.Message): - r"""ListLocationsResponse returns the list of all GKE locations - and their recommendation state. - - Attributes: - locations (MutableSequence[google.cloud.container_v1beta1.types.Location]): - A full list of GKE locations. - next_page_token (str): - Only return ListLocationsResponse that occur after the - page_token. This value should be populated from the - ListLocationsResponse.next_page_token if that response token - was set (which happens when listing more Locations than fit - in a single ListLocationsResponse). - """ - - @property - def raw_page(self): - return self - - locations: MutableSequence['Location'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='Location', - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class Location(proto.Message): - r"""Location returns the location name, and if the location is - recommended for GKE cluster scheduling. - - Attributes: - type_ (google.cloud.container_v1beta1.types.Location.LocationType): - Contains the type of location this Location - is for. Regional or Zonal. - name (str): - Contains the name of the resource requested. Specified in - the format ``projects/*/locations/*``. - recommended (bool): - Whether the location is recommended for GKE - cluster scheduling. - """ - class LocationType(proto.Enum): - r"""LocationType is the type of GKE location, regional or zonal. - - Values: - LOCATION_TYPE_UNSPECIFIED (0): - LOCATION_TYPE_UNSPECIFIED means the location type was not - determined. - ZONE (1): - A GKE Location where Zonal clusters can be - created. - REGION (2): - A GKE Location where Regional clusters can be - created. - """ - LOCATION_TYPE_UNSPECIFIED = 0 - ZONE = 1 - REGION = 2 - - type_: LocationType = proto.Field( - proto.ENUM, - number=1, - enum=LocationType, - ) - name: str = proto.Field( - proto.STRING, - number=2, - ) - recommended: bool = proto.Field( - proto.BOOL, - number=3, - ) - - -class StatusCondition(proto.Message): - r"""StatusCondition describes why a cluster or a node pool has a - certain status (e.g., ERROR or DEGRADED). - - Attributes: - code (google.cloud.container_v1beta1.types.StatusCondition.Code): - Machine-friendly representation of the condition Deprecated. - Use canonical_code instead. - message (str): - Human-friendly representation of the - condition - canonical_code (google.rpc.code_pb2.Code): - Canonical code of the condition. - """ - class Code(proto.Enum): - r"""Code for each condition - - Values: - UNKNOWN (0): - UNKNOWN indicates a generic condition. - GCE_STOCKOUT (1): - GCE_STOCKOUT indicates that Google Compute Engine resources - are temporarily unavailable. - GKE_SERVICE_ACCOUNT_DELETED (2): - GKE_SERVICE_ACCOUNT_DELETED indicates that the user deleted - their robot service account. - GCE_QUOTA_EXCEEDED (3): - Google Compute Engine quota was exceeded. - SET_BY_OPERATOR (4): - Cluster state was manually changed by an SRE - due to a system logic error. - CLOUD_KMS_KEY_ERROR (7): - Unable to perform an encrypt operation - against the CloudKMS key used for etcd level - encryption. - CA_EXPIRING (9): - Cluster CA is expiring soon. - More codes TBA - """ - _pb_options = {'deprecated': True} - UNKNOWN = 0 - GCE_STOCKOUT = 1 - GKE_SERVICE_ACCOUNT_DELETED = 2 - GCE_QUOTA_EXCEEDED = 3 - SET_BY_OPERATOR = 4 - CLOUD_KMS_KEY_ERROR = 7 - CA_EXPIRING = 9 - - code: Code = proto.Field( - proto.ENUM, - number=1, - enum=Code, - ) - message: str = proto.Field( - proto.STRING, - number=2, - ) - canonical_code: code_pb2.Code = proto.Field( - proto.ENUM, - number=3, - enum=code_pb2.Code, - ) - - -class NetworkConfig(proto.Message): - r"""NetworkConfig reports the relative names of network & - subnetwork. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - network (str): - Output only. The relative name of the Google Compute Engine - `network `__ - to which the cluster is connected. Example: - projects/my-project/global/networks/my-network - subnetwork (str): - Output only. The relative name of the Google Compute Engine - `subnetwork `__ - to which the cluster is connected. Example: - projects/my-project/regions/us-central1/subnetworks/my-subnet - enable_intra_node_visibility (bool): - Whether Intra-node visibility is enabled for - this cluster. This makes same node pod to pod - traffic visible for VPC network. - default_snat_status (google.cloud.container_v1beta1.types.DefaultSnatStatus): - Whether the cluster disables default in-node sNAT rules. - In-node sNAT rules will be disabled when default_snat_status - is disabled. When disabled is set to false, default IP - masquerade rules will be applied to the nodes to prevent - sNAT on cluster internal traffic. - enable_l4ilb_subsetting (bool): - Whether L4ILB Subsetting is enabled for this - cluster. - datapath_provider (google.cloud.container_v1beta1.types.DatapathProvider): - The desired datapath provider for this - cluster. By default, uses the IPTables-based - kube-proxy implementation. - private_ipv6_google_access (google.cloud.container_v1beta1.types.PrivateIPv6GoogleAccess): - The desired state of IPv6 connectivity to - Google Services. By default, no private IPv6 - access to or from Google Services (all access - will be via IPv4) - dns_config (google.cloud.container_v1beta1.types.DNSConfig): - DNSConfig contains clusterDNS config for this - cluster. - service_external_ips_config (google.cloud.container_v1beta1.types.ServiceExternalIPsConfig): - ServiceExternalIPsConfig specifies if - services with externalIPs field are blocked or - not. - gateway_api_config (google.cloud.container_v1beta1.types.GatewayAPIConfig): - GatewayAPIConfig contains the desired config - of Gateway API on this cluster. - enable_multi_networking (bool): - Whether multi-networking is enabled for this - cluster. - network_performance_config (google.cloud.container_v1beta1.types.NetworkConfig.ClusterNetworkPerformanceConfig): - Network bandwidth tier configuration. - enable_fqdn_network_policy (bool): - Whether FQDN Network Policy is enabled on - this cluster. - - This field is a member of `oneof`_ ``_enable_fqdn_network_policy``. - in_transit_encryption_config (google.cloud.container_v1beta1.types.InTransitEncryptionConfig): - Specify the details of in-transit encryption. - - This field is a member of `oneof`_ ``_in_transit_encryption_config``. - enable_cilium_clusterwide_network_policy (bool): - Whether CiliumClusterWideNetworkPolicy is - enabled on this cluster. - - This field is a member of `oneof`_ ``_enable_cilium_clusterwide_network_policy``. - """ - - class ClusterNetworkPerformanceConfig(proto.Message): - r"""Configuration of all network bandwidth tiers - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - total_egress_bandwidth_tier (google.cloud.container_v1beta1.types.NetworkConfig.ClusterNetworkPerformanceConfig.Tier): - Specifies the total network bandwidth tier - for the NodePool. - - This field is a member of `oneof`_ ``_total_egress_bandwidth_tier``. - """ - class Tier(proto.Enum): - r"""Node network tier - - Values: - TIER_UNSPECIFIED (0): - Default value - TIER_1 (1): - Higher bandwidth, actual values based on VM - size. - """ - TIER_UNSPECIFIED = 0 - TIER_1 = 1 - - total_egress_bandwidth_tier: 'NetworkConfig.ClusterNetworkPerformanceConfig.Tier' = proto.Field( - proto.ENUM, - number=1, - optional=True, - enum='NetworkConfig.ClusterNetworkPerformanceConfig.Tier', - ) - - network: str = proto.Field( - proto.STRING, - number=1, - ) - subnetwork: str = proto.Field( - proto.STRING, - number=2, - ) - enable_intra_node_visibility: bool = proto.Field( - proto.BOOL, - number=5, - ) - default_snat_status: 'DefaultSnatStatus' = proto.Field( - proto.MESSAGE, - number=7, - message='DefaultSnatStatus', - ) - enable_l4ilb_subsetting: bool = proto.Field( - proto.BOOL, - number=10, - ) - datapath_provider: 'DatapathProvider' = proto.Field( - proto.ENUM, - number=11, - enum='DatapathProvider', - ) - private_ipv6_google_access: 'PrivateIPv6GoogleAccess' = proto.Field( - proto.ENUM, - number=12, - enum='PrivateIPv6GoogleAccess', - ) - dns_config: 'DNSConfig' = proto.Field( - proto.MESSAGE, - number=13, - message='DNSConfig', - ) - service_external_ips_config: 'ServiceExternalIPsConfig' = proto.Field( - proto.MESSAGE, - number=15, - message='ServiceExternalIPsConfig', - ) - gateway_api_config: 'GatewayAPIConfig' = proto.Field( - proto.MESSAGE, - number=16, - message='GatewayAPIConfig', - ) - enable_multi_networking: bool = proto.Field( - proto.BOOL, - number=17, - ) - network_performance_config: ClusterNetworkPerformanceConfig = proto.Field( - proto.MESSAGE, - number=18, - message=ClusterNetworkPerformanceConfig, - ) - enable_fqdn_network_policy: bool = proto.Field( - proto.BOOL, - number=19, - optional=True, - ) - in_transit_encryption_config: 'InTransitEncryptionConfig' = proto.Field( - proto.ENUM, - number=20, - optional=True, - enum='InTransitEncryptionConfig', - ) - enable_cilium_clusterwide_network_policy: bool = proto.Field( - proto.BOOL, - number=21, - optional=True, - ) - - -class GatewayAPIConfig(proto.Message): - r"""GatewayAPIConfig contains the desired config of Gateway API - on this cluster. - - Attributes: - channel (google.cloud.container_v1beta1.types.GatewayAPIConfig.Channel): - The Gateway API release channel to use for - Gateway API. - """ - class Channel(proto.Enum): - r"""Channel describes if/how Gateway API should be installed and - implemented in a cluster. - - Values: - CHANNEL_UNSPECIFIED (0): - Default value. - CHANNEL_DISABLED (1): - Gateway API support is disabled - CHANNEL_EXPERIMENTAL (3): - Deprecated: use CHANNEL_STANDARD instead. Gateway API - support is enabled, experimental CRDs are installed - CHANNEL_STANDARD (4): - Gateway API support is enabled, standard CRDs - are installed - """ - CHANNEL_UNSPECIFIED = 0 - CHANNEL_DISABLED = 1 - CHANNEL_EXPERIMENTAL = 3 - CHANNEL_STANDARD = 4 - - channel: Channel = proto.Field( - proto.ENUM, - number=1, - enum=Channel, - ) - - -class ServiceExternalIPsConfig(proto.Message): - r"""Config to block services with externalIPs field. - - Attributes: - enabled (bool): - Whether Services with ExternalIPs field are - allowed or not. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class ListUsableSubnetworksRequest(proto.Message): - r"""ListUsableSubnetworksRequest requests the list of usable - subnetworks. available to a user for creating clusters. - - Attributes: - parent (str): - Required. The parent project where subnetworks are usable. - Specified in the format ``projects/*``. - filter (str): - Filtering currently only supports equality on the - networkProjectId and must be in the form: - "networkProjectId=[PROJECTID]", where ``networkProjectId`` - is the project which owns the listed subnetworks. This - defaults to the parent project ID. - page_size (int): - The max number of results per page that should be returned. - If the number of available results is larger than - ``page_size``, a ``next_page_token`` is returned which can - be used to get the next page of results in subsequent - requests. Acceptable values are 0 to 500, inclusive. - (Default: 500) - page_token (str): - Specifies a page token to use. Set this to - the nextPageToken returned by previous list - requests to get the next page of results. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - filter: str = proto.Field( - proto.STRING, - number=2, - ) - page_size: int = proto.Field( - proto.INT32, - number=3, - ) - page_token: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListUsableSubnetworksResponse(proto.Message): - r"""ListUsableSubnetworksResponse is the response of - ListUsableSubnetworksRequest. - - Attributes: - subnetworks (MutableSequence[google.cloud.container_v1beta1.types.UsableSubnetwork]): - A list of usable subnetworks in the specified - network project. - next_page_token (str): - This token allows you to get the next page of results for - list requests. If the number of results is larger than - ``page_size``, use the ``next_page_token`` as a value for - the query parameter ``page_token`` in the next request. The - value will become empty when there are no more pages. - """ - - @property - def raw_page(self): - return self - - subnetworks: MutableSequence['UsableSubnetwork'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='UsableSubnetwork', - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class UsableSubnetworkSecondaryRange(proto.Message): - r"""Secondary IP range of a usable subnetwork. - - Attributes: - range_name (str): - The name associated with this subnetwork - secondary range, used when adding an alias IP - range to a VM instance. - ip_cidr_range (str): - The range of IP addresses belonging to this - subnetwork secondary range. - status (google.cloud.container_v1beta1.types.UsableSubnetworkSecondaryRange.Status): - This field is to determine the status of the - secondary range programmably. - """ - class Status(proto.Enum): - r"""Status shows the current usage of a secondary IP range. - - Values: - UNKNOWN (0): - UNKNOWN is the zero value of the Status enum. - It's not a valid status. - UNUSED (1): - UNUSED denotes that this range is unclaimed - by any cluster. - IN_USE_SERVICE (2): - IN_USE_SERVICE denotes that this range is claimed by a - cluster for services. It cannot be used for other clusters. - IN_USE_SHAREABLE_POD (3): - IN_USE_SHAREABLE_POD denotes this range was created by the - network admin and is currently claimed by a cluster for - pods. It can only be used by other clusters as a pod range. - IN_USE_MANAGED_POD (4): - IN_USE_MANAGED_POD denotes this range was created by GKE and - is claimed for pods. It cannot be used for other clusters. - """ - UNKNOWN = 0 - UNUSED = 1 - IN_USE_SERVICE = 2 - IN_USE_SHAREABLE_POD = 3 - IN_USE_MANAGED_POD = 4 - - range_name: str = proto.Field( - proto.STRING, - number=1, - ) - ip_cidr_range: str = proto.Field( - proto.STRING, - number=2, - ) - status: Status = proto.Field( - proto.ENUM, - number=3, - enum=Status, - ) - - -class UsableSubnetwork(proto.Message): - r"""UsableSubnetwork resource returns the subnetwork name, its - associated network and the primary CIDR range. - - Attributes: - subnetwork (str): - Subnetwork Name. - Example: - projects/my-project/regions/us-central1/subnetworks/my-subnet - network (str): - Network Name. - Example: - projects/my-project/global/networks/my-network - ip_cidr_range (str): - The range of internal addresses that are - owned by this subnetwork. - secondary_ip_ranges (MutableSequence[google.cloud.container_v1beta1.types.UsableSubnetworkSecondaryRange]): - Secondary IP ranges. - status_message (str): - A human readable status message representing the reasons for - cases where the caller cannot use the secondary ranges under - the subnet. For example if the secondary_ip_ranges is empty - due to a permission issue, an insufficient permission - message will be given by status_message. - """ - - subnetwork: str = proto.Field( - proto.STRING, - number=1, - ) - network: str = proto.Field( - proto.STRING, - number=2, - ) - ip_cidr_range: str = proto.Field( - proto.STRING, - number=3, - ) - secondary_ip_ranges: MutableSequence['UsableSubnetworkSecondaryRange'] = proto.RepeatedField( - proto.MESSAGE, - number=4, - message='UsableSubnetworkSecondaryRange', - ) - status_message: str = proto.Field( - proto.STRING, - number=5, - ) - - -class VerticalPodAutoscaling(proto.Message): - r"""VerticalPodAutoscaling contains global, per-cluster - information required by Vertical Pod Autoscaler to automatically - adjust the resources of pods controlled by it. - - Attributes: - enabled (bool): - Enables vertical pod autoscaling. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class DefaultSnatStatus(proto.Message): - r"""DefaultSnatStatus contains the desired state of whether - default sNAT should be disabled on the cluster. - - Attributes: - disabled (bool): - Disables cluster default sNAT rules. - """ - - disabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class IntraNodeVisibilityConfig(proto.Message): - r"""IntraNodeVisibilityConfig contains the desired config of the - intra-node visibility on this cluster. - - Attributes: - enabled (bool): - Enables intra node visibility for this - cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class ILBSubsettingConfig(proto.Message): - r"""ILBSubsettingConfig contains the desired config of L4 - Internal LoadBalancer subsetting on this cluster. - - Attributes: - enabled (bool): - Enables l4 ILB subsetting for this cluster - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class DNSConfig(proto.Message): - r"""DNSConfig contains the desired set of options for configuring - clusterDNS. - - Attributes: - cluster_dns (google.cloud.container_v1beta1.types.DNSConfig.Provider): - cluster_dns indicates which in-cluster DNS provider should - be used. - cluster_dns_scope (google.cloud.container_v1beta1.types.DNSConfig.DNSScope): - cluster_dns_scope indicates the scope of access to cluster - DNS records. - cluster_dns_domain (str): - cluster_dns_domain is the suffix used for all cluster - service records. - additive_vpc_scope_dns_domain (str): - Optional. The domain used in Additive VPC - scope. - """ - class Provider(proto.Enum): - r"""Provider lists the various in-cluster DNS providers. - - Values: - PROVIDER_UNSPECIFIED (0): - Default value - PLATFORM_DEFAULT (1): - Use GKE default DNS provider(kube-dns) for - DNS resolution. - CLOUD_DNS (2): - Use CloudDNS for DNS resolution. - KUBE_DNS (3): - Use KubeDNS for DNS resolution. - """ - PROVIDER_UNSPECIFIED = 0 - PLATFORM_DEFAULT = 1 - CLOUD_DNS = 2 - KUBE_DNS = 3 - - class DNSScope(proto.Enum): - r"""DNSScope lists the various scopes of access to cluster DNS - records. - - Values: - DNS_SCOPE_UNSPECIFIED (0): - Default value, will be inferred as cluster - scope. - CLUSTER_SCOPE (1): - DNS records are accessible from within the - cluster. - VPC_SCOPE (2): - DNS records are accessible from within the - VPC. - """ - DNS_SCOPE_UNSPECIFIED = 0 - CLUSTER_SCOPE = 1 - VPC_SCOPE = 2 - - cluster_dns: Provider = proto.Field( - proto.ENUM, - number=1, - enum=Provider, - ) - cluster_dns_scope: DNSScope = proto.Field( - proto.ENUM, - number=2, - enum=DNSScope, - ) - cluster_dns_domain: str = proto.Field( - proto.STRING, - number=3, - ) - additive_vpc_scope_dns_domain: str = proto.Field( - proto.STRING, - number=5, - ) - - -class MaxPodsConstraint(proto.Message): - r"""Constraints applied to pods. - - Attributes: - max_pods_per_node (int): - Constraint enforced on the max num of pods - per node. - """ - - max_pods_per_node: int = proto.Field( - proto.INT64, - number=1, - ) - - -class WorkloadIdentityConfig(proto.Message): - r"""Configuration for the use of Kubernetes Service Accounts in - GCP IAM policies. - - Attributes: - identity_namespace (str): - IAM Identity Namespace to attach all - Kubernetes Service Accounts to. - workload_pool (str): - The workload pool to attach all Kubernetes - service accounts to. - identity_provider (str): - identity provider is the third party identity - provider. - """ - - identity_namespace: str = proto.Field( - proto.STRING, - number=1, - ) - workload_pool: str = proto.Field( - proto.STRING, - number=2, - ) - identity_provider: str = proto.Field( - proto.STRING, - number=3, - ) - - -class WorkloadALTSConfig(proto.Message): - r"""Configuration for direct-path (via ALTS) with workload - identity. - - Attributes: - enable_alts (google.protobuf.wrappers_pb2.BoolValue): - enable_alts controls whether the alts handshaker should be - enabled or not for direct-path. - - Requires Workload Identity - ([workload_pool][google.container.v1beta1.WorkloadIdentityConfig.workload_pool] - must be non-empty). - """ - - enable_alts: wrappers_pb2.BoolValue = proto.Field( - proto.MESSAGE, - number=1, - message=wrappers_pb2.BoolValue, - ) - - -class WorkloadCertificates(proto.Message): - r"""Configuration for issuance of mTLS keys and certificates to - Kubernetes pods. - - Attributes: - enable_certificates (google.protobuf.wrappers_pb2.BoolValue): - enable_certificates controls issuance of workload mTLS - certificates. - - If set, the GKE Workload Identity Certificates controller - and node agent will be deployed in the cluster, which can - then be configured by creating a WorkloadCertificateConfig - Custom Resource. - - Requires Workload Identity - ([workload_pool][google.container.v1beta1.WorkloadIdentityConfig.workload_pool] - must be non-empty). - """ - - enable_certificates: wrappers_pb2.BoolValue = proto.Field( - proto.MESSAGE, - number=1, - message=wrappers_pb2.BoolValue, - ) - - -class MeshCertificates(proto.Message): - r"""Configuration for issuance of mTLS keys and certificates to - Kubernetes pods. - - Attributes: - enable_certificates (google.protobuf.wrappers_pb2.BoolValue): - enable_certificates controls issuance of workload mTLS - certificates. - - If set, the GKE Workload Identity Certificates controller - and node agent will be deployed in the cluster, which can - then be configured by creating a WorkloadCertificateConfig - Custom Resource. - - Requires Workload Identity - ([workload_pool][google.container.v1alpha1.WorkloadIdentityConfig.workload_pool] - must be non-empty). - """ - - enable_certificates: wrappers_pb2.BoolValue = proto.Field( - proto.MESSAGE, - number=1, - message=wrappers_pb2.BoolValue, - ) - - -class DatabaseEncryption(proto.Message): - r"""Configuration of etcd encryption. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - key_name (str): - Name of CloudKMS key to use for the - encryption of secrets in etcd. Ex. - projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key - state (google.cloud.container_v1beta1.types.DatabaseEncryption.State): - The desired state of etcd encryption. - current_state (google.cloud.container_v1beta1.types.DatabaseEncryption.CurrentState): - Output only. The current state of etcd - encryption. - - This field is a member of `oneof`_ ``_current_state``. - decryption_keys (MutableSequence[str]): - Output only. Keys in use by the cluster for decrypting - existing objects, in addition to the key in ``key_name``. - - Each item is a CloudKMS key resource. - last_operation_errors (MutableSequence[google.cloud.container_v1beta1.types.DatabaseEncryption.OperationError]): - Output only. Records errors seen during - DatabaseEncryption update operations. - """ - class State(proto.Enum): - r"""State of etcd encryption. - - Values: - UNKNOWN (0): - Should never be set - ENCRYPTED (1): - Secrets in etcd are encrypted. - DECRYPTED (2): - Secrets in etcd are stored in plain text (at - etcd level) - this is unrelated to Compute - Engine level full disk encryption. - """ - UNKNOWN = 0 - ENCRYPTED = 1 - DECRYPTED = 2 - - class CurrentState(proto.Enum): - r"""Current State of etcd encryption. - - Values: - CURRENT_STATE_UNSPECIFIED (0): - Should never be set - CURRENT_STATE_ENCRYPTED (7): - Secrets in etcd are encrypted. - CURRENT_STATE_DECRYPTED (2): - Secrets in etcd are stored in plain text (at - etcd level) - this is unrelated to Compute - Engine level full disk encryption. - CURRENT_STATE_ENCRYPTION_PENDING (3): - Encryption (or re-encryption with a different - CloudKMS key) of Secrets is in progress. - CURRENT_STATE_ENCRYPTION_ERROR (4): - Encryption (or re-encryption with a different - CloudKMS key) of Secrets in etcd encountered an - error. - CURRENT_STATE_DECRYPTION_PENDING (5): - De-crypting Secrets to plain text in etcd is - in progress. - CURRENT_STATE_DECRYPTION_ERROR (6): - De-crypting Secrets to plain text in etcd - encountered an error. - """ - CURRENT_STATE_UNSPECIFIED = 0 - CURRENT_STATE_ENCRYPTED = 7 - CURRENT_STATE_DECRYPTED = 2 - CURRENT_STATE_ENCRYPTION_PENDING = 3 - CURRENT_STATE_ENCRYPTION_ERROR = 4 - CURRENT_STATE_DECRYPTION_PENDING = 5 - CURRENT_STATE_DECRYPTION_ERROR = 6 - - class OperationError(proto.Message): - r"""OperationError records errors seen from CloudKMS keys - encountered during updates to DatabaseEncryption configuration. - - Attributes: - key_name (str): - CloudKMS key resource that had the error. - error_message (str): - Description of the error seen during the - operation. - timestamp (google.protobuf.timestamp_pb2.Timestamp): - Time when the CloudKMS error was seen. - """ - - key_name: str = proto.Field( - proto.STRING, - number=1, - ) - error_message: str = proto.Field( - proto.STRING, - number=2, - ) - timestamp: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - - key_name: str = proto.Field( - proto.STRING, - number=1, - ) - state: State = proto.Field( - proto.ENUM, - number=2, - enum=State, - ) - current_state: CurrentState = proto.Field( - proto.ENUM, - number=3, - optional=True, - enum=CurrentState, - ) - decryption_keys: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - last_operation_errors: MutableSequence[OperationError] = proto.RepeatedField( - proto.MESSAGE, - number=5, - message=OperationError, - ) - - -class ResourceUsageExportConfig(proto.Message): - r"""Configuration for exporting cluster resource usages. - - Attributes: - bigquery_destination (google.cloud.container_v1beta1.types.ResourceUsageExportConfig.BigQueryDestination): - Configuration to use BigQuery as usage export - destination. - enable_network_egress_metering (bool): - Whether to enable network egress metering for - this cluster. If enabled, a daemonset will be - created in the cluster to meter network egress - traffic. - consumption_metering_config (google.cloud.container_v1beta1.types.ResourceUsageExportConfig.ConsumptionMeteringConfig): - Configuration to enable resource consumption - metering. - """ - - class BigQueryDestination(proto.Message): - r"""Parameters for using BigQuery as the destination of resource - usage export. - - Attributes: - dataset_id (str): - The ID of a BigQuery Dataset. - """ - - dataset_id: str = proto.Field( - proto.STRING, - number=1, - ) - - class ConsumptionMeteringConfig(proto.Message): - r"""Parameters for controlling consumption metering. - - Attributes: - enabled (bool): - Whether to enable consumption metering for - this cluster. If enabled, a second BigQuery - table will be created to hold resource - consumption records. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - bigquery_destination: BigQueryDestination = proto.Field( - proto.MESSAGE, - number=1, - message=BigQueryDestination, - ) - enable_network_egress_metering: bool = proto.Field( - proto.BOOL, - number=2, - ) - consumption_metering_config: ConsumptionMeteringConfig = proto.Field( - proto.MESSAGE, - number=3, - message=ConsumptionMeteringConfig, - ) - - -class ShieldedNodes(proto.Message): - r"""Configuration of Shielded Nodes feature. - - Attributes: - enabled (bool): - Whether Shielded Nodes features are enabled - on all nodes in this cluster. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class VirtualNIC(proto.Message): - r"""Configuration of gVNIC feature. - - Attributes: - enabled (bool): - Whether gVNIC features are enabled in the - node pool. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class FastSocket(proto.Message): - r"""Configuration of Fast Socket feature. - - Attributes: - enabled (bool): - Whether Fast Socket features are enabled in - the node pool. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class GetOpenIDConfigRequest(proto.Message): - r"""GetOpenIDConfigRequest gets the OIDC discovery document for - the cluster. See the OpenID Connect Discovery 1.0 specification - for details. - - Attributes: - parent (str): - The cluster (project, location, cluster name) to get the - discovery document for. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - - -class GetOpenIDConfigResponse(proto.Message): - r"""GetOpenIDConfigResponse is an OIDC discovery document for the - cluster. See the OpenID Connect Discovery 1.0 specification for - details. - - Attributes: - issuer (str): - OIDC Issuer. - jwks_uri (str): - JSON Web Key uri. - response_types_supported (MutableSequence[str]): - Supported response types. - subject_types_supported (MutableSequence[str]): - Supported subject types. - id_token_signing_alg_values_supported (MutableSequence[str]): - supported ID Token signing Algorithms. - claims_supported (MutableSequence[str]): - Supported claims. - grant_types (MutableSequence[str]): - Supported grant types. - """ - - issuer: str = proto.Field( - proto.STRING, - number=1, - ) - jwks_uri: str = proto.Field( - proto.STRING, - number=2, - ) - response_types_supported: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - subject_types_supported: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - id_token_signing_alg_values_supported: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=5, - ) - claims_supported: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=6, - ) - grant_types: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=7, - ) - - -class GetJSONWebKeysRequest(proto.Message): - r"""GetJSONWebKeysRequest gets the public component of the keys used by - the cluster to sign token requests. This will be the jwks_uri for - the discover document returned by getOpenIDConfig. See the OpenID - Connect Discovery 1.0 specification for details. - - Attributes: - parent (str): - The cluster (project, location, cluster name) to get keys - for. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - - -class Jwk(proto.Message): - r"""Jwk is a JSON Web Key as specified in RFC 7517 - - Attributes: - kty (str): - Key Type. - alg (str): - Algorithm. - use (str): - Permitted uses for the public keys. - kid (str): - Key ID. - n (str): - Used for RSA keys. - e (str): - Used for RSA keys. - x (str): - Used for ECDSA keys. - y (str): - Used for ECDSA keys. - crv (str): - Used for ECDSA keys. - """ - - kty: str = proto.Field( - proto.STRING, - number=1, - ) - alg: str = proto.Field( - proto.STRING, - number=2, - ) - use: str = proto.Field( - proto.STRING, - number=3, - ) - kid: str = proto.Field( - proto.STRING, - number=4, - ) - n: str = proto.Field( - proto.STRING, - number=5, - ) - e: str = proto.Field( - proto.STRING, - number=6, - ) - x: str = proto.Field( - proto.STRING, - number=7, - ) - y: str = proto.Field( - proto.STRING, - number=8, - ) - crv: str = proto.Field( - proto.STRING, - number=9, - ) - - -class GetJSONWebKeysResponse(proto.Message): - r"""GetJSONWebKeysResponse is a valid JSON Web Key Set as - specififed in rfc 7517 - - Attributes: - keys (MutableSequence[google.cloud.container_v1beta1.types.Jwk]): - The public component of the keys used by the - cluster to sign token requests. - """ - - keys: MutableSequence['Jwk'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='Jwk', - ) - - -class CheckAutopilotCompatibilityRequest(proto.Message): - r"""CheckAutopilotCompatibilityRequest requests getting the - blockers for the given operation in the cluster. - - Attributes: - name (str): - The name (project, location, cluster) of the cluster to - retrieve. Specified in the format - ``projects/*/locations/*/clusters/*``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class AutopilotCompatibilityIssue(proto.Message): - r"""AutopilotCompatibilityIssue contains information about a - specific compatibility issue with Autopilot mode. - - Attributes: - last_observation (google.protobuf.timestamp_pb2.Timestamp): - The last time when this issue was observed. - constraint_type (str): - The constraint type of the issue. - incompatibility_type (google.cloud.container_v1beta1.types.AutopilotCompatibilityIssue.IssueType): - The incompatibility type of this issue. - subjects (MutableSequence[str]): - The name of the resources which are subject - to this issue. - documentation_url (str): - A URL to a public documnetation, which - addresses resolving this issue. - description (str): - The description of the issue. - """ - class IssueType(proto.Enum): - r"""The type of the reported issue. - - Values: - UNSPECIFIED (0): - Default value, should not be used. - INCOMPATIBILITY (1): - Indicates that the issue is a known - incompatibility between the cluster and - Autopilot mode. - ADDITIONAL_CONFIG_REQUIRED (2): - Indicates the issue is an incompatibility if - customers take no further action to resolve. - PASSED_WITH_OPTIONAL_CONFIG (3): - Indicates the issue is not an - incompatibility, but depending on the workloads - business logic, there is a potential that they - won't work on Autopilot. - """ - UNSPECIFIED = 0 - INCOMPATIBILITY = 1 - ADDITIONAL_CONFIG_REQUIRED = 2 - PASSED_WITH_OPTIONAL_CONFIG = 3 - - last_observation: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=1, - message=timestamp_pb2.Timestamp, - ) - constraint_type: str = proto.Field( - proto.STRING, - number=2, - ) - incompatibility_type: IssueType = proto.Field( - proto.ENUM, - number=3, - enum=IssueType, - ) - subjects: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - documentation_url: str = proto.Field( - proto.STRING, - number=5, - ) - description: str = proto.Field( - proto.STRING, - number=6, - ) - - -class CheckAutopilotCompatibilityResponse(proto.Message): - r"""CheckAutopilotCompatibilityResponse has a list of - compatibility issues. - - Attributes: - issues (MutableSequence[google.cloud.container_v1beta1.types.AutopilotCompatibilityIssue]): - The list of issues for the given operation. - summary (str): - The summary of the autopilot compatibility - response. - """ - - issues: MutableSequence['AutopilotCompatibilityIssue'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='AutopilotCompatibilityIssue', - ) - summary: str = proto.Field( - proto.STRING, - number=2, - ) - - -class ReleaseChannel(proto.Message): - r"""ReleaseChannel indicates which release channel a cluster is - subscribed to. Release channels are arranged in order of risk. - - When a cluster is subscribed to a release channel, Google - maintains both the master version and the node version. Node - auto-upgrade defaults to true and cannot be disabled. - - Attributes: - channel (google.cloud.container_v1beta1.types.ReleaseChannel.Channel): - channel specifies which release channel the - cluster is subscribed to. - """ - class Channel(proto.Enum): - r"""Possible values for 'channel'. - - Values: - UNSPECIFIED (0): - No channel specified. - RAPID (1): - RAPID channel is offered on an early access - basis for customers who want to test new - releases. - - WARNING: Versions available in the RAPID Channel - may be subject to unresolved issues with no - known workaround and are not subject to any - SLAs. - REGULAR (2): - Clusters subscribed to REGULAR receive - versions that are considered GA quality. REGULAR - is intended for production users who want to - take advantage of new features. - STABLE (3): - Clusters subscribed to STABLE receive - versions that are known to be stable and - reliable in production. - EXTENDED (4): - Clusters subscribed to EXTENDED receive - extended support and availability for versions - which are known to be stable and reliable in - production. - """ - UNSPECIFIED = 0 - RAPID = 1 - REGULAR = 2 - STABLE = 3 - EXTENDED = 4 - - channel: Channel = proto.Field( - proto.ENUM, - number=1, - enum=Channel, - ) - - -class CostManagementConfig(proto.Message): - r"""Configuration for fine-grained cost management feature. - - Attributes: - enabled (bool): - Whether the feature is enabled or not. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class TpuConfig(proto.Message): - r"""Configuration for Cloud TPU. - - Attributes: - enabled (bool): - Whether Cloud TPU integration is enabled or - not. - use_service_networking (bool): - Whether to use service networking for Cloud - TPU or not. - ipv4_cidr_block (str): - IPv4 CIDR block reserved for Cloud TPU in the - VPC. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - use_service_networking: bool = proto.Field( - proto.BOOL, - number=2, - ) - ipv4_cidr_block: str = proto.Field( - proto.STRING, - number=3, - ) - - -class Master(proto.Message): - r"""Master is the configuration for components on master. - """ - - -class AutopilotConversionStatus(proto.Message): - r"""AutopilotConversionStatus represents conversion status. - - Attributes: - state (google.cloud.container_v1beta1.types.AutopilotConversionStatus.State): - Output only. The current state of the - conversion. - """ - class State(proto.Enum): - r"""The current state of the conversion. - - Values: - STATE_UNSPECIFIED (0): - STATE_UNSPECIFIED indicates the state is unspecified. - DONE (5): - DONE indicates the conversion has been - completed. Old node pools will continue being - deleted in the background. - """ - STATE_UNSPECIFIED = 0 - DONE = 5 - - state: State = proto.Field( - proto.ENUM, - number=2, - enum=State, - ) - - -class Autopilot(proto.Message): - r"""Autopilot is the configuration for Autopilot settings on the - cluster. - - Attributes: - enabled (bool): - Enable Autopilot - workload_policy_config (google.cloud.container_v1beta1.types.WorkloadPolicyConfig): - Workload policy configuration for Autopilot. - conversion_status (google.cloud.container_v1beta1.types.AutopilotConversionStatus): - Output only. ConversionStatus shows - conversion status. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - workload_policy_config: 'WorkloadPolicyConfig' = proto.Field( - proto.MESSAGE, - number=2, - message='WorkloadPolicyConfig', - ) - conversion_status: 'AutopilotConversionStatus' = proto.Field( - proto.MESSAGE, - number=3, - message='AutopilotConversionStatus', - ) - - -class WorkloadPolicyConfig(proto.Message): - r"""WorkloadPolicyConfig is the configuration of workload policy - for autopilot clusters. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - allow_net_admin (bool): - If true, workloads can use NET_ADMIN capability. - - This field is a member of `oneof`_ ``_allow_net_admin``. - """ - - allow_net_admin: bool = proto.Field( - proto.BOOL, - number=1, - optional=True, - ) - - -class NotificationConfig(proto.Message): - r"""NotificationConfig is the configuration of notifications. - - Attributes: - pubsub (google.cloud.container_v1beta1.types.NotificationConfig.PubSub): - Notification config for Pub/Sub. - """ - class EventType(proto.Enum): - r"""Types of notifications currently supported. Can be used to - filter what notifications are sent. - - Values: - EVENT_TYPE_UNSPECIFIED (0): - Not set, will be ignored. - UPGRADE_AVAILABLE_EVENT (1): - Corresponds with UpgradeAvailableEvent. - UPGRADE_EVENT (2): - Corresponds with UpgradeEvent. - SECURITY_BULLETIN_EVENT (3): - Corresponds with SecurityBulletinEvent. - """ - EVENT_TYPE_UNSPECIFIED = 0 - UPGRADE_AVAILABLE_EVENT = 1 - UPGRADE_EVENT = 2 - SECURITY_BULLETIN_EVENT = 3 - - class PubSub(proto.Message): - r"""Pub/Sub specific notification config. - - Attributes: - enabled (bool): - Enable notifications for Pub/Sub. - topic (str): - The desired Pub/Sub topic to which notifications will be - sent by GKE. Format is - ``projects/{project}/topics/{topic}``. - filter (google.cloud.container_v1beta1.types.NotificationConfig.Filter): - Allows filtering to one or more specific - event types. If no filter is specified, or if a - filter is specified with no event types, all - event types will be sent - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - topic: str = proto.Field( - proto.STRING, - number=2, - ) - filter: 'NotificationConfig.Filter' = proto.Field( - proto.MESSAGE, - number=3, - message='NotificationConfig.Filter', - ) - - class Filter(proto.Message): - r"""Allows filtering to one or more specific event types. If - event types are present, those and only those event types will - be transmitted to the cluster. Other types will be skipped. If - no filter is specified, or no event types are present, all event - types will be sent - - Attributes: - event_type (MutableSequence[google.cloud.container_v1beta1.types.NotificationConfig.EventType]): - Event types to allowlist. - """ - - event_type: MutableSequence['NotificationConfig.EventType'] = proto.RepeatedField( - proto.ENUM, - number=1, - enum='NotificationConfig.EventType', - ) - - pubsub: PubSub = proto.Field( - proto.MESSAGE, - number=1, - message=PubSub, - ) - - -class ConfidentialNodes(proto.Message): - r"""ConfidentialNodes is configuration for the confidential nodes - feature, which makes nodes run on confidential VMs. - - Attributes: - enabled (bool): - Whether Confidential Nodes feature is - enabled. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class UpgradeEvent(proto.Message): - r"""UpgradeEvent is a notification sent to customers by the - cluster server when a resource is upgrading. - - Attributes: - resource_type (google.cloud.container_v1beta1.types.UpgradeResourceType): - The resource type that is upgrading. - operation (str): - The operation associated with this upgrade. - operation_start_time (google.protobuf.timestamp_pb2.Timestamp): - The time when the operation was started. - current_version (str): - The current version before the upgrade. - target_version (str): - The target version for the upgrade. - resource (str): - Optional relative path to the resource. For - example in node pool upgrades, the relative path - of the node pool. - """ - - resource_type: 'UpgradeResourceType' = proto.Field( - proto.ENUM, - number=1, - enum='UpgradeResourceType', - ) - operation: str = proto.Field( - proto.STRING, - number=2, - ) - operation_start_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - current_version: str = proto.Field( - proto.STRING, - number=4, - ) - target_version: str = proto.Field( - proto.STRING, - number=5, - ) - resource: str = proto.Field( - proto.STRING, - number=6, - ) - - -class UpgradeAvailableEvent(proto.Message): - r"""UpgradeAvailableEvent is a notification sent to customers - when a new available version is released. - - Attributes: - version (str): - The release version available for upgrade. - resource_type (google.cloud.container_v1beta1.types.UpgradeResourceType): - The resource type of the release version. - release_channel (google.cloud.container_v1beta1.types.ReleaseChannel): - The release channel of the version. If empty, - it means a non-channel release. - resource (str): - Optional relative path to the resource. For - example, the relative path of the node pool. - windows_versions (google.cloud.container_v1beta1.types.WindowsVersions): - Windows node versions info. - """ - - version: str = proto.Field( - proto.STRING, - number=1, - ) - resource_type: 'UpgradeResourceType' = proto.Field( - proto.ENUM, - number=2, - enum='UpgradeResourceType', - ) - release_channel: 'ReleaseChannel' = proto.Field( - proto.MESSAGE, - number=3, - message='ReleaseChannel', - ) - resource: str = proto.Field( - proto.STRING, - number=4, - ) - windows_versions: 'WindowsVersions' = proto.Field( - proto.MESSAGE, - number=5, - message='WindowsVersions', - ) - - -class SecurityBulletinEvent(proto.Message): - r"""SecurityBulletinEvent is a notification sent to customers - when a security bulletin has been posted that they are - vulnerable to. - - Attributes: - resource_type_affected (str): - The resource type (node/control plane) that - has the vulnerability. Multiple notifications (1 - notification per resource type) will be sent for - a vulnerability that affects > 1 resource type. - bulletin_id (str): - The ID of the bulletin corresponding to the - vulnerability. - cve_ids (MutableSequence[str]): - The CVEs associated with this bulletin. - severity (str): - The severity of this bulletin as it relates - to GKE. - bulletin_uri (str): - The URI link to the bulletin on the website - for more information. - brief_description (str): - A brief description of the bulletin. See the bulletin - pointed to by the bulletin_uri field for an expanded - description. - affected_supported_minors (MutableSequence[str]): - The GKE minor versions affected by this - vulnerability. - patched_versions (MutableSequence[str]): - The GKE versions where this vulnerability is - patched. - suggested_upgrade_target (str): - This represents a version selected from the patched_versions - field that the cluster receiving this notification should - most likely want to upgrade to based on its current version. - Note that if this notification is being received by a given - cluster, it means that this version is currently available - as an upgrade target in that cluster's location. - manual_steps_required (bool): - If this field is specified, it means there - are manual steps that the user must take to make - their clusters safe. - """ - - resource_type_affected: str = proto.Field( - proto.STRING, - number=1, - ) - bulletin_id: str = proto.Field( - proto.STRING, - number=2, - ) - cve_ids: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - severity: str = proto.Field( - proto.STRING, - number=4, - ) - bulletin_uri: str = proto.Field( - proto.STRING, - number=5, - ) - brief_description: str = proto.Field( - proto.STRING, - number=6, - ) - affected_supported_minors: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=7, - ) - patched_versions: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=8, - ) - suggested_upgrade_target: str = proto.Field( - proto.STRING, - number=9, - ) - manual_steps_required: bool = proto.Field( - proto.BOOL, - number=10, - ) - - -class IdentityServiceConfig(proto.Message): - r"""IdentityServiceConfig is configuration for Identity Service - which allows customers to use external identity providers with - the K8S API - - Attributes: - enabled (bool): - Whether to enable the Identity Service - component - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class LoggingConfig(proto.Message): - r"""LoggingConfig is cluster logging configuration. - - Attributes: - component_config (google.cloud.container_v1beta1.types.LoggingComponentConfig): - Logging components configuration - """ - - component_config: 'LoggingComponentConfig' = proto.Field( - proto.MESSAGE, - number=1, - message='LoggingComponentConfig', - ) - - -class LoggingComponentConfig(proto.Message): - r"""LoggingComponentConfig is cluster logging component - configuration. - - Attributes: - enable_components (MutableSequence[google.cloud.container_v1beta1.types.LoggingComponentConfig.Component]): - Select components to collect logs. An empty - set would disable all logging. - """ - class Component(proto.Enum): - r"""GKE components exposing logs - - Values: - COMPONENT_UNSPECIFIED (0): - Default value. This shouldn't be used. - SYSTEM_COMPONENTS (1): - system components - WORKLOADS (2): - workloads - APISERVER (3): - kube-apiserver - SCHEDULER (4): - kube-scheduler - CONTROLLER_MANAGER (5): - kube-controller-manager - """ - COMPONENT_UNSPECIFIED = 0 - SYSTEM_COMPONENTS = 1 - WORKLOADS = 2 - APISERVER = 3 - SCHEDULER = 4 - CONTROLLER_MANAGER = 5 - - enable_components: MutableSequence[Component] = proto.RepeatedField( - proto.ENUM, - number=1, - enum=Component, - ) - - -class RayClusterLoggingConfig(proto.Message): - r"""RayClusterLoggingConfig specifies logging configuration for - Ray clusters. - - Attributes: - enabled (bool): - Enable log collection for Ray clusters. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class MonitoringConfig(proto.Message): - r"""MonitoringConfig is cluster monitoring configuration. - - Attributes: - component_config (google.cloud.container_v1beta1.types.MonitoringComponentConfig): - Monitoring components configuration - managed_prometheus_config (google.cloud.container_v1beta1.types.ManagedPrometheusConfig): - Enable Google Cloud Managed Service for - Prometheus in the cluster. - advanced_datapath_observability_config (google.cloud.container_v1beta1.types.AdvancedDatapathObservabilityConfig): - Configuration of Advanced Datapath - Observability features. - """ - - component_config: 'MonitoringComponentConfig' = proto.Field( - proto.MESSAGE, - number=1, - message='MonitoringComponentConfig', - ) - managed_prometheus_config: 'ManagedPrometheusConfig' = proto.Field( - proto.MESSAGE, - number=2, - message='ManagedPrometheusConfig', - ) - advanced_datapath_observability_config: 'AdvancedDatapathObservabilityConfig' = proto.Field( - proto.MESSAGE, - number=3, - message='AdvancedDatapathObservabilityConfig', - ) - - -class AdvancedDatapathObservabilityConfig(proto.Message): - r"""AdvancedDatapathObservabilityConfig specifies configuration - of observability features of advanced datapath. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - enable_metrics (bool): - Expose flow metrics on nodes - relay_mode (google.cloud.container_v1beta1.types.AdvancedDatapathObservabilityConfig.RelayMode): - Method used to make Relay available - enable_relay (bool): - Enable Relay component - - This field is a member of `oneof`_ ``_enable_relay``. - """ - class RelayMode(proto.Enum): - r"""Supported Relay modes - - Values: - RELAY_MODE_UNSPECIFIED (0): - Default value. This shouldn't be used. - DISABLED (1): - disabled - INTERNAL_VPC_LB (3): - exposed via internal load balancer - EXTERNAL_LB (4): - exposed via external load balancer - """ - RELAY_MODE_UNSPECIFIED = 0 - DISABLED = 1 - INTERNAL_VPC_LB = 3 - EXTERNAL_LB = 4 - - enable_metrics: bool = proto.Field( - proto.BOOL, - number=1, - ) - relay_mode: RelayMode = proto.Field( - proto.ENUM, - number=2, - enum=RelayMode, - ) - enable_relay: bool = proto.Field( - proto.BOOL, - number=3, - optional=True, - ) - - -class RayClusterMonitoringConfig(proto.Message): - r"""RayClusterMonitoringConfig specifies monitoring configuration - for Ray clusters. - - Attributes: - enabled (bool): - Enable metrics collection for Ray clusters. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - - -class NodePoolLoggingConfig(proto.Message): - r"""NodePoolLoggingConfig specifies logging configuration for - nodepools. - - Attributes: - variant_config (google.cloud.container_v1beta1.types.LoggingVariantConfig): - Logging variant configuration. - """ - - variant_config: 'LoggingVariantConfig' = proto.Field( - proto.MESSAGE, - number=1, - message='LoggingVariantConfig', - ) - - -class LoggingVariantConfig(proto.Message): - r"""LoggingVariantConfig specifies the behaviour of the logging - component. - - Attributes: - variant (google.cloud.container_v1beta1.types.LoggingVariantConfig.Variant): - Logging variant deployed on nodes. - """ - class Variant(proto.Enum): - r"""Logging component variants. - - Values: - VARIANT_UNSPECIFIED (0): - Default value. This shouldn't be used. - DEFAULT (1): - default logging variant. - MAX_THROUGHPUT (2): - maximum logging throughput variant. - """ - VARIANT_UNSPECIFIED = 0 - DEFAULT = 1 - MAX_THROUGHPUT = 2 - - variant: Variant = proto.Field( - proto.ENUM, - number=1, - enum=Variant, - ) - - -class MonitoringComponentConfig(proto.Message): - r"""MonitoringComponentConfig is cluster monitoring component - configuration. - - Attributes: - enable_components (MutableSequence[google.cloud.container_v1beta1.types.MonitoringComponentConfig.Component]): - Select components to collect metrics. An - empty set would disable all monitoring. - """ - class Component(proto.Enum): - r"""GKE components exposing metrics - - Values: - COMPONENT_UNSPECIFIED (0): - Default value. This shouldn't be used. - SYSTEM_COMPONENTS (1): - system components - WORKLOADS (2): - Deprecated: Use Google Cloud Managed Service - for Prometheus. - APISERVER (3): - kube-apiserver - SCHEDULER (4): - kube-scheduler - CONTROLLER_MANAGER (5): - kube-controller-manager - STORAGE (7): - Storage - HPA (8): - Horizontal Pod Autoscaling - POD (9): - Pod - DAEMONSET (10): - DaemonSet - DEPLOYMENT (11): - Deployment - STATEFULSET (12): - Statefulset - CADVISOR (13): - CADVISOR - KUBELET (14): - KUBELET - DCGM (15): - NVIDIA Data Center GPU Manager (DCGM) - """ - COMPONENT_UNSPECIFIED = 0 - SYSTEM_COMPONENTS = 1 - WORKLOADS = 2 - APISERVER = 3 - SCHEDULER = 4 - CONTROLLER_MANAGER = 5 - STORAGE = 7 - HPA = 8 - POD = 9 - DAEMONSET = 10 - DEPLOYMENT = 11 - STATEFULSET = 12 - CADVISOR = 13 - KUBELET = 14 - DCGM = 15 - - enable_components: MutableSequence[Component] = proto.RepeatedField( - proto.ENUM, - number=1, - enum=Component, - ) - - -class Fleet(proto.Message): - r"""Fleet is the fleet configuration for the cluster. - - Attributes: - project (str): - The Fleet host project(project ID or project - number) where this cluster will be registered - to. This field cannot be changed after the - cluster has been registered. - membership (str): - Output only. The full resource name of the registered fleet - membership of the cluster, in the format - ``//gkehub.googleapis.com/projects/*/locations/*/memberships/*``. - pre_registered (bool): - Output only. Whether the cluster has been - registered through the fleet API. - """ - - project: str = proto.Field( - proto.STRING, - number=1, - ) - membership: str = proto.Field( - proto.STRING, - number=2, - ) - pre_registered: bool = proto.Field( - proto.BOOL, - number=3, - ) - - -class ResourceManagerTags(proto.Message): - r"""A map of resource manager tag keys and values to be attached - to the nodes for managing Compute Engine firewalls using Network - Firewall Policies. Tags must be according to specifications in - https://cloud.google.com/vpc/docs/tags-firewalls-overview#specifications. - A maximum of 5 tag key-value pairs can be specified. Existing - tags will be replaced with new values. - - Attributes: - tags (MutableMapping[str, str]): - Tags must be in one of the following formats ([KEY]=[VALUE]) - - 1. ``tagKeys/{tag_key_id}=tagValues/{tag_value_id}`` - 2. ``{org_id}/{tag_key_name}={tag_value_name}`` - 3. ``{project_id}/{tag_key_name}={tag_value_name}`` - """ - - tags: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=1, - ) - - -class EnterpriseConfig(proto.Message): - r"""EnterpriseConfig is the cluster enterprise configuration. - - Attributes: - cluster_tier (google.cloud.container_v1beta1.types.EnterpriseConfig.ClusterTier): - Output only. cluster_tier specifies the premium tier of the - cluster. - """ - class ClusterTier(proto.Enum): - r"""Premium tiers for GKE Cluster. - - Values: - CLUSTER_TIER_UNSPECIFIED (0): - CLUSTER_TIER_UNSPECIFIED is when cluster_tier is not set. - STANDARD (1): - STANDARD indicates a standard GKE cluster. - ENTERPRISE (2): - ENTERPRISE indicates a GKE Enterprise - cluster. - """ - CLUSTER_TIER_UNSPECIFIED = 0 - STANDARD = 1 - ENTERPRISE = 2 - - cluster_tier: ClusterTier = proto.Field( - proto.ENUM, - number=1, - enum=ClusterTier, - ) - - -class SecretManagerConfig(proto.Message): - r"""SecretManagerConfig is config for secret manager enablement. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - enabled (bool): - Whether the cluster is configured to use - secret manager CSI component. - - This field is a member of `oneof`_ ``_enabled``. - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - optional=True, - ) - - -class SecondaryBootDisk(proto.Message): - r"""SecondaryBootDisk represents a persistent disk attached to a - node with special configurations based on its mode. - - Attributes: - mode (google.cloud.container_v1beta1.types.SecondaryBootDisk.Mode): - Disk mode (container image cache, etc.) - disk_image (str): - Fully-qualified resource ID for an existing - disk image. - """ - class Mode(proto.Enum): - r"""Mode specifies how the secondary boot disk will be used. - This triggers mode-specified logic in the control plane. - - Values: - MODE_UNSPECIFIED (0): - MODE_UNSPECIFIED is when mode is not set. - CONTAINER_IMAGE_CACHE (1): - CONTAINER_IMAGE_CACHE is for using the secondary boot disk - as a container image cache. - """ - MODE_UNSPECIFIED = 0 - CONTAINER_IMAGE_CACHE = 1 - - mode: Mode = proto.Field( - proto.ENUM, - number=1, - enum=Mode, - ) - disk_image: str = proto.Field( - proto.STRING, - number=2, - ) - - -class SecondaryBootDiskUpdateStrategy(proto.Message): - r"""SecondaryBootDiskUpdateStrategy is a placeholder which will - be extended in the future to define different options for - updating secondary boot disks. - - """ - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/mypy.ini b/owl-bot-staging/google-cloud-container/v1beta1/mypy.ini deleted file mode 100644 index 574c5aed394b..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.7 -namespace_packages = True diff --git a/owl-bot-staging/google-cloud-container/v1beta1/noxfile.py b/owl-bot-staging/google-cloud-container/v1beta1/noxfile.py deleted file mode 100644 index 56fbc67e34dc..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/noxfile.py +++ /dev/null @@ -1,280 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 re -import shutil -import subprocess -import sys - - -import nox # type: ignore - -ALL_PYTHON = [ - "3.7", - "3.8", - "3.9", - "3.10", - "3.11", - "3.12", - "3.13", -] - -CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() - -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" -PACKAGE_NAME = 'google-cloud-container' - -BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.13" - -nox.sessions = [ - "unit", - "cover", - "mypy", - "check_lower_bounds" - # exclude update_lower_bounds from default - "docs", - "blacken", - "lint", - "prerelease_deps", -] - -@nox.session(python=ALL_PYTHON) -@nox.parametrize( - "protobuf_implementation", - [ "python", "upb", "cpp" ], -) -def unit(session, protobuf_implementation): - """Run the unit test suite.""" - - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): - session.skip("cpp implementation is not supported in python 3.11+") - - session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') - session.install('-e', '.', "-c", f"testing/constraints-{session.python}.txt") - - # Remove the 'cpp' implementation once support for Protobuf 3.x is dropped. - # The 'cpp' implementation requires Protobuf<4. - if protobuf_implementation == "cpp": - session.install("protobuf<4") - - session.run( - 'py.test', - '--quiet', - '--cov=google/cloud/container_v1beta1/', - '--cov=tests/', - '--cov-config=.coveragerc', - '--cov-report=term', - '--cov-report=html', - os.path.join('tests', 'unit', ''.join(session.posargs)), - env={ - "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, - }, - ) - -@nox.session(python=ALL_PYTHON[-1]) -@nox.parametrize( - "protobuf_implementation", - [ "python", "upb", "cpp" ], -) -def prerelease_deps(session, protobuf_implementation): - """Run the unit test suite against pre-release versions of dependencies.""" - - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): - session.skip("cpp implementation is not supported in python 3.11+") - - # Install test environment dependencies - session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') - - # Install the package without dependencies - session.install('-e', '.', '--no-deps') - - # We test the minimum dependency versions using the minimum Python - # version so the lowest python runtime that we test has a corresponding constraints - # file, located at `testing/constraints--.txt`, which contains all of the - # dependencies and extras. - with open( - CURRENT_DIRECTORY - / "testing" - / f"constraints-{ALL_PYTHON[0]}.txt", - encoding="utf-8", - ) as constraints_file: - constraints_text = constraints_file.read() - - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] - - session.install(*constraints_deps) - - prerel_deps = [ - "googleapis-common-protos", - "google-api-core", - "google-auth", - # Exclude grpcio!=1.67.0rc1 which does not support python 3.13 - "grpcio!=1.67.0rc1", - "grpcio-status", - "protobuf", - "proto-plus", - ] - - for dep in prerel_deps: - session.install("--pre", "--no-deps", "--upgrade", dep) - - # Remaining dependencies - other_deps = [ - "requests", - ] - session.install(*other_deps) - - # Print out prerelease package versions - - session.run("python", "-c", "import google.api_core; print(google.api_core.__version__)") - session.run("python", "-c", "import google.auth; print(google.auth.__version__)") - session.run("python", "-c", "import grpc; print(grpc.__version__)") - session.run( - "python", "-c", "import google.protobuf; print(google.protobuf.__version__)" - ) - session.run( - "python", "-c", "import proto; print(proto.__version__)" - ) - - session.run( - 'py.test', - '--quiet', - '--cov=google/cloud/container_v1beta1/', - '--cov=tests/', - '--cov-config=.coveragerc', - '--cov-report=term', - '--cov-report=html', - os.path.join('tests', 'unit', ''.join(session.posargs)), - env={ - "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, - }, - ) - - -@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', - '-p', - '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==7.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, - ) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_async.py deleted file mode 100644 index c1ea365a58cd..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CancelOperation -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_CancelOperation_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 import container_v1beta1 - - -async def sample_cancel_operation(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.CancelOperationRequest( - project_id="project_id_value", - zone="zone_value", - operation_id="operation_id_value", - ) - - # Make the request - await client.cancel_operation(request=request) - - -# [END container_v1beta1_generated_ClusterManager_CancelOperation_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_sync.py deleted file mode 100644 index 4feacdc1fe11..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_cancel_operation_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CancelOperation -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_CancelOperation_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 import container_v1beta1 - - -def sample_cancel_operation(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.CancelOperationRequest( - project_id="project_id_value", - zone="zone_value", - operation_id="operation_id_value", - ) - - # Make the request - client.cancel_operation(request=request) - - -# [END container_v1beta1_generated_ClusterManager_CancelOperation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py deleted file mode 100644 index db3c1832592a..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CheckAutopilotCompatibility -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_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 import container_v1beta1 - - -async def sample_check_autopilot_compatibility(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.CheckAutopilotCompatibilityRequest( - ) - - # Make the request - response = await client.check_autopilot_compatibility(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py deleted file mode 100644 index 4a28c080e6d6..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CheckAutopilotCompatibility -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_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 import container_v1beta1 - - -def sample_check_autopilot_compatibility(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.CheckAutopilotCompatibilityRequest( - ) - - # Make the request - response = client.check_autopilot_compatibility(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_async.py deleted file mode 100644 index c69e0e4a42dc..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CompleteIPRotation -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_CompleteIPRotation_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 import container_v1beta1 - - -async def sample_complete_ip_rotation(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.CompleteIPRotationRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.complete_ip_rotation(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_CompleteIPRotation_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_sync.py deleted file mode 100644 index d824eaba52e7..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_ip_rotation_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CompleteIPRotation -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_CompleteIPRotation_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 import container_v1beta1 - - -def sample_complete_ip_rotation(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.CompleteIPRotationRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.complete_ip_rotation(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_CompleteIPRotation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py deleted file mode 100644 index c632dbad5a7d..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CompleteNodePoolUpgrade -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_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 import container_v1beta1 - - -async def sample_complete_node_pool_upgrade(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.CompleteNodePoolUpgradeRequest( - ) - - # Make the request - await client.complete_node_pool_upgrade(request=request) - - -# [END container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py deleted file mode 100644 index 08190a467b84..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CompleteNodePoolUpgrade -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_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 import container_v1beta1 - - -def sample_complete_node_pool_upgrade(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.CompleteNodePoolUpgradeRequest( - ) - - # Make the request - client.complete_node_pool_upgrade(request=request) - - -# [END container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_async.py deleted file mode 100644 index 93ff9cc1bff8..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CreateCluster -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_CreateCluster_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 import container_v1beta1 - - -async def sample_create_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.CreateClusterRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = await client.create_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_CreateCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_sync.py deleted file mode 100644 index eeb6ed305223..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_cluster_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CreateCluster -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_CreateCluster_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 import container_v1beta1 - - -def sample_create_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.CreateClusterRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = client.create_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_CreateCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_async.py deleted file mode 100644 index 492590335c2a..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CreateNodePool -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_CreateNodePool_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 import container_v1beta1 - - -async def sample_create_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.CreateNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.create_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_CreateNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_sync.py deleted file mode 100644 index 7675d5dc6664..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_create_node_pool_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 CreateNodePool -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_CreateNodePool_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 import container_v1beta1 - - -def sample_create_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.CreateNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.create_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_CreateNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_async.py deleted file mode 100644 index b8c2f59d69f8..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 DeleteCluster -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_DeleteCluster_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 import container_v1beta1 - - -async def sample_delete_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.DeleteClusterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.delete_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_DeleteCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_sync.py deleted file mode 100644 index 5ad62be2c90b..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_cluster_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 DeleteCluster -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_DeleteCluster_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 import container_v1beta1 - - -def sample_delete_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.DeleteClusterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.delete_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_DeleteCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_async.py deleted file mode 100644 index 489c3f7944ca..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 DeleteNodePool -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_DeleteNodePool_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 import container_v1beta1 - - -async def sample_delete_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.DeleteNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = await client.delete_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_DeleteNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_sync.py deleted file mode 100644 index 6a2342fa5962..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_delete_node_pool_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 DeleteNodePool -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_DeleteNodePool_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 import container_v1beta1 - - -def sample_delete_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.DeleteNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = client.delete_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_DeleteNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_async.py deleted file mode 100644 index 30cfe625ee4f..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetCluster -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_GetCluster_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 import container_v1beta1 - - -async def sample_get_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.GetClusterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.get_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_GetCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_sync.py deleted file mode 100644 index 48f0058e36aa..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_cluster_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetCluster -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_GetCluster_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 import container_v1beta1 - - -def sample_get_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.GetClusterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.get_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_GetCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_async.py deleted file mode 100644 index 908801c1151d..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetJSONWebKeys -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_GetJSONWebKeys_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 import container_v1beta1 - - -async def sample_get_json_web_keys(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.GetJSONWebKeysRequest( - ) - - # Make the request - response = await client.get_json_web_keys(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_GetJSONWebKeys_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_sync.py deleted file mode 100644 index 0e0526fe6700..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_json_web_keys_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetJSONWebKeys -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_GetJSONWebKeys_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 import container_v1beta1 - - -def sample_get_json_web_keys(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.GetJSONWebKeysRequest( - ) - - # Make the request - response = client.get_json_web_keys(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_GetJSONWebKeys_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_async.py deleted file mode 100644 index 0d3387eba3fc..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetNodePool -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_GetNodePool_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 import container_v1beta1 - - -async def sample_get_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.GetNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = await client.get_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_GetNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_sync.py deleted file mode 100644 index 0d40fab15fb0..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_node_pool_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetNodePool -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_GetNodePool_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 import container_v1beta1 - - -def sample_get_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.GetNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = client.get_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_GetNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_async.py deleted file mode 100644 index f02b55b89741..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetOperation -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_GetOperation_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 import container_v1beta1 - - -async def sample_get_operation(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.GetOperationRequest( - project_id="project_id_value", - zone="zone_value", - operation_id="operation_id_value", - ) - - # Make the request - response = await client.get_operation(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_GetOperation_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_sync.py deleted file mode 100644 index 85cf497df166..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_operation_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetOperation -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_GetOperation_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 import container_v1beta1 - - -def sample_get_operation(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.GetOperationRequest( - project_id="project_id_value", - zone="zone_value", - operation_id="operation_id_value", - ) - - # Make the request - response = client.get_operation(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_GetOperation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_async.py deleted file mode 100644 index 970ee5759f2a..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetServerConfig -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_GetServerConfig_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 import container_v1beta1 - - -async def sample_get_server_config(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.GetServerConfigRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = await client.get_server_config(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_GetServerConfig_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_sync.py deleted file mode 100644 index c5283c85267d..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_get_server_config_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 GetServerConfig -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_GetServerConfig_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 import container_v1beta1 - - -def sample_get_server_config(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.GetServerConfigRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = client.get_server_config(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_GetServerConfig_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_async.py deleted file mode 100644 index 8de8ac39ab9f..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListClusters -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_ListClusters_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 import container_v1beta1 - - -async def sample_list_clusters(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.ListClustersRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = await client.list_clusters(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_ListClusters_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_sync.py deleted file mode 100644 index f61bf48bec55..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_clusters_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListClusters -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_ListClusters_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 import container_v1beta1 - - -def sample_list_clusters(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.ListClustersRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = client.list_clusters(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_ListClusters_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_async.py deleted file mode 100644 index aedd9c4d796a..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListLocations -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_ListLocations_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 import container_v1beta1 - - -async def sample_list_locations(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.ListLocationsRequest( - parent="parent_value", - ) - - # Make the request - response = await client.list_locations(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_ListLocations_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_sync.py deleted file mode 100644 index 3dbd04439d82..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_locations_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListLocations -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_ListLocations_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 import container_v1beta1 - - -def sample_list_locations(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.ListLocationsRequest( - parent="parent_value", - ) - - # Make the request - response = client.list_locations(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_ListLocations_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_async.py deleted file mode 100644 index 450a160a14be..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListNodePools -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_ListNodePools_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 import container_v1beta1 - - -async def sample_list_node_pools(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.ListNodePoolsRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.list_node_pools(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_ListNodePools_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_sync.py deleted file mode 100644 index 74e78ae94303..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_node_pools_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListNodePools -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_ListNodePools_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 import container_v1beta1 - - -def sample_list_node_pools(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.ListNodePoolsRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.list_node_pools(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_ListNodePools_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_async.py deleted file mode 100644 index 76f947e78a73..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListOperations -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_ListOperations_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 import container_v1beta1 - - -async def sample_list_operations(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.ListOperationsRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = await client.list_operations(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_ListOperations_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_sync.py deleted file mode 100644 index 916dcfb14964..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_operations_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListOperations -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_ListOperations_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 import container_v1beta1 - - -def sample_list_operations(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.ListOperationsRequest( - project_id="project_id_value", - zone="zone_value", - ) - - # Make the request - response = client.list_operations(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_ListOperations_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_async.py deleted file mode 100644 index 1bb6f99ff5a5..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListUsableSubnetworks -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_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 import container_v1beta1 - - -async def sample_list_usable_subnetworks(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.ListUsableSubnetworksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_usable_subnetworks(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_sync.py deleted file mode 100644 index 286e0deed75a..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_list_usable_subnetworks_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 ListUsableSubnetworks -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_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 import container_v1beta1 - - -def sample_list_usable_subnetworks(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.ListUsableSubnetworksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_usable_subnetworks(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_async.py deleted file mode 100644 index 91d25a9dca95..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 RollbackNodePoolUpgrade -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_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 import container_v1beta1 - - -async def sample_rollback_node_pool_upgrade(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.RollbackNodePoolUpgradeRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = await client.rollback_node_pool_upgrade(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py deleted file mode 100644 index 6c1ebcfe084c..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 RollbackNodePoolUpgrade -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_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 import container_v1beta1 - - -def sample_rollback_node_pool_upgrade(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.RollbackNodePoolUpgradeRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = client.rollback_node_pool_upgrade(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_async.py deleted file mode 100644 index a77709da3037..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetAddonsConfig -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetAddonsConfig_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 import container_v1beta1 - - -async def sample_set_addons_config(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetAddonsConfigRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.set_addons_config(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetAddonsConfig_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_sync.py deleted file mode 100644 index 70a4f122f8b2..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_addons_config_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetAddonsConfig -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetAddonsConfig_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 import container_v1beta1 - - -def sample_set_addons_config(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetAddonsConfigRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.set_addons_config(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetAddonsConfig_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_async.py deleted file mode 100644 index 5d6ba506002c..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLabels -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetLabels_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 import container_v1beta1 - - -async def sample_set_labels(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLabelsRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - label_fingerprint="label_fingerprint_value", - ) - - # Make the request - response = await client.set_labels(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetLabels_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_sync.py deleted file mode 100644 index 046ae80a1cd9..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_labels_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLabels -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetLabels_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 import container_v1beta1 - - -def sample_set_labels(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLabelsRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - label_fingerprint="label_fingerprint_value", - ) - - # Make the request - response = client.set_labels(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetLabels_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_async.py deleted file mode 100644 index 8d8e3c574225..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLegacyAbac -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetLegacyAbac_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 import container_v1beta1 - - -async def sample_set_legacy_abac(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLegacyAbacRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - enabled=True, - ) - - # Make the request - response = await client.set_legacy_abac(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetLegacyAbac_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_sync.py deleted file mode 100644 index ab5375941d99..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_legacy_abac_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLegacyAbac -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetLegacyAbac_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 import container_v1beta1 - - -def sample_set_legacy_abac(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLegacyAbacRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - enabled=True, - ) - - # Make the request - response = client.set_legacy_abac(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetLegacyAbac_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_async.py deleted file mode 100644 index 85b77c9f3ec3..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLocations -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetLocations_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 import container_v1beta1 - - -async def sample_set_locations(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLocationsRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - locations=['locations_value1', 'locations_value2'], - ) - - # Make the request - response = await client.set_locations(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetLocations_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_sync.py deleted file mode 100644 index b75e4845bdc6..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_locations_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLocations -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetLocations_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 import container_v1beta1 - - -def sample_set_locations(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLocationsRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - locations=['locations_value1', 'locations_value2'], - ) - - # Make the request - response = client.set_locations(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetLocations_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_async.py deleted file mode 100644 index 06af3ddf004b..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLoggingService -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetLoggingService_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 import container_v1beta1 - - -async def sample_set_logging_service(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLoggingServiceRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - logging_service="logging_service_value", - ) - - # Make the request - response = await client.set_logging_service(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetLoggingService_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_sync.py deleted file mode 100644 index f50d24b82e6d..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_logging_service_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetLoggingService -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetLoggingService_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 import container_v1beta1 - - -def sample_set_logging_service(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetLoggingServiceRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - logging_service="logging_service_value", - ) - - # Make the request - response = client.set_logging_service(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetLoggingService_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_async.py deleted file mode 100644 index c57e1468731a..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetMaintenancePolicy -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_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 import container_v1beta1 - - -async def sample_set_maintenance_policy(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetMaintenancePolicyRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.set_maintenance_policy(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_sync.py deleted file mode 100644 index f55224117345..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_maintenance_policy_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetMaintenancePolicy -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_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 import container_v1beta1 - - -def sample_set_maintenance_policy(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetMaintenancePolicyRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.set_maintenance_policy(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_async.py deleted file mode 100644 index 078eedc19f68..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetMasterAuth -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetMasterAuth_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 import container_v1beta1 - - -async def sample_set_master_auth(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetMasterAuthRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - action="SET_USERNAME", - ) - - # Make the request - response = await client.set_master_auth(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetMasterAuth_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_sync.py deleted file mode 100644 index 0b352a531d24..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_master_auth_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetMasterAuth -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetMasterAuth_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 import container_v1beta1 - - -def sample_set_master_auth(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetMasterAuthRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - action="SET_USERNAME", - ) - - # Make the request - response = client.set_master_auth(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetMasterAuth_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_async.py deleted file mode 100644 index 8b6bbcef8829..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetMonitoringService -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetMonitoringService_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 import container_v1beta1 - - -async def sample_set_monitoring_service(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetMonitoringServiceRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - monitoring_service="monitoring_service_value", - ) - - # Make the request - response = await client.set_monitoring_service(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetMonitoringService_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_sync.py deleted file mode 100644 index 05bd4ce3d8cf..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_monitoring_service_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetMonitoringService -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetMonitoringService_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 import container_v1beta1 - - -def sample_set_monitoring_service(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetMonitoringServiceRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - monitoring_service="monitoring_service_value", - ) - - # Make the request - response = client.set_monitoring_service(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetMonitoringService_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_async.py deleted file mode 100644 index 360642acb5b5..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNetworkPolicy -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetNetworkPolicy_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 import container_v1beta1 - - -async def sample_set_network_policy(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNetworkPolicyRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.set_network_policy(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetNetworkPolicy_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_sync.py deleted file mode 100644 index cd9551639b17..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_network_policy_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNetworkPolicy -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetNetworkPolicy_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 import container_v1beta1 - - -def sample_set_network_policy(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNetworkPolicyRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.set_network_policy(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetNetworkPolicy_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_async.py deleted file mode 100644 index 34b65cd7461e..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNodePoolAutoscaling -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_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 import container_v1beta1 - - -async def sample_set_node_pool_autoscaling(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNodePoolAutoscalingRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = await client.set_node_pool_autoscaling(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_sync.py deleted file mode 100644 index 78a7e8f4e631..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNodePoolAutoscaling -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_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 import container_v1beta1 - - -def sample_set_node_pool_autoscaling(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNodePoolAutoscalingRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = client.set_node_pool_autoscaling(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_async.py deleted file mode 100644 index 0d8fafdf74d1..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNodePoolManagement -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetNodePoolManagement_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 import container_v1beta1 - - -async def sample_set_node_pool_management(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNodePoolManagementRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = await client.set_node_pool_management(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetNodePoolManagement_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_sync.py deleted file mode 100644 index d4a1c065ece5..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_management_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNodePoolManagement -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetNodePoolManagement_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 import container_v1beta1 - - -def sample_set_node_pool_management(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNodePoolManagementRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - ) - - # Make the request - response = client.set_node_pool_management(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetNodePoolManagement_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_async.py deleted file mode 100644 index 892d141e9c68..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNodePoolSize -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetNodePoolSize_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 import container_v1beta1 - - -async def sample_set_node_pool_size(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNodePoolSizeRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - node_count=1070, - ) - - # Make the request - response = await client.set_node_pool_size(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetNodePoolSize_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_sync.py deleted file mode 100644 index bc9b343ab962..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_set_node_pool_size_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 SetNodePoolSize -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_SetNodePoolSize_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 import container_v1beta1 - - -def sample_set_node_pool_size(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.SetNodePoolSizeRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - node_count=1070, - ) - - # Make the request - response = client.set_node_pool_size(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_SetNodePoolSize_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_async.py deleted file mode 100644 index 9c846b9cdcbe..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 StartIPRotation -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_StartIPRotation_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 import container_v1beta1 - - -async def sample_start_ip_rotation(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.StartIPRotationRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.start_ip_rotation(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_StartIPRotation_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_sync.py deleted file mode 100644 index dfe296ab6db3..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_start_ip_rotation_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 StartIPRotation -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_StartIPRotation_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 import container_v1beta1 - - -def sample_start_ip_rotation(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.StartIPRotationRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.start_ip_rotation(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_StartIPRotation_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_async.py deleted file mode 100644 index a8a5fb1bc41f..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 UpdateCluster -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_UpdateCluster_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 import container_v1beta1 - - -async def sample_update_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.UpdateClusterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = await client.update_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_UpdateCluster_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_sync.py deleted file mode 100644 index 3d8090ea9526..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_cluster_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 UpdateCluster -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_UpdateCluster_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 import container_v1beta1 - - -def sample_update_cluster(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.UpdateClusterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - ) - - # Make the request - response = client.update_cluster(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_UpdateCluster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_async.py deleted file mode 100644 index d802e8f2d3e3..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 UpdateMaster -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_UpdateMaster_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 import container_v1beta1 - - -async def sample_update_master(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.UpdateMasterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - master_version="master_version_value", - ) - - # Make the request - response = await client.update_master(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_UpdateMaster_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_sync.py deleted file mode 100644 index a47f3aaa5e99..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_master_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 UpdateMaster -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_UpdateMaster_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 import container_v1beta1 - - -def sample_update_master(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.UpdateMasterRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - master_version="master_version_value", - ) - - # Make the request - response = client.update_master(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_UpdateMaster_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_async.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_async.py deleted file mode 100644 index e3bb4c1aedba..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 UpdateNodePool -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_UpdateNodePool_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 import container_v1beta1 - - -async def sample_update_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerAsyncClient() - - # Initialize request argument(s) - request = container_v1beta1.UpdateNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - node_version="node_version_value", - image_type="image_type_value", - ) - - # Make the request - response = await client.update_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_UpdateNodePool_async] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_sync.py b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_sync.py deleted file mode 100644 index 3c7ee0c68e78..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/container_v1beta1_generated_cluster_manager_update_node_pool_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 UpdateNodePool -# 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-container - - -# [START container_v1beta1_generated_ClusterManager_UpdateNodePool_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 import container_v1beta1 - - -def sample_update_node_pool(): - # Create a client - client = container_v1beta1.ClusterManagerClient() - - # Initialize request argument(s) - request = container_v1beta1.UpdateNodePoolRequest( - project_id="project_id_value", - zone="zone_value", - cluster_id="cluster_id_value", - node_pool_id="node_pool_id_value", - node_version="node_version_value", - image_type="image_type_value", - ) - - # Make the request - response = client.update_node_pool(request=request) - - # Handle the response - print(response) - -# [END container_v1beta1_generated_ClusterManager_UpdateNodePool_sync] diff --git a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/snippet_metadata_google.container.v1beta1.json b/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/snippet_metadata_google.container.v1beta1.json deleted file mode 100644 index a1b63076c321..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/samples/generated_samples/snippet_metadata_google.container.v1beta1.json +++ /dev/null @@ -1,6110 +0,0 @@ -{ - "clientLibrary": { - "apis": [ - { - "id": "google.container.v1beta1", - "version": "v1beta1" - } - ], - "language": "PYTHON", - "name": "google-cloud-container", - "version": "0.1.0" - }, - "snippets": [ - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.cancel_operation", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.CancelOperation", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CancelOperation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.CancelOperationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "operation_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "shortName": "cancel_operation" - }, - "description": "Sample for CancelOperation", - "file": "container_v1beta1_generated_cluster_manager_cancel_operation_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_CancelOperation_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_cancel_operation_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.cancel_operation", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.CancelOperation", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CancelOperation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.CancelOperationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "operation_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "shortName": "cancel_operation" - }, - "description": "Sample for CancelOperation", - "file": "container_v1beta1_generated_cluster_manager_cancel_operation_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_CancelOperation_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_cancel_operation_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.check_autopilot_compatibility", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.CheckAutopilotCompatibility", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CheckAutopilotCompatibility" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityResponse", - "shortName": "check_autopilot_compatibility" - }, - "description": "Sample for CheckAutopilotCompatibility", - "file": "container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.check_autopilot_compatibility", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.CheckAutopilotCompatibility", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CheckAutopilotCompatibility" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityResponse", - "shortName": "check_autopilot_compatibility" - }, - "description": "Sample for CheckAutopilotCompatibility", - "file": "container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.complete_ip_rotation", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.CompleteIPRotation", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CompleteIPRotation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.CompleteIPRotationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "complete_ip_rotation" - }, - "description": "Sample for CompleteIPRotation", - "file": "container_v1beta1_generated_cluster_manager_complete_ip_rotation_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_CompleteIPRotation_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_complete_ip_rotation_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.complete_ip_rotation", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.CompleteIPRotation", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CompleteIPRotation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.CompleteIPRotationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "complete_ip_rotation" - }, - "description": "Sample for CompleteIPRotation", - "file": "container_v1beta1_generated_cluster_manager_complete_ip_rotation_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_CompleteIPRotation_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_complete_ip_rotation_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.complete_node_pool_upgrade", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.CompleteNodePoolUpgrade", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CompleteNodePoolUpgrade" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.CompleteNodePoolUpgradeRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "shortName": "complete_node_pool_upgrade" - }, - "description": "Sample for CompleteNodePoolUpgrade", - "file": "container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async", - "segments": [ - { - "end": 48, - "start": 27, - "type": "FULL" - }, - { - "end": 48, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.complete_node_pool_upgrade", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.CompleteNodePoolUpgrade", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CompleteNodePoolUpgrade" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.CompleteNodePoolUpgradeRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "shortName": "complete_node_pool_upgrade" - }, - "description": "Sample for CompleteNodePoolUpgrade", - "file": "container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_sync", - "segments": [ - { - "end": 48, - "start": 27, - "type": "FULL" - }, - { - "end": 48, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.create_cluster", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.CreateCluster", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CreateCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.CreateClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster", - "type": "google.cloud.container_v1beta1.types.Cluster" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "create_cluster" - }, - "description": "Sample for CreateCluster", - "file": "container_v1beta1_generated_cluster_manager_create_cluster_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_CreateCluster_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": "container_v1beta1_generated_cluster_manager_create_cluster_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.create_cluster", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.CreateCluster", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CreateCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.CreateClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster", - "type": "google.cloud.container_v1beta1.types.Cluster" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "create_cluster" - }, - "description": "Sample for CreateCluster", - "file": "container_v1beta1_generated_cluster_manager_create_cluster_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_CreateCluster_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": "container_v1beta1_generated_cluster_manager_create_cluster_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.create_node_pool", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.CreateNodePool", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CreateNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.CreateNodePoolRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool", - "type": "google.cloud.container_v1beta1.types.NodePool" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "create_node_pool" - }, - "description": "Sample for CreateNodePool", - "file": "container_v1beta1_generated_cluster_manager_create_node_pool_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_CreateNodePool_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_create_node_pool_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.create_node_pool", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.CreateNodePool", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "CreateNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.CreateNodePoolRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool", - "type": "google.cloud.container_v1beta1.types.NodePool" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "create_node_pool" - }, - "description": "Sample for CreateNodePool", - "file": "container_v1beta1_generated_cluster_manager_create_node_pool_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_CreateNodePool_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_create_node_pool_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.delete_cluster", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.DeleteCluster", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "DeleteCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.DeleteClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "delete_cluster" - }, - "description": "Sample for DeleteCluster", - "file": "container_v1beta1_generated_cluster_manager_delete_cluster_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_DeleteCluster_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_delete_cluster_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.delete_cluster", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.DeleteCluster", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "DeleteCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.DeleteClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "delete_cluster" - }, - "description": "Sample for DeleteCluster", - "file": "container_v1beta1_generated_cluster_manager_delete_cluster_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_DeleteCluster_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_delete_cluster_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.delete_node_pool", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.DeleteNodePool", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "DeleteNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.DeleteNodePoolRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "delete_node_pool" - }, - "description": "Sample for DeleteNodePool", - "file": "container_v1beta1_generated_cluster_manager_delete_node_pool_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_DeleteNodePool_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": "container_v1beta1_generated_cluster_manager_delete_node_pool_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.delete_node_pool", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.DeleteNodePool", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "DeleteNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.DeleteNodePoolRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "delete_node_pool" - }, - "description": "Sample for DeleteNodePool", - "file": "container_v1beta1_generated_cluster_manager_delete_node_pool_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_DeleteNodePool_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": "container_v1beta1_generated_cluster_manager_delete_node_pool_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.get_cluster", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.GetCluster", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.GetClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Cluster", - "shortName": "get_cluster" - }, - "description": "Sample for GetCluster", - "file": "container_v1beta1_generated_cluster_manager_get_cluster_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_GetCluster_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_get_cluster_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.get_cluster", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.GetCluster", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.GetClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Cluster", - "shortName": "get_cluster" - }, - "description": "Sample for GetCluster", - "file": "container_v1beta1_generated_cluster_manager_get_cluster_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_GetCluster_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_get_cluster_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.get_json_web_keys", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.GetJSONWebKeys", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetJSONWebKeys" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.GetJSONWebKeysRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.GetJSONWebKeysResponse", - "shortName": "get_json_web_keys" - }, - "description": "Sample for GetJSONWebKeys", - "file": "container_v1beta1_generated_cluster_manager_get_json_web_keys_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_GetJSONWebKeys_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_get_json_web_keys_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.get_json_web_keys", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.GetJSONWebKeys", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetJSONWebKeys" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.GetJSONWebKeysRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.GetJSONWebKeysResponse", - "shortName": "get_json_web_keys" - }, - "description": "Sample for GetJSONWebKeys", - "file": "container_v1beta1_generated_cluster_manager_get_json_web_keys_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_GetJSONWebKeys_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_get_json_web_keys_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.get_node_pool", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.GetNodePool", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.GetNodePoolRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.NodePool", - "shortName": "get_node_pool" - }, - "description": "Sample for GetNodePool", - "file": "container_v1beta1_generated_cluster_manager_get_node_pool_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_GetNodePool_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": "container_v1beta1_generated_cluster_manager_get_node_pool_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.get_node_pool", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.GetNodePool", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.GetNodePoolRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.NodePool", - "shortName": "get_node_pool" - }, - "description": "Sample for GetNodePool", - "file": "container_v1beta1_generated_cluster_manager_get_node_pool_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_GetNodePool_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": "container_v1beta1_generated_cluster_manager_get_node_pool_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.get_operation", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.GetOperation", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetOperation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.GetOperationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "operation_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "get_operation" - }, - "description": "Sample for GetOperation", - "file": "container_v1beta1_generated_cluster_manager_get_operation_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_GetOperation_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_get_operation_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.get_operation", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.GetOperation", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetOperation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.GetOperationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "operation_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "get_operation" - }, - "description": "Sample for GetOperation", - "file": "container_v1beta1_generated_cluster_manager_get_operation_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_GetOperation_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_get_operation_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.get_server_config", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.GetServerConfig", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetServerConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.GetServerConfigRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.ServerConfig", - "shortName": "get_server_config" - }, - "description": "Sample for GetServerConfig", - "file": "container_v1beta1_generated_cluster_manager_get_server_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_GetServerConfig_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": "container_v1beta1_generated_cluster_manager_get_server_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.get_server_config", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.GetServerConfig", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "GetServerConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.GetServerConfigRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.ServerConfig", - "shortName": "get_server_config" - }, - "description": "Sample for GetServerConfig", - "file": "container_v1beta1_generated_cluster_manager_get_server_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_GetServerConfig_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": "container_v1beta1_generated_cluster_manager_get_server_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.list_clusters", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.ListClusters", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListClusters" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.ListClustersRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.ListClustersResponse", - "shortName": "list_clusters" - }, - "description": "Sample for ListClusters", - "file": "container_v1beta1_generated_cluster_manager_list_clusters_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_ListClusters_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": "container_v1beta1_generated_cluster_manager_list_clusters_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.list_clusters", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.ListClusters", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListClusters" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.ListClustersRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.ListClustersResponse", - "shortName": "list_clusters" - }, - "description": "Sample for ListClusters", - "file": "container_v1beta1_generated_cluster_manager_list_clusters_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_ListClusters_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": "container_v1beta1_generated_cluster_manager_list_clusters_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.list_locations", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.ListLocations", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListLocations" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.ListLocationsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.ListLocationsResponse", - "shortName": "list_locations" - }, - "description": "Sample for ListLocations", - "file": "container_v1beta1_generated_cluster_manager_list_locations_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_ListLocations_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": "container_v1beta1_generated_cluster_manager_list_locations_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.list_locations", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.ListLocations", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListLocations" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.ListLocationsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.ListLocationsResponse", - "shortName": "list_locations" - }, - "description": "Sample for ListLocations", - "file": "container_v1beta1_generated_cluster_manager_list_locations_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_ListLocations_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": "container_v1beta1_generated_cluster_manager_list_locations_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.list_node_pools", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.ListNodePools", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListNodePools" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.ListNodePoolsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.ListNodePoolsResponse", - "shortName": "list_node_pools" - }, - "description": "Sample for ListNodePools", - "file": "container_v1beta1_generated_cluster_manager_list_node_pools_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_ListNodePools_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_list_node_pools_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.list_node_pools", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.ListNodePools", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListNodePools" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.ListNodePoolsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.ListNodePoolsResponse", - "shortName": "list_node_pools" - }, - "description": "Sample for ListNodePools", - "file": "container_v1beta1_generated_cluster_manager_list_node_pools_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_ListNodePools_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_list_node_pools_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.list_operations", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.ListOperations", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListOperations" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.ListOperationsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.ListOperationsResponse", - "shortName": "list_operations" - }, - "description": "Sample for ListOperations", - "file": "container_v1beta1_generated_cluster_manager_list_operations_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_ListOperations_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": "container_v1beta1_generated_cluster_manager_list_operations_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.list_operations", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.ListOperations", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListOperations" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.ListOperationsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.ListOperationsResponse", - "shortName": "list_operations" - }, - "description": "Sample for ListOperations", - "file": "container_v1beta1_generated_cluster_manager_list_operations_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_ListOperations_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": "container_v1beta1_generated_cluster_manager_list_operations_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.list_usable_subnetworks", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.ListUsableSubnetworks", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListUsableSubnetworks" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.ListUsableSubnetworksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.services.cluster_manager.pagers.ListUsableSubnetworksAsyncPager", - "shortName": "list_usable_subnetworks" - }, - "description": "Sample for ListUsableSubnetworks", - "file": "container_v1beta1_generated_cluster_manager_list_usable_subnetworks_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_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": "container_v1beta1_generated_cluster_manager_list_usable_subnetworks_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.list_usable_subnetworks", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.ListUsableSubnetworks", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "ListUsableSubnetworks" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.ListUsableSubnetworksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.services.cluster_manager.pagers.ListUsableSubnetworksPager", - "shortName": "list_usable_subnetworks" - }, - "description": "Sample for ListUsableSubnetworks", - "file": "container_v1beta1_generated_cluster_manager_list_usable_subnetworks_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_ListUsableSubnetworks_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": "container_v1beta1_generated_cluster_manager_list_usable_subnetworks_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.rollback_node_pool_upgrade", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.RollbackNodePoolUpgrade", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "RollbackNodePoolUpgrade" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.RollbackNodePoolUpgradeRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "rollback_node_pool_upgrade" - }, - "description": "Sample for RollbackNodePoolUpgrade", - "file": "container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_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": "container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.rollback_node_pool_upgrade", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.RollbackNodePoolUpgrade", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "RollbackNodePoolUpgrade" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.RollbackNodePoolUpgradeRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "rollback_node_pool_upgrade" - }, - "description": "Sample for RollbackNodePoolUpgrade", - "file": "container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_RollbackNodePoolUpgrade_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": "container_v1beta1_generated_cluster_manager_rollback_node_pool_upgrade_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_addons_config", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetAddonsConfig", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetAddonsConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetAddonsConfigRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "addons_config", - "type": "google.cloud.container_v1beta1.types.AddonsConfig" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_addons_config" - }, - "description": "Sample for SetAddonsConfig", - "file": "container_v1beta1_generated_cluster_manager_set_addons_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetAddonsConfig_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_set_addons_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_addons_config", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetAddonsConfig", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetAddonsConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetAddonsConfigRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "addons_config", - "type": "google.cloud.container_v1beta1.types.AddonsConfig" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_addons_config" - }, - "description": "Sample for SetAddonsConfig", - "file": "container_v1beta1_generated_cluster_manager_set_addons_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetAddonsConfig_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_set_addons_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_labels", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetLabels", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLabels" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetLabelsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "resource_labels", - "type": "MutableMapping[str, str]" - }, - { - "name": "label_fingerprint", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_labels" - }, - "description": "Sample for SetLabels", - "file": "container_v1beta1_generated_cluster_manager_set_labels_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetLabels_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": "container_v1beta1_generated_cluster_manager_set_labels_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_labels", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetLabels", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLabels" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetLabelsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "resource_labels", - "type": "MutableMapping[str, str]" - }, - { - "name": "label_fingerprint", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_labels" - }, - "description": "Sample for SetLabels", - "file": "container_v1beta1_generated_cluster_manager_set_labels_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetLabels_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": "container_v1beta1_generated_cluster_manager_set_labels_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_legacy_abac", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetLegacyAbac", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLegacyAbac" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetLegacyAbacRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "enabled", - "type": "bool" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_legacy_abac" - }, - "description": "Sample for SetLegacyAbac", - "file": "container_v1beta1_generated_cluster_manager_set_legacy_abac_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetLegacyAbac_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": "container_v1beta1_generated_cluster_manager_set_legacy_abac_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_legacy_abac", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetLegacyAbac", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLegacyAbac" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetLegacyAbacRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "enabled", - "type": "bool" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_legacy_abac" - }, - "description": "Sample for SetLegacyAbac", - "file": "container_v1beta1_generated_cluster_manager_set_legacy_abac_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetLegacyAbac_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": "container_v1beta1_generated_cluster_manager_set_legacy_abac_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_locations", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetLocations", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLocations" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetLocationsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "locations", - "type": "MutableSequence[str]" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_locations" - }, - "description": "Sample for SetLocations", - "file": "container_v1beta1_generated_cluster_manager_set_locations_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetLocations_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": "container_v1beta1_generated_cluster_manager_set_locations_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_locations", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetLocations", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLocations" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetLocationsRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "locations", - "type": "MutableSequence[str]" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_locations" - }, - "description": "Sample for SetLocations", - "file": "container_v1beta1_generated_cluster_manager_set_locations_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetLocations_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": "container_v1beta1_generated_cluster_manager_set_locations_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_logging_service", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetLoggingService", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLoggingService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetLoggingServiceRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "logging_service", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_logging_service" - }, - "description": "Sample for SetLoggingService", - "file": "container_v1beta1_generated_cluster_manager_set_logging_service_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetLoggingService_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": "container_v1beta1_generated_cluster_manager_set_logging_service_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_logging_service", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetLoggingService", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetLoggingService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetLoggingServiceRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "logging_service", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_logging_service" - }, - "description": "Sample for SetLoggingService", - "file": "container_v1beta1_generated_cluster_manager_set_logging_service_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetLoggingService_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": "container_v1beta1_generated_cluster_manager_set_logging_service_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_maintenance_policy", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetMaintenancePolicy", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetMaintenancePolicy" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetMaintenancePolicyRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "maintenance_policy", - "type": "google.cloud.container_v1beta1.types.MaintenancePolicy" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_maintenance_policy" - }, - "description": "Sample for SetMaintenancePolicy", - "file": "container_v1beta1_generated_cluster_manager_set_maintenance_policy_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_set_maintenance_policy_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_maintenance_policy", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetMaintenancePolicy", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetMaintenancePolicy" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetMaintenancePolicyRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "maintenance_policy", - "type": "google.cloud.container_v1beta1.types.MaintenancePolicy" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_maintenance_policy" - }, - "description": "Sample for SetMaintenancePolicy", - "file": "container_v1beta1_generated_cluster_manager_set_maintenance_policy_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetMaintenancePolicy_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_set_maintenance_policy_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_master_auth", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetMasterAuth", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetMasterAuth" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetMasterAuthRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_master_auth" - }, - "description": "Sample for SetMasterAuth", - "file": "container_v1beta1_generated_cluster_manager_set_master_auth_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetMasterAuth_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": "container_v1beta1_generated_cluster_manager_set_master_auth_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_master_auth", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetMasterAuth", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetMasterAuth" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetMasterAuthRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_master_auth" - }, - "description": "Sample for SetMasterAuth", - "file": "container_v1beta1_generated_cluster_manager_set_master_auth_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetMasterAuth_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": "container_v1beta1_generated_cluster_manager_set_master_auth_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_monitoring_service", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetMonitoringService", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetMonitoringService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetMonitoringServiceRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "monitoring_service", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_monitoring_service" - }, - "description": "Sample for SetMonitoringService", - "file": "container_v1beta1_generated_cluster_manager_set_monitoring_service_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetMonitoringService_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": "container_v1beta1_generated_cluster_manager_set_monitoring_service_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_monitoring_service", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetMonitoringService", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetMonitoringService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetMonitoringServiceRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "monitoring_service", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_monitoring_service" - }, - "description": "Sample for SetMonitoringService", - "file": "container_v1beta1_generated_cluster_manager_set_monitoring_service_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetMonitoringService_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": "container_v1beta1_generated_cluster_manager_set_monitoring_service_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_network_policy", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetNetworkPolicy", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNetworkPolicy" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetNetworkPolicyRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "network_policy", - "type": "google.cloud.container_v1beta1.types.NetworkPolicy" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_network_policy" - }, - "description": "Sample for SetNetworkPolicy", - "file": "container_v1beta1_generated_cluster_manager_set_network_policy_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetNetworkPolicy_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_set_network_policy_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_network_policy", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetNetworkPolicy", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNetworkPolicy" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetNetworkPolicyRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "network_policy", - "type": "google.cloud.container_v1beta1.types.NetworkPolicy" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_network_policy" - }, - "description": "Sample for SetNetworkPolicy", - "file": "container_v1beta1_generated_cluster_manager_set_network_policy_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetNetworkPolicy_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_set_network_policy_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_node_pool_autoscaling", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolAutoscaling", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNodePoolAutoscaling" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetNodePoolAutoscalingRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_node_pool_autoscaling" - }, - "description": "Sample for SetNodePoolAutoscaling", - "file": "container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_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": "container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_node_pool_autoscaling", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolAutoscaling", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNodePoolAutoscaling" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetNodePoolAutoscalingRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_node_pool_autoscaling" - }, - "description": "Sample for SetNodePoolAutoscaling", - "file": "container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolAutoscaling_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": "container_v1beta1_generated_cluster_manager_set_node_pool_autoscaling_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_node_pool_management", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolManagement", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNodePoolManagement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetNodePoolManagementRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "management", - "type": "google.cloud.container_v1beta1.types.NodeManagement" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_node_pool_management" - }, - "description": "Sample for SetNodePoolManagement", - "file": "container_v1beta1_generated_cluster_manager_set_node_pool_management_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolManagement_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": "container_v1beta1_generated_cluster_manager_set_node_pool_management_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_node_pool_management", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolManagement", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNodePoolManagement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetNodePoolManagementRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "node_pool_id", - "type": "str" - }, - { - "name": "management", - "type": "google.cloud.container_v1beta1.types.NodeManagement" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_node_pool_management" - }, - "description": "Sample for SetNodePoolManagement", - "file": "container_v1beta1_generated_cluster_manager_set_node_pool_management_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolManagement_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": "container_v1beta1_generated_cluster_manager_set_node_pool_management_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.set_node_pool_size", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolSize", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNodePoolSize" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetNodePoolSizeRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_node_pool_size" - }, - "description": "Sample for SetNodePoolSize", - "file": "container_v1beta1_generated_cluster_manager_set_node_pool_size_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolSize_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": "container_v1beta1_generated_cluster_manager_set_node_pool_size_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.set_node_pool_size", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.SetNodePoolSize", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "SetNodePoolSize" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.SetNodePoolSizeRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "set_node_pool_size" - }, - "description": "Sample for SetNodePoolSize", - "file": "container_v1beta1_generated_cluster_manager_set_node_pool_size_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_SetNodePoolSize_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": "container_v1beta1_generated_cluster_manager_set_node_pool_size_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.start_ip_rotation", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.StartIPRotation", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "StartIPRotation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.StartIPRotationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "start_ip_rotation" - }, - "description": "Sample for StartIPRotation", - "file": "container_v1beta1_generated_cluster_manager_start_ip_rotation_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_StartIPRotation_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_start_ip_rotation_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.start_ip_rotation", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.StartIPRotation", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "StartIPRotation" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.StartIPRotationRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "start_ip_rotation" - }, - "description": "Sample for StartIPRotation", - "file": "container_v1beta1_generated_cluster_manager_start_ip_rotation_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_StartIPRotation_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_start_ip_rotation_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.update_cluster", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.UpdateCluster", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "UpdateCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.UpdateClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "update", - "type": "google.cloud.container_v1beta1.types.ClusterUpdate" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "update_cluster" - }, - "description": "Sample for UpdateCluster", - "file": "container_v1beta1_generated_cluster_manager_update_cluster_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_UpdateCluster_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_update_cluster_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.update_cluster", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.UpdateCluster", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "UpdateCluster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.UpdateClusterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "update", - "type": "google.cloud.container_v1beta1.types.ClusterUpdate" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "update_cluster" - }, - "description": "Sample for UpdateCluster", - "file": "container_v1beta1_generated_cluster_manager_update_cluster_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_UpdateCluster_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_update_cluster_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.update_master", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.UpdateMaster", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "UpdateMaster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.UpdateMasterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "master_version", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "update_master" - }, - "description": "Sample for UpdateMaster", - "file": "container_v1beta1_generated_cluster_manager_update_master_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_UpdateMaster_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": "container_v1beta1_generated_cluster_manager_update_master_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.update_master", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.UpdateMaster", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "UpdateMaster" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.UpdateMasterRequest" - }, - { - "name": "project_id", - "type": "str" - }, - { - "name": "zone", - "type": "str" - }, - { - "name": "cluster_id", - "type": "str" - }, - { - "name": "master_version", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "update_master" - }, - "description": "Sample for UpdateMaster", - "file": "container_v1beta1_generated_cluster_manager_update_master_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_UpdateMaster_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": "container_v1beta1_generated_cluster_manager_update_master_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", - "shortName": "ClusterManagerAsyncClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.update_node_pool", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.UpdateNodePool", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "UpdateNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.UpdateNodePoolRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "update_node_pool" - }, - "description": "Sample for UpdateNodePool", - "file": "container_v1beta1_generated_cluster_manager_update_node_pool_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_UpdateNodePool_async", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_update_node_pool_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", - "shortName": "ClusterManagerClient" - }, - "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.update_node_pool", - "method": { - "fullName": "google.container.v1beta1.ClusterManager.UpdateNodePool", - "service": { - "fullName": "google.container.v1beta1.ClusterManager", - "shortName": "ClusterManager" - }, - "shortName": "UpdateNodePool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.container_v1beta1.types.UpdateNodePoolRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, Union[str, bytes]]]" - } - ], - "resultType": "google.cloud.container_v1beta1.types.Operation", - "shortName": "update_node_pool" - }, - "description": "Sample for UpdateNodePool", - "file": "container_v1beta1_generated_cluster_manager_update_node_pool_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "container_v1beta1_generated_ClusterManager_UpdateNodePool_sync", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "container_v1beta1_generated_cluster_manager_update_node_pool_sync.py" - } - ] -} diff --git a/owl-bot-staging/google-cloud-container/v1beta1/scripts/fixup_container_v1beta1_keywords.py b/owl-bot-staging/google-cloud-container/v1beta1/scripts/fixup_container_v1beta1_keywords.py deleted file mode 100644 index b44a3331c2dc..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/scripts/fixup_container_v1beta1_keywords.py +++ /dev/null @@ -1,210 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 containerCallTransformer(cst.CSTTransformer): - CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') - METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'cancel_operation': ('project_id', 'zone', 'operation_id', 'name', ), - 'check_autopilot_compatibility': ('name', ), - 'complete_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', ), - 'complete_node_pool_upgrade': ('name', ), - 'create_cluster': ('project_id', 'zone', 'cluster', 'parent', ), - 'create_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool', 'parent', ), - 'delete_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), - 'delete_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'get_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), - 'get_json_web_keys': ('parent', ), - 'get_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'get_operation': ('project_id', 'zone', 'operation_id', 'name', ), - 'get_server_config': ('project_id', 'zone', 'name', ), - 'list_clusters': ('project_id', 'zone', 'parent', ), - 'list_locations': ('parent', ), - 'list_node_pools': ('project_id', 'zone', 'cluster_id', 'parent', ), - 'list_operations': ('project_id', 'zone', 'parent', ), - 'list_usable_subnetworks': ('parent', 'filter', 'page_size', 'page_token', ), - 'rollback_node_pool_upgrade': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', 'respect_pdb', ), - 'set_addons_config': ('project_id', 'zone', 'cluster_id', 'addons_config', 'name', ), - 'set_labels': ('project_id', 'zone', 'cluster_id', 'resource_labels', 'label_fingerprint', 'name', ), - 'set_legacy_abac': ('project_id', 'zone', 'cluster_id', 'enabled', 'name', ), - 'set_locations': ('project_id', 'zone', 'cluster_id', 'locations', 'name', ), - 'set_logging_service': ('project_id', 'zone', 'cluster_id', 'logging_service', 'name', ), - 'set_maintenance_policy': ('project_id', 'zone', 'cluster_id', 'maintenance_policy', 'name', ), - 'set_master_auth': ('project_id', 'zone', 'cluster_id', 'action', 'update', 'name', ), - 'set_monitoring_service': ('project_id', 'zone', 'cluster_id', 'monitoring_service', 'name', ), - 'set_network_policy': ('project_id', 'zone', 'cluster_id', 'network_policy', 'name', ), - 'set_node_pool_autoscaling': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'autoscaling', 'name', ), - 'set_node_pool_management': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'management', 'name', ), - 'set_node_pool_size': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'node_count', 'name', ), - 'start_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', 'rotate_credentials', ), - 'update_cluster': ('project_id', 'zone', 'cluster_id', 'update', 'name', ), - 'update_master': ('project_id', 'zone', 'cluster_id', 'master_version', 'name', ), - 'update_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'node_version', 'image_type', 'locations', 'workload_metadata_config', 'name', 'upgrade_settings', 'tags', 'taints', 'labels', 'linux_node_config', 'kubelet_config', 'node_network_config', 'gcfs_config', 'confidential_nodes', 'gvnic', 'etag', 'fast_socket', 'logging_config', 'resource_labels', 'windows_node_config', 'accelerators', 'machine_type', 'disk_type', 'disk_size_gb', 'resource_manager_tags', 'containerd_config', 'queued_provisioning', ), - } - - 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=containerCallTransformer(), -): - """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 container 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/google-cloud-container/v1beta1/setup.py b/owl-bot-staging/google-cloud-container/v1beta1/setup.py deleted file mode 100644 index 0085de6f1022..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/setup.py +++ /dev/null @@ -1,98 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 re - -import setuptools # type: ignore - -package_root = os.path.abspath(os.path.dirname(__file__)) - -name = 'google-cloud-container' - - -description = "Google Cloud Container API client library" - -version = None - -with open(os.path.join(package_root, 'google/cloud/container/gapic_version.py')) as fp: - version_candidates = re.findall(r"(?<=\")\d+.\d+.\d+(?=\")", fp.read()) - assert (len(version_candidates) == 1) - version = version_candidates[0] - -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.1, <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.*", - # Exclude incompatible versions of `google-auth` - # See https://github.com/googleapis/google-cloud-python/issues/12364 - "google-auth >= 2.14.1, <3.0.0dev,!=2.24.0,!=2.25.0", - "proto-plus >= 1.22.3, <2.0.0dev", - "proto-plus >= 1.25.0, <2.0.0dev; python_version >= '3.13'", - "protobuf>=3.20.2,<6.0.0dev,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", -] -extras = { -} -url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-container" - -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.find_namespace_packages() - if package.startswith("google") -] - -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", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Operating System :: OS Independent", - "Topic :: Internet", - ], - platforms="Posix; MacOS X; Windows", - packages=packages, - python_requires=">=3.7", - install_requires=dependencies, - extras_require=extras, - include_package_data=True, - zip_safe=False, -) diff --git a/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.10.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.10.txt deleted file mode 100644 index ed7f9aed2559..000000000000 --- a/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1beta1/testing/constraints-3.11.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.11.txt deleted file mode 100644 index ed7f9aed2559..000000000000 --- a/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1beta1/testing/constraints-3.12.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.12.txt deleted file mode 100644 index ed7f9aed2559..000000000000 --- a/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1beta1/testing/constraints-3.13.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.13.txt deleted file mode 100644 index ed7f9aed2559..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.13.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/google-cloud-container/v1beta1/testing/constraints-3.7.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.7.txt deleted file mode 100644 index fc812592b0ee..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.7.txt +++ /dev/null @@ -1,10 +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.1 -google-auth==2.14.1 -proto-plus==1.22.3 -protobuf==3.20.2 diff --git a/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.8.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.8.txt deleted file mode 100644 index ed7f9aed2559..000000000000 --- a/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1beta1/testing/constraints-3.9.txt b/owl-bot-staging/google-cloud-container/v1beta1/testing/constraints-3.9.txt deleted file mode 100644 index ed7f9aed2559..000000000000 --- a/owl-bot-staging/google-cloud-container/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/google-cloud-container/v1beta1/tests/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/tests/__init__.py deleted file mode 100644 index 7b3de3117f38..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/tests/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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/google-cloud-container/v1beta1/tests/unit/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/__init__.py deleted file mode 100644 index 7b3de3117f38..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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/google-cloud-container/v1beta1/tests/unit/gapic/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/__init__.py deleted file mode 100644 index 7b3de3117f38..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/__init__.py b/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/__init__.py deleted file mode 100644 index 7b3de3117f38..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/test_cluster_manager.py b/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/test_cluster_manager.py deleted file mode 100644 index 657b141ea187..000000000000 --- a/owl-bot-staging/google-cloud-container/v1beta1/tests/unit/gapic/container_v1beta1/test_cluster_manager.py +++ /dev/null @@ -1,15801 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 google.api_core import api_core_version -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers - -try: - from google.auth.aio import credentials as ga_credentials_async - HAS_GOOGLE_AUTH_AIO = True -except ImportError: # pragma: NO COVER - HAS_GOOGLE_AUTH_AIO = False - -from google.api_core import client_options -from google.api_core import exceptions as core_exceptions -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 path_template -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials -from google.auth.exceptions import MutualTLSChannelError -from google.cloud.container_v1beta1.services.cluster_manager import ClusterManagerAsyncClient -from google.cloud.container_v1beta1.services.cluster_manager import ClusterManagerClient -from google.cloud.container_v1beta1.services.cluster_manager import pagers -from google.cloud.container_v1beta1.services.cluster_manager import transports -from google.cloud.container_v1beta1.types import cluster_service -from google.oauth2 import service_account -from google.protobuf import duration_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from google.protobuf import wrappers_pb2 # type: ignore -from google.rpc import code_pb2 # type: ignore -from google.rpc import status_pb2 # type: ignore -import google.auth - - -async def mock_async_gen(data, chunk_size=1): - for i in range(0, len(data)): # pragma: NO COVER - chunk = data[i : i + chunk_size] - yield chunk.encode("utf-8") - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - -# TODO: use async auth anon credentials by default once the minimum version of google-auth is upgraded. -# See related issue: https://github.com/googleapis/gapic-generator-python/issues/2107. -def async_anonymous_credentials(): - if HAS_GOOGLE_AUTH_AIO: - return ga_credentials_async.AnonymousCredentials() - return ga_credentials.AnonymousCredentials() - -# 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 - -# If default endpoint template is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint template so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint_template(client): - return "test.{UNIVERSE_DOMAIN}" if ("localhost" in client._DEFAULT_ENDPOINT_TEMPLATE) else client._DEFAULT_ENDPOINT_TEMPLATE - - -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 ClusterManagerClient._get_default_mtls_endpoint(None) is None - assert ClusterManagerClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - assert ClusterManagerClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint - assert ClusterManagerClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint - assert ClusterManagerClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint - assert ClusterManagerClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - -def test__read_environment_variables(): - assert ClusterManagerClient._read_environment_variables() == (False, "auto", None) - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - assert ClusterManagerClient._read_environment_variables() == (True, "auto", None) - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - assert ClusterManagerClient._read_environment_variables() == (False, "auto", None) - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): - with pytest.raises(ValueError) as excinfo: - ClusterManagerClient._read_environment_variables() - assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - assert ClusterManagerClient._read_environment_variables() == (False, "never", None) - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - assert ClusterManagerClient._read_environment_variables() == (False, "always", None) - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}): - assert ClusterManagerClient._read_environment_variables() == (False, "auto", None) - - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError) as excinfo: - ClusterManagerClient._read_environment_variables() - assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - - with mock.patch.dict(os.environ, {"GOOGLE_CLOUD_UNIVERSE_DOMAIN": "foo.com"}): - assert ClusterManagerClient._read_environment_variables() == (False, "auto", "foo.com") - -def test__get_client_cert_source(): - mock_provided_cert_source = mock.Mock() - mock_default_cert_source = mock.Mock() - - assert ClusterManagerClient._get_client_cert_source(None, False) is None - assert ClusterManagerClient._get_client_cert_source(mock_provided_cert_source, False) is None - assert ClusterManagerClient._get_client_cert_source(mock_provided_cert_source, True) == mock_provided_cert_source - - 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_default_cert_source): - assert ClusterManagerClient._get_client_cert_source(None, True) is mock_default_cert_source - assert ClusterManagerClient._get_client_cert_source(mock_provided_cert_source, "true") is mock_provided_cert_source - -@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) -@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) -def test__get_api_endpoint(): - api_override = "foo.com" - mock_client_cert_source = mock.Mock() - default_universe = ClusterManagerClient._DEFAULT_UNIVERSE - default_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=default_universe) - mock_universe = "bar.com" - mock_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=mock_universe) - - assert ClusterManagerClient._get_api_endpoint(api_override, mock_client_cert_source, default_universe, "always") == api_override - assert ClusterManagerClient._get_api_endpoint(None, mock_client_cert_source, default_universe, "auto") == ClusterManagerClient.DEFAULT_MTLS_ENDPOINT - assert ClusterManagerClient._get_api_endpoint(None, None, default_universe, "auto") == default_endpoint - assert ClusterManagerClient._get_api_endpoint(None, None, default_universe, "always") == ClusterManagerClient.DEFAULT_MTLS_ENDPOINT - assert ClusterManagerClient._get_api_endpoint(None, mock_client_cert_source, default_universe, "always") == ClusterManagerClient.DEFAULT_MTLS_ENDPOINT - assert ClusterManagerClient._get_api_endpoint(None, None, mock_universe, "never") == mock_endpoint - assert ClusterManagerClient._get_api_endpoint(None, None, default_universe, "never") == default_endpoint - - with pytest.raises(MutualTLSChannelError) as excinfo: - ClusterManagerClient._get_api_endpoint(None, mock_client_cert_source, mock_universe, "auto") - assert str(excinfo.value) == "mTLS is not supported in any universe other than googleapis.com." - - -def test__get_universe_domain(): - client_universe_domain = "foo.com" - universe_domain_env = "bar.com" - - assert ClusterManagerClient._get_universe_domain(client_universe_domain, universe_domain_env) == client_universe_domain - assert ClusterManagerClient._get_universe_domain(None, universe_domain_env) == universe_domain_env - assert ClusterManagerClient._get_universe_domain(None, None) == ClusterManagerClient._DEFAULT_UNIVERSE - - with pytest.raises(ValueError) as excinfo: - ClusterManagerClient._get_universe_domain("", None) - assert str(excinfo.value) == "Universe Domain cannot be an empty string." - - -@pytest.mark.parametrize("client_class,transport_name", [ - (ClusterManagerClient, "grpc"), - (ClusterManagerAsyncClient, "grpc_asyncio"), -]) -def test_cluster_manager_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 == ( - 'container.googleapis.com:443' - ) - - -@pytest.mark.parametrize("transport_class,transport_name", [ - (transports.ClusterManagerGrpcTransport, "grpc"), - (transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_cluster_manager_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", [ - (ClusterManagerClient, "grpc"), - (ClusterManagerAsyncClient, "grpc_asyncio"), -]) -def test_cluster_manager_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 == ( - 'container.googleapis.com:443' - ) - - -def test_cluster_manager_client_get_transport_class(): - transport = ClusterManagerClient.get_transport_class() - available_transports = [ - transports.ClusterManagerGrpcTransport, - ] - assert transport in available_transports - - transport = ClusterManagerClient.get_transport_class("grpc") - assert transport == transports.ClusterManagerGrpcTransport - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc"), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio"), -]) -@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) -@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) -def test_cluster_manager_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(ClusterManagerClient, '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(ClusterManagerClient, '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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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) as excinfo: - client = client_class(transport=transport_name) - assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - - # 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) as excinfo: - client = client_class(transport=transport_name) - assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - - # 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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", [ - (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", "true"), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", "true"), - (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", "false"), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", "false"), -]) -@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) -@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE) - 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE) - 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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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", [ - ClusterManagerClient, ClusterManagerAsyncClient -]) -@mock.patch.object(ClusterManagerClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ClusterManagerClient)) -@mock.patch.object(ClusterManagerAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ClusterManagerAsyncClient)) -def test_cluster_manager_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 - - # 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) as excinfo: - client_class.get_mtls_endpoint_and_cert_source() - - assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - - # 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) as excinfo: - client_class.get_mtls_endpoint_and_cert_source() - - assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - -@pytest.mark.parametrize("client_class", [ - ClusterManagerClient, ClusterManagerAsyncClient -]) -@mock.patch.object(ClusterManagerClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerClient)) -@mock.patch.object(ClusterManagerAsyncClient, "_DEFAULT_ENDPOINT_TEMPLATE", modify_default_endpoint_template(ClusterManagerAsyncClient)) -def test_cluster_manager_client_client_api_endpoint(client_class): - mock_client_cert_source = client_cert_source_callback - api_override = "foo.com" - default_universe = ClusterManagerClient._DEFAULT_UNIVERSE - default_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=default_universe) - mock_universe = "bar.com" - mock_endpoint = ClusterManagerClient._DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=mock_universe) - - # If ClientOptions.api_endpoint is set and GOOGLE_API_USE_CLIENT_CERTIFICATE="true", - # use ClientOptions.api_endpoint as the api endpoint regardless. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch("google.auth.transport.requests.AuthorizedSession.configure_mtls_channel"): - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=api_override) - client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) - assert client.api_endpoint == api_override - - # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", - # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=ga_credentials.AnonymousCredentials()) - assert client.api_endpoint == default_endpoint - - # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", - # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=ga_credentials.AnonymousCredentials()) - assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - - # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), - # GOOGLE_API_USE_CLIENT_CERTIFICATE="false" (default), default cert source doesn't exist, - # and ClientOptions.universe_domain="bar.com", - # use the _DEFAULT_ENDPOINT_TEMPLATE populated with universe domain as the api endpoint. - options = client_options.ClientOptions() - universe_exists = hasattr(options, "universe_domain") - if universe_exists: - options = client_options.ClientOptions(universe_domain=mock_universe) - client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) - else: - client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) - assert client.api_endpoint == (mock_endpoint if universe_exists else default_endpoint) - assert client.universe_domain == (mock_universe if universe_exists else default_universe) - - # If ClientOptions does not have a universe domain attribute and GOOGLE_API_USE_MTLS_ENDPOINT="never", - # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. - options = client_options.ClientOptions() - if hasattr(options, "universe_domain"): - delattr(options, "universe_domain") - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials()) - assert client.api_endpoint == default_endpoint - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc"), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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", [ - (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", grpc_helpers), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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_cluster_manager_client_client_options_from_dict(): - with mock.patch('google.cloud.container_v1beta1.services.cluster_manager.transports.ClusterManagerGrpcTransport.__init__') as grpc_transport: - grpc_transport.return_value = None - client = ClusterManagerClient( - 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", [ - (ClusterManagerClient, transports.ClusterManagerGrpcTransport, "grpc", grpc_helpers), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_cluster_manager_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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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( - "container.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="container.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.ListClustersRequest, - dict, -]) -def test_list_clusters(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_clusters), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListClustersResponse( - missing_zones=['missing_zones_value'], - ) - response = client.list_clusters(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.ListClustersRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListClustersResponse) - assert response.missing_zones == ['missing_zones_value'] - - -def test_list_clusters_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.ListClustersRequest( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.list_clusters(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListClustersRequest( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - -def test_list_clusters_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.list_clusters in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.list_clusters] = mock_rpc - request = {} - client.list_clusters(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.list_clusters(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_clusters_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.list_clusters in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.list_clusters] = mock_rpc - - request = {} - await client.list_clusters(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.list_clusters(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_clusters_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListClustersRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_clusters), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse( - missing_zones=['missing_zones_value'], - )) - response = await client.list_clusters(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.ListClustersRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListClustersResponse) - assert response.missing_zones == ['missing_zones_value'] - - -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - -def test_list_clusters_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListClustersRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - call.return_value = cluster_service.ListClustersResponse() - client.list_clusters(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_clusters_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListClustersRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse()) - await client.list_clusters(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_clusters_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListClustersResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_clusters( - project_id='project_id_value', - zone='zone_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - - -def test_list_clusters_flattened_error(): - client = ClusterManagerClient( - 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_clusters( - cluster_service.ListClustersRequest(), - project_id='project_id_value', - zone='zone_value', - ) - -@pytest.mark.asyncio -async def test_list_clusters_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListClustersResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_clusters( - project_id='project_id_value', - zone='zone_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_clusters_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_clusters( - cluster_service.ListClustersRequest(), - project_id='project_id_value', - zone='zone_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetClusterRequest, - dict, -]) -def test_get_cluster(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Cluster( - name='name_value', - description='description_value', - initial_node_count=1911, - logging_service='logging_service_value', - monitoring_service='monitoring_service_value', - network='network_value', - cluster_ipv4_cidr='cluster_ipv4_cidr_value', - subnetwork='subnetwork_value', - locations=['locations_value'], - enable_kubernetes_alpha=True, - label_fingerprint='label_fingerprint_value', - private_cluster=True, - master_ipv4_cidr_block='master_ipv4_cidr_block_value', - self_link='self_link_value', - zone='zone_value', - endpoint='endpoint_value', - initial_cluster_version='initial_cluster_version_value', - current_master_version='current_master_version_value', - current_node_version='current_node_version_value', - create_time='create_time_value', - status=cluster_service.Cluster.Status.PROVISIONING, - status_message='status_message_value', - node_ipv4_cidr_size=1955, - services_ipv4_cidr='services_ipv4_cidr_value', - instance_group_urls=['instance_group_urls_value'], - current_node_count=1936, - expire_time='expire_time_value', - location='location_value', - enable_tpu=True, - tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', - id='id_value', - etag='etag_value', - satisfies_pzs=True, - satisfies_pzi=True, - ) - response = client.get_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.GetClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Cluster) - assert response.name == 'name_value' - assert response.description == 'description_value' - assert response.initial_node_count == 1911 - assert response.logging_service == 'logging_service_value' - assert response.monitoring_service == 'monitoring_service_value' - assert response.network == 'network_value' - assert response.cluster_ipv4_cidr == 'cluster_ipv4_cidr_value' - assert response.subnetwork == 'subnetwork_value' - assert response.locations == ['locations_value'] - assert response.enable_kubernetes_alpha is True - assert response.label_fingerprint == 'label_fingerprint_value' - assert response.private_cluster is True - assert response.master_ipv4_cidr_block == 'master_ipv4_cidr_block_value' - assert response.self_link == 'self_link_value' - assert response.zone == 'zone_value' - assert response.endpoint == 'endpoint_value' - assert response.initial_cluster_version == 'initial_cluster_version_value' - assert response.current_master_version == 'current_master_version_value' - assert response.current_node_version == 'current_node_version_value' - assert response.create_time == 'create_time_value' - assert response.status == cluster_service.Cluster.Status.PROVISIONING - assert response.status_message == 'status_message_value' - assert response.node_ipv4_cidr_size == 1955 - assert response.services_ipv4_cidr == 'services_ipv4_cidr_value' - assert response.instance_group_urls == ['instance_group_urls_value'] - assert response.current_node_count == 1936 - assert response.expire_time == 'expire_time_value' - assert response.location == 'location_value' - assert response.enable_tpu is True - assert response.tpu_ipv4_cidr_block == 'tpu_ipv4_cidr_block_value' - assert response.id == 'id_value' - assert response.etag == 'etag_value' - assert response.satisfies_pzs is True - assert response.satisfies_pzi is True - - -def test_get_cluster_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.GetClusterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.get_cluster(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetClusterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_get_cluster_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_cluster in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_cluster] = mock_rpc - request = {} - client.get_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.get_cluster in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.get_cluster] = mock_rpc - - request = {} - await client.get_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.get_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetClusterRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster( - name='name_value', - description='description_value', - initial_node_count=1911, - logging_service='logging_service_value', - monitoring_service='monitoring_service_value', - network='network_value', - cluster_ipv4_cidr='cluster_ipv4_cidr_value', - subnetwork='subnetwork_value', - locations=['locations_value'], - enable_kubernetes_alpha=True, - label_fingerprint='label_fingerprint_value', - private_cluster=True, - master_ipv4_cidr_block='master_ipv4_cidr_block_value', - self_link='self_link_value', - zone='zone_value', - endpoint='endpoint_value', - initial_cluster_version='initial_cluster_version_value', - current_master_version='current_master_version_value', - current_node_version='current_node_version_value', - create_time='create_time_value', - status=cluster_service.Cluster.Status.PROVISIONING, - status_message='status_message_value', - node_ipv4_cidr_size=1955, - services_ipv4_cidr='services_ipv4_cidr_value', - instance_group_urls=['instance_group_urls_value'], - current_node_count=1936, - expire_time='expire_time_value', - location='location_value', - enable_tpu=True, - tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', - id='id_value', - etag='etag_value', - satisfies_pzs=True, - satisfies_pzi=True, - )) - response = await client.get_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.GetClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Cluster) - assert response.name == 'name_value' - assert response.description == 'description_value' - assert response.initial_node_count == 1911 - assert response.logging_service == 'logging_service_value' - assert response.monitoring_service == 'monitoring_service_value' - assert response.network == 'network_value' - assert response.cluster_ipv4_cidr == 'cluster_ipv4_cidr_value' - assert response.subnetwork == 'subnetwork_value' - assert response.locations == ['locations_value'] - assert response.enable_kubernetes_alpha is True - assert response.label_fingerprint == 'label_fingerprint_value' - assert response.private_cluster is True - assert response.master_ipv4_cidr_block == 'master_ipv4_cidr_block_value' - assert response.self_link == 'self_link_value' - assert response.zone == 'zone_value' - assert response.endpoint == 'endpoint_value' - assert response.initial_cluster_version == 'initial_cluster_version_value' - assert response.current_master_version == 'current_master_version_value' - assert response.current_node_version == 'current_node_version_value' - assert response.create_time == 'create_time_value' - assert response.status == cluster_service.Cluster.Status.PROVISIONING - assert response.status_message == 'status_message_value' - assert response.node_ipv4_cidr_size == 1955 - assert response.services_ipv4_cidr == 'services_ipv4_cidr_value' - assert response.instance_group_urls == ['instance_group_urls_value'] - assert response.current_node_count == 1936 - assert response.expire_time == 'expire_time_value' - assert response.location == 'location_value' - assert response.enable_tpu is True - assert response.tpu_ipv4_cidr_block == 'tpu_ipv4_cidr_block_value' - assert response.id == 'id_value' - assert response.etag == 'etag_value' - assert response.satisfies_pzs is True - assert response.satisfies_pzi is True - - -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - -def test_get_cluster_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetClusterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - call.return_value = cluster_service.Cluster() - client.get_cluster(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_cluster_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetClusterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster()) - await client.get_cluster(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_cluster_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Cluster() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_cluster( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - - -def test_get_cluster_flattened_error(): - client = ClusterManagerClient( - 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_cluster( - cluster_service.GetClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - ) - -@pytest.mark.asyncio -async def test_get_cluster_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Cluster() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_cluster( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_cluster( - cluster_service.GetClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CreateClusterRequest, - dict, -]) -def test_create_cluster(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.create_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.CreateClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_create_cluster_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.CreateClusterRequest( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.create_cluster(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateClusterRequest( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - -def test_create_cluster_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.create_cluster in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.create_cluster] = mock_rpc - request = {} - client.create_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.create_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_create_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.create_cluster in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.create_cluster] = mock_rpc - - request = {} - await client.create_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.create_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_create_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CreateClusterRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.create_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.CreateClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - -def test_create_cluster_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CreateClusterRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.create_cluster(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_cluster_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CreateClusterRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.create_cluster(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_cluster_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.create_cluster( - project_id='project_id_value', - zone='zone_value', - cluster=cluster_service.Cluster(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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster - mock_val = cluster_service.Cluster(name='name_value') - assert arg == mock_val - - -def test_create_cluster_flattened_error(): - client = ClusterManagerClient( - 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_cluster( - cluster_service.CreateClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster=cluster_service.Cluster(name='name_value'), - ) - -@pytest.mark.asyncio -async def test_create_cluster_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_cluster( - project_id='project_id_value', - zone='zone_value', - cluster=cluster_service.Cluster(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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster - mock_val = cluster_service.Cluster(name='name_value') - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_cluster( - cluster_service.CreateClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster=cluster_service.Cluster(name='name_value'), - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.UpdateClusterRequest, - dict, -]) -def test_update_cluster(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.update_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.UpdateClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_update_cluster_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.UpdateClusterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.update_cluster(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateClusterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_update_cluster_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.update_cluster in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.update_cluster] = mock_rpc - request = {} - client.update_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.update_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_update_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.update_cluster in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.update_cluster] = mock_rpc - - request = {} - await client.update_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.update_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_update_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.UpdateClusterRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.update_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.UpdateClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - -def test_update_cluster_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.UpdateClusterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.update_cluster(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_update_cluster_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.UpdateClusterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.update_cluster(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_update_cluster_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.update_cluster( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].update - mock_val = cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value') - assert arg == mock_val - - -def test_update_cluster_flattened_error(): - client = ClusterManagerClient( - 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_cluster( - cluster_service.UpdateClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), - ) - -@pytest.mark.asyncio -async def test_update_cluster_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_cluster( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].update - mock_val = cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value') - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_cluster( - cluster_service.UpdateClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - update=cluster_service.ClusterUpdate(desired_node_version='desired_node_version_value'), - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.UpdateNodePoolRequest, - dict, -]) -def test_update_node_pool(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.update_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.UpdateNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_update_node_pool_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.UpdateNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - node_version='node_version_value', - image_type='image_type_value', - name='name_value', - etag='etag_value', - machine_type='machine_type_value', - disk_type='disk_type_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_node_pool), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.update_node_pool(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - node_version='node_version_value', - image_type='image_type_value', - name='name_value', - etag='etag_value', - machine_type='machine_type_value', - disk_type='disk_type_value', - ) - -def test_update_node_pool_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.update_node_pool in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.update_node_pool] = mock_rpc - request = {} - client.update_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.update_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_update_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.update_node_pool in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.update_node_pool] = mock_rpc - - request = {} - await client.update_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.update_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_update_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.UpdateNodePoolRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.update_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.UpdateNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_update_node_pool_async_from_dict(): - await test_update_node_pool_async(request_type=dict) - -def test_update_node_pool_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.UpdateNodePoolRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_node_pool), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.update_node_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_update_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.UpdateNodePoolRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_node_pool), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.update_node_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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetNodePoolAutoscalingRequest, - dict, -]) -def test_set_node_pool_autoscaling(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_node_pool_autoscaling), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_node_pool_autoscaling(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNodePoolAutoscalingRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_node_pool_autoscaling_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetNodePoolAutoscalingRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_autoscaling), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_node_pool_autoscaling(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolAutoscalingRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -def test_set_node_pool_autoscaling_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_node_pool_autoscaling in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_node_pool_autoscaling] = mock_rpc - request = {} - client.set_node_pool_autoscaling(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_node_pool_autoscaling(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_node_pool_autoscaling_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_node_pool_autoscaling in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_node_pool_autoscaling] = mock_rpc - - request = {} - await client.set_node_pool_autoscaling(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_node_pool_autoscaling(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_node_pool_autoscaling_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNodePoolAutoscalingRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_node_pool_autoscaling), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_node_pool_autoscaling(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNodePoolAutoscalingRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_node_pool_autoscaling_async_from_dict(): - await test_set_node_pool_autoscaling_async(request_type=dict) - -def test_set_node_pool_autoscaling_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNodePoolAutoscalingRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_autoscaling), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_node_pool_autoscaling(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_set_node_pool_autoscaling_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNodePoolAutoscalingRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_autoscaling), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_node_pool_autoscaling(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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetLoggingServiceRequest, - dict, -]) -def test_set_logging_service(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_logging_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_logging_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLoggingServiceRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_logging_service_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetLoggingServiceRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_logging_service(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLoggingServiceRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_value', - name='name_value', - ) - -def test_set_logging_service_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_logging_service in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_logging_service] = mock_rpc - request = {} - client.set_logging_service(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_logging_service(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_logging_service_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_logging_service in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_logging_service] = mock_rpc - - request = {} - await client.set_logging_service(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_logging_service(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_logging_service_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLoggingServiceRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_logging_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_logging_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLoggingServiceRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_logging_service_async_from_dict(): - await test_set_logging_service_async(request_type=dict) - -def test_set_logging_service_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLoggingServiceRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_logging_service(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_set_logging_service_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLoggingServiceRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_logging_service(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_set_logging_service_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_logging_service( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].logging_service - mock_val = 'logging_service_value' - assert arg == mock_val - - -def test_set_logging_service_flattened_error(): - client = ClusterManagerClient( - 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.set_logging_service( - cluster_service.SetLoggingServiceRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_value', - ) - -@pytest.mark.asyncio -async def test_set_logging_service_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_logging_service( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].logging_service - mock_val = 'logging_service_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_logging_service_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_logging_service( - cluster_service.SetLoggingServiceRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - logging_service='logging_service_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetMonitoringServiceRequest, - dict, -]) -def test_set_monitoring_service(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_monitoring_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_monitoring_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetMonitoringServiceRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_monitoring_service_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetMonitoringServiceRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_monitoring_service(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMonitoringServiceRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_value', - name='name_value', - ) - -def test_set_monitoring_service_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_monitoring_service in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_monitoring_service] = mock_rpc - request = {} - client.set_monitoring_service(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_monitoring_service(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_monitoring_service_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_monitoring_service in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_monitoring_service] = mock_rpc - - request = {} - await client.set_monitoring_service(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_monitoring_service(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_monitoring_service_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetMonitoringServiceRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_monitoring_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_monitoring_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetMonitoringServiceRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_monitoring_service_async_from_dict(): - await test_set_monitoring_service_async(request_type=dict) - -def test_set_monitoring_service_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetMonitoringServiceRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_monitoring_service(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_set_monitoring_service_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetMonitoringServiceRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_monitoring_service(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_set_monitoring_service_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_monitoring_service( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].monitoring_service - mock_val = 'monitoring_service_value' - assert arg == mock_val - - -def test_set_monitoring_service_flattened_error(): - client = ClusterManagerClient( - 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.set_monitoring_service( - cluster_service.SetMonitoringServiceRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_value', - ) - -@pytest.mark.asyncio -async def test_set_monitoring_service_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_monitoring_service( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].monitoring_service - mock_val = 'monitoring_service_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_monitoring_service_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_monitoring_service( - cluster_service.SetMonitoringServiceRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - monitoring_service='monitoring_service_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetAddonsConfigRequest, - dict, -]) -def test_set_addons_config(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_addons_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_addons_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetAddonsConfigRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_addons_config_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetAddonsConfigRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_addons_config(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetAddonsConfigRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_set_addons_config_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_addons_config in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_addons_config] = mock_rpc - request = {} - client.set_addons_config(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_addons_config(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_addons_config_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_addons_config in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_addons_config] = mock_rpc - - request = {} - await client.set_addons_config(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_addons_config(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_addons_config_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetAddonsConfigRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_addons_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_addons_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetAddonsConfigRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_addons_config_async_from_dict(): - await test_set_addons_config_async(request_type=dict) - -def test_set_addons_config_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetAddonsConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_addons_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_set_addons_config_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetAddonsConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_addons_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_set_addons_config_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_addons_config( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), - ) - - # 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].addons_config - mock_val = cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)) - assert arg == mock_val - - -def test_set_addons_config_flattened_error(): - client = ClusterManagerClient( - 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.set_addons_config( - cluster_service.SetAddonsConfigRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), - ) - -@pytest.mark.asyncio -async def test_set_addons_config_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_addons_config( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), - ) - - # 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].addons_config - mock_val = cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_addons_config_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_addons_config( - cluster_service.SetAddonsConfigRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - addons_config=cluster_service.AddonsConfig(http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True)), - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetLocationsRequest, - dict, -]) -def test_set_locations(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_locations(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLocationsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_locations_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetLocationsRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_locations(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLocationsRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_set_locations_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_locations in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_locations] = mock_rpc - request = {} - client.set_locations(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_locations(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_locations_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_locations in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_locations] = mock_rpc - - request = {} - await client.set_locations(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_locations(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_locations_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLocationsRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_locations(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLocationsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_locations_async_from_dict(): - await test_set_locations_async(request_type=dict) - -def test_set_locations_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLocationsRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_locations(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_set_locations_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLocationsRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_locations(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_set_locations_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_locations( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - locations=['locations_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].locations - mock_val = ['locations_value'] - assert arg == mock_val - - -def test_set_locations_flattened_error(): - client = ClusterManagerClient( - 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.set_locations( - cluster_service.SetLocationsRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - locations=['locations_value'], - ) - -@pytest.mark.asyncio -async def test_set_locations_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_locations( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - locations=['locations_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].locations - mock_val = ['locations_value'] - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_locations_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_locations( - cluster_service.SetLocationsRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - locations=['locations_value'], - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.UpdateMasterRequest, - dict, -]) -def test_update_master(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_master), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.update_master(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.UpdateMasterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_update_master_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.UpdateMasterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.update_master(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateMasterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_value', - name='name_value', - ) - -def test_update_master_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.update_master in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.update_master] = mock_rpc - request = {} - client.update_master(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.update_master(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_update_master_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.update_master in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.update_master] = mock_rpc - - request = {} - await client.update_master(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.update_master(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_update_master_async(transport: str = 'grpc_asyncio', request_type=cluster_service.UpdateMasterRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_master), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.update_master(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.UpdateMasterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_update_master_async_from_dict(): - await test_update_master_async(request_type=dict) - -def test_update_master_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.UpdateMasterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.update_master(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_update_master_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.UpdateMasterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.update_master(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_update_master_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.update_master( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].master_version - mock_val = 'master_version_value' - assert arg == mock_val - - -def test_update_master_flattened_error(): - client = ClusterManagerClient( - 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_master( - cluster_service.UpdateMasterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_value', - ) - -@pytest.mark.asyncio -async def test_update_master_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_master( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].master_version - mock_val = 'master_version_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_master_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_master( - cluster_service.UpdateMasterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - master_version='master_version_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetMasterAuthRequest, - dict, -]) -def test_set_master_auth(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_master_auth), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_master_auth(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetMasterAuthRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_master_auth_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetMasterAuthRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_master_auth), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_master_auth(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMasterAuthRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_set_master_auth_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_master_auth in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_master_auth] = mock_rpc - request = {} - client.set_master_auth(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_master_auth(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_master_auth_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_master_auth in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_master_auth] = mock_rpc - - request = {} - await client.set_master_auth(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_master_auth(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_master_auth_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetMasterAuthRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_master_auth), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_master_auth(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetMasterAuthRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_master_auth_async_from_dict(): - await test_set_master_auth_async(request_type=dict) - -def test_set_master_auth_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetMasterAuthRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_master_auth), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_master_auth(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_set_master_auth_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetMasterAuthRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_master_auth), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_master_auth(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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.DeleteClusterRequest, - dict, -]) -def test_delete_cluster(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.delete_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.DeleteClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_delete_cluster_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.DeleteClusterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.delete_cluster(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteClusterRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_delete_cluster_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.delete_cluster in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.delete_cluster] = mock_rpc - request = {} - client.delete_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.delete_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_delete_cluster_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.delete_cluster in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.delete_cluster] = mock_rpc - - request = {} - await client.delete_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.delete_cluster(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_delete_cluster_async(transport: str = 'grpc_asyncio', request_type=cluster_service.DeleteClusterRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.delete_cluster(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.DeleteClusterRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - -def test_delete_cluster_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.DeleteClusterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.delete_cluster(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_cluster_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.DeleteClusterRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.delete_cluster(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_cluster_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_cluster( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - - -def test_delete_cluster_flattened_error(): - client = ClusterManagerClient( - 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_cluster( - cluster_service.DeleteClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - ) - -@pytest.mark.asyncio -async def test_delete_cluster_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_cluster( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_cluster( - cluster_service.DeleteClusterRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.ListOperationsRequest, - dict, -]) -def test_list_operations(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_operations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListOperationsResponse( - missing_zones=['missing_zones_value'], - ) - response = client.list_operations(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.ListOperationsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListOperationsResponse) - assert response.missing_zones == ['missing_zones_value'] - - -def test_list_operations_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.ListOperationsRequest( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.list_operations(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListOperationsRequest( - project_id='project_id_value', - zone='zone_value', - parent='parent_value', - ) - -def test_list_operations_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.list_operations in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.list_operations] = mock_rpc - request = {} - client.list_operations(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.list_operations(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_operations_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.list_operations in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.list_operations] = mock_rpc - - request = {} - await client.list_operations(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.list_operations(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_operations_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListOperationsRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_operations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse( - missing_zones=['missing_zones_value'], - )) - response = await client.list_operations(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.ListOperationsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListOperationsResponse) - assert response.missing_zones == ['missing_zones_value'] - - -@pytest.mark.asyncio -async def test_list_operations_async_from_dict(): - await test_list_operations_async(request_type=dict) - -def test_list_operations_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListOperationsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - call.return_value = cluster_service.ListOperationsResponse() - client.list_operations(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_operations_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListOperationsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse()) - await client.list_operations(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_operations_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListOperationsResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_operations( - project_id='project_id_value', - zone='zone_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - - -def test_list_operations_flattened_error(): - client = ClusterManagerClient( - 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_operations( - cluster_service.ListOperationsRequest(), - project_id='project_id_value', - zone='zone_value', - ) - -@pytest.mark.asyncio -async def test_list_operations_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListOperationsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_operations( - project_id='project_id_value', - zone='zone_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_operations_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_operations( - cluster_service.ListOperationsRequest(), - project_id='project_id_value', - zone='zone_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetOperationRequest, - dict, -]) -def test_get_operation(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.get_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.GetOperationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_get_operation_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.GetOperationRequest( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.get_operation(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetOperationRequest( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - -def test_get_operation_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_operation in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_operation] = mock_rpc - request = {} - client.get_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_operation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_operation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.get_operation in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.get_operation] = mock_rpc - - request = {} - await client.get_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.get_operation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_operation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetOperationRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.get_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.GetOperationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_get_operation_async_from_dict(): - await test_get_operation_async(request_type=dict) - -def test_get_operation_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetOperationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.get_operation(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_operation_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetOperationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.get_operation(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_operation_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_operation( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].operation_id - mock_val = 'operation_id_value' - assert arg == mock_val - - -def test_get_operation_flattened_error(): - client = ClusterManagerClient( - 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_operation( - cluster_service.GetOperationRequest(), - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - ) - -@pytest.mark.asyncio -async def test_get_operation_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_operation( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].operation_id - mock_val = 'operation_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_operation_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_operation( - cluster_service.GetOperationRequest(), - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CancelOperationRequest, - dict, -]) -def test_cancel_operation(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.cancel_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.cancel_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.CancelOperationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None - - -def test_cancel_operation_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.CancelOperationRequest( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.cancel_operation(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CancelOperationRequest( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - name='name_value', - ) - -def test_cancel_operation_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.cancel_operation in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.cancel_operation] = mock_rpc - request = {} - client.cancel_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.cancel_operation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_cancel_operation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.cancel_operation in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.cancel_operation] = mock_rpc - - request = {} - await client.cancel_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.cancel_operation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_cancel_operation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CancelOperationRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.cancel_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.cancel_operation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.CancelOperationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.asyncio -async def test_cancel_operation_async_from_dict(): - await test_cancel_operation_async(request_type=dict) - -def test_cancel_operation_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CancelOperationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - call.return_value = None - client.cancel_operation(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_cancel_operation_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CancelOperationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.cancel_operation(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_cancel_operation_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.cancel_operation( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].operation_id - mock_val = 'operation_id_value' - assert arg == mock_val - - -def test_cancel_operation_flattened_error(): - client = ClusterManagerClient( - 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.cancel_operation( - cluster_service.CancelOperationRequest(), - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - ) - -@pytest.mark.asyncio -async def test_cancel_operation_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.cancel_operation( - project_id='project_id_value', - zone='zone_value', - operation_id='operation_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].operation_id - mock_val = 'operation_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_cancel_operation_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.cancel_operation( - cluster_service.CancelOperationRequest(), - project_id='project_id_value', - zone='zone_value', - operation_id='operation_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetServerConfigRequest, - dict, -]) -def test_get_server_config(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_server_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ServerConfig( - default_cluster_version='default_cluster_version_value', - valid_node_versions=['valid_node_versions_value'], - default_image_type='default_image_type_value', - valid_image_types=['valid_image_types_value'], - valid_master_versions=['valid_master_versions_value'], - ) - response = client.get_server_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.GetServerConfigRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ServerConfig) - assert response.default_cluster_version == 'default_cluster_version_value' - assert response.valid_node_versions == ['valid_node_versions_value'] - assert response.default_image_type == 'default_image_type_value' - assert response.valid_image_types == ['valid_image_types_value'] - assert response.valid_master_versions == ['valid_master_versions_value'] - - -def test_get_server_config_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.GetServerConfigRequest( - project_id='project_id_value', - zone='zone_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.get_server_config(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetServerConfigRequest( - project_id='project_id_value', - zone='zone_value', - name='name_value', - ) - -def test_get_server_config_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_server_config in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_server_config] = mock_rpc - request = {} - client.get_server_config(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_server_config(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_server_config_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.get_server_config in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.get_server_config] = mock_rpc - - request = {} - await client.get_server_config(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.get_server_config(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_server_config_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetServerConfigRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_server_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig( - default_cluster_version='default_cluster_version_value', - valid_node_versions=['valid_node_versions_value'], - default_image_type='default_image_type_value', - valid_image_types=['valid_image_types_value'], - valid_master_versions=['valid_master_versions_value'], - )) - response = await client.get_server_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.GetServerConfigRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ServerConfig) - assert response.default_cluster_version == 'default_cluster_version_value' - assert response.valid_node_versions == ['valid_node_versions_value'] - assert response.default_image_type == 'default_image_type_value' - assert response.valid_image_types == ['valid_image_types_value'] - assert response.valid_master_versions == ['valid_master_versions_value'] - - -@pytest.mark.asyncio -async def test_get_server_config_async_from_dict(): - await test_get_server_config_async(request_type=dict) - -def test_get_server_config_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetServerConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - call.return_value = cluster_service.ServerConfig() - client.get_server_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_server_config_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetServerConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig()) - await client.get_server_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_server_config_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ServerConfig() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_server_config( - project_id='project_id_value', - zone='zone_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - - -def test_get_server_config_flattened_error(): - client = ClusterManagerClient( - 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_server_config( - cluster_service.GetServerConfigRequest(), - project_id='project_id_value', - zone='zone_value', - ) - -@pytest.mark.asyncio -async def test_get_server_config_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ServerConfig() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_server_config( - project_id='project_id_value', - zone='zone_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_server_config_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_server_config( - cluster_service.GetServerConfigRequest(), - project_id='project_id_value', - zone='zone_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetJSONWebKeysRequest, - dict, -]) -def test_get_json_web_keys(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_json_web_keys), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.GetJSONWebKeysResponse( - ) - response = client.get_json_web_keys(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.GetJSONWebKeysRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.GetJSONWebKeysResponse) - - -def test_get_json_web_keys_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.GetJSONWebKeysRequest( - parent='parent_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_json_web_keys), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.get_json_web_keys(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetJSONWebKeysRequest( - parent='parent_value', - ) - -def test_get_json_web_keys_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_json_web_keys in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_json_web_keys] = mock_rpc - request = {} - client.get_json_web_keys(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_json_web_keys(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_json_web_keys_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.get_json_web_keys in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.get_json_web_keys] = mock_rpc - - request = {} - await client.get_json_web_keys(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.get_json_web_keys(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_json_web_keys_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetJSONWebKeysRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_json_web_keys), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.GetJSONWebKeysResponse( - )) - response = await client.get_json_web_keys(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.GetJSONWebKeysRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.GetJSONWebKeysResponse) - - -@pytest.mark.asyncio -async def test_get_json_web_keys_async_from_dict(): - await test_get_json_web_keys_async(request_type=dict) - -def test_get_json_web_keys_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetJSONWebKeysRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_json_web_keys), - '__call__') as call: - call.return_value = cluster_service.GetJSONWebKeysResponse() - client.get_json_web_keys(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_get_json_web_keys_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetJSONWebKeysRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_json_web_keys), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.GetJSONWebKeysResponse()) - await client.get_json_web_keys(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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.ListNodePoolsRequest, - dict, -]) -def test_list_node_pools(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_node_pools), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListNodePoolsResponse( - ) - response = client.list_node_pools(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.ListNodePoolsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListNodePoolsResponse) - - -def test_list_node_pools_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.ListNodePoolsRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - parent='parent_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.list_node_pools(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListNodePoolsRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - parent='parent_value', - ) - -def test_list_node_pools_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.list_node_pools in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.list_node_pools] = mock_rpc - request = {} - client.list_node_pools(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.list_node_pools(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_node_pools_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.list_node_pools in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.list_node_pools] = mock_rpc - - request = {} - await client.list_node_pools(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.list_node_pools(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_node_pools_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListNodePoolsRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_node_pools), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse( - )) - response = await client.list_node_pools(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.ListNodePoolsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListNodePoolsResponse) - - -@pytest.mark.asyncio -async def test_list_node_pools_async_from_dict(): - await test_list_node_pools_async(request_type=dict) - -def test_list_node_pools_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListNodePoolsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - call.return_value = cluster_service.ListNodePoolsResponse() - client.list_node_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_node_pools_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListNodePoolsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse()) - await client.list_node_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_node_pools_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListNodePoolsResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_node_pools( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - - -def test_list_node_pools_flattened_error(): - client = ClusterManagerClient( - 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_node_pools( - cluster_service.ListNodePoolsRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - ) - -@pytest.mark.asyncio -async def test_list_node_pools_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListNodePoolsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_node_pools( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_node_pools_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_node_pools( - cluster_service.ListNodePoolsRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.GetNodePoolRequest, - dict, -]) -def test_get_node_pool(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.NodePool( - name='name_value', - initial_node_count=1911, - locations=['locations_value'], - self_link='self_link_value', - version='version_value', - instance_group_urls=['instance_group_urls_value'], - status=cluster_service.NodePool.Status.PROVISIONING, - status_message='status_message_value', - pod_ipv4_cidr_size=1856, - etag='etag_value', - ) - response = client.get_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.GetNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.NodePool) - assert response.name == 'name_value' - assert response.initial_node_count == 1911 - assert response.locations == ['locations_value'] - assert response.self_link == 'self_link_value' - assert response.version == 'version_value' - assert response.instance_group_urls == ['instance_group_urls_value'] - assert response.status == cluster_service.NodePool.Status.PROVISIONING - assert response.status_message == 'status_message_value' - assert response.pod_ipv4_cidr_size == 1856 - assert response.etag == 'etag_value' - - -def test_get_node_pool_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.GetNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.get_node_pool(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -def test_get_node_pool_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.get_node_pool in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.get_node_pool] = mock_rpc - request = {} - client.get_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.get_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.get_node_pool in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.get_node_pool] = mock_rpc - - request = {} - await client.get_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.get_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_get_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.GetNodePoolRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool( - name='name_value', - initial_node_count=1911, - locations=['locations_value'], - self_link='self_link_value', - version='version_value', - instance_group_urls=['instance_group_urls_value'], - status=cluster_service.NodePool.Status.PROVISIONING, - status_message='status_message_value', - pod_ipv4_cidr_size=1856, - etag='etag_value', - )) - response = await client.get_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.GetNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.NodePool) - assert response.name == 'name_value' - assert response.initial_node_count == 1911 - assert response.locations == ['locations_value'] - assert response.self_link == 'self_link_value' - assert response.version == 'version_value' - assert response.instance_group_urls == ['instance_group_urls_value'] - assert response.status == cluster_service.NodePool.Status.PROVISIONING - assert response.status_message == 'status_message_value' - assert response.pod_ipv4_cidr_size == 1856 - assert response.etag == 'etag_value' - - -@pytest.mark.asyncio -async def test_get_node_pool_async_from_dict(): - await test_get_node_pool_async(request_type=dict) - -def test_get_node_pool_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetNodePoolRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - call.return_value = cluster_service.NodePool() - client.get_node_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_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.GetNodePoolRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool()) - await client.get_node_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_node_pool_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.NodePool() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_node_pool( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - - -def test_get_node_pool_flattened_error(): - client = ClusterManagerClient( - 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_node_pool( - cluster_service.GetNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - ) - -@pytest.mark.asyncio -async def test_get_node_pool_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.NodePool() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_node_pool( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_node_pool_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_node_pool( - cluster_service.GetNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CreateNodePoolRequest, - dict, -]) -def test_create_node_pool(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.create_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.CreateNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_create_node_pool_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.CreateNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - parent='parent_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.create_node_pool(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - parent='parent_value', - ) - -def test_create_node_pool_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.create_node_pool in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.create_node_pool] = mock_rpc - request = {} - client.create_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.create_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_create_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.create_node_pool in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.create_node_pool] = mock_rpc - - request = {} - await client.create_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.create_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_create_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CreateNodePoolRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.create_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.CreateNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_create_node_pool_async_from_dict(): - await test_create_node_pool_async(request_type=dict) - -def test_create_node_pool_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CreateNodePoolRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.create_node_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_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CreateNodePoolRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.create_node_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_node_pool_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.create_node_pool( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool=cluster_service.NodePool(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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool - mock_val = cluster_service.NodePool(name='name_value') - assert arg == mock_val - - -def test_create_node_pool_flattened_error(): - client = ClusterManagerClient( - 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_node_pool( - cluster_service.CreateNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool=cluster_service.NodePool(name='name_value'), - ) - -@pytest.mark.asyncio -async def test_create_node_pool_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_node_pool( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool=cluster_service.NodePool(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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool - mock_val = cluster_service.NodePool(name='name_value') - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_node_pool_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_node_pool( - cluster_service.CreateNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool=cluster_service.NodePool(name='name_value'), - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.DeleteNodePoolRequest, - dict, -]) -def test_delete_node_pool(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.delete_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.DeleteNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_delete_node_pool_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.DeleteNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.delete_node_pool(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteNodePoolRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -def test_delete_node_pool_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.delete_node_pool in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.delete_node_pool] = mock_rpc - request = {} - client.delete_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.delete_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_delete_node_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.delete_node_pool in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.delete_node_pool] = mock_rpc - - request = {} - await client.delete_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.delete_node_pool(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_delete_node_pool_async(transport: str = 'grpc_asyncio', request_type=cluster_service.DeleteNodePoolRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.delete_node_pool(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.DeleteNodePoolRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_delete_node_pool_async_from_dict(): - await test_delete_node_pool_async(request_type=dict) - -def test_delete_node_pool_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.DeleteNodePoolRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.delete_node_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_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.DeleteNodePoolRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.delete_node_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_node_pool_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_node_pool( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - - -def test_delete_node_pool_flattened_error(): - client = ClusterManagerClient( - 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_node_pool( - cluster_service.DeleteNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - ) - -@pytest.mark.asyncio -async def test_delete_node_pool_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_node_pool( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_node_pool_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_node_pool( - cluster_service.DeleteNodePoolRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CompleteNodePoolUpgradeRequest, - dict, -]) -def test_complete_node_pool_upgrade(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.complete_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.complete_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.CompleteNodePoolUpgradeRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None - - -def test_complete_node_pool_upgrade_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.CompleteNodePoolUpgradeRequest( - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_node_pool_upgrade), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.complete_node_pool_upgrade(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteNodePoolUpgradeRequest( - name='name_value', - ) - -def test_complete_node_pool_upgrade_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.complete_node_pool_upgrade in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.complete_node_pool_upgrade] = mock_rpc - request = {} - client.complete_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.complete_node_pool_upgrade(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_complete_node_pool_upgrade_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.complete_node_pool_upgrade in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.complete_node_pool_upgrade] = mock_rpc - - request = {} - await client.complete_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.complete_node_pool_upgrade(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_complete_node_pool_upgrade_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CompleteNodePoolUpgradeRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.complete_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.complete_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.CompleteNodePoolUpgradeRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.asyncio -async def test_complete_node_pool_upgrade_async_from_dict(): - await test_complete_node_pool_upgrade_async(request_type=dict) - -def test_complete_node_pool_upgrade_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CompleteNodePoolUpgradeRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_node_pool_upgrade), - '__call__') as call: - call.return_value = None - client.complete_node_pool_upgrade(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_complete_node_pool_upgrade_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CompleteNodePoolUpgradeRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_node_pool_upgrade), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.complete_node_pool_upgrade(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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.RollbackNodePoolUpgradeRequest, - dict, -]) -def test_rollback_node_pool_upgrade(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.rollback_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.rollback_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.RollbackNodePoolUpgradeRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_rollback_node_pool_upgrade_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.RollbackNodePoolUpgradeRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.rollback_node_pool_upgrade(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -def test_rollback_node_pool_upgrade_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.rollback_node_pool_upgrade in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.rollback_node_pool_upgrade] = mock_rpc - request = {} - client.rollback_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.rollback_node_pool_upgrade(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.rollback_node_pool_upgrade in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.rollback_node_pool_upgrade] = mock_rpc - - request = {} - await client.rollback_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.rollback_node_pool_upgrade(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_async(transport: str = 'grpc_asyncio', request_type=cluster_service.RollbackNodePoolUpgradeRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.rollback_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.rollback_node_pool_upgrade(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.RollbackNodePoolUpgradeRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_async_from_dict(): - await test_rollback_node_pool_upgrade_async(request_type=dict) - -def test_rollback_node_pool_upgrade_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.RollbackNodePoolUpgradeRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.rollback_node_pool_upgrade(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_rollback_node_pool_upgrade_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.RollbackNodePoolUpgradeRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.rollback_node_pool_upgrade(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_rollback_node_pool_upgrade_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.rollback_node_pool_upgrade( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - - -def test_rollback_node_pool_upgrade_flattened_error(): - client = ClusterManagerClient( - 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.rollback_node_pool_upgrade( - cluster_service.RollbackNodePoolUpgradeRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - ) - -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.rollback_node_pool_upgrade( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.rollback_node_pool_upgrade( - cluster_service.RollbackNodePoolUpgradeRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetNodePoolManagementRequest, - dict, -]) -def test_set_node_pool_management(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_node_pool_management), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_node_pool_management(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNodePoolManagementRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_node_pool_management_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetNodePoolManagementRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_management), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_node_pool_management(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolManagementRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -def test_set_node_pool_management_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_node_pool_management in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_node_pool_management] = mock_rpc - request = {} - client.set_node_pool_management(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_node_pool_management(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_node_pool_management_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_node_pool_management in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_node_pool_management] = mock_rpc - - request = {} - await client.set_node_pool_management(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_node_pool_management(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_node_pool_management_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNodePoolManagementRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_node_pool_management), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_node_pool_management(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNodePoolManagementRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_node_pool_management_async_from_dict(): - await test_set_node_pool_management_async(request_type=dict) - -def test_set_node_pool_management_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNodePoolManagementRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_management), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_node_pool_management(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_set_node_pool_management_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNodePoolManagementRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_management), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_node_pool_management(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_set_node_pool_management_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_management), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_node_pool_management( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - management=cluster_service.NodeManagement(auto_upgrade=True), - ) - - # 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - arg = args[0].management - mock_val = cluster_service.NodeManagement(auto_upgrade=True) - assert arg == mock_val - - -def test_set_node_pool_management_flattened_error(): - client = ClusterManagerClient( - 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.set_node_pool_management( - cluster_service.SetNodePoolManagementRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - management=cluster_service.NodeManagement(auto_upgrade=True), - ) - -@pytest.mark.asyncio -async def test_set_node_pool_management_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_management), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_node_pool_management( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - management=cluster_service.NodeManagement(auto_upgrade=True), - ) - - # 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].node_pool_id - mock_val = 'node_pool_id_value' - assert arg == mock_val - arg = args[0].management - mock_val = cluster_service.NodeManagement(auto_upgrade=True) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_node_pool_management_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_node_pool_management( - cluster_service.SetNodePoolManagementRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - management=cluster_service.NodeManagement(auto_upgrade=True), - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetLabelsRequest, - dict, -]) -def test_set_labels(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_labels), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_labels(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLabelsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_labels_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetLabelsRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - label_fingerprint='label_fingerprint_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_labels), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_labels(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLabelsRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - label_fingerprint='label_fingerprint_value', - name='name_value', - ) - -def test_set_labels_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_labels in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_labels] = mock_rpc - request = {} - client.set_labels(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_labels(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_labels_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_labels in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_labels] = mock_rpc - - request = {} - await client.set_labels(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_labels(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_labels_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLabelsRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_labels), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_labels(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLabelsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_labels_async_from_dict(): - await test_set_labels_async(request_type=dict) - -def test_set_labels_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLabelsRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_labels), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_labels(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_set_labels_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLabelsRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_labels), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_labels(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_set_labels_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_labels), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_labels( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - resource_labels={'key_value': 'value_value'}, - label_fingerprint='label_fingerprint_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].resource_labels - mock_val = {'key_value': 'value_value'} - assert arg == mock_val - arg = args[0].label_fingerprint - mock_val = 'label_fingerprint_value' - assert arg == mock_val - - -def test_set_labels_flattened_error(): - client = ClusterManagerClient( - 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.set_labels( - cluster_service.SetLabelsRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - resource_labels={'key_value': 'value_value'}, - label_fingerprint='label_fingerprint_value', - ) - -@pytest.mark.asyncio -async def test_set_labels_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_labels), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_labels( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - resource_labels={'key_value': 'value_value'}, - label_fingerprint='label_fingerprint_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].resource_labels - mock_val = {'key_value': 'value_value'} - assert arg == mock_val - arg = args[0].label_fingerprint - mock_val = 'label_fingerprint_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_labels_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_labels( - cluster_service.SetLabelsRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - resource_labels={'key_value': 'value_value'}, - label_fingerprint='label_fingerprint_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetLegacyAbacRequest, - dict, -]) -def test_set_legacy_abac(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_legacy_abac), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_legacy_abac(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLegacyAbacRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_legacy_abac_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetLegacyAbacRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_legacy_abac(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLegacyAbacRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_set_legacy_abac_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_legacy_abac in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_legacy_abac] = mock_rpc - request = {} - client.set_legacy_abac(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_legacy_abac(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_legacy_abac_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_legacy_abac in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_legacy_abac] = mock_rpc - - request = {} - await client.set_legacy_abac(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_legacy_abac(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_legacy_abac_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetLegacyAbacRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_legacy_abac), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_legacy_abac(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetLegacyAbacRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_legacy_abac_async_from_dict(): - await test_set_legacy_abac_async(request_type=dict) - -def test_set_legacy_abac_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLegacyAbacRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_legacy_abac(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_set_legacy_abac_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetLegacyAbacRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_legacy_abac(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_set_legacy_abac_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_legacy_abac( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - enabled=True, - ) - - # 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].enabled - mock_val = True - assert arg == mock_val - - -def test_set_legacy_abac_flattened_error(): - client = ClusterManagerClient( - 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.set_legacy_abac( - cluster_service.SetLegacyAbacRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - enabled=True, - ) - -@pytest.mark.asyncio -async def test_set_legacy_abac_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_legacy_abac( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - enabled=True, - ) - - # 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].enabled - mock_val = True - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_legacy_abac_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_legacy_abac( - cluster_service.SetLegacyAbacRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - enabled=True, - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.StartIPRotationRequest, - dict, -]) -def test_start_ip_rotation(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.start_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.start_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.StartIPRotationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_start_ip_rotation_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.StartIPRotationRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.start_ip_rotation(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.StartIPRotationRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_start_ip_rotation_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.start_ip_rotation in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.start_ip_rotation] = mock_rpc - request = {} - client.start_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.start_ip_rotation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_start_ip_rotation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.start_ip_rotation in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.start_ip_rotation] = mock_rpc - - request = {} - await client.start_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.start_ip_rotation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_start_ip_rotation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.StartIPRotationRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.start_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.start_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.StartIPRotationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_start_ip_rotation_async_from_dict(): - await test_start_ip_rotation_async(request_type=dict) - -def test_start_ip_rotation_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.StartIPRotationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.start_ip_rotation(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_start_ip_rotation_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.StartIPRotationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.start_ip_rotation(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_start_ip_rotation_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.start_ip_rotation( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - - -def test_start_ip_rotation_flattened_error(): - client = ClusterManagerClient( - 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.start_ip_rotation( - cluster_service.StartIPRotationRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - ) - -@pytest.mark.asyncio -async def test_start_ip_rotation_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.start_ip_rotation( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_start_ip_rotation_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.start_ip_rotation( - cluster_service.StartIPRotationRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.CompleteIPRotationRequest, - dict, -]) -def test_complete_ip_rotation(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.complete_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.complete_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.CompleteIPRotationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_complete_ip_rotation_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.CompleteIPRotationRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.complete_ip_rotation(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteIPRotationRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_complete_ip_rotation_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.complete_ip_rotation in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.complete_ip_rotation] = mock_rpc - request = {} - client.complete_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.complete_ip_rotation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_complete_ip_rotation_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.complete_ip_rotation in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.complete_ip_rotation] = mock_rpc - - request = {} - await client.complete_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.complete_ip_rotation(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_complete_ip_rotation_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CompleteIPRotationRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.complete_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.complete_ip_rotation(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.CompleteIPRotationRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_complete_ip_rotation_async_from_dict(): - await test_complete_ip_rotation_async(request_type=dict) - -def test_complete_ip_rotation_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CompleteIPRotationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.complete_ip_rotation(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_complete_ip_rotation_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CompleteIPRotationRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.complete_ip_rotation(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_complete_ip_rotation_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.complete_ip_rotation( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - - -def test_complete_ip_rotation_flattened_error(): - client = ClusterManagerClient( - 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.complete_ip_rotation( - cluster_service.CompleteIPRotationRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - ) - -@pytest.mark.asyncio -async def test_complete_ip_rotation_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.complete_ip_rotation( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_complete_ip_rotation_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.complete_ip_rotation( - cluster_service.CompleteIPRotationRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetNodePoolSizeRequest, - dict, -]) -def test_set_node_pool_size(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_node_pool_size), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_node_pool_size(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNodePoolSizeRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_node_pool_size_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetNodePoolSizeRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_size), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_node_pool_size(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolSizeRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - node_pool_id='node_pool_id_value', - name='name_value', - ) - -def test_set_node_pool_size_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_node_pool_size in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_node_pool_size] = mock_rpc - request = {} - client.set_node_pool_size(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_node_pool_size(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_node_pool_size_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_node_pool_size in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_node_pool_size] = mock_rpc - - request = {} - await client.set_node_pool_size(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_node_pool_size(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_node_pool_size_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNodePoolSizeRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_node_pool_size), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_node_pool_size(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNodePoolSizeRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_node_pool_size_async_from_dict(): - await test_set_node_pool_size_async(request_type=dict) - -def test_set_node_pool_size_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNodePoolSizeRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_size), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_node_pool_size(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_set_node_pool_size_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNodePoolSizeRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_size), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_node_pool_size(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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetNetworkPolicyRequest, - dict, -]) -def test_set_network_policy(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_network_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_network_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNetworkPolicyRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_network_policy_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetNetworkPolicyRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_network_policy(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNetworkPolicyRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_set_network_policy_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_network_policy in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_network_policy] = mock_rpc - request = {} - client.set_network_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_network_policy(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_network_policy_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_network_policy in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_network_policy] = mock_rpc - - request = {} - await client.set_network_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_network_policy(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_network_policy_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetNetworkPolicyRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_network_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_network_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetNetworkPolicyRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_network_policy_async_from_dict(): - await test_set_network_policy_async(request_type=dict) - -def test_set_network_policy_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNetworkPolicyRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_network_policy(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_set_network_policy_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetNetworkPolicyRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_network_policy(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_set_network_policy_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_network_policy( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), - ) - - # 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].network_policy - mock_val = cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO) - assert arg == mock_val - - -def test_set_network_policy_flattened_error(): - client = ClusterManagerClient( - 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.set_network_policy( - cluster_service.SetNetworkPolicyRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), - ) - -@pytest.mark.asyncio -async def test_set_network_policy_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_network_policy( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), - ) - - # 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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].network_policy - mock_val = cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_network_policy_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_network_policy( - cluster_service.SetNetworkPolicyRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - network_policy=cluster_service.NetworkPolicy(provider=cluster_service.NetworkPolicy.Provider.CALICO), - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.SetMaintenancePolicyRequest, - dict, -]) -def test_set_maintenance_policy(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.set_maintenance_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - ) - response = client.set_maintenance_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.SetMaintenancePolicyRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -def test_set_maintenance_policy_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.SetMaintenancePolicyRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.set_maintenance_policy(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMaintenancePolicyRequest( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - name='name_value', - ) - -def test_set_maintenance_policy_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.set_maintenance_policy in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.set_maintenance_policy] = mock_rpc - request = {} - client.set_maintenance_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.set_maintenance_policy(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_maintenance_policy_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.set_maintenance_policy in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.set_maintenance_policy] = mock_rpc - - request = {} - await client.set_maintenance_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.set_maintenance_policy(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_set_maintenance_policy_async(transport: str = 'grpc_asyncio', request_type=cluster_service.SetMaintenancePolicyRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.set_maintenance_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - response = await client.set_maintenance_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.SetMaintenancePolicyRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == 'name_value' - assert response.zone == 'zone_value' - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == 'detail_value' - assert response.status_message == 'status_message_value' - assert response.self_link == 'self_link_value' - assert response.target_link == 'target_link_value' - assert response.location == 'location_value' - assert response.start_time == 'start_time_value' - assert response.end_time == 'end_time_value' - - -@pytest.mark.asyncio -async def test_set_maintenance_policy_async_from_dict(): - await test_set_maintenance_policy_async(request_type=dict) - -def test_set_maintenance_policy_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetMaintenancePolicyRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_maintenance_policy(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_set_maintenance_policy_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.SetMaintenancePolicyRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - await client.set_maintenance_policy(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_set_maintenance_policy_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.set_maintenance_policy( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].maintenance_policy - mock_val = cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))) - assert arg == mock_val - - -def test_set_maintenance_policy_flattened_error(): - client = ClusterManagerClient( - 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.set_maintenance_policy( - cluster_service.SetMaintenancePolicyRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), - ) - -@pytest.mark.asyncio -async def test_set_maintenance_policy_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.Operation() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.set_maintenance_policy( - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_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].project_id - mock_val = 'project_id_value' - assert arg == mock_val - arg = args[0].zone - mock_val = 'zone_value' - assert arg == mock_val - arg = args[0].cluster_id - mock_val = 'cluster_id_value' - assert arg == mock_val - arg = args[0].maintenance_policy - mock_val = cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_set_maintenance_policy_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.set_maintenance_policy( - cluster_service.SetMaintenancePolicyRequest(), - project_id='project_id_value', - zone='zone_value', - cluster_id='cluster_id_value', - maintenance_policy=cluster_service.MaintenancePolicy(window=cluster_service.MaintenanceWindow(daily_maintenance_window=cluster_service.DailyMaintenanceWindow(start_time='start_time_value'))), - ) - - -@pytest.mark.parametrize("request_type", [ - cluster_service.ListUsableSubnetworksRequest, - dict, -]) -def test_list_usable_subnetworks(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_usable_subnetworks), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListUsableSubnetworksResponse( - next_page_token='next_page_token_value', - ) - response = client.list_usable_subnetworks(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.ListUsableSubnetworksRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListUsableSubnetworksPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_usable_subnetworks_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.ListUsableSubnetworksRequest( - parent='parent_value', - filter='filter_value', - page_token='page_token_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.list_usable_subnetworks(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListUsableSubnetworksRequest( - parent='parent_value', - filter='filter_value', - page_token='page_token_value', - ) - -def test_list_usable_subnetworks_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.list_usable_subnetworks in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.list_usable_subnetworks] = mock_rpc - request = {} - client.list_usable_subnetworks(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.list_usable_subnetworks(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_usable_subnetworks_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.list_usable_subnetworks in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.list_usable_subnetworks] = mock_rpc - - request = {} - await client.list_usable_subnetworks(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.list_usable_subnetworks(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_usable_subnetworks_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListUsableSubnetworksRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_usable_subnetworks), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_usable_subnetworks(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.ListUsableSubnetworksRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListUsableSubnetworksAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_usable_subnetworks_async_from_dict(): - await test_list_usable_subnetworks_async(request_type=dict) - -def test_list_usable_subnetworks_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListUsableSubnetworksRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__') as call: - call.return_value = cluster_service.ListUsableSubnetworksResponse() - client.list_usable_subnetworks(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_usable_subnetworks_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListUsableSubnetworksRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse()) - await client.list_usable_subnetworks(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_usable_subnetworks_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListUsableSubnetworksResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_usable_subnetworks( - 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_usable_subnetworks_flattened_error(): - client = ClusterManagerClient( - 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_usable_subnetworks( - cluster_service.ListUsableSubnetworksRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_usable_subnetworks_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListUsableSubnetworksResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_usable_subnetworks( - 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_usable_subnetworks_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_usable_subnetworks( - cluster_service.ListUsableSubnetworksRequest(), - parent='parent_value', - ) - - -def test_list_usable_subnetworks_pager(transport_name: str = "grpc"): - client = ClusterManagerClient( - 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_usable_subnetworks), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - next_page_token='abc', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[], - next_page_token='def', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - ], - next_page_token='ghi', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - ), - RuntimeError, - ) - - expected_metadata = () - retry = retries.Retry() - timeout = 5 - expected_metadata = tuple(expected_metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_usable_subnetworks(request={}, retry=retry, timeout=timeout) - - assert pager._metadata == expected_metadata - assert pager._retry == retry - assert pager._timeout == timeout - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, cluster_service.UsableSubnetwork) - for i in results) -def test_list_usable_subnetworks_pages(transport_name: str = "grpc"): - client = ClusterManagerClient( - 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_usable_subnetworks), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - next_page_token='abc', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[], - next_page_token='def', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - ], - next_page_token='ghi', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - ), - RuntimeError, - ) - pages = list(client.list_usable_subnetworks(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_usable_subnetworks_async_pager(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - next_page_token='abc', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[], - next_page_token='def', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - ], - next_page_token='ghi', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_usable_subnetworks(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, cluster_service.UsableSubnetwork) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_usable_subnetworks_async_pages(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - next_page_token='abc', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[], - next_page_token='def', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - ], - next_page_token='ghi', - ), - cluster_service.ListUsableSubnetworksResponse( - subnetworks=[ - cluster_service.UsableSubnetwork(), - cluster_service.UsableSubnetwork(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_usable_subnetworks(request={}) - ).pages: - 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", [ - cluster_service.CheckAutopilotCompatibilityRequest, - dict, -]) -def test_check_autopilot_compatibility(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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.check_autopilot_compatibility), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.CheckAutopilotCompatibilityResponse( - summary='summary_value', - ) - response = client.check_autopilot_compatibility(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.CheckAutopilotCompatibilityRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) - assert response.summary == 'summary_value' - - -def test_check_autopilot_compatibility_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.CheckAutopilotCompatibilityRequest( - name='name_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.check_autopilot_compatibility), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.check_autopilot_compatibility(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CheckAutopilotCompatibilityRequest( - name='name_value', - ) - -def test_check_autopilot_compatibility_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.check_autopilot_compatibility in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.check_autopilot_compatibility] = mock_rpc - request = {} - client.check_autopilot_compatibility(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.check_autopilot_compatibility(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_check_autopilot_compatibility_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.check_autopilot_compatibility in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.check_autopilot_compatibility] = mock_rpc - - request = {} - await client.check_autopilot_compatibility(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.check_autopilot_compatibility(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_check_autopilot_compatibility_async(transport: str = 'grpc_asyncio', request_type=cluster_service.CheckAutopilotCompatibilityRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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.check_autopilot_compatibility), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.CheckAutopilotCompatibilityResponse( - summary='summary_value', - )) - response = await client.check_autopilot_compatibility(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.CheckAutopilotCompatibilityRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) - assert response.summary == 'summary_value' - - -@pytest.mark.asyncio -async def test_check_autopilot_compatibility_async_from_dict(): - await test_check_autopilot_compatibility_async(request_type=dict) - -def test_check_autopilot_compatibility_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CheckAutopilotCompatibilityRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.check_autopilot_compatibility), - '__call__') as call: - call.return_value = cluster_service.CheckAutopilotCompatibilityResponse() - client.check_autopilot_compatibility(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_check_autopilot_compatibility_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.CheckAutopilotCompatibilityRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.check_autopilot_compatibility), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.CheckAutopilotCompatibilityResponse()) - await client.check_autopilot_compatibility(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'] - - -@pytest.mark.parametrize("request_type", [ - cluster_service.ListLocationsRequest, - dict, -]) -def test_list_locations(request_type, transport: str = 'grpc'): - client = ClusterManagerClient( - 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_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListLocationsResponse( - next_page_token='next_page_token_value', - ) - response = client.list_locations(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - request = cluster_service.ListLocationsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response.raw_page is response - assert isinstance(response, cluster_service.ListLocationsResponse) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_locations_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that UUID4 fields are - # automatically populated, according to AIP-4235, with non-empty requests. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Populate all string fields in the request which are not UUID4 - # since we want to check that UUID4 are populated automatically - # if they meet the requirements of AIP 4235. - request = cluster_service.ListLocationsRequest( - parent='parent_value', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_locations), - '__call__') as call: - call.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client.list_locations(request=request) - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListLocationsRequest( - parent='parent_value', - ) - -def test_list_locations_use_cached_wrapped_rpc(): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method.wrap_method") as wrapper_fn: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._transport.list_locations in client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.Mock() - mock_rpc.return_value.name = "foo" # operation_request.operation in compute client(s) expect a string. - client._transport._wrapped_methods[client._transport.list_locations] = mock_rpc - request = {} - client.list_locations(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - client.list_locations(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_locations_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio"): - # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, - # instead of constructing them on each call - with mock.patch("google.api_core.gapic_v1.method_async.wrap_method") as wrapper_fn: - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - - # Should wrap all calls on client creation - assert wrapper_fn.call_count > 0 - wrapper_fn.reset_mock() - - # Ensure method has been cached - assert client._client._transport.list_locations in client._client._transport._wrapped_methods - - # Replace cached wrapped function with mock - mock_rpc = mock.AsyncMock() - mock_rpc.return_value = mock.Mock() - client._client._transport._wrapped_methods[client._client._transport.list_locations] = mock_rpc - - request = {} - await client.list_locations(request) - - # Establish that the underlying gRPC stub method was called. - assert mock_rpc.call_count == 1 - - await client.list_locations(request) - - # Establish that a new wrapper was not created for this call - assert wrapper_fn.call_count == 0 - assert mock_rpc.call_count == 2 - -@pytest.mark.asyncio -async def test_list_locations_async(transport: str = 'grpc_asyncio', request_type=cluster_service.ListLocationsRequest): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListLocationsResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_locations(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - request = cluster_service.ListLocationsRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListLocationsResponse) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_locations_async_from_dict(): - await test_list_locations_async(request_type=dict) - -def test_list_locations_field_headers(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListLocationsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_locations), - '__call__') as call: - call.return_value = cluster_service.ListLocationsResponse() - client.list_locations(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_locations_field_headers_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cluster_service.ListLocationsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_locations), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListLocationsResponse()) - await client.list_locations(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_locations_flattened(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListLocationsResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_locations( - 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_locations_flattened_error(): - client = ClusterManagerClient( - 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_locations( - cluster_service.ListLocationsRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_locations_flattened_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cluster_service.ListLocationsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListLocationsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_locations( - 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_locations_flattened_error_async(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_locations( - cluster_service.ListLocationsRequest(), - parent='parent_value', - ) - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.ClusterManagerGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.ClusterManagerGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ClusterManagerClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.ClusterManagerGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = ClusterManagerClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = ClusterManagerClient( - client_options=options, - credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.ClusterManagerGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ClusterManagerClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.ClusterManagerGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = ClusterManagerClient(transport=transport) - assert client.transport is transport - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.ClusterManagerGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.ClusterManagerGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - -@pytest.mark.parametrize("transport_class", [ - transports.ClusterManagerGrpcTransport, - transports.ClusterManagerGrpcAsyncIOTransport, -]) -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() - -def test_transport_kind_grpc(): - transport = ClusterManagerClient.get_transport_class("grpc")( - credentials=ga_credentials.AnonymousCredentials() - ) - assert transport.kind == "grpc" - - -def test_initialize_client_w_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc" - ) - assert client is not None - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_list_clusters_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - call.return_value = cluster_service.ListClustersResponse() - client.list_clusters(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListClustersRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_cluster_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - call.return_value = cluster_service.Cluster() - client.get_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_create_cluster_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.create_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CreateClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_update_cluster_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.update_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_update_node_pool_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_node_pool), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.update_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_node_pool_autoscaling_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_autoscaling), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_node_pool_autoscaling(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolAutoscalingRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_logging_service_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_logging_service(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLoggingServiceRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_monitoring_service_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_monitoring_service(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMonitoringServiceRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_addons_config_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_addons_config(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetAddonsConfigRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_locations_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_locations(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLocationsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_update_master_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.update_master(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateMasterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_master_auth_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_master_auth), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_master_auth(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMasterAuthRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_delete_cluster_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.delete_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.DeleteClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_list_operations_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - call.return_value = cluster_service.ListOperationsResponse() - client.list_operations(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListOperationsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_operation_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.get_operation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetOperationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_cancel_operation_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - call.return_value = None - client.cancel_operation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CancelOperationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_server_config_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - call.return_value = cluster_service.ServerConfig() - client.get_server_config(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetServerConfigRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_json_web_keys_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_json_web_keys), - '__call__') as call: - call.return_value = cluster_service.GetJSONWebKeysResponse() - client.get_json_web_keys(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetJSONWebKeysRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_list_node_pools_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - call.return_value = cluster_service.ListNodePoolsResponse() - client.list_node_pools(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListNodePoolsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_get_node_pool_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - call.return_value = cluster_service.NodePool() - client.get_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_create_node_pool_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.create_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CreateNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_delete_node_pool_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.delete_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.DeleteNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_complete_node_pool_upgrade_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.complete_node_pool_upgrade), - '__call__') as call: - call.return_value = None - client.complete_node_pool_upgrade(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CompleteNodePoolUpgradeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_rollback_node_pool_upgrade_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.rollback_node_pool_upgrade(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.RollbackNodePoolUpgradeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_node_pool_management_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_management), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_node_pool_management(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolManagementRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_labels_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_labels), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_labels(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLabelsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_legacy_abac_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_legacy_abac(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLegacyAbacRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_start_ip_rotation_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.start_ip_rotation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.StartIPRotationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_complete_ip_rotation_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.complete_ip_rotation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CompleteIPRotationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_node_pool_size_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_size), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_node_pool_size(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolSizeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_network_policy_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_network_policy(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNetworkPolicyRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_set_maintenance_policy_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - call.return_value = cluster_service.Operation() - client.set_maintenance_policy(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMaintenancePolicyRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_list_usable_subnetworks_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__') as call: - call.return_value = cluster_service.ListUsableSubnetworksResponse() - client.list_usable_subnetworks(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListUsableSubnetworksRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_check_autopilot_compatibility_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.check_autopilot_compatibility), - '__call__') as call: - call.return_value = cluster_service.CheckAutopilotCompatibilityResponse() - client.check_autopilot_compatibility(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CheckAutopilotCompatibilityRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -def test_list_locations_empty_call_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_locations), - '__call__') as call: - call.return_value = cluster_service.ListLocationsResponse() - client.list_locations(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListLocationsRequest() - - assert args[0] == request_msg - - -def test_transport_kind_grpc_asyncio(): - transport = ClusterManagerAsyncClient.get_transport_class("grpc_asyncio")( - credentials=async_anonymous_credentials() - ) - assert transport.kind == "grpc_asyncio" - - -def test_initialize_client_w_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio" - ) - assert client is not None - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_list_clusters_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_clusters), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListClustersResponse( - missing_zones=['missing_zones_value'], - )) - await client.list_clusters(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListClustersRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_get_cluster_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Cluster( - name='name_value', - description='description_value', - initial_node_count=1911, - logging_service='logging_service_value', - monitoring_service='monitoring_service_value', - network='network_value', - cluster_ipv4_cidr='cluster_ipv4_cidr_value', - subnetwork='subnetwork_value', - locations=['locations_value'], - enable_kubernetes_alpha=True, - label_fingerprint='label_fingerprint_value', - private_cluster=True, - master_ipv4_cidr_block='master_ipv4_cidr_block_value', - self_link='self_link_value', - zone='zone_value', - endpoint='endpoint_value', - initial_cluster_version='initial_cluster_version_value', - current_master_version='current_master_version_value', - current_node_version='current_node_version_value', - create_time='create_time_value', - status=cluster_service.Cluster.Status.PROVISIONING, - status_message='status_message_value', - node_ipv4_cidr_size=1955, - services_ipv4_cidr='services_ipv4_cidr_value', - instance_group_urls=['instance_group_urls_value'], - current_node_count=1936, - expire_time='expire_time_value', - location='location_value', - enable_tpu=True, - tpu_ipv4_cidr_block='tpu_ipv4_cidr_block_value', - id='id_value', - etag='etag_value', - satisfies_pzs=True, - satisfies_pzi=True, - )) - await client.get_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_create_cluster_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.create_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.create_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CreateClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_update_cluster_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.update_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_update_node_pool_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.update_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_node_pool_autoscaling_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_autoscaling), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_node_pool_autoscaling(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolAutoscalingRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_logging_service_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_logging_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_logging_service(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLoggingServiceRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_monitoring_service_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_monitoring_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_monitoring_service(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMonitoringServiceRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_addons_config_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_addons_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_addons_config(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetAddonsConfigRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_locations_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_locations(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLocationsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_update_master_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.update_master), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.update_master(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.UpdateMasterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_master_auth_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_master_auth), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_master_auth(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMasterAuthRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_delete_cluster_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.delete_cluster), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.delete_cluster(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.DeleteClusterRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_list_operations_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_operations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListOperationsResponse( - missing_zones=['missing_zones_value'], - )) - await client.list_operations(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListOperationsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_get_operation_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.get_operation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetOperationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_cancel_operation_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.cancel_operation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.cancel_operation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CancelOperationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_get_server_config_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_server_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ServerConfig( - default_cluster_version='default_cluster_version_value', - valid_node_versions=['valid_node_versions_value'], - default_image_type='default_image_type_value', - valid_image_types=['valid_image_types_value'], - valid_master_versions=['valid_master_versions_value'], - )) - await client.get_server_config(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetServerConfigRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_get_json_web_keys_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_json_web_keys), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.GetJSONWebKeysResponse( - )) - await client.get_json_web_keys(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetJSONWebKeysRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_list_node_pools_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_node_pools), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListNodePoolsResponse( - )) - await client.list_node_pools(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListNodePoolsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_get_node_pool_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.get_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.NodePool( - name='name_value', - initial_node_count=1911, - locations=['locations_value'], - self_link='self_link_value', - version='version_value', - instance_group_urls=['instance_group_urls_value'], - status=cluster_service.NodePool.Status.PROVISIONING, - status_message='status_message_value', - pod_ipv4_cidr_size=1856, - etag='etag_value', - )) - await client.get_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.GetNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_create_node_pool_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.create_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.create_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CreateNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_delete_node_pool_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.delete_node_pool), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.delete_node_pool(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.DeleteNodePoolRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_complete_node_pool_upgrade_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.complete_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.complete_node_pool_upgrade(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CompleteNodePoolUpgradeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.rollback_node_pool_upgrade), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.rollback_node_pool_upgrade(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.RollbackNodePoolUpgradeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_node_pool_management_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_management), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_node_pool_management(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolManagementRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_labels_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_labels), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_labels(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLabelsRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_legacy_abac_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_legacy_abac), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_legacy_abac(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetLegacyAbacRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_start_ip_rotation_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.start_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.start_ip_rotation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.StartIPRotationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_complete_ip_rotation_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.complete_ip_rotation), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.complete_ip_rotation(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CompleteIPRotationRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_node_pool_size_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_node_pool_size), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_node_pool_size(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNodePoolSizeRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_network_policy_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_network_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_network_policy(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetNetworkPolicyRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_set_maintenance_policy_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.set_maintenance_policy), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.Operation( - name='name_value', - zone='zone_value', - operation_type=cluster_service.Operation.Type.CREATE_CLUSTER, - status=cluster_service.Operation.Status.PENDING, - detail='detail_value', - status_message='status_message_value', - self_link='self_link_value', - target_link='target_link_value', - location='location_value', - start_time='start_time_value', - end_time='end_time_value', - )) - await client.set_maintenance_policy(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.SetMaintenancePolicyRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_list_usable_subnetworks_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_usable_subnetworks), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListUsableSubnetworksResponse( - next_page_token='next_page_token_value', - )) - await client.list_usable_subnetworks(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListUsableSubnetworksRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_check_autopilot_compatibility_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.check_autopilot_compatibility), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.CheckAutopilotCompatibilityResponse( - summary='summary_value', - )) - await client.check_autopilot_compatibility(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.CheckAutopilotCompatibilityRequest() - - assert args[0] == request_msg - - -# This test is a coverage failsafe to make sure that totally empty calls, -# i.e. request == None and no flattened fields passed, work. -@pytest.mark.asyncio -async def test_list_locations_empty_call_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - transport="grpc_asyncio", - ) - - # Mock the actual call, and fake the request. - with mock.patch.object( - type(client.transport.list_locations), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cluster_service.ListLocationsResponse( - next_page_token='next_page_token_value', - )) - await client.list_locations(request=None) - - # Establish that the underlying stub method was called. - call.assert_called() - _, args, _ = call.mock_calls[0] - request_msg = cluster_service.ListLocationsRequest() - - assert args[0] == request_msg - - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.ClusterManagerGrpcTransport, - ) - -def test_cluster_manager_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.ClusterManagerTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json" - ) - - -def test_cluster_manager_base_transport(): - # Instantiate the base transport. - with mock.patch('google.cloud.container_v1beta1.services.cluster_manager.transports.ClusterManagerTransport.__init__') as Transport: - Transport.return_value = None - transport = transports.ClusterManagerTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - 'list_clusters', - 'get_cluster', - 'create_cluster', - 'update_cluster', - 'update_node_pool', - 'set_node_pool_autoscaling', - 'set_logging_service', - 'set_monitoring_service', - 'set_addons_config', - 'set_locations', - 'update_master', - 'set_master_auth', - 'delete_cluster', - 'list_operations', - 'get_operation', - 'cancel_operation', - 'get_server_config', - 'get_json_web_keys', - 'list_node_pools', - 'get_node_pool', - 'create_node_pool', - 'delete_node_pool', - 'complete_node_pool_upgrade', - 'rollback_node_pool_upgrade', - 'set_node_pool_management', - 'set_labels', - 'set_legacy_abac', - 'start_ip_rotation', - 'complete_ip_rotation', - 'set_node_pool_size', - 'set_network_policy', - 'set_maintenance_policy', - 'list_usable_subnetworks', - 'check_autopilot_compatibility', - 'list_locations', - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Catch all for all remaining methods and properties - remainder = [ - 'kind', - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_cluster_manager_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.container_v1beta1.services.cluster_manager.transports.ClusterManagerTransport._prep_wrapped_messages') as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.ClusterManagerTransport( - 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_cluster_manager_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.container_v1beta1.services.cluster_manager.transports.ClusterManagerTransport._prep_wrapped_messages') as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.ClusterManagerTransport() - adc.assert_called_once() - - -def test_cluster_manager_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) - ClusterManagerClient() - 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.ClusterManagerGrpcTransport, - transports.ClusterManagerGrpcAsyncIOTransport, - ], -) -def test_cluster_manager_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.ClusterManagerGrpcTransport, - transports.ClusterManagerGrpcAsyncIOTransport, - ], -) -def test_cluster_manager_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.ClusterManagerGrpcTransport, grpc_helpers), - (transports.ClusterManagerGrpcAsyncIOTransport, grpc_helpers_async) - ], -) -def test_cluster_manager_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( - "container.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="container.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("transport_class", [transports.ClusterManagerGrpcTransport, transports.ClusterManagerGrpcAsyncIOTransport]) -def test_cluster_manager_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_cluster_manager_host_no_port(transport_name): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='container.googleapis.com'), - transport=transport_name, - ) - assert client.transport._host == ( - 'container.googleapis.com:443' - ) - -@pytest.mark.parametrize("transport_name", [ - "grpc", - "grpc_asyncio", -]) -def test_cluster_manager_host_with_port(transport_name): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='container.googleapis.com:8000'), - transport=transport_name, - ) - assert client.transport._host == ( - 'container.googleapis.com:8000' - ) - -def test_cluster_manager_grpc_transport_channel(): - channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.ClusterManagerGrpcTransport( - 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_cluster_manager_grpc_asyncio_transport_channel(): - channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.ClusterManagerGrpcAsyncIOTransport( - 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.ClusterManagerGrpcTransport, transports.ClusterManagerGrpcAsyncIOTransport]) -def test_cluster_manager_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.ClusterManagerGrpcTransport, transports.ClusterManagerGrpcAsyncIOTransport]) -def test_cluster_manager_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_topic_path(): - project = "squid" - topic = "clam" - expected = "projects/{project}/topics/{topic}".format(project=project, topic=topic, ) - actual = ClusterManagerClient.topic_path(project, topic) - assert expected == actual - - -def test_parse_topic_path(): - expected = { - "project": "whelk", - "topic": "octopus", - } - path = ClusterManagerClient.topic_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.parse_topic_path(path) - assert expected == actual - -def test_common_billing_account_path(): - billing_account = "oyster" - expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) - actual = ClusterManagerClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "nudibranch", - } - path = ClusterManagerClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.parse_common_billing_account_path(path) - assert expected == actual - -def test_common_folder_path(): - folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder, ) - actual = ClusterManagerClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "mussel", - } - path = ClusterManagerClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.parse_common_folder_path(path) - assert expected == actual - -def test_common_organization_path(): - organization = "winkle" - expected = "organizations/{organization}".format(organization=organization, ) - actual = ClusterManagerClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "nautilus", - } - path = ClusterManagerClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.parse_common_organization_path(path) - assert expected == actual - -def test_common_project_path(): - project = "scallop" - expected = "projects/{project}".format(project=project, ) - actual = ClusterManagerClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "abalone", - } - path = ClusterManagerClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.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 = ClusterManagerClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "whelk", - "location": "octopus", - } - path = ClusterManagerClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = ClusterManagerClient.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.ClusterManagerTransport, '_prep_wrapped_messages') as prep: - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object(transports.ClusterManagerTransport, '_prep_wrapped_messages') as prep: - transport_class = ClusterManagerClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - -def test_transport_close_grpc(): - client = ClusterManagerClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc" - ) - with mock.patch.object(type(getattr(client.transport, "_grpc_channel")), "close") as close: - with client: - close.assert_not_called() - close.assert_called_once() - - -@pytest.mark.asyncio -async def test_transport_close_grpc_asyncio(): - client = ClusterManagerAsyncClient( - credentials=async_anonymous_credentials(), - 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_client_ctx(): - transports = [ - 'grpc', - ] - for transport in transports: - client = ClusterManagerClient( - 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", [ - (ClusterManagerClient, transports.ClusterManagerGrpcTransport), - (ClusterManagerAsyncClient, transports.ClusterManagerGrpcAsyncIOTransport), -]) -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_TEMPLATE.format(UNIVERSE_DOMAIN=client._DEFAULT_UNIVERSE), - 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/packages/google-cloud-container/google/cloud/container/gapic_version.py b/packages/google-cloud-container/google/cloud/container/gapic_version.py index 4fa43f226ae2..558c8aab67c5 100644 --- a/packages/google-cloud-container/google/cloud/container/gapic_version.py +++ b/packages/google-cloud-container/google/cloud/container/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.55.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-container/google/cloud/container_v1/gapic_version.py b/packages/google-cloud-container/google/cloud/container_v1/gapic_version.py index 4fa43f226ae2..558c8aab67c5 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/gapic_version.py +++ b/packages/google-cloud-container/google/cloud/container_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.55.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-container/google/cloud/container_v1/types/cluster_service.py b/packages/google-cloud-container/google/cloud/container_v1/types/cluster_service.py index 7e4d3f93d382..8c944e004ef3 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/types/cluster_service.py +++ b/packages/google-cloud-container/google/cloud/container_v1/types/cluster_service.py @@ -8342,7 +8342,7 @@ class NetworkConfig(proto.Message): Attributes: network (str): Output only. The relative name of the Google Compute Engine - [network]`google.container.v1.NetworkConfig.network `__ + `network `__ to which the cluster is connected. Example: projects/my-project/global/networks/my-network subnetwork (str): diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/gapic_version.py b/packages/google-cloud-container/google/cloud/container_v1beta1/gapic_version.py index 4fa43f226ae2..558c8aab67c5 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/gapic_version.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.55.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/types/cluster_service.py b/packages/google-cloud-container/google/cloud/container_v1beta1/types/cluster_service.py index f6187795c40e..98a387be93ab 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/types/cluster_service.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/types/cluster_service.py @@ -8945,7 +8945,7 @@ class NetworkConfig(proto.Message): Attributes: network (str): Output only. The relative name of the Google Compute Engine - [network]`google.container.v1beta1.NetworkConfig.network `__ + `network `__ to which the cluster is connected. Example: projects/my-project/global/networks/my-network subnetwork (str): diff --git a/packages/google-cloud-container/samples/generated_samples/snippet_metadata_google.container.v1.json b/packages/google-cloud-container/samples/generated_samples/snippet_metadata_google.container.v1.json index 94f59ca01be3..815ec00b3982 100644 --- a/packages/google-cloud-container/samples/generated_samples/snippet_metadata_google.container.v1.json +++ b/packages/google-cloud-container/samples/generated_samples/snippet_metadata_google.container.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-container", - "version": "2.55.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-container/samples/generated_samples/snippet_metadata_google.container.v1beta1.json b/packages/google-cloud-container/samples/generated_samples/snippet_metadata_google.container.v1beta1.json index c0c9270a83a4..a1b63076c321 100644 --- a/packages/google-cloud-container/samples/generated_samples/snippet_metadata_google.container.v1beta1.json +++ b/packages/google-cloud-container/samples/generated_samples/snippet_metadata_google.container.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-container", - "version": "2.55.0" + "version": "0.1.0" }, "snippets": [ {