diff --git a/google/cloud/container_v1/services/cluster_manager/async_client.py b/google/cloud/container_v1/services/cluster_manager/async_client.py index e2af7b28..dbc4d6d1 100644 --- a/google/cloud/container_v1/services/cluster_manager/async_client.py +++ b/google/cloud/container_v1/services/cluster_manager/async_client.py @@ -3491,6 +3491,12 @@ async def list_usable_subnetworks( # Done; return the response. return response + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/container_v1/services/cluster_manager/client.py b/google/cloud/container_v1/services/cluster_manager/client.py index e981168c..33b85ac9 100644 --- a/google/cloud/container_v1/services/cluster_manager/client.py +++ b/google/cloud/container_v1/services/cluster_manager/client.py @@ -329,10 +329,7 @@ def __init__( client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, - always_use_jwt_access=( - Transport == type(self).get_transport_class("grpc") - or Transport == type(self).get_transport_class("grpc_asyncio") - ), + always_use_jwt_access=True, ) def list_clusters( @@ -3588,6 +3585,19 @@ def list_usable_subnetworks( # Done; return the response. return response + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/container_v1/services/cluster_manager/transports/base.py b/google/cloud/container_v1/services/cluster_manager/transports/base.py index c47ec349..0ae408bf 100644 --- a/google/cloud/container_v1/services/cluster_manager/transports/base.py +++ b/google/cloud/container_v1/services/cluster_manager/transports/base.py @@ -373,6 +373,15 @@ def _prep_wrapped_messages(self, client_info): ), } + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + @property def list_clusters( self, diff --git a/google/cloud/container_v1/services/cluster_manager/transports/grpc.py b/google/cloud/container_v1/services/cluster_manager/transports/grpc.py index 713489ea..367736ee 100644 --- a/google/cloud/container_v1/services/cluster_manager/transports/grpc.py +++ b/google/cloud/container_v1/services/cluster_manager/transports/grpc.py @@ -1123,5 +1123,8 @@ def list_usable_subnetworks( ) return self._stubs["list_usable_subnetworks"] + def close(self): + self.grpc_channel.close() + __all__ = ("ClusterManagerGrpcTransport",) diff --git a/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py b/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py index 37e50a7d..e78ba601 100644 --- a/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py +++ b/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py @@ -1173,5 +1173,8 @@ def list_usable_subnetworks( ) return self._stubs["list_usable_subnetworks"] + def close(self): + return self.grpc_channel.close() + __all__ = ("ClusterManagerGrpcAsyncIOTransport",) diff --git a/google/cloud/container_v1/types/cluster_service.py b/google/cloud/container_v1/types/cluster_service.py index 6029eade..8ab73440 100644 --- a/google/cloud/container_v1/types/cluster_service.py +++ b/google/cloud/container_v1/types/cluster_service.py @@ -122,6 +122,7 @@ class NodeConfig(proto.Message): r"""Parameters that describe the nodes in a cluster. + Attributes: machine_type (str): The name of a Google Compute Engine `machine @@ -320,6 +321,7 @@ class NodeConfig(proto.Message): class ShieldedInstanceConfig(proto.Message): r"""A set of Shielded Instance options. + Attributes: enable_secure_boot (bool): Defines whether the instance has Secure Boot @@ -484,6 +486,7 @@ class MasterAuth(proto.Message): class ClientCertificateConfig(proto.Message): r"""Configuration for client certificates on the cluster. + Attributes: issue_client_certificate (bool): Issue a client certificate. @@ -589,6 +592,7 @@ class HorizontalPodAutoscaling(proto.Message): class KubernetesDashboard(proto.Message): r"""Configuration for the Kubernetes Dashboard. + Attributes: disabled (bool): Whether the Kubernetes Dashboard is enabled @@ -614,6 +618,7 @@ class NetworkPolicyConfig(proto.Message): class DnsCacheConfig(proto.Message): r"""Configuration for NodeLocal DNSCache + Attributes: enabled (bool): Whether NodeLocal DNSCache is enabled for @@ -625,6 +630,7 @@ class DnsCacheConfig(proto.Message): class PrivateClusterMasterGlobalAccessConfig(proto.Message): r"""Configuration for controlling master global access settings. + Attributes: enabled (bool): Whenever master is accessible globally or @@ -636,6 +642,7 @@ class PrivateClusterMasterGlobalAccessConfig(proto.Message): class PrivateClusterConfig(proto.Message): r"""Configuration options for private clusters. + Attributes: enable_private_nodes (bool): Whether nodes have internal IP addresses @@ -696,6 +703,7 @@ class AuthenticatorGroupsConfig(proto.Message): class CloudRunConfig(proto.Message): r"""Configuration options for the Cloud Run feature. + Attributes: disabled (bool): Whether Cloud Run addon is enabled for this @@ -717,6 +725,7 @@ class LoadBalancerType(proto.Enum): class ConfigConnectorConfig(proto.Message): r"""Configuration options for the Config Connector add-on. + Attributes: enabled (bool): Whether Cloud Connector is enabled for this @@ -744,6 +753,7 @@ class MasterAuthorizedNetworksConfig(proto.Message): class CidrBlock(proto.Message): r"""CidrBlock contains an optional name and one CIDR block. + Attributes: display_name (str): display_name is an optional field for users to identify CIDR @@ -800,6 +810,7 @@ class Provider(proto.Enum): class BinaryAuthorization(proto.Message): r"""Configuration for Binary Authorization. + Attributes: enabled (bool): Enable Binary Authorization for this cluster. @@ -947,6 +958,7 @@ class IPAllocationPolicy(proto.Message): class Cluster(proto.Message): r"""A Google Kubernetes Engine cluster. + Attributes: name (str): The name of this cluster. The name must be unique within @@ -1575,6 +1587,7 @@ class Type(proto.Enum): class OperationProgress(proto.Message): r"""Information about operation (or operation stage) progress. + Attributes: name (str): A non-parameterized string describing an @@ -1594,6 +1607,7 @@ class OperationProgress(proto.Message): class Metric(proto.Message): r"""Progress metric is (string, int|float|string) pair. + Attributes: name (str): Required. Metric name, e.g., "nodes total", @@ -1620,6 +1634,7 @@ class Metric(proto.Message): class CreateClusterRequest(proto.Message): r"""CreateClusterRequest creates a cluster. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -1648,6 +1663,7 @@ class CreateClusterRequest(proto.Message): class GetClusterRequest(proto.Message): r"""GetClusterRequest gets the settings of a cluster. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -1678,6 +1694,7 @@ class GetClusterRequest(proto.Message): class UpdateClusterRequest(proto.Message): r"""UpdateClusterRequest updates the settings of a cluster. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -1959,6 +1976,7 @@ class SetAddonsConfigRequest(proto.Message): class SetLocationsRequest(proto.Message): r"""SetLocationsRequest sets the locations of the cluster. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -1999,6 +2017,7 @@ class SetLocationsRequest(proto.Message): class UpdateMasterRequest(proto.Message): r"""UpdateMasterRequest updates the master of the cluster. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2043,6 +2062,7 @@ class UpdateMasterRequest(proto.Message): class SetMasterAuthRequest(proto.Message): r"""SetMasterAuthRequest updates the admin password of a cluster. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2087,6 +2107,7 @@ class Action(proto.Enum): class DeleteClusterRequest(proto.Message): r"""DeleteClusterRequest deletes a cluster. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2117,6 +2138,7 @@ class DeleteClusterRequest(proto.Message): class ListClustersRequest(proto.Message): r"""ListClustersRequest lists clusters. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2142,6 +2164,7 @@ class ListClustersRequest(proto.Message): class ListClustersResponse(proto.Message): r"""ListClustersResponse is the result of ListClustersRequest. + Attributes: clusters (Sequence[google.cloud.container_v1.types.Cluster]): A list of clusters in the project in the @@ -2157,6 +2180,7 @@ class ListClustersResponse(proto.Message): class GetOperationRequest(proto.Message): r"""GetOperationRequest gets a single operation. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2187,6 +2211,7 @@ class GetOperationRequest(proto.Message): class ListOperationsRequest(proto.Message): r"""ListOperationsRequest lists operations. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2213,6 +2238,7 @@ class ListOperationsRequest(proto.Message): class CancelOperationRequest(proto.Message): r"""CancelOperationRequest cancels a single operation. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2261,6 +2287,7 @@ class ListOperationsResponse(proto.Message): class GetServerConfigRequest(proto.Message): r"""Gets the current Kubernetes Engine service configuration. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2285,6 +2312,7 @@ class GetServerConfigRequest(proto.Message): class ServerConfig(proto.Message): r"""Kubernetes Engine service configuration. + Attributes: default_cluster_version (str): Version of Kubernetes the service deploys by @@ -2334,6 +2362,7 @@ class ReleaseChannelConfig(proto.Message): class CreateNodePoolRequest(proto.Message): r"""CreateNodePoolRequest creates a node pool for a cluster. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2367,6 +2396,7 @@ class CreateNodePoolRequest(proto.Message): class DeleteNodePoolRequest(proto.Message): r"""DeleteNodePoolRequest deletes a node pool for a cluster. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2402,6 +2432,7 @@ class DeleteNodePoolRequest(proto.Message): class ListNodePoolsRequest(proto.Message): r"""ListNodePoolsRequest lists the node pool(s) for a cluster. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2432,6 +2463,7 @@ class ListNodePoolsRequest(proto.Message): class GetNodePoolRequest(proto.Message): r"""GetNodePoolRequest retrieves a node pool for a cluster. + Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2707,6 +2739,7 @@ class MaintenanceWindow(proto.Message): class TimeWindow(proto.Message): r"""Represents an arbitrary window of time. + Attributes: start_time (google.protobuf.timestamp_pb2.Timestamp): The time that the window first starts. @@ -2721,6 +2754,7 @@ class TimeWindow(proto.Message): class RecurringTimeWindow(proto.Message): r"""Represents an arbitrary window of time that recurs. + Attributes: window (google.cloud.container_v1.types.TimeWindow): The window of the first recurrence. @@ -2771,6 +2805,7 @@ class RecurringTimeWindow(proto.Message): class DailyMaintenanceWindow(proto.Message): r"""Time window specified for daily maintenance operations. + Attributes: start_time (str): Time within the maintenance window to start the maintenance @@ -2911,6 +2946,7 @@ class RollbackNodePoolUpgradeRequest(proto.Message): class ListNodePoolsResponse(proto.Message): r"""ListNodePoolsResponse is the result of ListNodePoolsRequest. + Attributes: node_pools (Sequence[google.cloud.container_v1.types.NodePool]): A list of node pools for a cluster. @@ -3217,6 +3253,7 @@ class CompleteIPRotationRequest(proto.Message): class AcceleratorConfig(proto.Message): r"""AcceleratorConfig represents a Hardware Accelerator request. + Attributes: accelerator_count (int): The number of the accelerator cards exposed @@ -3447,6 +3484,7 @@ class GetJSONWebKeysRequest(proto.Message): class Jwk(proto.Message): r"""Jwk is a JSON Web Key as specified in RFC 7517 + Attributes: kty (str): Key Type. @@ -3530,6 +3568,7 @@ class IntraNodeVisibilityConfig(proto.Message): class MaxPodsConstraint(proto.Message): r"""Constraints applied to pods. + Attributes: max_pods_per_node (int): Constraint enforced on the max num of pods @@ -3554,6 +3593,7 @@ class WorkloadIdentityConfig(proto.Message): class DatabaseEncryption(proto.Message): r"""Configuration of etcd encryption. + Attributes: state (google.cloud.container_v1.types.DatabaseEncryption.State): Denotes the state of etcd encryption. @@ -3635,6 +3675,7 @@ def raw_page(self): class UsableSubnetworkSecondaryRange(proto.Message): r"""Secondary IP range of a usable subnetwork. + Attributes: range_name (str): The name associated with this subnetwork @@ -3698,6 +3739,7 @@ class UsableSubnetwork(proto.Message): class ResourceUsageExportConfig(proto.Message): r"""Configuration for exporting cluster resource usages. + Attributes: bigquery_destination (google.cloud.container_v1.types.ResourceUsageExportConfig.BigQueryDestination): Configuration to use BigQuery as usage export @@ -3725,6 +3767,7 @@ class BigQueryDestination(proto.Message): class ConsumptionMeteringConfig(proto.Message): r"""Parameters for controlling consumption metering. + Attributes: enabled (bool): Whether to enable consumption metering for @@ -3771,6 +3814,7 @@ class DefaultSnatStatus(proto.Message): class ShieldedNodes(proto.Message): r"""Configuration of Shielded Nodes feature. + Attributes: enabled (bool): Whether Shielded Nodes features are enabled diff --git a/google/cloud/container_v1beta1/services/cluster_manager/async_client.py b/google/cloud/container_v1beta1/services/cluster_manager/async_client.py index 4bc1adb0..e0a245e6 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/async_client.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/async_client.py @@ -3563,6 +3563,12 @@ async def list_locations( # Done; return the response. return response + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/container_v1beta1/services/cluster_manager/client.py b/google/cloud/container_v1beta1/services/cluster_manager/client.py index 3aa3c18c..ea046514 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/client.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/client.py @@ -341,10 +341,7 @@ def __init__( client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, - always_use_jwt_access=( - Transport == type(self).get_transport_class("grpc") - or Transport == type(self).get_transport_class("grpc_asyncio") - ), + always_use_jwt_access=True, ) def list_clusters( @@ -3645,6 +3642,19 @@ def list_locations( # Done; return the response. return response + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py b/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py index 1f43ef2e..cfd8a8d2 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py @@ -398,6 +398,15 @@ def _prep_wrapped_messages(self, client_info): ), } + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + @property def list_clusters( self, diff --git a/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py b/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py index 174a3c30..c925d4c1 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py @@ -1155,5 +1155,8 @@ def list_locations( ) return self._stubs["list_locations"] + def close(self): + self.grpc_channel.close() + __all__ = ("ClusterManagerGrpcTransport",) diff --git a/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py b/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py index da248d6d..758ebfa1 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py @@ -1206,5 +1206,8 @@ def list_locations( ) return self._stubs["list_locations"] + def close(self): + return self.grpc_channel.close() + __all__ = ("ClusterManagerGrpcAsyncIOTransport",) diff --git a/google/cloud/container_v1beta1/types/cluster_service.py b/google/cloud/container_v1beta1/types/cluster_service.py index d3b9f790..3e7aa302 100644 --- a/google/cloud/container_v1beta1/types/cluster_service.py +++ b/google/cloud/container_v1beta1/types/cluster_service.py @@ -193,6 +193,7 @@ class UpgradeResourceType(proto.Enum): class LinuxNodeConfig(proto.Message): r"""Parameters that can be configured on Linux nodes. + Attributes: sysctls (Sequence[google.cloud.container_v1beta1.types.LinuxNodeConfig.SysctlsEntry]): The Linux kernel parameters to be applied to the nodes and @@ -211,6 +212,7 @@ class LinuxNodeConfig(proto.Message): class NodeKubeletConfig(proto.Message): r"""Node kubelet configs. + Attributes: cpu_manager_policy (str): Control the CPU management policy on the @@ -258,6 +260,7 @@ class NodeKubeletConfig(proto.Message): class NodeConfig(proto.Message): r"""Parameters that describe the nodes in a cluster. + Attributes: machine_type (str): The name of a Google Compute Engine `machine @@ -471,6 +474,7 @@ class NodeConfig(proto.Message): class NodeNetworkConfig(proto.Message): r"""Parameters for node pool-level network config. + Attributes: create_pod_range (bool): Input only. Whether to create a new range for pod IPs in @@ -526,6 +530,7 @@ class NodeNetworkConfig(proto.Message): class ShieldedInstanceConfig(proto.Message): r"""A set of Shielded Instance options. + Attributes: enable_secure_boot (bool): Defines whether the instance has Secure Boot @@ -745,6 +750,7 @@ class MasterAuth(proto.Message): class ClientCertificateConfig(proto.Message): r"""Configuration for client certificates on the cluster. + Attributes: issue_client_certificate (bool): Issue a client certificate. @@ -864,6 +870,7 @@ class HorizontalPodAutoscaling(proto.Message): class KubernetesDashboard(proto.Message): r"""Configuration for the Kubernetes Dashboard. + Attributes: disabled (bool): Whether the Kubernetes Dashboard is enabled @@ -889,6 +896,7 @@ class NetworkPolicyConfig(proto.Message): class DnsCacheConfig(proto.Message): r"""Configuration for NodeLocal DNSCache + Attributes: enabled (bool): Whether NodeLocal DNSCache is enabled for @@ -900,6 +908,7 @@ class DnsCacheConfig(proto.Message): class KalmConfig(proto.Message): r"""Configuration options for the KALM addon. + Attributes: enabled (bool): Whether KALM is enabled for this cluster. @@ -910,6 +919,7 @@ class KalmConfig(proto.Message): class ConfigConnectorConfig(proto.Message): r"""Configuration options for the Config Connector add-on. + Attributes: enabled (bool): Whether Cloud Connector is enabled for this @@ -921,6 +931,7 @@ class ConfigConnectorConfig(proto.Message): class GcePersistentDiskCsiDriverConfig(proto.Message): r"""Configuration for the Compute Engine PD CSI driver. + Attributes: enabled (bool): Whether the Compute Engine PD CSI driver is @@ -932,6 +943,7 @@ class GcePersistentDiskCsiDriverConfig(proto.Message): class PrivateClusterMasterGlobalAccessConfig(proto.Message): r"""Configuration for controlling master global access settings. + Attributes: enabled (bool): Whenever master is accessible globally or @@ -943,6 +955,7 @@ class PrivateClusterMasterGlobalAccessConfig(proto.Message): class PrivateClusterConfig(proto.Message): r"""Configuration options for private clusters. + Attributes: enable_private_nodes (bool): Whether nodes have internal IP addresses @@ -985,6 +998,7 @@ class PrivateClusterConfig(proto.Message): class IstioConfig(proto.Message): r"""Configuration options for Istio addon. + Attributes: disabled (bool): Whether Istio is enabled for this cluster. @@ -1006,6 +1020,7 @@ class IstioAuthMode(proto.Enum): class CloudRunConfig(proto.Message): r"""Configuration options for the Cloud Run feature. + Attributes: disabled (bool): Whether Cloud Run addon is enabled for this @@ -1043,6 +1058,7 @@ class MasterAuthorizedNetworksConfig(proto.Message): class CidrBlock(proto.Message): r"""CidrBlock contains an optional name and one CIDR block. + Attributes: display_name (str): display_name is an optional field for users to identify CIDR @@ -1254,6 +1270,7 @@ class IPAllocationPolicy(proto.Message): class BinaryAuthorization(proto.Message): r"""Configuration for Binary Authorization. + Attributes: enabled (bool): Enable Binary Authorization for this cluster. @@ -1266,6 +1283,7 @@ class BinaryAuthorization(proto.Message): class PodSecurityPolicyConfig(proto.Message): r"""Configuration for the PodSecurityPolicy feature. + Attributes: enabled (bool): Enable the PodSecurityPolicy controller for @@ -1296,6 +1314,7 @@ class AuthenticatorGroupsConfig(proto.Message): class ClusterTelemetry(proto.Message): r"""Telemetry integration for the cluster. + Attributes: type_ (google.cloud.container_v1beta1.types.ClusterTelemetry.Type): Type of the integration. @@ -1313,6 +1332,7 @@ class Type(proto.Enum): class Cluster(proto.Message): r"""A Google Kubernetes Engine cluster. + Attributes: name (str): The name of this cluster. The name must be unique within @@ -1740,6 +1760,7 @@ class Status(proto.Enum): class NodePoolDefaults(proto.Message): r"""Subset of Nodepool message that has defaults. + Attributes: node_config_defaults (google.cloud.container_v1beta1.types.NodeConfigDefaults): Subset of NodeConfig message that has @@ -1752,7 +1773,8 @@ class NodePoolDefaults(proto.Message): class NodeConfigDefaults(proto.Message): - r"""Subset of NodeConfig message that has defaults. """ + r"""Subset of NodeConfig message that has defaults. + """ class ClusterUpdate(proto.Message): @@ -2113,6 +2135,7 @@ class Type(proto.Enum): class OperationProgress(proto.Message): r"""Information about operation (or operation stage) progress. + Attributes: name (str): A non-parameterized string describing an @@ -2132,6 +2155,7 @@ class OperationProgress(proto.Message): class Metric(proto.Message): r"""Progress metric is (string, int|float|string) pair. + Attributes: name (str): Required. Metric name, e.g., "nodes total", @@ -2158,6 +2182,7 @@ class Metric(proto.Message): class CreateClusterRequest(proto.Message): r"""CreateClusterRequest creates a cluster. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2186,6 +2211,7 @@ class CreateClusterRequest(proto.Message): class GetClusterRequest(proto.Message): r"""GetClusterRequest gets the settings of a cluster. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2216,6 +2242,7 @@ class GetClusterRequest(proto.Message): class UpdateClusterRequest(proto.Message): r"""UpdateClusterRequest updates the settings of a cluster. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2249,6 +2276,7 @@ class UpdateClusterRequest(proto.Message): class UpdateNodePoolRequest(proto.Message): r"""SetNodePoolVersionRequest updates the version of a node pool. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2489,6 +2517,7 @@ class SetMonitoringServiceRequest(proto.Message): class SetAddonsConfigRequest(proto.Message): r"""SetAddonsRequest sets the addons associated with the cluster. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2523,6 +2552,7 @@ class SetAddonsConfigRequest(proto.Message): class SetLocationsRequest(proto.Message): r"""SetLocationsRequest sets the locations of the cluster. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2563,6 +2593,7 @@ class SetLocationsRequest(proto.Message): class UpdateMasterRequest(proto.Message): r"""UpdateMasterRequest updates the master of the cluster. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2607,6 +2638,7 @@ class UpdateMasterRequest(proto.Message): class SetMasterAuthRequest(proto.Message): r"""SetMasterAuthRequest updates the admin password of a cluster. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2651,6 +2683,7 @@ class Action(proto.Enum): class DeleteClusterRequest(proto.Message): r"""DeleteClusterRequest deletes a cluster. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2681,6 +2714,7 @@ class DeleteClusterRequest(proto.Message): class ListClustersRequest(proto.Message): r"""ListClustersRequest lists clusters. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2706,6 +2740,7 @@ class ListClustersRequest(proto.Message): class ListClustersResponse(proto.Message): r"""ListClustersResponse is the result of ListClustersRequest. + Attributes: clusters (Sequence[google.cloud.container_v1beta1.types.Cluster]): A list of clusters in the project in the @@ -2721,6 +2756,7 @@ class ListClustersResponse(proto.Message): class GetOperationRequest(proto.Message): r"""GetOperationRequest gets a single operation. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2751,6 +2787,7 @@ class GetOperationRequest(proto.Message): class ListOperationsRequest(proto.Message): r"""ListOperationsRequest lists operations. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2777,6 +2814,7 @@ class ListOperationsRequest(proto.Message): class CancelOperationRequest(proto.Message): r"""CancelOperationRequest cancels a single operation. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2825,6 +2863,7 @@ class ListOperationsResponse(proto.Message): class GetServerConfigRequest(proto.Message): r"""Gets the current Kubernetes Engine service configuration. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2849,6 +2888,7 @@ class GetServerConfigRequest(proto.Message): class ServerConfig(proto.Message): r"""Kubernetes Engine service configuration. + Attributes: default_cluster_version (str): Version of Kubernetes the service deploys by @@ -2890,6 +2930,7 @@ class ReleaseChannelConfig(proto.Message): class AvailableVersion(proto.Message): r"""Deprecated. + Attributes: version (str): Kubernetes version. @@ -2924,6 +2965,7 @@ class AvailableVersion(proto.Message): class WindowsVersions(proto.Message): r"""Windows server versions. + Attributes: windows_versions (Sequence[google.cloud.container_v1beta1.types.WindowsVersions.WindowsVersion]): List of Windows server versions. @@ -2931,6 +2973,7 @@ class WindowsVersions(proto.Message): class WindowsVersion(proto.Message): r"""Windows server version. + Attributes: image_type (str): Windows server image type @@ -2951,6 +2994,7 @@ class WindowsVersion(proto.Message): class CreateNodePoolRequest(proto.Message): r"""CreateNodePoolRequest creates a node pool for a cluster. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2984,6 +3028,7 @@ class CreateNodePoolRequest(proto.Message): class DeleteNodePoolRequest(proto.Message): r"""DeleteNodePoolRequest deletes a node pool for a cluster. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -3019,6 +3064,7 @@ class DeleteNodePoolRequest(proto.Message): class ListNodePoolsRequest(proto.Message): r"""ListNodePoolsRequest lists the node pool(s) for a cluster. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -3049,6 +3095,7 @@ class ListNodePoolsRequest(proto.Message): class GetNodePoolRequest(proto.Message): r"""GetNodePoolRequest retrieves a node pool for a cluster. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -3189,6 +3236,7 @@ class Status(proto.Enum): class UpgradeSettings(proto.Message): r""" + Attributes: max_surge (int): The maximum number of nodes that can be @@ -3323,6 +3371,7 @@ class MaintenanceWindow(proto.Message): class TimeWindow(proto.Message): r"""Represents an arbitrary window of time. + Attributes: start_time (google.protobuf.timestamp_pb2.Timestamp): The time that the window first starts. @@ -3337,6 +3386,7 @@ class TimeWindow(proto.Message): class RecurringTimeWindow(proto.Message): r"""Represents an arbitrary window of time that recurs. + Attributes: window (google.cloud.container_v1beta1.types.TimeWindow): The window of the first recurrence. @@ -3387,6 +3437,7 @@ class RecurringTimeWindow(proto.Message): class DailyMaintenanceWindow(proto.Message): r"""Time window specified for daily maintenance operations. + Attributes: start_time (str): Time within the maintenance window to start the maintenance @@ -3444,6 +3495,7 @@ class SetNodePoolManagementRequest(proto.Message): class SetNodePoolSizeRequest(proto.Message): r"""SetNodePoolSizeRequest sets the size of a node pool. + Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -3521,6 +3573,7 @@ class RollbackNodePoolUpgradeRequest(proto.Message): class ListNodePoolsResponse(proto.Message): r"""ListNodePoolsResponse is the result of ListNodePoolsRequest. + Attributes: node_pools (Sequence[google.cloud.container_v1beta1.types.NodePool]): A list of node pools for a cluster. @@ -3853,6 +3906,7 @@ class CompleteIPRotationRequest(proto.Message): class AcceleratorConfig(proto.Message): r"""AcceleratorConfig represents a Hardware Accelerator request. + Attributes: accelerator_count (int): The number of the accelerator cards exposed @@ -4136,6 +4190,7 @@ class NetworkConfig(proto.Message): class ServiceExternalIPsConfig(proto.Message): r"""Config to block services with externalIPs field. + Attributes: enabled (bool): Whether Services with ExternalIPs field are @@ -4206,6 +4261,7 @@ def raw_page(self): class UsableSubnetworkSecondaryRange(proto.Message): r"""Secondary IP range of a usable subnetwork. + Attributes: range_name (str): The name associated with this subnetwork @@ -4354,6 +4410,7 @@ class DNSScope(proto.Enum): class MaxPodsConstraint(proto.Message): r"""Constraints applied to pods. + Attributes: max_pods_per_node (int): Constraint enforced on the max num of pods @@ -4410,6 +4467,7 @@ class WorkloadCertificates(proto.Message): class DatabaseEncryption(proto.Message): r"""Configuration of etcd encryption. + Attributes: state (google.cloud.container_v1beta1.types.DatabaseEncryption.State): Denotes the state of etcd encryption. @@ -4432,6 +4490,7 @@ class State(proto.Enum): class ResourceUsageExportConfig(proto.Message): r"""Configuration for exporting cluster resource usages. + Attributes: bigquery_destination (google.cloud.container_v1beta1.types.ResourceUsageExportConfig.BigQueryDestination): Configuration to use BigQuery as usage export @@ -4459,6 +4518,7 @@ class BigQueryDestination(proto.Message): class ConsumptionMeteringConfig(proto.Message): r"""Parameters for controlling consumption metering. + Attributes: enabled (bool): Whether to enable consumption metering for @@ -4480,6 +4540,7 @@ class ConsumptionMeteringConfig(proto.Message): class ShieldedNodes(proto.Message): r"""Configuration of Shielded Nodes feature. + Attributes: enabled (bool): Whether Shielded Nodes features are enabled @@ -4491,6 +4552,7 @@ class ShieldedNodes(proto.Message): class VirtualNIC(proto.Message): r"""Configuration of gVNIC feature. + Attributes: enabled (bool): Whether gVNIC features are enabled in the @@ -4564,6 +4626,7 @@ class GetJSONWebKeysRequest(proto.Message): class Jwk(proto.Message): r"""Jwk is a JSON Web Key as specified in RFC 7517 + Attributes: kty (str): Key Type. @@ -4634,6 +4697,7 @@ class Channel(proto.Enum): class TpuConfig(proto.Message): r"""Configuration for Cloud TPU. + Attributes: enabled (bool): Whether Cloud TPU integration is enabled or @@ -4652,7 +4716,8 @@ class TpuConfig(proto.Message): class Master(proto.Message): - r"""Master is the configuration for components on master. """ + r"""Master is the configuration for components on master. + """ class Autopilot(proto.Message): @@ -4669,6 +4734,7 @@ class Autopilot(proto.Message): class NotificationConfig(proto.Message): r"""NotificationConfig is the configuration of notifications. + Attributes: pubsub (google.cloud.container_v1beta1.types.NotificationConfig.PubSub): Notification config for Pub/Sub. @@ -4676,6 +4742,7 @@ class NotificationConfig(proto.Message): class PubSub(proto.Message): r"""Pub/Sub specific notification config. + Attributes: enabled (bool): Enable notifications for Pub/Sub. @@ -4777,6 +4844,7 @@ class IdentityServiceConfig(proto.Message): class LoggingConfig(proto.Message): r"""LoggingConfig is cluster logging configuration. + Attributes: component_config (google.cloud.container_v1beta1.types.LoggingComponentConfig): Logging components configuration @@ -4808,6 +4876,7 @@ class Component(proto.Enum): class MonitoringConfig(proto.Message): r"""MonitoringConfig is cluster monitoring configuration. + Attributes: component_config (google.cloud.container_v1beta1.types.MonitoringComponentConfig): Monitoring components configuration diff --git a/tests/unit/gapic/container_v1/test_cluster_manager.py b/tests/unit/gapic/container_v1/test_cluster_manager.py index 56618242..ba84a02e 100644 --- a/tests/unit/gapic/container_v1/test_cluster_manager.py +++ b/tests/unit/gapic/container_v1/test_cluster_manager.py @@ -29,6 +29,7 @@ from google.api_core import gapic_v1 from google.api_core import grpc_helpers from google.api_core import grpc_helpers_async +from google.api_core import path_template from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.container_v1.services.cluster_manager import ClusterManagerAsyncClient @@ -8774,6 +8775,9 @@ def test_cluster_manager_base_transport(): with pytest.raises(NotImplementedError): getattr(transport, method)(request=object()) + with pytest.raises(NotImplementedError): + transport.close() + @requires_google_auth_gte_1_25_0 def test_cluster_manager_base_transport_with_credentials_file(): @@ -9232,3 +9236,49 @@ def test_client_withDEFAULT_CLIENT_INFO(): credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) + + +@pytest.mark.asyncio +async def test_transport_close_async(): + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + ) + with mock.patch.object( + type(getattr(client.transport, "grpc_channel")), "close" + ) as close: + async with client: + close.assert_not_called() + close.assert_called_once() + + +def test_transport_close(): + transports = { + "grpc": "_grpc_channel", + } + + for transport, close_name in transports.items(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + with mock.patch.object( + type(getattr(client.transport, close_name)), "close" + ) as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +def test_client_ctx(): + transports = [ + "grpc", + ] + for transport in transports: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() diff --git a/tests/unit/gapic/container_v1beta1/test_cluster_manager.py b/tests/unit/gapic/container_v1beta1/test_cluster_manager.py index 929fac3b..6ebeaee7 100644 --- a/tests/unit/gapic/container_v1beta1/test_cluster_manager.py +++ b/tests/unit/gapic/container_v1beta1/test_cluster_manager.py @@ -29,6 +29,7 @@ from google.api_core import gapic_v1 from google.api_core import grpc_helpers from google.api_core import grpc_helpers_async +from google.api_core import path_template from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.container_v1beta1.services.cluster_manager import ( @@ -9137,6 +9138,9 @@ def test_cluster_manager_base_transport(): with pytest.raises(NotImplementedError): getattr(transport, method)(request=object()) + with pytest.raises(NotImplementedError): + transport.close() + @requires_google_auth_gte_1_25_0 def test_cluster_manager_base_transport_with_credentials_file(): @@ -9615,3 +9619,49 @@ def test_client_withDEFAULT_CLIENT_INFO(): credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) + + +@pytest.mark.asyncio +async def test_transport_close_async(): + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + ) + with mock.patch.object( + type(getattr(client.transport, "grpc_channel")), "close" + ) as close: + async with client: + close.assert_not_called() + close.assert_called_once() + + +def test_transport_close(): + transports = { + "grpc": "_grpc_channel", + } + + for transport, close_name in transports.items(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + with mock.patch.object( + type(getattr(client.transport, close_name)), "close" + ) as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +def test_client_ctx(): + transports = [ + "grpc", + ] + for transport in transports: + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called()