class_docstr: Google Kubernetes Engine cluster APIs.
  
  All the methods in the hook where project_id is used must be called with
  keyword arguments rather than positional.
class_docstr_tok: ["Google","Kubernetes","Engine","cluster","APIs",".","All","the","methods","in","the","hook","where","project_id","is","used","must","be","called","with","keyword","arguments","rather","than","positional","."]
docstr: Continuously fetch the status from Google Cloud.
  
  This is done until the given operation completes, or raises an error.
  
  :param operation: The Operation to wait for.
  :param project_id: Google Cloud project ID.
  :return: A new, updated operation fetched from Google Cloud.
docstr_tok: ["Continuously","fetch","the","status","from","Google","Cloud",".","This","is","done","until","the","given","operation","completes",",","or","raises","an","error",".",":","param","operation",":","The","Operation","to","wait","for",".",":","param","project_id",":","Google","Cloud","project","ID",".",":","return",":","A","new",",","updated","operation","fetched","from","Google","Cloud","."]
code: def wait_for_operation(
      self, operation: Operation, project_id: str | None = None
  ) -> Operation:
      """Continuously fetch the status from Google Cloud.
  
      This is done until the given operation completes, or raises an error.
  
      :param operation: The Operation to wait for.
      :param project_id: Google Cloud project ID.
      :return: A new, updated operation fetched from Google Cloud.
      """
      self.log.info("Waiting for OPERATION_NAME %s", operation.name)
      time.sleep(OPERATIONAL_POLL_INTERVAL)
      while operation.status != Operation.Status.DONE:
          if operation.status in (
              Operation.Status.RUNNING,
              Operation.Status.PENDING,
          ):
              time.sleep(OPERATIONAL_POLL_INTERVAL)
          else:
              raise exceptions.GoogleCloudError(
                  f"Operation has failed with status: {operation.status}"
              )
          # To update status of operation
          operation = self.get_operation(
              operation.name, project_id=project_id or self.project_id
          )
      return operation
  
imports: from __future__ import annotations
  import contextlib
  import json
  import time
  import warnings
  from functools import cached_property
  from typing import TYPE_CHECKING, Sequence
  from gcloud.aio.auth import Token
  from google.api_core.exceptions import NotFound
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
  from google.auth.transport import requests
  from google.cloud import container_v1, exceptions
  from google.cloud.container_v1 import ClusterManagerAsyncClient, ClusterManagerClient
  from google.cloud.container_v1.types import Cluster, Operation
  from kubernetes import client
  from kubernetes_asyncio import client
  from kubernetes_asyncio.config.kube_config import FileOrData
  from urllib3.exceptions import HTTPError
  from airflow import version
  from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
  from airflow.providers.cncf.kubernetes.utils.pod_manager import PodOperatorHookProtocol
  from airflow.providers.google.common.consts import CLIENT_INFO
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseAsyncHook, GoogleBaseHook
label_desc: Use image node_id 5 for calling the GKEHook obj's underlying member method code with example usage: obj.wait_for_operation(operation, project_id) and returns: operation