From 737203065897c4598e10abb1895341890a0f5e8d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 14:54:13 +0000 Subject: [PATCH] chore: use gapic-generator-python 0.53.4 (#164) - [ ] Regenerate this pull request now. docs: list oneofs in docstring fix(deps): require google-api-core >= 1.28.0 fix(deps): drop packaging dependency committer: busunkim96@ PiperOrigin-RevId: 406468269 Source-Link: https://github.com/googleapis/googleapis/commit/83d81b0c8fc22291a13398d6d77f02dc97a5b6f4 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2ff001fbacb9e77e71d734de5f955c05fdae8526 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9 --- .../services/cluster_manager/async_client.py | 196 ++++++++--------- .../services/cluster_manager/client.py | 66 +++--- .../cluster_manager/transports/base.py | 35 +-- .../transports/grpc_asyncio.py | 1 - .../container_v1/types/cluster_service.py | 19 ++ .../services/cluster_manager/async_client.py | 202 +++++++++--------- .../services/cluster_manager/client.py | 68 +++--- .../cluster_manager/transports/base.py | 35 +-- .../transports/grpc_asyncio.py | 1 - .../types/cluster_service.py | 20 ++ packages/google-cloud-container/setup.py | 3 +- .../testing/constraints-3.6.txt | 3 +- .../container_v1/test_cluster_manager.py | 91 +------- .../container_v1beta1/test_cluster_manager.py | 91 +------- 14 files changed, 331 insertions(+), 500 deletions(-) diff --git a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/async_client.py b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/async_client.py index dbc4d6d167ba..2ae46aada7b3 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/async_client.py +++ b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/async_client.py @@ -20,13 +20,15 @@ import pkg_resources import warnings -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.cloud.container_v1.services.cluster_manager import pagers from google.cloud.container_v1.types import cluster_service from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO @@ -162,12 +164,12 @@ def __init__( async def list_clusters( self, - request: cluster_service.ListClustersRequest = None, + request: Union[cluster_service.ListClustersRequest, dict] = None, *, project_id: str = None, zone: str = None, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListClustersResponse: @@ -175,7 +177,7 @@ async def list_clusters( specified zone or all zones. Args: - request (:class:`google.cloud.container_v1.types.ListClustersRequest`): + request (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 @@ -271,20 +273,20 @@ async def list_clusters( async def get_cluster( self, - request: cluster_service.GetClusterRequest = None, + request: Union[cluster_service.GetClusterRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Cluster: r"""Gets the details of a specific cluster. Args: - request (:class:`google.cloud.container_v1.types.GetClusterRequest`): + request (Union[google.cloud.container_v1.types.GetClusterRequest, dict]): The request object. GetClusterRequest gets the settings of a cluster. project_id (:class:`str`): @@ -388,13 +390,13 @@ async def get_cluster( async def create_cluster( self, - request: cluster_service.CreateClusterRequest = None, + request: Union[cluster_service.CreateClusterRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster: cluster_service.Cluster = None, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -413,7 +415,7 @@ async def create_cluster( indicating which CIDR range the cluster is using. Args: - request (:class:`google.cloud.container_v1.types.CreateClusterRequest`): + request (Union[google.cloud.container_v1.types.CreateClusterRequest, dict]): The request object. CreateClusterRequest creates a cluster. project_id (:class:`str`): @@ -509,21 +511,21 @@ async def create_cluster( async def update_cluster( self, - request: cluster_service.UpdateClusterRequest = None, + request: Union[cluster_service.UpdateClusterRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, update: cluster_service.ClusterUpdate = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Updates the settings of a specific cluster. Args: - request (:class:`google.cloud.container_v1.types.UpdateClusterRequest`): + request (Union[google.cloud.container_v1.types.UpdateClusterRequest, dict]): The request object. UpdateClusterRequest updates the settings of a cluster. project_id (:class:`str`): @@ -630,9 +632,9 @@ async def update_cluster( async def update_node_pool( self, - request: cluster_service.UpdateNodePoolRequest = None, + request: Union[cluster_service.UpdateNodePoolRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -640,7 +642,7 @@ async def update_node_pool( specified node pool. Args: - request (:class:`google.cloud.container_v1.types.UpdateNodePoolRequest`): + 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, @@ -682,9 +684,9 @@ async def update_node_pool( async def set_node_pool_autoscaling( self, - request: cluster_service.SetNodePoolAutoscalingRequest = None, + request: Union[cluster_service.SetNodePoolAutoscalingRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -692,7 +694,7 @@ async def set_node_pool_autoscaling( pool. Args: - request (:class:`google.cloud.container_v1.types.SetNodePoolAutoscalingRequest`): + 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, @@ -734,21 +736,21 @@ async def set_node_pool_autoscaling( async def set_logging_service( self, - request: cluster_service.SetLoggingServiceRequest = None, + request: Union[cluster_service.SetLoggingServiceRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, logging_service: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Sets the logging service for a specific cluster. Args: - request (:class:`google.cloud.container_v1.types.SetLoggingServiceRequest`): + request (Union[google.cloud.container_v1.types.SetLoggingServiceRequest, dict]): The request object. SetLoggingServiceRequest sets the logging service of a cluster. project_id (:class:`str`): @@ -869,21 +871,21 @@ async def set_logging_service( async def set_monitoring_service( self, - request: cluster_service.SetMonitoringServiceRequest = None, + request: Union[cluster_service.SetMonitoringServiceRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, monitoring_service: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Sets the monitoring service for a specific cluster. Args: - request (:class:`google.cloud.container_v1.types.SetMonitoringServiceRequest`): + request (Union[google.cloud.container_v1.types.SetMonitoringServiceRequest, dict]): The request object. SetMonitoringServiceRequest sets the monitoring service of a cluster. project_id (:class:`str`): @@ -1006,21 +1008,21 @@ async def set_monitoring_service( async def set_addons_config( self, - request: cluster_service.SetAddonsConfigRequest = None, + request: Union[cluster_service.SetAddonsConfigRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, addons_config: cluster_service.AddonsConfig = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Sets the addons for a specific cluster. Args: - request (:class:`google.cloud.container_v1.types.SetAddonsConfigRequest`): + request (Union[google.cloud.container_v1.types.SetAddonsConfigRequest, dict]): The request object. SetAddonsConfigRequest sets the addons associated with the cluster. project_id (:class:`str`): @@ -1128,14 +1130,14 @@ async def set_addons_config( async def set_locations( self, - request: cluster_service.SetLocationsRequest = None, + request: Union[cluster_service.SetLocationsRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, locations: Sequence[str] = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1144,7 +1146,7 @@ async def set_locations( instead. Args: - request (:class:`google.cloud.container_v1.types.SetLocationsRequest`): + request (Union[google.cloud.container_v1.types.SetLocationsRequest, dict]): The request object. SetLocationsRequest sets the locations of the cluster. project_id (:class:`str`): @@ -1262,21 +1264,21 @@ async def set_locations( async def update_master( self, - request: cluster_service.UpdateMasterRequest = None, + request: Union[cluster_service.UpdateMasterRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, master_version: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Updates the master for a specific cluster. Args: - request (:class:`google.cloud.container_v1.types.UpdateMasterRequest`): + request (Union[google.cloud.container_v1.types.UpdateMasterRequest, dict]): The request object. UpdateMasterRequest updates the master of the cluster. project_id (:class:`str`): @@ -1395,9 +1397,9 @@ async def update_master( async def set_master_auth( self, - request: cluster_service.SetMasterAuthRequest = None, + request: Union[cluster_service.SetMasterAuthRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1407,7 +1409,7 @@ async def set_master_auth( password. Args: - request (:class:`google.cloud.container_v1.types.SetMasterAuthRequest`): + 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, @@ -1449,13 +1451,13 @@ async def set_master_auth( async def delete_cluster( self, - request: cluster_service.DeleteClusterRequest = None, + request: Union[cluster_service.DeleteClusterRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1471,7 +1473,7 @@ async def delete_cluster( initially created. Args: - request (:class:`google.cloud.container_v1.types.DeleteClusterRequest`): + request (Union[google.cloud.container_v1.types.DeleteClusterRequest, dict]): The request object. DeleteClusterRequest deletes a cluster. project_id (:class:`str`): @@ -1579,11 +1581,11 @@ async def delete_cluster( async def list_operations( self, - request: cluster_service.ListOperationsRequest = None, + request: Union[cluster_service.ListOperationsRequest, dict] = None, *, project_id: str = None, zone: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListOperationsResponse: @@ -1591,7 +1593,7 @@ async def list_operations( or all zones. Args: - request (:class:`google.cloud.container_v1.types.ListOperationsRequest`): + request (Union[google.cloud.container_v1.types.ListOperationsRequest, dict]): The request object. ListOperationsRequest lists operations. project_id (:class:`str`): @@ -1677,20 +1679,20 @@ async def list_operations( async def get_operation( self, - request: cluster_service.GetOperationRequest = None, + request: Union[cluster_service.GetOperationRequest, dict] = None, *, project_id: str = None, zone: str = None, operation_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Gets the specified operation. Args: - request (:class:`google.cloud.container_v1.types.GetOperationRequest`): + request (Union[google.cloud.container_v1.types.GetOperationRequest, dict]): The request object. GetOperationRequest gets a single operation. project_id (:class:`str`): @@ -1797,20 +1799,20 @@ async def get_operation( async def cancel_operation( self, - request: cluster_service.CancelOperationRequest = None, + request: Union[cluster_service.CancelOperationRequest, dict] = None, *, project_id: str = None, zone: str = None, operation_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Cancels the specified operation. Args: - request (:class:`google.cloud.container_v1.types.CancelOperationRequest`): + request (Union[google.cloud.container_v1.types.CancelOperationRequest, dict]): The request object. CancelOperationRequest cancels a single operation. project_id (:class:`str`): @@ -1898,12 +1900,12 @@ async def cancel_operation( async def get_server_config( self, - request: cluster_service.GetServerConfigRequest = None, + request: Union[cluster_service.GetServerConfigRequest, dict] = None, *, project_id: str = None, zone: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ServerConfig: @@ -1911,7 +1913,7 @@ async def get_server_config( Kubernetes Engine service. Args: - request (:class:`google.cloud.container_v1.types.GetServerConfigRequest`): + request (Union[google.cloud.container_v1.types.GetServerConfigRequest, dict]): The request object. Gets the current Kubernetes Engine service configuration. project_id (:class:`str`): @@ -2005,9 +2007,9 @@ async def get_server_config( async def get_json_web_keys( self, - request: cluster_service.GetJSONWebKeysRequest = None, + request: Union[cluster_service.GetJSONWebKeysRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.GetJSONWebKeysResponse: @@ -2017,7 +2019,7 @@ async def get_json_web_keys( available for all clusters. Args: - request (:class:`google.cloud.container_v1.types.GetJSONWebKeysRequest`): + 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 @@ -2061,20 +2063,20 @@ async def get_json_web_keys( async def list_node_pools( self, - request: cluster_service.ListNodePoolsRequest = None, + request: Union[cluster_service.ListNodePoolsRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListNodePoolsResponse: r"""Lists the node pools for a cluster. Args: - request (:class:`google.cloud.container_v1.types.ListNodePoolsRequest`): + request (Union[google.cloud.container_v1.types.ListNodePoolsRequest, dict]): The request object. ListNodePoolsRequest lists the node pool(s) for a cluster. project_id (:class:`str`): @@ -2179,21 +2181,21 @@ async def list_node_pools( async def get_node_pool( self, - request: cluster_service.GetNodePoolRequest = None, + request: Union[cluster_service.GetNodePoolRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, node_pool_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.NodePool: r"""Retrieves the requested node pool. Args: - request (:class:`google.cloud.container_v1.types.GetNodePoolRequest`): + request (Union[google.cloud.container_v1.types.GetNodePoolRequest, dict]): The request object. GetNodePoolRequest retrieves a node pool for a cluster. project_id (:class:`str`): @@ -2316,21 +2318,21 @@ async def get_node_pool( async def create_node_pool( self, - request: cluster_service.CreateNodePoolRequest = None, + request: Union[cluster_service.CreateNodePoolRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, node_pool: cluster_service.NodePool = None, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Creates a node pool for a cluster. Args: - request (:class:`google.cloud.container_v1.types.CreateNodePoolRequest`): + request (Union[google.cloud.container_v1.types.CreateNodePoolRequest, dict]): The request object. CreateNodePoolRequest creates a node pool for a cluster. project_id (:class:`str`): @@ -2434,21 +2436,21 @@ async def create_node_pool( async def delete_node_pool( self, - request: cluster_service.DeleteNodePoolRequest = None, + request: Union[cluster_service.DeleteNodePoolRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, node_pool_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Deletes a node pool from a cluster. Args: - request (:class:`google.cloud.container_v1.types.DeleteNodePoolRequest`): + request (Union[google.cloud.container_v1.types.DeleteNodePoolRequest, dict]): The request object. DeleteNodePoolRequest deletes a node pool for a cluster. project_id (:class:`str`): @@ -2566,14 +2568,14 @@ async def delete_node_pool( async def rollback_node_pool_upgrade( self, - request: cluster_service.RollbackNodePoolUpgradeRequest = None, + request: Union[cluster_service.RollbackNodePoolUpgradeRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, node_pool_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2582,7 +2584,7 @@ async def rollback_node_pool_upgrade( successfully completed. Args: - request (:class:`google.cloud.container_v1.types.RollbackNodePoolUpgradeRequest`): + 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 @@ -2694,16 +2696,16 @@ async def rollback_node_pool_upgrade( async def set_node_pool_management( self, - request: cluster_service.SetNodePoolManagementRequest = None, + request: Union[cluster_service.SetNodePoolManagementRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Sets the NodeManagement options for a node pool. Args: - request (:class:`google.cloud.container_v1.types.SetNodePoolManagementRequest`): + 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, @@ -2745,16 +2747,16 @@ async def set_node_pool_management( async def set_labels( self, - request: cluster_service.SetLabelsRequest = None, + request: Union[cluster_service.SetLabelsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Sets labels on a cluster. Args: - request (:class:`google.cloud.container_v1.types.SetLabelsRequest`): + 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 @@ -2798,14 +2800,14 @@ async def set_labels( async def set_legacy_abac( self, - request: cluster_service.SetLegacyAbacRequest = None, + request: Union[cluster_service.SetLegacyAbacRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, enabled: bool = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2813,7 +2815,7 @@ async def set_legacy_abac( on a cluster. Args: - request (:class:`google.cloud.container_v1.types.SetLegacyAbacRequest`): + 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 (:class:`str`): @@ -2920,20 +2922,20 @@ async def set_legacy_abac( async def start_ip_rotation( self, - request: cluster_service.StartIPRotationRequest = None, + request: Union[cluster_service.StartIPRotationRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Starts master IP rotation. Args: - request (:class:`google.cloud.container_v1.types.StartIPRotationRequest`): + 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. @@ -3031,20 +3033,20 @@ async def start_ip_rotation( async def complete_ip_rotation( self, - request: cluster_service.CompleteIPRotationRequest = None, + request: Union[cluster_service.CompleteIPRotationRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Completes master IP rotation. Args: - request (:class:`google.cloud.container_v1.types.CompleteIPRotationRequest`): + request (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`): @@ -3141,16 +3143,16 @@ async def complete_ip_rotation( async def set_node_pool_size( self, - request: cluster_service.SetNodePoolSizeRequest = None, + request: Union[cluster_service.SetNodePoolSizeRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Sets the size for a specific node pool. Args: - request (:class:`google.cloud.container_v1.types.SetNodePoolSizeRequest`): + request (Union[google.cloud.container_v1.types.SetNodePoolSizeRequest, dict]): The request object. SetNodePoolSizeRequest sets the size a node pool. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -3192,21 +3194,21 @@ async def set_node_pool_size( async def set_network_policy( self, - request: cluster_service.SetNetworkPolicyRequest = None, + request: Union[cluster_service.SetNetworkPolicyRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, network_policy: cluster_service.NetworkPolicy = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Enables or disables Network Policy for a cluster. Args: - request (:class:`google.cloud.container_v1.types.SetNetworkPolicyRequest`): + request (Union[google.cloud.container_v1.types.SetNetworkPolicyRequest, dict]): The request object. SetNetworkPolicyRequest enables/disables network policy for a cluster. project_id (:class:`str`): @@ -3312,21 +3314,21 @@ async def set_network_policy( async def set_maintenance_policy( self, - request: cluster_service.SetMaintenancePolicyRequest = None, + request: Union[cluster_service.SetMaintenancePolicyRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, maintenance_policy: cluster_service.MaintenancePolicy = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Sets the maintenance policy for a cluster. Args: - request (:class:`google.cloud.container_v1.types.SetMaintenancePolicyRequest`): + request (Union[google.cloud.container_v1.types.SetMaintenancePolicyRequest, dict]): The request object. SetMaintenancePolicyRequest sets the maintenance policy for a cluster. project_id (:class:`str`): @@ -3431,9 +3433,9 @@ async def set_maintenance_policy( async def list_usable_subnetworks( self, - request: cluster_service.ListUsableSubnetworksRequest = None, + request: Union[cluster_service.ListUsableSubnetworksRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListUsableSubnetworksAsyncPager: @@ -3441,7 +3443,7 @@ async def list_usable_subnetworks( clusters in a project. Args: - request (:class:`google.cloud.container_v1.types.ListUsableSubnetworksRequest`): + 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. diff --git a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/client.py b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/client.py index 33b85ac9c465..0826c954f238 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/client.py +++ b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/client.py @@ -31,6 +31,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.cloud.container_v1.services.cluster_manager import pagers from google.cloud.container_v1.types import cluster_service from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO @@ -339,7 +341,7 @@ def list_clusters( project_id: str = None, zone: str = None, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListClustersResponse: @@ -439,7 +441,7 @@ def get_cluster( zone: str = None, cluster_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Cluster: @@ -546,7 +548,7 @@ def create_cluster( zone: str = None, cluster: cluster_service.Cluster = None, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -668,7 +670,7 @@ def update_cluster( cluster_id: str = None, update: cluster_service.ClusterUpdate = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -784,7 +786,7 @@ def update_node_pool( self, request: Union[cluster_service.UpdateNodePoolRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -837,7 +839,7 @@ def set_node_pool_autoscaling( self, request: Union[cluster_service.SetNodePoolAutoscalingRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -897,7 +899,7 @@ def set_logging_service( cluster_id: str = None, logging_service: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1032,7 +1034,7 @@ def set_monitoring_service( cluster_id: str = None, monitoring_service: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1169,7 +1171,7 @@ def set_addons_config( cluster_id: str = None, addons_config: cluster_service.AddonsConfig = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1291,7 +1293,7 @@ def set_locations( cluster_id: str = None, locations: Sequence[str] = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1425,7 +1427,7 @@ def update_master( cluster_id: str = None, master_version: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1553,7 +1555,7 @@ def set_master_auth( self, request: Union[cluster_service.SetMasterAuthRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1612,7 +1614,7 @@ def delete_cluster( zone: str = None, cluster_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1730,7 +1732,7 @@ def list_operations( *, project_id: str = None, zone: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListOperationsResponse: @@ -1820,7 +1822,7 @@ def get_operation( zone: str = None, operation_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1930,7 +1932,7 @@ def cancel_operation( zone: str = None, operation_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -2030,7 +2032,7 @@ def get_server_config( project_id: str = None, zone: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ServerConfig: @@ -2124,7 +2126,7 @@ def get_json_web_keys( self, request: Union[cluster_service.GetJSONWebKeysRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.GetJSONWebKeysResponse: @@ -2185,7 +2187,7 @@ def list_node_pools( zone: str = None, cluster_id: str = None, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListNodePoolsResponse: @@ -2294,7 +2296,7 @@ def get_node_pool( cluster_id: str = None, node_pool_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.NodePool: @@ -2421,7 +2423,7 @@ def create_node_pool( cluster_id: str = None, node_pool: cluster_service.NodePool = None, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2539,7 +2541,7 @@ def delete_node_pool( cluster_id: str = None, node_pool_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2661,7 +2663,7 @@ def rollback_node_pool_upgrade( cluster_id: str = None, node_pool_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2786,7 +2788,7 @@ def set_node_pool_management( self, request: Union[cluster_service.SetNodePoolManagementRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2838,7 +2840,7 @@ def set_labels( self, request: Union[cluster_service.SetLabelsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2897,7 +2899,7 @@ def set_legacy_abac( cluster_id: str = None, enabled: bool = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -3018,7 +3020,7 @@ def start_ip_rotation( zone: str = None, cluster_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -3129,7 +3131,7 @@ def complete_ip_rotation( zone: str = None, cluster_id: str = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -3235,7 +3237,7 @@ def set_node_pool_size( self, request: Union[cluster_service.SetNodePoolSizeRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -3292,7 +3294,7 @@ def set_network_policy( cluster_id: str = None, network_policy: cluster_service.NetworkPolicy = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -3412,7 +3414,7 @@ def set_maintenance_policy( cluster_id: str = None, maintenance_policy: cluster_service.MaintenancePolicy = None, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -3526,7 +3528,7 @@ def list_usable_subnetworks( self, request: Union[cluster_service.ListUsableSubnetworksRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListUsableSubnetworksPager: diff --git a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/base.py b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/base.py index 0ae408bf9c15..9dcddab650fe 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/base.py +++ b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -36,15 +35,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class ClusterManagerTransport(abc.ABC): """Abstract transport class for ClusterManager.""" @@ -94,7 +84,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -127,29 +117,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py index e78ba601e647..f61561fca082 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py +++ b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py @@ -20,7 +20,6 @@ from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore 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 8ab73440c82a..4b83ff67e939 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 @@ -1608,17 +1608,27 @@ class OperationProgress(proto.Message): 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 = proto.Field(proto.STRING, number=1,) @@ -2710,16 +2720,25 @@ 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 (Sequence[google.cloud.container_v1.types.MaintenanceWindow.MaintenanceExclusionsEntry]): Exceptions to maintenance window. Non- mergency maintenance should not occur in these diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/async_client.py b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/async_client.py index e0a245e62177..5af433125a2d 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/async_client.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/async_client.py @@ -20,13 +20,15 @@ import pkg_resources import warnings -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -165,11 +167,11 @@ def __init__( async def list_clusters( self, - request: cluster_service.ListClustersRequest = None, + request: Union[cluster_service.ListClustersRequest, dict] = None, *, project_id: str = None, zone: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListClustersResponse: @@ -177,7 +179,7 @@ async def list_clusters( specified zone or all zones. Args: - request (:class:`google.cloud.container_v1beta1.types.ListClustersRequest`): + request (Union[google.cloud.container_v1beta1.types.ListClustersRequest, dict]): The request object. ListClustersRequest lists clusters. project_id (:class:`str`): Required. Deprecated. The Google Developers Console @@ -263,19 +265,19 @@ async def list_clusters( async def get_cluster( self, - request: cluster_service.GetClusterRequest = None, + request: Union[cluster_service.GetClusterRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Cluster: r"""Gets the details for a specific cluster. Args: - request (:class:`google.cloud.container_v1beta1.types.GetClusterRequest`): + request (Union[google.cloud.container_v1beta1.types.GetClusterRequest, dict]): The request object. GetClusterRequest gets the settings of a cluster. project_id (:class:`str`): @@ -370,12 +372,12 @@ async def get_cluster( async def create_cluster( self, - request: cluster_service.CreateClusterRequest = None, + request: Union[cluster_service.CreateClusterRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster: cluster_service.Cluster = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -394,7 +396,7 @@ async def create_cluster( indicating which CIDR range the cluster is using. Args: - request (:class:`google.cloud.container_v1beta1.types.CreateClusterRequest`): + request (Union[google.cloud.container_v1beta1.types.CreateClusterRequest, dict]): The request object. CreateClusterRequest creates a cluster. project_id (:class:`str`): @@ -481,20 +483,20 @@ async def create_cluster( async def update_cluster( self, - request: cluster_service.UpdateClusterRequest = None, + request: Union[cluster_service.UpdateClusterRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, update: cluster_service.ClusterUpdate = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Updates the settings for a specific cluster. Args: - request (:class:`google.cloud.container_v1beta1.types.UpdateClusterRequest`): + request (Union[google.cloud.container_v1beta1.types.UpdateClusterRequest, dict]): The request object. UpdateClusterRequest updates the settings of a cluster. project_id (:class:`str`): @@ -592,9 +594,9 @@ async def update_cluster( async def update_node_pool( self, - request: cluster_service.UpdateNodePoolRequest = None, + request: Union[cluster_service.UpdateNodePoolRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -602,7 +604,7 @@ async def update_node_pool( node pool. Args: - request (:class:`google.cloud.container_v1beta1.types.UpdateNodePoolRequest`): + 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, @@ -644,9 +646,9 @@ async def update_node_pool( async def set_node_pool_autoscaling( self, - request: cluster_service.SetNodePoolAutoscalingRequest = None, + request: Union[cluster_service.SetNodePoolAutoscalingRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -654,7 +656,7 @@ async def set_node_pool_autoscaling( pool. Args: - request (:class:`google.cloud.container_v1beta1.types.SetNodePoolAutoscalingRequest`): + 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, @@ -696,20 +698,20 @@ async def set_node_pool_autoscaling( async def set_logging_service( self, - request: cluster_service.SetLoggingServiceRequest = None, + request: Union[cluster_service.SetLoggingServiceRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, logging_service: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Sets the logging service for a specific cluster. Args: - request (:class:`google.cloud.container_v1beta1.types.SetLoggingServiceRequest`): + request (Union[google.cloud.container_v1beta1.types.SetLoggingServiceRequest, dict]): The request object. SetLoggingServiceRequest sets the logging service of a cluster. project_id (:class:`str`): @@ -819,20 +821,20 @@ async def set_logging_service( async def set_monitoring_service( self, - request: cluster_service.SetMonitoringServiceRequest = None, + request: Union[cluster_service.SetMonitoringServiceRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, monitoring_service: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Sets the monitoring service for a specific cluster. Args: - request (:class:`google.cloud.container_v1beta1.types.SetMonitoringServiceRequest`): + request (Union[google.cloud.container_v1beta1.types.SetMonitoringServiceRequest, dict]): The request object. SetMonitoringServiceRequest sets the monitoring service of a cluster. project_id (:class:`str`): @@ -944,20 +946,20 @@ async def set_monitoring_service( async def set_addons_config( self, - request: cluster_service.SetAddonsConfigRequest = None, + request: Union[cluster_service.SetAddonsConfigRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, addons_config: cluster_service.AddonsConfig = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Sets the addons for a specific cluster. Args: - request (:class:`google.cloud.container_v1beta1.types.SetAddonsConfigRequest`): + request (Union[google.cloud.container_v1beta1.types.SetAddonsConfigRequest, dict]): The request object. SetAddonsRequest sets the addons associated with the cluster. project_id (:class:`str`): @@ -1056,13 +1058,13 @@ async def set_addons_config( async def set_locations( self, - request: cluster_service.SetLocationsRequest = None, + request: Union[cluster_service.SetLocationsRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, locations: Sequence[str] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1071,7 +1073,7 @@ async def set_locations( instead. Args: - request (:class:`google.cloud.container_v1beta1.types.SetLocationsRequest`): + request (Union[google.cloud.container_v1beta1.types.SetLocationsRequest, dict]): The request object. SetLocationsRequest sets the locations of the cluster. project_id (:class:`str`): @@ -1180,20 +1182,20 @@ async def set_locations( async def update_master( self, - request: cluster_service.UpdateMasterRequest = None, + request: Union[cluster_service.UpdateMasterRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, master_version: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Updates the master for a specific cluster. Args: - request (:class:`google.cloud.container_v1beta1.types.UpdateMasterRequest`): + request (Union[google.cloud.container_v1beta1.types.UpdateMasterRequest, dict]): The request object. UpdateMasterRequest updates the master of the cluster. project_id (:class:`str`): @@ -1303,9 +1305,9 @@ async def update_master( async def set_master_auth( self, - request: cluster_service.SetMasterAuthRequest = None, + request: Union[cluster_service.SetMasterAuthRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1315,7 +1317,7 @@ async def set_master_auth( password. Args: - request (:class:`google.cloud.container_v1beta1.types.SetMasterAuthRequest`): + 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, @@ -1357,12 +1359,12 @@ async def set_master_auth( async def delete_cluster( self, - request: cluster_service.DeleteClusterRequest = None, + request: Union[cluster_service.DeleteClusterRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1378,7 +1380,7 @@ async def delete_cluster( initially created. Args: - request (:class:`google.cloud.container_v1beta1.types.DeleteClusterRequest`): + request (Union[google.cloud.container_v1beta1.types.DeleteClusterRequest, dict]): The request object. DeleteClusterRequest deletes a cluster. project_id (:class:`str`): @@ -1477,11 +1479,11 @@ async def delete_cluster( async def list_operations( self, - request: cluster_service.ListOperationsRequest = None, + request: Union[cluster_service.ListOperationsRequest, dict] = None, *, project_id: str = None, zone: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListOperationsResponse: @@ -1489,7 +1491,7 @@ async def list_operations( zone or all zones. Args: - request (:class:`google.cloud.container_v1beta1.types.ListOperationsRequest`): + request (Union[google.cloud.container_v1beta1.types.ListOperationsRequest, dict]): The request object. ListOperationsRequest lists operations. project_id (:class:`str`): @@ -1576,19 +1578,19 @@ async def list_operations( async def get_operation( self, - request: cluster_service.GetOperationRequest = None, + request: Union[cluster_service.GetOperationRequest, dict] = None, *, project_id: str = None, zone: str = None, operation_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Gets the specified operation. Args: - request (:class:`google.cloud.container_v1beta1.types.GetOperationRequest`): + request (Union[google.cloud.container_v1beta1.types.GetOperationRequest, dict]): The request object. GetOperationRequest gets a single operation. project_id (:class:`str`): @@ -1686,19 +1688,19 @@ async def get_operation( async def cancel_operation( self, - request: cluster_service.CancelOperationRequest = None, + request: Union[cluster_service.CancelOperationRequest, dict] = None, *, project_id: str = None, zone: str = None, operation_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Cancels the specified operation. Args: - request (:class:`google.cloud.container_v1beta1.types.CancelOperationRequest`): + request (Union[google.cloud.container_v1beta1.types.CancelOperationRequest, dict]): The request object. CancelOperationRequest cancels a single operation. project_id (:class:`str`): @@ -1777,11 +1779,11 @@ async def cancel_operation( async def get_server_config( self, - request: cluster_service.GetServerConfigRequest = None, + request: Union[cluster_service.GetServerConfigRequest, dict] = None, *, project_id: str = None, zone: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ServerConfig: @@ -1789,7 +1791,7 @@ async def get_server_config( Kubernetes Engine service. Args: - request (:class:`google.cloud.container_v1beta1.types.GetServerConfigRequest`): + request (Union[google.cloud.container_v1beta1.types.GetServerConfigRequest, dict]): The request object. Gets the current Kubernetes Engine service configuration. project_id (:class:`str`): @@ -1875,19 +1877,19 @@ async def get_server_config( async def list_node_pools( self, - request: cluster_service.ListNodePoolsRequest = None, + request: Union[cluster_service.ListNodePoolsRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListNodePoolsResponse: r"""Lists the node pools for a cluster. Args: - request (:class:`google.cloud.container_v1beta1.types.ListNodePoolsRequest`): + request (Union[google.cloud.container_v1beta1.types.ListNodePoolsRequest, dict]): The request object. ListNodePoolsRequest lists the node pool(s) for a cluster. project_id (:class:`str`): @@ -1983,9 +1985,9 @@ async def list_node_pools( async def get_json_web_keys( self, - request: cluster_service.GetJSONWebKeysRequest = None, + request: Union[cluster_service.GetJSONWebKeysRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.GetJSONWebKeysResponse: @@ -1995,7 +1997,7 @@ async def get_json_web_keys( available for all clusters. Args: - request (:class:`google.cloud.container_v1beta1.types.GetJSONWebKeysRequest`): + 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 @@ -2039,20 +2041,20 @@ async def get_json_web_keys( async def get_node_pool( self, - request: cluster_service.GetNodePoolRequest = None, + request: Union[cluster_service.GetNodePoolRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, node_pool_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.NodePool: r"""Retrieves the requested node pool. Args: - request (:class:`google.cloud.container_v1beta1.types.GetNodePoolRequest`): + request (Union[google.cloud.container_v1beta1.types.GetNodePoolRequest, dict]): The request object. GetNodePoolRequest retrieves a node pool for a cluster. project_id (:class:`str`): @@ -2200,20 +2202,20 @@ async def get_node_pool( async def create_node_pool( self, - request: cluster_service.CreateNodePoolRequest = None, + request: Union[cluster_service.CreateNodePoolRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, node_pool: cluster_service.NodePool = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Creates a node pool for a cluster. Args: - request (:class:`google.cloud.container_v1beta1.types.CreateNodePoolRequest`): + request (Union[google.cloud.container_v1beta1.types.CreateNodePoolRequest, dict]): The request object. CreateNodePoolRequest creates a node pool for a cluster. project_id (:class:`str`): @@ -2308,20 +2310,20 @@ async def create_node_pool( async def delete_node_pool( self, - request: cluster_service.DeleteNodePoolRequest = None, + request: Union[cluster_service.DeleteNodePoolRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, node_pool_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Deletes a node pool from a cluster. Args: - request (:class:`google.cloud.container_v1beta1.types.DeleteNodePoolRequest`): + request (Union[google.cloud.container_v1beta1.types.DeleteNodePoolRequest, dict]): The request object. DeleteNodePoolRequest deletes a node pool for a cluster. project_id (:class:`str`): @@ -2430,13 +2432,13 @@ async def delete_node_pool( async def rollback_node_pool_upgrade( self, - request: cluster_service.RollbackNodePoolUpgradeRequest = None, + request: Union[cluster_service.RollbackNodePoolUpgradeRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, node_pool_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2445,7 +2447,7 @@ async def rollback_node_pool_upgrade( successfully completed. Args: - request (:class:`google.cloud.container_v1beta1.types.RollbackNodePoolUpgradeRequest`): + 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 @@ -2547,21 +2549,21 @@ async def rollback_node_pool_upgrade( async def set_node_pool_management( self, - request: cluster_service.SetNodePoolManagementRequest = None, + request: Union[cluster_service.SetNodePoolManagementRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, node_pool_id: str = None, management: cluster_service.NodeManagement = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Sets the NodeManagement options for a node pool. Args: - request (:class:`google.cloud.container_v1beta1.types.SetNodePoolManagementRequest`): + request (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`): @@ -2672,7 +2674,7 @@ async def set_node_pool_management( async def set_labels( self, - request: cluster_service.SetLabelsRequest = None, + request: Union[cluster_service.SetLabelsRequest, dict] = None, *, project_id: str = None, zone: str = None, @@ -2681,14 +2683,14 @@ async def set_labels( cluster_service.SetLabelsRequest.ResourceLabelsEntry ] = None, label_fingerprint: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Sets labels on a cluster. Args: - request (:class:`google.cloud.container_v1beta1.types.SetLabelsRequest`): + 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 @@ -2805,13 +2807,13 @@ async def set_labels( async def set_legacy_abac( self, - request: cluster_service.SetLegacyAbacRequest = None, + request: Union[cluster_service.SetLegacyAbacRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, enabled: bool = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2819,7 +2821,7 @@ async def set_legacy_abac( on a cluster. Args: - request (:class:`google.cloud.container_v1beta1.types.SetLegacyAbacRequest`): + 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 (:class:`str`): @@ -2917,19 +2919,19 @@ async def set_legacy_abac( async def start_ip_rotation( self, - request: cluster_service.StartIPRotationRequest = None, + request: Union[cluster_service.StartIPRotationRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Starts master IP rotation. Args: - request (:class:`google.cloud.container_v1beta1.types.StartIPRotationRequest`): + 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. @@ -3018,19 +3020,19 @@ async def start_ip_rotation( async def complete_ip_rotation( self, - request: cluster_service.CompleteIPRotationRequest = None, + request: Union[cluster_service.CompleteIPRotationRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Completes master IP rotation. Args: - request (:class:`google.cloud.container_v1beta1.types.CompleteIPRotationRequest`): + request (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`): @@ -3118,9 +3120,9 @@ async def complete_ip_rotation( async def set_node_pool_size( self, - request: cluster_service.SetNodePoolSizeRequest = None, + request: Union[cluster_service.SetNodePoolSizeRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -3130,7 +3132,7 @@ async def set_node_pool_size( [NodePool.locations][google.container.v1beta1.NodePool.locations]. Args: - request (:class:`google.cloud.container_v1beta1.types.SetNodePoolSizeRequest`): + 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, @@ -3172,20 +3174,20 @@ async def set_node_pool_size( async def set_network_policy( self, - request: cluster_service.SetNetworkPolicyRequest = None, + request: Union[cluster_service.SetNetworkPolicyRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, network_policy: cluster_service.NetworkPolicy = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Enables or disables Network Policy for a cluster. Args: - request (:class:`google.cloud.container_v1beta1.types.SetNetworkPolicyRequest`): + request (Union[google.cloud.container_v1beta1.types.SetNetworkPolicyRequest, dict]): The request object. SetNetworkPolicyRequest enables/disables network policy for a cluster. project_id (:class:`str`): @@ -3282,20 +3284,20 @@ async def set_network_policy( async def set_maintenance_policy( self, - request: cluster_service.SetMaintenancePolicyRequest = None, + request: Union[cluster_service.SetMaintenancePolicyRequest, dict] = None, *, project_id: str = None, zone: str = None, cluster_id: str = None, maintenance_policy: cluster_service.MaintenancePolicy = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: r"""Sets the maintenance policy for a cluster. Args: - request (:class:`google.cloud.container_v1beta1.types.SetMaintenancePolicyRequest`): + request (Union[google.cloud.container_v1beta1.types.SetMaintenancePolicyRequest, dict]): The request object. SetMaintenancePolicyRequest sets the maintenance policy for a cluster. project_id (:class:`str`): @@ -3388,10 +3390,10 @@ async def set_maintenance_policy( async def list_usable_subnetworks( self, - request: cluster_service.ListUsableSubnetworksRequest = None, + request: Union[cluster_service.ListUsableSubnetworksRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListUsableSubnetworksAsyncPager: @@ -3399,7 +3401,7 @@ async def list_usable_subnetworks( clusters in a project. Args: - request (:class:`google.cloud.container_v1beta1.types.ListUsableSubnetworksRequest`): + 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. @@ -3482,10 +3484,10 @@ async def list_usable_subnetworks( async def list_locations( self, - request: cluster_service.ListLocationsRequest = None, + request: Union[cluster_service.ListLocationsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListLocationsResponse: @@ -3493,7 +3495,7 @@ async def list_locations( Engine. Args: - request (:class:`google.cloud.container_v1beta1.types.ListLocationsRequest`): + request (Union[google.cloud.container_v1beta1.types.ListLocationsRequest, dict]): The request object. ListLocationsRequest is used to request the locations that offer GKE. parent (:class:`str`): diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/client.py b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/client.py index ea0465140de2..dc161eba9eff 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/client.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/client.py @@ -31,6 +31,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -350,7 +352,7 @@ def list_clusters( *, project_id: str = None, zone: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListClustersResponse: @@ -439,7 +441,7 @@ def get_cluster( project_id: str = None, zone: str = None, cluster_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Cluster: @@ -536,7 +538,7 @@ def create_cluster( project_id: str = None, zone: str = None, cluster: cluster_service.Cluster = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -648,7 +650,7 @@ def update_cluster( zone: str = None, cluster_id: str = None, update: cluster_service.ClusterUpdate = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -755,7 +757,7 @@ def update_node_pool( self, request: Union[cluster_service.UpdateNodePoolRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -808,7 +810,7 @@ def set_node_pool_autoscaling( self, request: Union[cluster_service.SetNodePoolAutoscalingRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -867,7 +869,7 @@ def set_logging_service( zone: str = None, cluster_id: str = None, logging_service: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -990,7 +992,7 @@ def set_monitoring_service( zone: str = None, cluster_id: str = None, monitoring_service: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1115,7 +1117,7 @@ def set_addons_config( zone: str = None, cluster_id: str = None, addons_config: cluster_service.AddonsConfig = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1227,7 +1229,7 @@ def set_locations( zone: str = None, cluster_id: str = None, locations: Sequence[str] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1351,7 +1353,7 @@ def update_master( zone: str = None, cluster_id: str = None, master_version: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1470,7 +1472,7 @@ def set_master_auth( self, request: Union[cluster_service.SetMasterAuthRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1528,7 +1530,7 @@ def delete_cluster( project_id: str = None, zone: str = None, cluster_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1637,7 +1639,7 @@ def list_operations( *, project_id: str = None, zone: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListOperationsResponse: @@ -1727,7 +1729,7 @@ def get_operation( project_id: str = None, zone: str = None, operation_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -1827,7 +1829,7 @@ def cancel_operation( project_id: str = None, zone: str = None, operation_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -1917,7 +1919,7 @@ def get_server_config( *, project_id: str = None, zone: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ServerConfig: @@ -2006,7 +2008,7 @@ def list_node_pools( project_id: str = None, zone: str = None, cluster_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListNodePoolsResponse: @@ -2101,7 +2103,7 @@ def get_json_web_keys( self, request: Union[cluster_service.GetJSONWebKeysRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.GetJSONWebKeysResponse: @@ -2162,7 +2164,7 @@ def get_node_pool( zone: str = None, cluster_id: str = None, node_pool_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.NodePool: @@ -2313,7 +2315,7 @@ def create_node_pool( zone: str = None, cluster_id: str = None, node_pool: cluster_service.NodePool = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2421,7 +2423,7 @@ def delete_node_pool( zone: str = None, cluster_id: str = None, node_pool_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2533,7 +2535,7 @@ def rollback_node_pool_upgrade( zone: str = None, cluster_id: str = None, node_pool_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2653,7 +2655,7 @@ def set_node_pool_management( cluster_id: str = None, node_pool_id: str = None, management: cluster_service.NodeManagement = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2780,7 +2782,7 @@ def set_labels( cluster_service.SetLabelsRequest.ResourceLabelsEntry ] = None, label_fingerprint: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -2909,7 +2911,7 @@ def set_legacy_abac( zone: str = None, cluster_id: str = None, enabled: bool = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -3020,7 +3022,7 @@ def start_ip_rotation( project_id: str = None, zone: str = None, cluster_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -3121,7 +3123,7 @@ def complete_ip_rotation( project_id: str = None, zone: str = None, cluster_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -3218,7 +3220,7 @@ def set_node_pool_size( self, request: Union[cluster_service.SetNodePoolSizeRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -3277,7 +3279,7 @@ def set_network_policy( zone: str = None, cluster_id: str = None, network_policy: cluster_service.NetworkPolicy = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -3387,7 +3389,7 @@ def set_maintenance_policy( zone: str = None, cluster_id: str = None, maintenance_policy: cluster_service.MaintenancePolicy = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.Operation: @@ -3490,7 +3492,7 @@ def list_usable_subnetworks( request: Union[cluster_service.ListUsableSubnetworksRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListUsableSubnetworksPager: @@ -3574,7 +3576,7 @@ def list_locations( request: Union[cluster_service.ListLocationsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cluster_service.ListLocationsResponse: diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py index cfd8a8d2f888..e585042af0fe 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -36,15 +35,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class ClusterManagerTransport(abc.ABC): """Abstract transport class for ClusterManager.""" @@ -94,7 +84,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -127,29 +117,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py index 758ebfa16ecd..8689a4c27a6e 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py @@ -20,7 +20,6 @@ from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore 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 3e7aa302c8c6..c4a41f40c86d 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 @@ -1634,6 +1634,7 @@ class Cluster(proto.Message): 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): @@ -2156,17 +2157,27 @@ class OperationProgress(proto.Message): 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 = proto.Field(proto.STRING, number=1,) @@ -3342,16 +3353,25 @@ 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 (Sequence[google.cloud.container_v1beta1.types.MaintenanceWindow.MaintenanceExclusionsEntry]): Exceptions to maintenance window. Non- mergency maintenance should not occur in these diff --git a/packages/google-cloud-container/setup.py b/packages/google-cloud-container/setup.py index 717d9f551764..d65cd9a237f9 100644 --- a/packages/google-cloud-container/setup.py +++ b/packages/google-cloud-container/setup.py @@ -32,10 +32,9 @@ # NOTE: Maintainers, please do not require google-api-core>=2.x.x # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 - "google-api-core[grpc] >= 1.26.0, <3.0.0dev", + "google-api-core[grpc] >= 1.28.0, <3.0.0dev", "grpc-google-iam-v1 >= 0.12.3, < 0.13dev", "proto-plus >= 1.15.0", - "packaging >= 14.3", "libcst >= 0.2.5", ] extras = {} diff --git a/packages/google-cloud-container/testing/constraints-3.6.txt b/packages/google-cloud-container/testing/constraints-3.6.txt index 11e12641cbcf..646b950e895b 100644 --- a/packages/google-cloud-container/testing/constraints-3.6.txt +++ b/packages/google-cloud-container/testing/constraints-3.6.txt @@ -5,8 +5,7 @@ # # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 -google-api-core==1.26.0 +google-api-core==1.28.0 grpc-google-iam-v1==0.12.3 proto-plus==1.15.0 libcst==0.2.5 -packaging==14.3 diff --git a/packages/google-cloud-container/tests/unit/gapic/container_v1/test_cluster_manager.py b/packages/google-cloud-container/tests/unit/gapic/container_v1/test_cluster_manager.py index ba84a02ef7a5..aed40e2207a0 100644 --- a/packages/google-cloud-container/tests/unit/gapic/container_v1/test_cluster_manager.py +++ b/packages/google-cloud-container/tests/unit/gapic/container_v1/test_cluster_manager.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -36,29 +35,12 @@ 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.services.cluster_manager.transports.base import ( - _GOOGLE_AUTH_VERSION, -) from google.cloud.container_v1.types import cluster_service from google.oauth2 import service_account from google.protobuf import timestamp_pb2 # type: ignore import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -215,7 +197,7 @@ def test_cluster_manager_client_client_options( 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(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -232,7 +214,7 @@ def test_cluster_manager_client_client_options( 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -249,7 +231,7 @@ def test_cluster_manager_client_client_options( 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -278,7 +260,7 @@ def test_cluster_manager_client_client_options( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -337,7 +319,7 @@ def test_cluster_manager_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -379,7 +361,7 @@ def test_cluster_manager_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -401,7 +383,7 @@ def test_cluster_manager_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -432,7 +414,7 @@ def test_cluster_manager_client_client_options_scopes( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -463,7 +445,7 @@ def test_cluster_manager_client_client_options_credentials_file( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -8779,7 +8761,6 @@ def test_cluster_manager_base_transport(): transport.close() -@requires_google_auth_gte_1_25_0 def test_cluster_manager_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -8800,26 +8781,6 @@ def test_cluster_manager_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_cluster_manager_base_transport_with_credentials_file_old_google_auth(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.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=("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( @@ -8831,7 +8792,6 @@ def test_cluster_manager_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 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: @@ -8844,18 +8804,6 @@ def test_cluster_manager_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_cluster_manager_auth_adc_old_google_auth(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - ClusterManagerClient() - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id=None, - ) - - @pytest.mark.parametrize( "transport_class", [ @@ -8863,7 +8811,6 @@ def test_cluster_manager_auth_adc_old_google_auth(): transports.ClusterManagerGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_cluster_manager_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -8877,26 +8824,6 @@ def test_cluster_manager_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.ClusterManagerGrpcTransport, - transports.ClusterManagerGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_cluster_manager_transport_auth_adc_old_google_auth(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus") - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id="octopus", - ) - - @pytest.mark.parametrize( "transport_class,grpc_helpers", [ diff --git a/packages/google-cloud-container/tests/unit/gapic/container_v1beta1/test_cluster_manager.py b/packages/google-cloud-container/tests/unit/gapic/container_v1beta1/test_cluster_manager.py index 6ebeaee796e0..a551fb05ef0b 100644 --- a/packages/google-cloud-container/tests/unit/gapic/container_v1beta1/test_cluster_manager.py +++ b/packages/google-cloud-container/tests/unit/gapic/container_v1beta1/test_cluster_manager.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -38,9 +37,6 @@ 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.services.cluster_manager.transports.base import ( - _GOOGLE_AUTH_VERSION, -) from google.cloud.container_v1beta1.types import cluster_service from google.oauth2 import service_account from google.protobuf import timestamp_pb2 # type: ignore @@ -50,20 +46,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -220,7 +202,7 @@ def test_cluster_manager_client_client_options( 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(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -237,7 +219,7 @@ def test_cluster_manager_client_client_options( 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -254,7 +236,7 @@ def test_cluster_manager_client_client_options( 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -283,7 +265,7 @@ def test_cluster_manager_client_client_options( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -342,7 +324,7 @@ def test_cluster_manager_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -384,7 +366,7 @@ def test_cluster_manager_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -406,7 +388,7 @@ def test_cluster_manager_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -437,7 +419,7 @@ def test_cluster_manager_client_client_options_scopes( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -468,7 +450,7 @@ def test_cluster_manager_client_client_options_credentials_file( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -9142,7 +9124,6 @@ def test_cluster_manager_base_transport(): transport.close() -@requires_google_auth_gte_1_25_0 def test_cluster_manager_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -9163,26 +9144,6 @@ def test_cluster_manager_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_cluster_manager_base_transport_with_credentials_file_old_google_auth(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.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=("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( @@ -9194,7 +9155,6 @@ def test_cluster_manager_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 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: @@ -9207,18 +9167,6 @@ def test_cluster_manager_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_cluster_manager_auth_adc_old_google_auth(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - ClusterManagerClient() - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id=None, - ) - - @pytest.mark.parametrize( "transport_class", [ @@ -9226,7 +9174,6 @@ def test_cluster_manager_auth_adc_old_google_auth(): transports.ClusterManagerGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_cluster_manager_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -9240,26 +9187,6 @@ def test_cluster_manager_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.ClusterManagerGrpcTransport, - transports.ClusterManagerGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_cluster_manager_transport_auth_adc_old_google_auth(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus") - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id="octopus", - ) - - @pytest.mark.parametrize( "transport_class,grpc_helpers", [