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 55c87752..338290bc 100644 --- a/google/cloud/container_v1/services/cluster_manager/async_client.py +++ b/google/cloud/container_v1/services/cluster_manager/async_client.py @@ -137,7 +137,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/container_v1/services/cluster_manager/client.py b/google/cloud/container_v1/services/cluster_manager/client.py index 6d5e6274..ddf1c6f5 100644 --- a/google/cloud/container_v1/services/cluster_manager/client.py +++ b/google/cloud/container_v1/services/cluster_manager/client.py @@ -288,7 +288,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/container_v1/types/cluster_service.py b/google/cloud/container_v1/types/cluster_service.py index 1446d0d1..e9736f69 100644 --- a/google/cloud/container_v1/types/cluster_service.py +++ b/google/cloud/container_v1/types/cluster_service.py @@ -358,6 +358,9 @@ class NodeConfig(proto.Message): [AutoprovisioningNodePoolDefaults][google.container.v1.AutoprovisioningNodePoolDefaults] instead. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: machine_type (str): The name of a Google Compute Engine `machine @@ -716,6 +719,8 @@ class NodeConfig(proto.Message): class AdvancedMachineFeatures(proto.Message): r"""Specifies options for controlling advanced machine features. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: threads_per_core (int): The number of threads per physical core. To @@ -737,6 +742,8 @@ class AdvancedMachineFeatures(proto.Message): class NodeNetworkConfig(proto.Message): r"""Parameters for node pool-level network config. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: create_pod_range (bool): Input only. Whether to create a new range for pod IPs in @@ -799,6 +806,8 @@ class NodeNetworkConfig(proto.Message): class NetworkPerformanceConfig(proto.Message): r"""Configuration of all network bandwidth tiers + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: total_egress_bandwidth_tier (google.cloud.container_v1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier): Specifies the total network bandwidth tier @@ -1543,6 +1552,9 @@ class MasterAuthorizedNetworksConfig(proto.Message): except traffic from the given CIDR blocks, Google Compute Engine Public IPs and Google Prod IPs. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: enabled (bool): Whether or not master authorized networks is @@ -1865,6 +1877,8 @@ class IPAllocationPolicy(proto.Message): class Cluster(proto.Message): r"""A Google Kubernetes Engine cluster. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: name (str): The name of this cluster. The name must be unique within @@ -2531,6 +2545,9 @@ class ClusterUpdate(proto.Message): update can be applied to a cluster with each request, so at most one field can be provided. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: desired_node_version (str): The Kubernetes version to change the nodes to @@ -4693,6 +4710,9 @@ class UpgradeSettings(proto.Message): 2. node_pool_soak_duration is the soak time after all blue nodes are drained. After this period, the blue pool nodes will be deleted. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: max_surge (int): The maximum number of nodes that can be @@ -5884,6 +5904,8 @@ class CompleteIPRotationRequest(proto.Message): class AcceleratorConfig(proto.Message): r"""AcceleratorConfig represents a Hardware Accelerator request. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: accelerator_count (int): The number of the accelerator cards exposed @@ -5926,6 +5948,9 @@ class GPUSharingConfig(proto.Message): r"""GPUSharingConfig represents the GPU sharing configuration for Hardware Accelerators. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: max_shared_clients_per_gpu (int): The max number of containers that can share a 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 760e7065..861a2814 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/async_client.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/async_client.py @@ -137,7 +137,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/container_v1beta1/services/cluster_manager/client.py b/google/cloud/container_v1beta1/services/cluster_manager/client.py index e2f03357..2b1ada40 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/client.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/client.py @@ -288,7 +288,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/container_v1beta1/types/cluster_service.py b/google/cloud/container_v1beta1/types/cluster_service.py index d0656135..8a0678be 100644 --- a/google/cloud/container_v1beta1/types/cluster_service.py +++ b/google/cloud/container_v1beta1/types/cluster_service.py @@ -366,6 +366,9 @@ class NodeConfig(proto.Message): [AutoprovisioningNodePoolDefaults][google.container.v1beta1.AutoprovisioningNodePoolDefaults] instead. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: machine_type (str): The name of a Google Compute Engine `machine @@ -733,6 +736,8 @@ class NodeConfig(proto.Message): class AdvancedMachineFeatures(proto.Message): r"""Specifies options for controlling advanced machine features. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: threads_per_core (int): The number of threads per physical core. To @@ -754,6 +759,8 @@ class AdvancedMachineFeatures(proto.Message): class NodeNetworkConfig(proto.Message): r"""Parameters for node pool-level network config. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: create_pod_range (bool): Input only. Whether to create a new range for pod IPs in @@ -816,6 +823,8 @@ class NodeNetworkConfig(proto.Message): class NetworkPerformanceConfig(proto.Message): r"""Configuration of all network bandwidth tiers + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: total_egress_bandwidth_tier (google.cloud.container_v1beta1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier): Specifies the total network bandwidth tier @@ -1678,6 +1687,9 @@ class MasterAuthorizedNetworksConfig(proto.Message): except traffic from the given CIDR blocks, Google Compute Engine Public IPs and Google Prod IPs. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: enabled (bool): Whether or not master authorized networks is @@ -2111,6 +2123,8 @@ class Type(proto.Enum): class Cluster(proto.Message): r"""A Google Kubernetes Engine cluster. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: name (str): The name of this cluster. The name must be unique within @@ -2439,6 +2453,11 @@ class Cluster(proto.Message): cluster. This field is a member of `oneof`_ ``_protect_config``. + etag (str): + This checksum is computed by the server based + on the value of cluster fields, and may be sent + on update requests to ensure the client has an + up-to-date value before proceeding. """ class Status(proto.Enum): @@ -2778,12 +2797,19 @@ class Status(proto.Enum): optional=True, message="ProtectConfig", ) + etag: str = proto.Field( + proto.STRING, + number=139, + ) class WorkloadConfig(proto.Message): r"""WorkloadConfig defines the flags to enable or disable the workload configurations for the cluster. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: audit_mode (google.cloud.container_v1beta1.types.WorkloadConfig.Mode): Sets which mode of auditing should be used @@ -2812,6 +2838,9 @@ class ProtectConfig(proto.Message): r"""ProtectConfig defines the flags needed to enable/disable features for the Protect API. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: workload_config (google.cloud.container_v1beta1.types.WorkloadConfig): WorkloadConfig defines which actions are @@ -2913,6 +2942,9 @@ class ClusterUpdate(proto.Message): update can be applied to a cluster with each request, so at most one field can be provided. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: desired_node_version (str): The Kubernetes version to change the nodes to @@ -3096,6 +3128,11 @@ class ClusterUpdate(proto.Message): desired_gateway_api_config (google.cloud.container_v1beta1.types.GatewayAPIConfig): The desired config of Gateway API on this cluster. + etag (str): + The current etag of the cluster. + If an etag is provided and does not match the + current etag of the cluster, update will be + blocked and an ABORTED error will be returned. desired_node_pool_logging_config (google.cloud.container_v1beta1.types.NodePoolLoggingConfig): The desired node pool logging configuration defaults for the cluster. @@ -3323,6 +3360,10 @@ class ClusterUpdate(proto.Message): number=114, message="GatewayAPIConfig", ) + etag: str = proto.Field( + proto.STRING, + number=115, + ) desired_node_pool_logging_config: "NodePoolLoggingConfig" = proto.Field( proto.MESSAGE, number=116, @@ -3799,6 +3840,11 @@ class UpdateNodePoolRequest(proto.Message): Confidential VM once enabled. gvnic (google.cloud.container_v1beta1.types.VirtualNIC): Enable or disable gvnic on the node pool. + etag (str): + The current etag of the node pool. + If an etag is provided and does not match the + current etag of the node pool, update will be + blocked and an ABORTED error will be returned. fast_socket (google.cloud.container_v1beta1.types.FastSocket): Enable or disable NCCL fast socket for the node pool. @@ -3900,6 +3946,10 @@ class UpdateNodePoolRequest(proto.Message): number=29, message="VirtualNIC", ) + etag: str = proto.Field( + proto.STRING, + number=30, + ) fast_socket: "FastSocket" = proto.Field( proto.MESSAGE, number=31, @@ -5147,6 +5197,11 @@ class NodePool(proto.Message): update_info (google.cloud.container_v1beta1.types.NodePool.UpdateInfo): Output only. [Output only] Update info contains relevant information during a node pool update. + etag (str): + This checksum is computed by the server based + on the value of node pool fields, and may be + sent on update requests to ensure the client has + an up-to-date value before proceeding. """ class Status(proto.Enum): @@ -5188,6 +5243,9 @@ class UpgradeSettings(proto.Message): 2. node_pool_soak_duration is the soak time after all blue nodes are drained. After this period, the blue pool nodes will be deleted. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: max_surge (int): The maximum number of nodes that can be @@ -5405,6 +5463,10 @@ class Type(proto.Enum): number=109, message=UpdateInfo, ) + etag: str = proto.Field( + proto.STRING, + number=110, + ) class NodeManagement(proto.Message): @@ -6381,6 +6443,8 @@ class CompleteIPRotationRequest(proto.Message): class AcceleratorConfig(proto.Message): r"""AcceleratorConfig represents a Hardware Accelerator request. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: accelerator_count (int): The number of the accelerator cards exposed @@ -6430,6 +6494,9 @@ class GPUSharingConfig(proto.Message): r"""GPUSharingConfig represents the GPU sharing configuration for Hardware Accelerators. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: max_shared_clients_per_gpu (int): The max number of containers that can share a diff --git a/samples/generated_samples/snippet_metadata_google.container.v1.json b/samples/generated_samples/snippet_metadata_google.container.v1.json index db5d85de..34c1cf39 100644 --- a/samples/generated_samples/snippet_metadata_google.container.v1.json +++ b/samples/generated_samples/snippet_metadata_google.container.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-container", - "version": "2.15.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_google.container.v1beta1.json b/samples/generated_samples/snippet_metadata_google.container.v1beta1.json index 69b77990..15a96218 100644 --- a/samples/generated_samples/snippet_metadata_google.container.v1beta1.json +++ b/samples/generated_samples/snippet_metadata_google.container.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-container", - "version": "2.15.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/scripts/fixup_container_v1beta1_keywords.py b/scripts/fixup_container_v1beta1_keywords.py index 6bb191d0..4284707b 100644 --- a/scripts/fixup_container_v1beta1_keywords.py +++ b/scripts/fixup_container_v1beta1_keywords.py @@ -72,7 +72,7 @@ class containerCallTransformer(cst.CSTTransformer): 'start_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', 'rotate_credentials', ), 'update_cluster': ('project_id', 'zone', 'cluster_id', 'update', 'name', ), 'update_master': ('project_id', 'zone', 'cluster_id', 'master_version', 'name', ), - 'update_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'node_version', 'image_type', 'locations', 'workload_metadata_config', 'name', 'upgrade_settings', 'tags', 'taints', 'labels', 'linux_node_config', 'kubelet_config', 'node_network_config', 'gcfs_config', 'confidential_nodes', 'gvnic', 'fast_socket', 'logging_config', 'resource_labels', 'windows_node_config', ), + 'update_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'node_version', 'image_type', 'locations', 'workload_metadata_config', 'name', 'upgrade_settings', 'tags', 'taints', 'labels', 'linux_node_config', 'kubelet_config', 'node_network_config', 'gcfs_config', 'confidential_nodes', 'gvnic', 'etag', 'fast_socket', 'logging_config', 'resource_labels', 'windows_node_config', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: diff --git a/setup.py b/setup.py index 2b3fa71a..f2375cb5 100644 --- a/setup.py +++ b/setup.py @@ -38,6 +38,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", "proto-plus >= 1.22.0, <2.0.0dev", + "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] url = "https://github.com/googleapis/python-container" @@ -77,6 +78,7 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Operating System :: OS Independent", "Topic :: Internet", ], diff --git a/testing/constraints-3.12.txt b/testing/constraints-3.12.txt new file mode 100644 index 00000000..ed7f9aed --- /dev/null +++ b/testing/constraints-3.12.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/tests/unit/gapic/container_v1beta1/test_cluster_manager.py b/tests/unit/gapic/container_v1beta1/test_cluster_manager.py index f9d24a4f..9b550989 100644 --- a/tests/unit/gapic/container_v1beta1/test_cluster_manager.py +++ b/tests/unit/gapic/container_v1beta1/test_cluster_manager.py @@ -979,6 +979,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): enable_tpu=True, tpu_ipv4_cidr_block="tpu_ipv4_cidr_block_value", id="id_value", + etag="etag_value", ) response = client.get_cluster(request) @@ -1020,6 +1021,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): assert response.enable_tpu is True assert response.tpu_ipv4_cidr_block == "tpu_ipv4_cidr_block_value" assert response.id == "id_value" + assert response.etag == "etag_value" def test_get_cluster_empty_call(): @@ -1087,6 +1089,7 @@ async def test_get_cluster_async( enable_tpu=True, tpu_ipv4_cidr_block="tpu_ipv4_cidr_block_value", id="id_value", + etag="etag_value", ) ) response = await client.get_cluster(request) @@ -1129,6 +1132,7 @@ async def test_get_cluster_async( assert response.enable_tpu is True assert response.tpu_ipv4_cidr_block == "tpu_ipv4_cidr_block_value" assert response.id == "id_value" + assert response.etag == "etag_value" @pytest.mark.asyncio @@ -5820,6 +5824,7 @@ def test_get_node_pool(request_type, transport: str = "grpc"): status=cluster_service.NodePool.Status.PROVISIONING, status_message="status_message_value", pod_ipv4_cidr_size=1856, + etag="etag_value", ) response = client.get_node_pool(request) @@ -5839,6 +5844,7 @@ def test_get_node_pool(request_type, transport: str = "grpc"): assert response.status == cluster_service.NodePool.Status.PROVISIONING assert response.status_message == "status_message_value" assert response.pod_ipv4_cidr_size == 1856 + assert response.etag == "etag_value" def test_get_node_pool_empty_call(): @@ -5884,6 +5890,7 @@ async def test_get_node_pool_async( status=cluster_service.NodePool.Status.PROVISIONING, status_message="status_message_value", pod_ipv4_cidr_size=1856, + etag="etag_value", ) ) response = await client.get_node_pool(request) @@ -5904,6 +5911,7 @@ async def test_get_node_pool_async( assert response.status == cluster_service.NodePool.Status.PROVISIONING assert response.status_message == "status_message_value" assert response.pod_ipv4_cidr_size == 1856 + assert response.etag == "etag_value" @pytest.mark.asyncio