From e67586330bff46b3c944ec145def147c575bdab9 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 3 Jun 2023 21:44:13 +0000 Subject: [PATCH 1/3] build(deps): bump cryptography to 41.0.0 [autoapprove] (#374) Source-Link: https://togithub.com/googleapis/synthtool/commit/d0f51a0c2a9a6bcca86911eabea9e484baadf64b Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:240b5bcc2bafd450912d2da2be15e62bc6de2cf839823ae4bf94d4f392b451dc --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 42 +++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 32b3c486..02a4dedc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:9bc5fa3b62b091f60614c08a7fb4fd1d3e1678e326f34dd66ce1eefb5dc3267b -# created: 2023-05-25T14:56:16.294623272Z + digest: sha256:240b5bcc2bafd450912d2da2be15e62bc6de2cf839823ae4bf94d4f392b451dc +# created: 2023-06-03T21:25:37.968717478Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 3b8d7ee8..c7929db6 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -113,28 +113,26 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==39.0.1 \ - --hash=sha256:0f8da300b5c8af9f98111ffd512910bc792b4c77392a9523624680f7956a99d4 \ - --hash=sha256:35f7c7d015d474f4011e859e93e789c87d21f6f4880ebdc29896a60403328f1f \ - --hash=sha256:5aa67414fcdfa22cf052e640cb5ddc461924a045cacf325cd164e65312d99502 \ - --hash=sha256:5d2d8b87a490bfcd407ed9d49093793d0f75198a35e6eb1a923ce1ee86c62b41 \ - --hash=sha256:6687ef6d0a6497e2b58e7c5b852b53f62142cfa7cd1555795758934da363a965 \ - --hash=sha256:6f8ba7f0328b79f08bdacc3e4e66fb4d7aab0c3584e0bd41328dce5262e26b2e \ - --hash=sha256:706843b48f9a3f9b9911979761c91541e3d90db1ca905fd63fee540a217698bc \ - --hash=sha256:807ce09d4434881ca3a7594733669bd834f5b2c6d5c7e36f8c00f691887042ad \ - --hash=sha256:83e17b26de248c33f3acffb922748151d71827d6021d98c70e6c1a25ddd78505 \ - --hash=sha256:96f1157a7c08b5b189b16b47bc9db2332269d6680a196341bf30046330d15388 \ - --hash=sha256:aec5a6c9864be7df2240c382740fcf3b96928c46604eaa7f3091f58b878c0bb6 \ - --hash=sha256:b0afd054cd42f3d213bf82c629efb1ee5f22eba35bf0eec88ea9ea7304f511a2 \ - --hash=sha256:ced4e447ae29ca194449a3f1ce132ded8fcab06971ef5f618605aacaa612beac \ - --hash=sha256:d1f6198ee6d9148405e49887803907fe8962a23e6c6f83ea7d98f1c0de375695 \ - --hash=sha256:e124352fd3db36a9d4a21c1aa27fd5d051e621845cb87fb851c08f4f75ce8be6 \ - --hash=sha256:e422abdec8b5fa8462aa016786680720d78bdce7a30c652b7fadf83a4ba35336 \ - --hash=sha256:ef8b72fa70b348724ff1218267e7f7375b8de4e8194d1636ee60510aae104cd0 \ - --hash=sha256:f0c64d1bd842ca2633e74a1a28033d139368ad959872533b1bab8c80e8240a0c \ - --hash=sha256:f24077a3b5298a5a06a8e0536e3ea9ec60e4c7ac486755e5fb6e6ea9b3500106 \ - --hash=sha256:fdd188c8a6ef8769f148f88f859884507b954cc64db6b52f66ef199bb9ad660a \ - --hash=sha256:fe913f20024eb2cb2f323e42a64bdf2911bb9738a15dba7d3cce48151034e3a8 +cryptography==41.0.0 \ + --hash=sha256:0ddaee209d1cf1f180f1efa338a68c4621154de0afaef92b89486f5f96047c55 \ + --hash=sha256:14754bcdae909d66ff24b7b5f166d69340ccc6cb15731670435efd5719294895 \ + --hash=sha256:344c6de9f8bda3c425b3a41b319522ba3208551b70c2ae00099c205f0d9fd3be \ + --hash=sha256:34d405ea69a8b34566ba3dfb0521379b210ea5d560fafedf9f800a9a94a41928 \ + --hash=sha256:3680248309d340fda9611498a5319b0193a8dbdb73586a1acf8109d06f25b92d \ + --hash=sha256:3c5ef25d060c80d6d9f7f9892e1d41bb1c79b78ce74805b8cb4aa373cb7d5ec8 \ + --hash=sha256:4ab14d567f7bbe7f1cdff1c53d5324ed4d3fc8bd17c481b395db224fb405c237 \ + --hash=sha256:5c1f7293c31ebc72163a9a0df246f890d65f66b4a40d9ec80081969ba8c78cc9 \ + --hash=sha256:6b71f64beeea341c9b4f963b48ee3b62d62d57ba93eb120e1196b31dc1025e78 \ + --hash=sha256:7d92f0248d38faa411d17f4107fc0bce0c42cae0b0ba5415505df72d751bf62d \ + --hash=sha256:8362565b3835ceacf4dc8f3b56471a2289cf51ac80946f9087e66dc283a810e0 \ + --hash=sha256:84a165379cb9d411d58ed739e4af3396e544eac190805a54ba2e0322feb55c46 \ + --hash=sha256:88ff107f211ea696455ea8d911389f6d2b276aabf3231bf72c8853d22db755c5 \ + --hash=sha256:9f65e842cb02550fac96536edb1d17f24c0a338fd84eaf582be25926e993dde4 \ + --hash=sha256:a4fc68d1c5b951cfb72dfd54702afdbbf0fb7acdc9b7dc4301bbf2225a27714d \ + --hash=sha256:b7f2f5c525a642cecad24ee8670443ba27ac1fab81bba4cc24c7b6b41f2d0c75 \ + --hash=sha256:b846d59a8d5a9ba87e2c3d757ca019fa576793e8758174d3868aecb88d6fc8eb \ + --hash=sha256:bf8fc66012ca857d62f6a347007e166ed59c0bc150cefa49f28376ebe7d992a2 \ + --hash=sha256:f5d0bf9b252f30a31664b6f64432b4730bb7038339bd18b1fafe129cfc2be9be # via # gcp-releasetool # secretstorage From 52d14803c65c06f65c1dcf7679faa9c6a0cca784 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 6 Jun 2023 10:23:44 -0400 Subject: [PATCH 2/3] feat: add a API field to enable FQDN Network Policy on clusters (#375) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add a API field to enable FQDN Network Policy on clusters --- feat: turn on public visibility for best effort provision --- feat: add CheckAutopilotCompatibility API to get autopilot compatibility issues for a given standard cluster PiperOrigin-RevId: 537883922 Source-Link: https://github.com/googleapis/googleapis/commit/e1de7d7cfac0fe2faf265381b8d0b616c93f1d6b Source-Link: https://github.com/googleapis/googleapis-gen/commit/66f4014cfe85984b171d20c6ad5d73fed27a9680 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjZmNDAxNGNmZTg1OTg0YjE3MWQyMGM2YWQ1ZDczZmVkMjdhOTY4MCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: add a API field to enable FQDN Network Policy on clusters --- feat: turn on public visibility for best effort provision --- feat: add CheckAutopilotCompatibility API to get autopilot compatibility issues for a given standard cluster PiperOrigin-RevId: 537987027 Source-Link: https://github.com/googleapis/googleapis/commit/5a5735972ca46dafcf70caea39aec5f2b67130fb Source-Link: https://github.com/googleapis/googleapis-gen/commit/8c47f208c5e704be08afcf278fb021779cb53da0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGM0N2YyMDhjNWU3MDRiZTA4YWZjZjI3OGZiMDIxNzc5Y2I1M2RhMCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- google/cloud/container/__init__.py | 10 + google/cloud/container_v1/__init__.py | 10 + google/cloud/container_v1/gapic_metadata.json | 10 + .../services/cluster_manager/async_client.py | 83 +++++++ .../services/cluster_manager/client.py | 86 +++++++ .../cluster_manager/transports/base.py | 17 ++ .../cluster_manager/transports/grpc.py | 32 +++ .../transports/grpc_asyncio.py | 32 +++ google/cloud/container_v1/types/__init__.py | 10 + .../container_v1/types/cluster_service.py | 212 +++++++++++++++++ google/cloud/container_v1beta1/__init__.py | 10 + .../container_v1beta1/gapic_metadata.json | 10 + .../services/cluster_manager/async_client.py | 83 +++++++ .../services/cluster_manager/client.py | 86 +++++++ .../cluster_manager/transports/base.py | 17 ++ .../cluster_manager/transports/grpc.py | 32 +++ .../transports/grpc_asyncio.py | 32 +++ .../cloud/container_v1beta1/types/__init__.py | 10 + .../types/cluster_service.py | 214 ++++++++++++++++++ ...ger_check_autopilot_compatibility_async.py | 51 +++++ ...ager_check_autopilot_compatibility_sync.py | 51 +++++ ...ger_check_autopilot_compatibility_async.py | 51 +++++ ...ager_check_autopilot_compatibility_sync.py | 51 +++++ .../snippet_metadata_google.container.v1.json | 155 ++++++++++++- ...pet_metadata_google.container.v1beta1.json | 155 ++++++++++++- scripts/fixup_container_v1_keywords.py | 1 + scripts/fixup_container_v1beta1_keywords.py | 1 + .../container_v1/test_cluster_manager.py | 162 +++++++++++++ .../container_v1beta1/test_cluster_manager.py | 162 +++++++++++++ 29 files changed, 1834 insertions(+), 2 deletions(-) create mode 100644 samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py create mode 100644 samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py create mode 100644 samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py create mode 100644 samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py diff --git a/google/cloud/container/__init__.py b/google/cloud/container/__init__.py index 477cb459..e7390061 100644 --- a/google/cloud/container/__init__.py +++ b/google/cloud/container/__init__.py @@ -31,11 +31,15 @@ AdvancedMachineFeatures, AuthenticatorGroupsConfig, Autopilot, + AutopilotCompatibilityIssue, AutoprovisioningNodePoolDefaults, AutoUpgradeOptions, + BestEffortProvisioning, BinaryAuthorization, BlueGreenSettings, CancelOperationRequest, + CheckAutopilotCompatibilityRequest, + CheckAutopilotCompatibilityResponse, ClientCertificateConfig, CloudRunConfig, Cluster, @@ -81,6 +85,7 @@ IPAllocationPolicy, IPv6AccessType, Jwk, + K8sBetaAPIConfig, KubernetesDashboard, LegacyAbac, LinuxNodeConfig, @@ -185,11 +190,15 @@ "AdvancedMachineFeatures", "AuthenticatorGroupsConfig", "Autopilot", + "AutopilotCompatibilityIssue", "AutoprovisioningNodePoolDefaults", "AutoUpgradeOptions", + "BestEffortProvisioning", "BinaryAuthorization", "BlueGreenSettings", "CancelOperationRequest", + "CheckAutopilotCompatibilityRequest", + "CheckAutopilotCompatibilityResponse", "ClientCertificateConfig", "CloudRunConfig", "Cluster", @@ -233,6 +242,7 @@ "IntraNodeVisibilityConfig", "IPAllocationPolicy", "Jwk", + "K8sBetaAPIConfig", "KubernetesDashboard", "LegacyAbac", "LinuxNodeConfig", diff --git a/google/cloud/container_v1/__init__.py b/google/cloud/container_v1/__init__.py index c7cd3767..af3051b9 100644 --- a/google/cloud/container_v1/__init__.py +++ b/google/cloud/container_v1/__init__.py @@ -26,11 +26,15 @@ AdvancedMachineFeatures, AuthenticatorGroupsConfig, Autopilot, + AutopilotCompatibilityIssue, AutoprovisioningNodePoolDefaults, AutoUpgradeOptions, + BestEffortProvisioning, BinaryAuthorization, BlueGreenSettings, CancelOperationRequest, + CheckAutopilotCompatibilityRequest, + CheckAutopilotCompatibilityResponse, ClientCertificateConfig, CloudRunConfig, Cluster, @@ -76,6 +80,7 @@ IPAllocationPolicy, IPv6AccessType, Jwk, + K8sBetaAPIConfig, KubernetesDashboard, LegacyAbac, LinuxNodeConfig, @@ -180,10 +185,14 @@ "AuthenticatorGroupsConfig", "AutoUpgradeOptions", "Autopilot", + "AutopilotCompatibilityIssue", "AutoprovisioningNodePoolDefaults", + "BestEffortProvisioning", "BinaryAuthorization", "BlueGreenSettings", "CancelOperationRequest", + "CheckAutopilotCompatibilityRequest", + "CheckAutopilotCompatibilityResponse", "ClientCertificateConfig", "CloudRunConfig", "Cluster", @@ -230,6 +239,7 @@ "IdentityServiceConfig", "IntraNodeVisibilityConfig", "Jwk", + "K8sBetaAPIConfig", "KubernetesDashboard", "LegacyAbac", "LinuxNodeConfig", diff --git a/google/cloud/container_v1/gapic_metadata.json b/google/cloud/container_v1/gapic_metadata.json index 5ef3b3dd..85cb487b 100644 --- a/google/cloud/container_v1/gapic_metadata.json +++ b/google/cloud/container_v1/gapic_metadata.json @@ -15,6 +15,11 @@ "cancel_operation" ] }, + "CheckAutopilotCompatibility": { + "methods": [ + "check_autopilot_compatibility" + ] + }, "CompleteIPRotation": { "methods": [ "complete_ip_rotation" @@ -185,6 +190,11 @@ "cancel_operation" ] }, + "CheckAutopilotCompatibility": { + "methods": [ + "check_autopilot_compatibility" + ] + }, "CompleteIPRotation": { "methods": [ "complete_ip_rotation" 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 33f4568a..dc642563 100644 --- a/google/cloud/container_v1/services/cluster_manager/async_client.py +++ b/google/cloud/container_v1/services/cluster_manager/async_client.py @@ -4614,6 +4614,89 @@ async def sample_list_usable_subnetworks(): # Done; return the response. return response + async def check_autopilot_compatibility( + self, + request: Optional[ + Union[cluster_service.CheckAutopilotCompatibilityRequest, dict] + ] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cluster_service.CheckAutopilotCompatibilityResponse: + r"""Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import container_v1 + + async def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = await client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1.types.CheckAutopilotCompatibilityRequest, dict]]): + The request object. CheckAutopilotCompatibilityRequest + requests getting the blockers for the + given operation in the cluster. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.container_v1.types.CheckAutopilotCompatibilityResponse: + CheckAutopilotCompatibilityResponse + has a list of compatibility issues. + + """ + # Create or coerce a protobuf request object. + request = cluster_service.CheckAutopilotCompatibilityRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.check_autopilot_compatibility, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + async def __aenter__(self): return self diff --git a/google/cloud/container_v1/services/cluster_manager/client.py b/google/cloud/container_v1/services/cluster_manager/client.py index 87dc6aa0..210ba4f5 100644 --- a/google/cloud/container_v1/services/cluster_manager/client.py +++ b/google/cloud/container_v1/services/cluster_manager/client.py @@ -4761,6 +4761,92 @@ def sample_list_usable_subnetworks(): # Done; return the response. return response + def check_autopilot_compatibility( + self, + request: Optional[ + Union[cluster_service.CheckAutopilotCompatibilityRequest, dict] + ] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cluster_service.CheckAutopilotCompatibilityResponse: + r"""Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import container_v1 + + def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1.types.CheckAutopilotCompatibilityRequest, dict]): + The request object. CheckAutopilotCompatibilityRequest + requests getting the blockers for the + given operation in the cluster. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.container_v1.types.CheckAutopilotCompatibilityResponse: + CheckAutopilotCompatibilityResponse + has a list of compatibility issues. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a cluster_service.CheckAutopilotCompatibilityRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cluster_service.CheckAutopilotCompatibilityRequest): + request = cluster_service.CheckAutopilotCompatibilityRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.check_autopilot_compatibility + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + def __enter__(self) -> "ClusterManagerClient": return self 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 2c4a4aee..7659285d 100644 --- a/google/cloud/container_v1/services/cluster_manager/transports/base.py +++ b/google/cloud/container_v1/services/cluster_manager/transports/base.py @@ -378,6 +378,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.check_autopilot_compatibility: gapic_v1.method.wrap_method( + self.check_autopilot_compatibility, + default_timeout=None, + client_info=client_info, + ), } def close(self): @@ -701,6 +706,18 @@ def list_usable_subnetworks( ]: raise NotImplementedError() + @property + def check_autopilot_compatibility( + self, + ) -> Callable[ + [cluster_service.CheckAutopilotCompatibilityRequest], + Union[ + cluster_service.CheckAutopilotCompatibilityResponse, + Awaitable[cluster_service.CheckAutopilotCompatibilityResponse], + ], + ]: + raise NotImplementedError() + @property def kind(self) -> str: raise NotImplementedError() 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 3dcdd5a9..83f2f029 100644 --- a/google/cloud/container_v1/services/cluster_manager/transports/grpc.py +++ b/google/cloud/container_v1/services/cluster_manager/transports/grpc.py @@ -1156,6 +1156,38 @@ def list_usable_subnetworks( ) return self._stubs["list_usable_subnetworks"] + @property + def check_autopilot_compatibility( + self, + ) -> Callable[ + [cluster_service.CheckAutopilotCompatibilityRequest], + cluster_service.CheckAutopilotCompatibilityResponse, + ]: + r"""Return a callable for the check autopilot compatibility method over gRPC. + + Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + Returns: + Callable[[~.CheckAutopilotCompatibilityRequest], + ~.CheckAutopilotCompatibilityResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "check_autopilot_compatibility" not in self._stubs: + self._stubs[ + "check_autopilot_compatibility" + ] = self.grpc_channel.unary_unary( + "/google.container.v1.ClusterManager/CheckAutopilotCompatibility", + request_serializer=cluster_service.CheckAutopilotCompatibilityRequest.serialize, + response_deserializer=cluster_service.CheckAutopilotCompatibilityResponse.deserialize, + ) + return self._stubs["check_autopilot_compatibility"] + def close(self): self.grpc_channel.close() 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 b308b28d..59326ab5 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 @@ -1208,6 +1208,38 @@ def list_usable_subnetworks( ) return self._stubs["list_usable_subnetworks"] + @property + def check_autopilot_compatibility( + self, + ) -> Callable[ + [cluster_service.CheckAutopilotCompatibilityRequest], + Awaitable[cluster_service.CheckAutopilotCompatibilityResponse], + ]: + r"""Return a callable for the check autopilot compatibility method over gRPC. + + Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + Returns: + Callable[[~.CheckAutopilotCompatibilityRequest], + Awaitable[~.CheckAutopilotCompatibilityResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "check_autopilot_compatibility" not in self._stubs: + self._stubs[ + "check_autopilot_compatibility" + ] = self.grpc_channel.unary_unary( + "/google.container.v1.ClusterManager/CheckAutopilotCompatibility", + request_serializer=cluster_service.CheckAutopilotCompatibilityRequest.serialize, + response_deserializer=cluster_service.CheckAutopilotCompatibilityResponse.deserialize, + ) + return self._stubs["check_autopilot_compatibility"] + def close(self): return self.grpc_channel.close() diff --git a/google/cloud/container_v1/types/__init__.py b/google/cloud/container_v1/types/__init__.py index bc9131a0..1b0016b1 100644 --- a/google/cloud/container_v1/types/__init__.py +++ b/google/cloud/container_v1/types/__init__.py @@ -20,11 +20,15 @@ AdvancedMachineFeatures, AuthenticatorGroupsConfig, Autopilot, + AutopilotCompatibilityIssue, AutoprovisioningNodePoolDefaults, AutoUpgradeOptions, + BestEffortProvisioning, BinaryAuthorization, BlueGreenSettings, CancelOperationRequest, + CheckAutopilotCompatibilityRequest, + CheckAutopilotCompatibilityResponse, ClientCertificateConfig, CloudRunConfig, Cluster, @@ -70,6 +74,7 @@ IPAllocationPolicy, IPv6AccessType, Jwk, + K8sBetaAPIConfig, KubernetesDashboard, LegacyAbac, LinuxNodeConfig, @@ -172,11 +177,15 @@ "AdvancedMachineFeatures", "AuthenticatorGroupsConfig", "Autopilot", + "AutopilotCompatibilityIssue", "AutoprovisioningNodePoolDefaults", "AutoUpgradeOptions", + "BestEffortProvisioning", "BinaryAuthorization", "BlueGreenSettings", "CancelOperationRequest", + "CheckAutopilotCompatibilityRequest", + "CheckAutopilotCompatibilityResponse", "ClientCertificateConfig", "CloudRunConfig", "Cluster", @@ -220,6 +229,7 @@ "IntraNodeVisibilityConfig", "IPAllocationPolicy", "Jwk", + "K8sBetaAPIConfig", "KubernetesDashboard", "LegacyAbac", "LinuxNodeConfig", diff --git a/google/cloud/container_v1/types/cluster_service.py b/google/cloud/container_v1/types/cluster_service.py index 52d7de75..dbfc2b32 100644 --- a/google/cloud/container_v1/types/cluster_service.py +++ b/google/cloud/container_v1/types/cluster_service.py @@ -72,6 +72,7 @@ "PodCIDROverprovisionConfig", "IPAllocationPolicy", "Cluster", + "K8sBetaAPIConfig", "NodePoolAutoConfig", "NodePoolDefaults", "NodeConfigDefaults", @@ -106,6 +107,7 @@ "BlueGreenSettings", "NodePool", "NodeManagement", + "BestEffortProvisioning", "AutoUpgradeOptions", "MaintenancePolicy", "MaintenanceWindow", @@ -140,6 +142,9 @@ "GetJSONWebKeysRequest", "Jwk", "GetJSONWebKeysResponse", + "CheckAutopilotCompatibilityRequest", + "AutopilotCompatibilityIssue", + "CheckAutopilotCompatibilityResponse", "ReleaseChannel", "CostManagementConfig", "IntraNodeVisibilityConfig", @@ -2500,6 +2505,8 @@ class Cluster(proto.Message): up-to-date value before proceeding. fleet (google.cloud.container_v1.types.Fleet): Fleet information for the cluster. + enable_k8s_beta_apis (google.cloud.container_v1.types.K8sBetaAPIConfig): + Beta APIs Config """ class Status(proto.Enum): @@ -2831,6 +2838,25 @@ class Status(proto.Enum): number=140, message="Fleet", ) + enable_k8s_beta_apis: "K8sBetaAPIConfig" = proto.Field( + proto.MESSAGE, + number=143, + message="K8sBetaAPIConfig", + ) + + +class K8sBetaAPIConfig(proto.Message): + r"""K8sBetaAPIConfig , configuration for beta APIs + + Attributes: + enabled_apis (MutableSequence[str]): + Enabled k8s beta APIs. + """ + + enabled_apis: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) class NodePoolAutoConfig(proto.Message): @@ -3088,6 +3114,16 @@ class ClusterUpdate(proto.Message): cluster. The pod ranges specified here must have been specified earlier in the 'additional_pod_ranges_config' argument. + enable_k8s_beta_apis (google.cloud.container_v1.types.K8sBetaAPIConfig): + Kubernetes open source beta apis enabled on + the cluster. Only beta apis + desired_enable_fqdn_network_policy (bool): + Enable/Disable FQDN Network Policy for the + cluster. + + This field is a member of `oneof`_ ``_desired_enable_fqdn_network_policy``. + desired_k8s_beta_apis (google.cloud.container_v1.types.K8sBetaAPIConfig): + Desired Beta APIs to be enabled for cluster. """ desired_node_version: str = proto.Field( @@ -3299,6 +3335,21 @@ class ClusterUpdate(proto.Message): number=121, message="AdditionalPodRangesConfig", ) + enable_k8s_beta_apis: "K8sBetaAPIConfig" = proto.Field( + proto.MESSAGE, + number=122, + message="K8sBetaAPIConfig", + ) + desired_enable_fqdn_network_policy: bool = proto.Field( + proto.BOOL, + number=126, + optional=True, + ) + desired_k8s_beta_apis: "K8sBetaAPIConfig" = proto.Field( + proto.MESSAGE, + number=131, + message="K8sBetaAPIConfig", + ) class AdditionalPodRangesConfig(proto.Message): @@ -5204,6 +5255,8 @@ class NodePool(proto.Message): 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. + best_effort_provisioning (google.cloud.container_v1.types.BestEffortProvisioning): + Enable best effort provisioning for nodes """ class Status(proto.Enum): @@ -5549,6 +5602,11 @@ class Type(proto.Enum): proto.STRING, number=110, ) + best_effort_provisioning: "BestEffortProvisioning" = proto.Field( + proto.MESSAGE, + number=113, + message="BestEffortProvisioning", + ) class NodeManagement(proto.Message): @@ -5589,6 +5647,34 @@ class NodeManagement(proto.Message): ) +class BestEffortProvisioning(proto.Message): + r"""Best effort provisioning. + + Attributes: + enabled (bool): + When this is enabled, cluster/node pool + creations will ignore non-fatal errors like + stockout to best provision as many nodes as + possible right now and eventually bring up all + target number of nodes + min_provision_nodes (int): + Minimum number of nodes to be provisioned to + be considered as succeeded, and the rest of + nodes will be provisioned gradually and + eventually when stockout issue has been + resolved. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + min_provision_nodes: int = proto.Field( + proto.INT32, + number=2, + ) + + class AutoUpgradeOptions(proto.Message): r"""AutoUpgradeOptions defines the set of options for the user to control how the Auto Upgrades will proceed. @@ -6845,6 +6931,9 @@ class NetworkConfig(proto.Message): r"""NetworkConfig reports the relative names of network & subnetwork. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: network (str): Output only. The relative name of the Google Compute Engine @@ -6888,6 +6977,11 @@ class NetworkConfig(proto.Message): gateway_api_config (google.cloud.container_v1.types.GatewayAPIConfig): GatewayAPIConfig contains the desired config of Gateway API on this cluster. + enable_fqdn_network_policy (bool): + Whether FQDN Network Policy is enabled on + this cluster. + + This field is a member of `oneof`_ ``_enable_fqdn_network_policy``. """ network: str = proto.Field( @@ -6936,6 +7030,11 @@ class NetworkConfig(proto.Message): number=16, message="GatewayAPIConfig", ) + enable_fqdn_network_policy: bool = proto.Field( + proto.BOOL, + number=19, + optional=True, + ) class GatewayAPIConfig(proto.Message): @@ -7159,6 +7258,119 @@ class GetJSONWebKeysResponse(proto.Message): ) +class CheckAutopilotCompatibilityRequest(proto.Message): + r"""CheckAutopilotCompatibilityRequest requests getting the + blockers for the given operation in the cluster. + + Attributes: + name (str): + The name (project, location, cluster) of the cluster to + retrieve. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class AutopilotCompatibilityIssue(proto.Message): + r"""AutopilotCompatibilityIssue contains information about a + specific compatibility issue with Autopilot mode. + + Attributes: + last_observation (google.protobuf.timestamp_pb2.Timestamp): + The last time when this issue was observed. + constraint_type (str): + The constraint type of the issue. + incompatibility_type (google.cloud.container_v1.types.AutopilotCompatibilityIssue.IssueType): + The incompatibility type of this issue. + subjects (MutableSequence[str]): + The name of the resources which are subject + to this issue. + documentation_url (str): + A URL to a public documnetation, which + addresses resolving this issue. + description (str): + The description of the issue. + """ + + class IssueType(proto.Enum): + r"""The type of the reported issue. + + Values: + UNSPECIFIED (0): + Default value, should not be used. + INCOMPATIBILITY (1): + Indicates that the issue is a known + incompatibility between the cluster and + Autopilot mode. + ADDITIONAL_CONFIG_REQUIRED (2): + Indicates the issue is an incompatibility if + customers take no further action to resolve. + PASSED_WITH_OPTIONAL_CONFIG (3): + Indicates the issue is not an + incompatibility, but depending on the workloads + business logic, there is a potential that they + won't work on Autopilot. + """ + UNSPECIFIED = 0 + INCOMPATIBILITY = 1 + ADDITIONAL_CONFIG_REQUIRED = 2 + PASSED_WITH_OPTIONAL_CONFIG = 3 + + last_observation: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + constraint_type: str = proto.Field( + proto.STRING, + number=2, + ) + incompatibility_type: IssueType = proto.Field( + proto.ENUM, + number=3, + enum=IssueType, + ) + subjects: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + documentation_url: str = proto.Field( + proto.STRING, + number=5, + ) + description: str = proto.Field( + proto.STRING, + number=6, + ) + + +class CheckAutopilotCompatibilityResponse(proto.Message): + r"""CheckAutopilotCompatibilityResponse has a list of + compatibility issues. + + Attributes: + issues (MutableSequence[google.cloud.container_v1.types.AutopilotCompatibilityIssue]): + The list of issues for the given operation. + summary (str): + The summary of the autopilot compatibility + response. + """ + + issues: MutableSequence["AutopilotCompatibilityIssue"] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="AutopilotCompatibilityIssue", + ) + summary: str = proto.Field( + proto.STRING, + number=2, + ) + + class ReleaseChannel(proto.Message): r"""ReleaseChannel indicates which release channel a cluster is subscribed to. Release channels are arranged in order of risk. diff --git a/google/cloud/container_v1beta1/__init__.py b/google/cloud/container_v1beta1/__init__.py index b1804d1b..72bc8cbf 100644 --- a/google/cloud/container_v1beta1/__init__.py +++ b/google/cloud/container_v1beta1/__init__.py @@ -26,11 +26,15 @@ AdvancedMachineFeatures, AuthenticatorGroupsConfig, Autopilot, + AutopilotCompatibilityIssue, AutoprovisioningNodePoolDefaults, AutoUpgradeOptions, + BestEffortProvisioning, BinaryAuthorization, BlueGreenSettings, CancelOperationRequest, + CheckAutopilotCompatibilityRequest, + CheckAutopilotCompatibilityResponse, ClientCertificateConfig, CloudRunConfig, Cluster, @@ -79,6 +83,7 @@ IPAllocationPolicy, IstioConfig, Jwk, + K8sBetaAPIConfig, KalmConfig, KubernetesDashboard, LegacyAbac, @@ -195,10 +200,14 @@ "AuthenticatorGroupsConfig", "AutoUpgradeOptions", "Autopilot", + "AutopilotCompatibilityIssue", "AutoprovisioningNodePoolDefaults", + "BestEffortProvisioning", "BinaryAuthorization", "BlueGreenSettings", "CancelOperationRequest", + "CheckAutopilotCompatibilityRequest", + "CheckAutopilotCompatibilityResponse", "ClientCertificateConfig", "CloudRunConfig", "Cluster", @@ -248,6 +257,7 @@ "IntraNodeVisibilityConfig", "IstioConfig", "Jwk", + "K8sBetaAPIConfig", "KalmConfig", "KubernetesDashboard", "LegacyAbac", diff --git a/google/cloud/container_v1beta1/gapic_metadata.json b/google/cloud/container_v1beta1/gapic_metadata.json index 4e429961..b925b821 100644 --- a/google/cloud/container_v1beta1/gapic_metadata.json +++ b/google/cloud/container_v1beta1/gapic_metadata.json @@ -15,6 +15,11 @@ "cancel_operation" ] }, + "CheckAutopilotCompatibility": { + "methods": [ + "check_autopilot_compatibility" + ] + }, "CompleteIPRotation": { "methods": [ "complete_ip_rotation" @@ -190,6 +195,11 @@ "cancel_operation" ] }, + "CheckAutopilotCompatibility": { + "methods": [ + "check_autopilot_compatibility" + ] + }, "CompleteIPRotation": { "methods": [ "complete_ip_rotation" 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 9dbec8e6..54d77f71 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/async_client.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/async_client.py @@ -4687,6 +4687,89 @@ async def sample_list_usable_subnetworks(): # Done; return the response. return response + async def check_autopilot_compatibility( + self, + request: Optional[ + Union[cluster_service.CheckAutopilotCompatibilityRequest, dict] + ] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cluster_service.CheckAutopilotCompatibilityResponse: + r"""Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import container_v1beta1 + + async def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = await client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityRequest, dict]]): + The request object. CheckAutopilotCompatibilityRequest + requests getting the blockers for the + given operation in the cluster. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityResponse: + CheckAutopilotCompatibilityResponse + has a list of compatibility issues. + + """ + # Create or coerce a protobuf request object. + request = cluster_service.CheckAutopilotCompatibilityRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.check_autopilot_compatibility, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + async def list_locations( self, request: Optional[Union[cluster_service.ListLocationsRequest, dict]] = None, diff --git a/google/cloud/container_v1beta1/services/cluster_manager/client.py b/google/cloud/container_v1beta1/services/cluster_manager/client.py index 487d52fd..14d00ae5 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/client.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/client.py @@ -4820,6 +4820,92 @@ def sample_list_usable_subnetworks(): # Done; return the response. return response + def check_autopilot_compatibility( + self, + request: Optional[ + Union[cluster_service.CheckAutopilotCompatibilityRequest, dict] + ] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cluster_service.CheckAutopilotCompatibilityResponse: + r"""Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import container_v1beta1 + + def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityRequest, dict]): + The request object. CheckAutopilotCompatibilityRequest + requests getting the blockers for the + given operation in the cluster. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityResponse: + CheckAutopilotCompatibilityResponse + has a list of compatibility issues. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a cluster_service.CheckAutopilotCompatibilityRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cluster_service.CheckAutopilotCompatibilityRequest): + request = cluster_service.CheckAutopilotCompatibilityRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.check_autopilot_compatibility + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + def list_locations( self, request: Optional[Union[cluster_service.ListLocationsRequest, dict]] = None, 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 f705f455..075e0def 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py @@ -388,6 +388,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=20.0, client_info=client_info, ), + self.check_autopilot_compatibility: gapic_v1.method.wrap_method( + self.check_autopilot_compatibility, + default_timeout=None, + client_info=client_info, + ), self.list_locations: gapic_v1.method.wrap_method( self.list_locations, default_retry=retries.Retry( @@ -726,6 +731,18 @@ def list_usable_subnetworks( ]: raise NotImplementedError() + @property + def check_autopilot_compatibility( + self, + ) -> Callable[ + [cluster_service.CheckAutopilotCompatibilityRequest], + Union[ + cluster_service.CheckAutopilotCompatibilityResponse, + Awaitable[cluster_service.CheckAutopilotCompatibilityResponse], + ], + ]: + raise NotImplementedError() + @property def list_locations( self, 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 992ef6af..78d54c20 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py @@ -1156,6 +1156,38 @@ def list_usable_subnetworks( ) return self._stubs["list_usable_subnetworks"] + @property + def check_autopilot_compatibility( + self, + ) -> Callable[ + [cluster_service.CheckAutopilotCompatibilityRequest], + cluster_service.CheckAutopilotCompatibilityResponse, + ]: + r"""Return a callable for the check autopilot compatibility method over gRPC. + + Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + Returns: + Callable[[~.CheckAutopilotCompatibilityRequest], + ~.CheckAutopilotCompatibilityResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "check_autopilot_compatibility" not in self._stubs: + self._stubs[ + "check_autopilot_compatibility" + ] = self.grpc_channel.unary_unary( + "/google.container.v1beta1.ClusterManager/CheckAutopilotCompatibility", + request_serializer=cluster_service.CheckAutopilotCompatibilityRequest.serialize, + response_deserializer=cluster_service.CheckAutopilotCompatibilityResponse.deserialize, + ) + return self._stubs["check_autopilot_compatibility"] + @property def list_locations( self, 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 7613064d..13d4a748 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 @@ -1208,6 +1208,38 @@ def list_usable_subnetworks( ) return self._stubs["list_usable_subnetworks"] + @property + def check_autopilot_compatibility( + self, + ) -> Callable[ + [cluster_service.CheckAutopilotCompatibilityRequest], + Awaitable[cluster_service.CheckAutopilotCompatibilityResponse], + ]: + r"""Return a callable for the check autopilot compatibility method over gRPC. + + Checks the cluster compatibility with Autopilot mode, + and returns a list of compatibility issues. + + Returns: + Callable[[~.CheckAutopilotCompatibilityRequest], + Awaitable[~.CheckAutopilotCompatibilityResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "check_autopilot_compatibility" not in self._stubs: + self._stubs[ + "check_autopilot_compatibility" + ] = self.grpc_channel.unary_unary( + "/google.container.v1beta1.ClusterManager/CheckAutopilotCompatibility", + request_serializer=cluster_service.CheckAutopilotCompatibilityRequest.serialize, + response_deserializer=cluster_service.CheckAutopilotCompatibilityResponse.deserialize, + ) + return self._stubs["check_autopilot_compatibility"] + @property def list_locations( self, diff --git a/google/cloud/container_v1beta1/types/__init__.py b/google/cloud/container_v1beta1/types/__init__.py index 5c999336..71a85c79 100644 --- a/google/cloud/container_v1beta1/types/__init__.py +++ b/google/cloud/container_v1beta1/types/__init__.py @@ -20,11 +20,15 @@ AdvancedMachineFeatures, AuthenticatorGroupsConfig, Autopilot, + AutopilotCompatibilityIssue, AutoprovisioningNodePoolDefaults, AutoUpgradeOptions, + BestEffortProvisioning, BinaryAuthorization, BlueGreenSettings, CancelOperationRequest, + CheckAutopilotCompatibilityRequest, + CheckAutopilotCompatibilityResponse, ClientCertificateConfig, CloudRunConfig, Cluster, @@ -73,6 +77,7 @@ IPAllocationPolicy, IstioConfig, Jwk, + K8sBetaAPIConfig, KalmConfig, KubernetesDashboard, LegacyAbac, @@ -187,11 +192,15 @@ "AdvancedMachineFeatures", "AuthenticatorGroupsConfig", "Autopilot", + "AutopilotCompatibilityIssue", "AutoprovisioningNodePoolDefaults", "AutoUpgradeOptions", + "BestEffortProvisioning", "BinaryAuthorization", "BlueGreenSettings", "CancelOperationRequest", + "CheckAutopilotCompatibilityRequest", + "CheckAutopilotCompatibilityResponse", "ClientCertificateConfig", "CloudRunConfig", "Cluster", @@ -239,6 +248,7 @@ "IPAllocationPolicy", "IstioConfig", "Jwk", + "K8sBetaAPIConfig", "KalmConfig", "KubernetesDashboard", "LegacyAbac", diff --git a/google/cloud/container_v1beta1/types/cluster_service.py b/google/cloud/container_v1beta1/types/cluster_service.py index 76610a83..8c2cb0c4 100644 --- a/google/cloud/container_v1beta1/types/cluster_service.py +++ b/google/cloud/container_v1beta1/types/cluster_service.py @@ -80,6 +80,7 @@ "AuthenticatorGroupsConfig", "ClusterTelemetry", "Cluster", + "K8sBetaAPIConfig", "WorkloadConfig", "ProtectConfig", "NodePoolDefaults", @@ -109,6 +110,7 @@ "ListOperationsResponse", "GetServerConfigRequest", "ServerConfig", + "BestEffortProvisioning", "WindowsVersions", "CreateNodePoolRequest", "DeleteNodePoolRequest", @@ -174,6 +176,9 @@ "GetJSONWebKeysRequest", "Jwk", "GetJSONWebKeysResponse", + "CheckAutopilotCompatibilityRequest", + "AutopilotCompatibilityIssue", + "CheckAutopilotCompatibilityResponse", "ReleaseChannel", "CostManagementConfig", "TpuConfig", @@ -2595,6 +2600,9 @@ class Cluster(proto.Message): master/node upgrades are disabled. Alpha enabled clusters are automatically deleted thirty days after creation. + enable_k8s_beta_apis (google.cloud.container_v1beta1.types.K8sBetaAPIConfig): + Kubernetes open source beta apis enabled on + the cluster. Only beta apis. resource_labels (MutableMapping[str, str]): The resource labels for the cluster to use to annotate any related Google Compute Engine @@ -2917,6 +2925,11 @@ class Status(proto.Enum): proto.BOOL, number=14, ) + enable_k8s_beta_apis: "K8sBetaAPIConfig" = proto.Field( + proto.MESSAGE, + number=143, + message="K8sBetaAPIConfig", + ) resource_labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, @@ -3195,6 +3208,21 @@ class Status(proto.Enum): ) +class K8sBetaAPIConfig(proto.Message): + r"""Kubernetes open source beta apis enabled on the cluster. + + Attributes: + enabled_apis (MutableSequence[str]): + api name, e.g. + storage.k8s.io/v1beta1/csistoragecapacities. + """ + + enabled_apis: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + + class WorkloadConfig(proto.Message): r"""WorkloadConfig defines the flags to enable or disable the workload configurations for the cluster. @@ -3576,6 +3604,16 @@ class ClusterUpdate(proto.Message): cluster. The pod ranges specified here must have been specified earlier in the 'additional_pod_ranges_config' argument. + enable_k8s_beta_apis (google.cloud.container_v1beta1.types.K8sBetaAPIConfig): + Kubernetes open source beta apis enabled on + the cluster. Only beta apis + desired_enable_fqdn_network_policy (bool): + Enable/Disable FQDN Network Policy for the + cluster. + + This field is a member of `oneof`_ ``_desired_enable_fqdn_network_policy``. + desired_k8s_beta_apis (google.cloud.container_v1beta1.types.K8sBetaAPIConfig): + Beta APIs enabled for cluster. """ desired_node_version: str = proto.Field( @@ -3823,6 +3861,21 @@ class ClusterUpdate(proto.Message): number=121, message="AdditionalPodRangesConfig", ) + enable_k8s_beta_apis: "K8sBetaAPIConfig" = proto.Field( + proto.MESSAGE, + number=122, + message="K8sBetaAPIConfig", + ) + desired_enable_fqdn_network_policy: bool = proto.Field( + proto.BOOL, + number=126, + optional=True, + ) + desired_k8s_beta_apis: "K8sBetaAPIConfig" = proto.Field( + proto.MESSAGE, + number=131, + message="K8sBetaAPIConfig", + ) class AdditionalPodRangesConfig(proto.Message): @@ -5411,6 +5464,34 @@ class AvailableVersion(proto.Message): ) +class BestEffortProvisioning(proto.Message): + r"""Best effort provisioning. + + Attributes: + enabled (bool): + When this is enabled, cluster/node pool + creations will ignore non-fatal errors like + stockout to best provision as many nodes as + possible right now and eventually bring up all + target number of nodes + min_provision_nodes (int): + Minimum number of nodes to be provisioned to + be considered as succeeded, and the rest of + nodes will be provisioned gradually and + eventually when stockout issue has been + resolved. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + ) + min_provision_nodes: int = proto.Field( + proto.INT32, + number=2, + ) + + class WindowsVersions(proto.Message): r"""Windows server versions. @@ -5829,6 +5910,8 @@ class NodePool(proto.Message): 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. + best_effort_provisioning (google.cloud.container_v1beta1.types.BestEffortProvisioning): + Enable best effort provisioning for nodes """ class Status(proto.Enum): @@ -6150,6 +6233,11 @@ class Type(proto.Enum): proto.STRING, number=110, ) + best_effort_provisioning: "BestEffortProvisioning" = proto.Field( + proto.MESSAGE, + number=113, + message="BestEffortProvisioning", + ) class NodeManagement(proto.Message): @@ -7615,6 +7703,9 @@ class NetworkConfig(proto.Message): r"""NetworkConfig reports the relative names of network & subnetwork. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: network (str): Output only. The relative name of the Google Compute Engine @@ -7658,6 +7749,11 @@ class NetworkConfig(proto.Message): gateway_api_config (google.cloud.container_v1beta1.types.GatewayAPIConfig): GatewayAPIConfig contains the desired config of Gateway API on this cluster. + enable_fqdn_network_policy (bool): + Whether FQDN Network Policy is enabled on + this cluster. + + This field is a member of `oneof`_ ``_enable_fqdn_network_policy``. """ network: str = proto.Field( @@ -7706,6 +7802,11 @@ class NetworkConfig(proto.Message): number=16, message="GatewayAPIConfig", ) + enable_fqdn_network_policy: bool = proto.Field( + proto.BOOL, + number=19, + optional=True, + ) class GatewayAPIConfig(proto.Message): @@ -8509,6 +8610,119 @@ class GetJSONWebKeysResponse(proto.Message): ) +class CheckAutopilotCompatibilityRequest(proto.Message): + r"""CheckAutopilotCompatibilityRequest requests getting the + blockers for the given operation in the cluster. + + Attributes: + name (str): + The name (project, location, cluster) of the cluster to + retrieve. Specified in the format + ``projects/*/locations/*/clusters/*``. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class AutopilotCompatibilityIssue(proto.Message): + r"""AutopilotCompatibilityIssue contains information about a + specific compatibility issue with Autopilot mode. + + Attributes: + last_observation (google.protobuf.timestamp_pb2.Timestamp): + The last time when this issue was observed. + constraint_type (str): + The constraint type of the issue. + incompatibility_type (google.cloud.container_v1beta1.types.AutopilotCompatibilityIssue.IssueType): + The incompatibility type of this issue. + subjects (MutableSequence[str]): + The name of the resources which are subject + to this issue. + documentation_url (str): + A URL to a public documnetation, which + addresses resolving this issue. + description (str): + The description of the issue. + """ + + class IssueType(proto.Enum): + r"""The type of the reported issue. + + Values: + UNSPECIFIED (0): + Default value, should not be used. + INCOMPATIBILITY (1): + Indicates that the issue is a known + incompatibility between the cluster and + Autopilot mode. + ADDITIONAL_CONFIG_REQUIRED (2): + Indicates the issue is an incompatibility if + customers take no further action to resolve. + PASSED_WITH_OPTIONAL_CONFIG (3): + Indicates the issue is not an + incompatibility, but depending on the workloads + business logic, there is a potential that they + won't work on Autopilot. + """ + UNSPECIFIED = 0 + INCOMPATIBILITY = 1 + ADDITIONAL_CONFIG_REQUIRED = 2 + PASSED_WITH_OPTIONAL_CONFIG = 3 + + last_observation: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + constraint_type: str = proto.Field( + proto.STRING, + number=2, + ) + incompatibility_type: IssueType = proto.Field( + proto.ENUM, + number=3, + enum=IssueType, + ) + subjects: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + documentation_url: str = proto.Field( + proto.STRING, + number=5, + ) + description: str = proto.Field( + proto.STRING, + number=6, + ) + + +class CheckAutopilotCompatibilityResponse(proto.Message): + r"""CheckAutopilotCompatibilityResponse has a list of + compatibility issues. + + Attributes: + issues (MutableSequence[google.cloud.container_v1beta1.types.AutopilotCompatibilityIssue]): + The list of issues for the given operation. + summary (str): + The summary of the autopilot compatibility + response. + """ + + issues: MutableSequence["AutopilotCompatibilityIssue"] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="AutopilotCompatibilityIssue", + ) + summary: str = proto.Field( + proto.STRING, + number=2, + ) + + class ReleaseChannel(proto.Message): r"""ReleaseChannel indicates which release channel a cluster is subscribed to. Release channels are arranged in order of risk. diff --git a/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py b/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py new file mode 100644 index 00000000..d459f738 --- /dev/null +++ b/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CheckAutopilotCompatibility +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-container + + +# [START container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import container_v1 + + +async def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = await client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async] diff --git a/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py b/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py new file mode 100644 index 00000000..db544a70 --- /dev/null +++ b/samples/generated_samples/container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CheckAutopilotCompatibility +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-container + + +# [START container_v1_generated_ClusterManager_CheckAutopilotCompatibility_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import container_v1 + + +def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + +# [END container_v1_generated_ClusterManager_CheckAutopilotCompatibility_sync] diff --git a/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py b/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py new file mode 100644 index 00000000..30da40c5 --- /dev/null +++ b/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CheckAutopilotCompatibility +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-container + + +# [START container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import container_v1beta1 + + +async def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = await client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async] diff --git a/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py b/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py new file mode 100644 index 00000000..89d43c28 --- /dev/null +++ b/samples/generated_samples/container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CheckAutopilotCompatibility +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-container + + +# [START container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import container_v1beta1 + + +def sample_check_autopilot_compatibility(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CheckAutopilotCompatibilityRequest( + ) + + # Make the request + response = client.check_autopilot_compatibility(request=request) + + # Handle the response + print(response) + +# [END container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_sync] diff --git a/samples/generated_samples/snippet_metadata_google.container.v1.json b/samples/generated_samples/snippet_metadata_google.container.v1.json index 35acfe2c..477de1ee 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.22.0" + "version": "0.1.0" }, "snippets": [ { @@ -190,6 +190,159 @@ ], "title": "container_v1_generated_cluster_manager_cancel_operation_sync.py" }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.check_autopilot_compatibility", + "method": { + "fullName": "google.container.v1.ClusterManager.CheckAutopilotCompatibility", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CheckAutopilotCompatibility" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CheckAutopilotCompatibilityRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.container_v1.types.CheckAutopilotCompatibilityResponse", + "shortName": "check_autopilot_compatibility" + }, + "description": "Sample for CheckAutopilotCompatibility", + "file": "container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CheckAutopilotCompatibility_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_check_autopilot_compatibility_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.check_autopilot_compatibility", + "method": { + "fullName": "google.container.v1.ClusterManager.CheckAutopilotCompatibility", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CheckAutopilotCompatibility" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CheckAutopilotCompatibilityRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.container_v1.types.CheckAutopilotCompatibilityResponse", + "shortName": "check_autopilot_compatibility" + }, + "description": "Sample for CheckAutopilotCompatibility", + "file": "container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CheckAutopilotCompatibility_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_check_autopilot_compatibility_sync.py" + }, { "canonical": true, "clientMethod": { diff --git a/samples/generated_samples/snippet_metadata_google.container.v1beta1.json b/samples/generated_samples/snippet_metadata_google.container.v1beta1.json index d94eac8d..afdb562b 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.22.0" + "version": "0.1.0" }, "snippets": [ { @@ -182,6 +182,159 @@ ], "title": "container_v1beta1_generated_cluster_manager_cancel_operation_sync.py" }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.check_autopilot_compatibility", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CheckAutopilotCompatibility", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CheckAutopilotCompatibility" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityResponse", + "shortName": "check_autopilot_compatibility" + }, + "description": "Sample for CheckAutopilotCompatibility", + "file": "container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.check_autopilot_compatibility", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CheckAutopilotCompatibility", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CheckAutopilotCompatibility" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.container_v1beta1.types.CheckAutopilotCompatibilityResponse", + "shortName": "check_autopilot_compatibility" + }, + "description": "Sample for CheckAutopilotCompatibility", + "file": "container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CheckAutopilotCompatibility_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_check_autopilot_compatibility_sync.py" + }, { "canonical": true, "clientMethod": { diff --git a/scripts/fixup_container_v1_keywords.py b/scripts/fixup_container_v1_keywords.py index 80b16377..2d51f43f 100644 --- a/scripts/fixup_container_v1_keywords.py +++ b/scripts/fixup_container_v1_keywords.py @@ -40,6 +40,7 @@ class containerCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { 'cancel_operation': ('project_id', 'zone', 'operation_id', 'name', ), + 'check_autopilot_compatibility': ('name', ), 'complete_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', ), 'complete_node_pool_upgrade': ('name', ), 'create_cluster': ('cluster', 'project_id', 'zone', 'parent', ), diff --git a/scripts/fixup_container_v1beta1_keywords.py b/scripts/fixup_container_v1beta1_keywords.py index 4284707b..17b1b0aa 100644 --- a/scripts/fixup_container_v1beta1_keywords.py +++ b/scripts/fixup_container_v1beta1_keywords.py @@ -40,6 +40,7 @@ class containerCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { 'cancel_operation': ('project_id', 'zone', 'operation_id', 'name', ), + 'check_autopilot_compatibility': ('name', ), 'complete_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', ), 'complete_node_pool_upgrade': ('name', ), 'create_cluster': ('project_id', 'zone', 'cluster', 'parent', ), diff --git a/tests/unit/gapic/container_v1/test_cluster_manager.py b/tests/unit/gapic/container_v1/test_cluster_manager.py index fce41dee..ab4d44fe 100644 --- a/tests/unit/gapic/container_v1/test_cluster_manager.py +++ b/tests/unit/gapic/container_v1/test_cluster_manager.py @@ -9931,6 +9931,167 @@ async def test_list_usable_subnetworks_async_pages(): assert page_.raw_page.next_page_token == token +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CheckAutopilotCompatibilityRequest, + dict, + ], +) +def test_check_autopilot_compatibility(request_type, transport: str = "grpc"): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.CheckAutopilotCompatibilityResponse( + summary="summary_value", + ) + response = client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CheckAutopilotCompatibilityRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) + assert response.summary == "summary_value" + + +def test_check_autopilot_compatibility_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), "__call__" + ) as call: + client.check_autopilot_compatibility() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CheckAutopilotCompatibilityRequest() + + +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_async( + transport: str = "grpc_asyncio", + request_type=cluster_service.CheckAutopilotCompatibilityRequest, +): + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cluster_service.CheckAutopilotCompatibilityResponse( + summary="summary_value", + ) + ) + response = await client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CheckAutopilotCompatibilityRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) + assert response.summary == "summary_value" + + +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_async_from_dict(): + await test_check_autopilot_compatibility_async(request_type=dict) + + +def test_check_autopilot_compatibility_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CheckAutopilotCompatibilityRequest() + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), "__call__" + ) as call: + call.return_value = cluster_service.CheckAutopilotCompatibilityResponse() + client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CheckAutopilotCompatibilityRequest() + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cluster_service.CheckAutopilotCompatibilityResponse() + ) + await client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ClusterManagerGrpcTransport( @@ -10101,6 +10262,7 @@ def test_cluster_manager_base_transport(): "set_network_policy", "set_maintenance_policy", "list_usable_subnetworks", + "check_autopilot_compatibility", ) for method in methods: with pytest.raises(NotImplementedError): diff --git a/tests/unit/gapic/container_v1beta1/test_cluster_manager.py b/tests/unit/gapic/container_v1beta1/test_cluster_manager.py index c299d152..014f8e8f 100644 --- a/tests/unit/gapic/container_v1beta1/test_cluster_manager.py +++ b/tests/unit/gapic/container_v1beta1/test_cluster_manager.py @@ -10043,6 +10043,167 @@ async def test_list_usable_subnetworks_async_pages(): assert page_.raw_page.next_page_token == token +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CheckAutopilotCompatibilityRequest, + dict, + ], +) +def test_check_autopilot_compatibility(request_type, transport: str = "grpc"): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cluster_service.CheckAutopilotCompatibilityResponse( + summary="summary_value", + ) + response = client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CheckAutopilotCompatibilityRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) + assert response.summary == "summary_value" + + +def test_check_autopilot_compatibility_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), "__call__" + ) as call: + client.check_autopilot_compatibility() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CheckAutopilotCompatibilityRequest() + + +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_async( + transport: str = "grpc_asyncio", + request_type=cluster_service.CheckAutopilotCompatibilityRequest, +): + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cluster_service.CheckAutopilotCompatibilityResponse( + summary="summary_value", + ) + ) + response = await client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CheckAutopilotCompatibilityRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cluster_service.CheckAutopilotCompatibilityResponse) + assert response.summary == "summary_value" + + +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_async_from_dict(): + await test_check_autopilot_compatibility_async(request_type=dict) + + +def test_check_autopilot_compatibility_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CheckAutopilotCompatibilityRequest() + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), "__call__" + ) as call: + call.return_value = cluster_service.CheckAutopilotCompatibilityResponse() + client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_check_autopilot_compatibility_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CheckAutopilotCompatibilityRequest() + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_autopilot_compatibility), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cluster_service.CheckAutopilotCompatibilityResponse() + ) + await client.check_autopilot_compatibility(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] + + @pytest.mark.parametrize( "request_type", [ @@ -10446,6 +10607,7 @@ def test_cluster_manager_base_transport(): "set_network_policy", "set_maintenance_policy", "list_usable_subnetworks", + "check_autopilot_compatibility", "list_locations", ) for method in methods: From 1008adab45a013d35bec909bc30d4fee5a3f2078 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 6 Jun 2023 10:36:03 -0400 Subject: [PATCH 3/3] chore(main): release 2.23.0 (#376) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ google/cloud/container/gapic_version.py | 2 +- google/cloud/container_v1/gapic_version.py | 2 +- google/cloud/container_v1beta1/gapic_version.py | 2 +- .../snippet_metadata_google.container.v1.json | 2 +- .../snippet_metadata_google.container.v1beta1.json | 2 +- 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8428ab92..20929136 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.22.0" + ".": "2.23.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index ed4f91d6..db820757 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ [1]: https://pypi.org/project/google-cloud-container/#history +## [2.23.0](https://github.com/googleapis/python-container/compare/v2.22.0...v2.23.0) (2023-06-06) + + +### Features + +* Add a API field to enable FQDN Network Policy on clusters ([52d1480](https://github.com/googleapis/python-container/commit/52d14803c65c06f65c1dcf7679faa9c6a0cca784)) +* Add CheckAutopilotCompatibility API to get autopilot compatibility issues for a given standard cluster ([52d1480](https://github.com/googleapis/python-container/commit/52d14803c65c06f65c1dcf7679faa9c6a0cca784)) +* Turn on public visibility for best effort provision ([52d1480](https://github.com/googleapis/python-container/commit/52d14803c65c06f65c1dcf7679faa9c6a0cca784)) + ## [2.22.0](https://github.com/googleapis/python-container/compare/v2.21.0...v2.22.0) (2023-06-01) diff --git a/google/cloud/container/gapic_version.py b/google/cloud/container/gapic_version.py index 03d6d020..f01e1d3a 100644 --- a/google/cloud/container/gapic_version.py +++ b/google/cloud/container/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.22.0" # {x-release-please-version} +__version__ = "2.23.0" # {x-release-please-version} diff --git a/google/cloud/container_v1/gapic_version.py b/google/cloud/container_v1/gapic_version.py index 03d6d020..f01e1d3a 100644 --- a/google/cloud/container_v1/gapic_version.py +++ b/google/cloud/container_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.22.0" # {x-release-please-version} +__version__ = "2.23.0" # {x-release-please-version} diff --git a/google/cloud/container_v1beta1/gapic_version.py b/google/cloud/container_v1beta1/gapic_version.py index 03d6d020..f01e1d3a 100644 --- a/google/cloud/container_v1beta1/gapic_version.py +++ b/google/cloud/container_v1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.22.0" # {x-release-please-version} +__version__ = "2.23.0" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.container.v1.json b/samples/generated_samples/snippet_metadata_google.container.v1.json index 477de1ee..7f5cc056 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": "0.1.0" + "version": "2.23.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 afdb562b..72d9ce16 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": "0.1.0" + "version": "2.23.0" }, "snippets": [ {