class_docstr: Hook for the Google Drive APIs.
  
  :param api_version: API version used (for example v3).
  :param gcp_conn_id: The connection ID to use when fetching connection info.
  :param delegate_to: The account to impersonate using domain-wide delegation of authority,
      if any. For this to work, the service account making the request must have
      domain-wide delegation enabled.
  :param impersonation_chain: Optional service account to impersonate using short-term
      credentials, or chained list of accounts required to get the access_token
      of the last account in the list, which will be impersonated in the request.
      If set as a string, the account must grant the originating account
      the Service Account Token Creator IAM role.
      If set as a sequence, the identities from the list must grant
      Service Account Token Creator IAM role to the directly preceding identity, with first
      account from the list granting this role to the originating account.
class_docstr_tok: ["Hook","for","the","Google","Drive","APIs",".",":","param","api_version",":","API","version","used","(","for","example","v3",")",".",":","param","gcp_conn_id",":","The","connection","ID","to","use","when","fetching","connection","info",".",":","param","delegate_to",":","The","account","to","impersonate","using","domain-wide","delegation","of","authority",",","if","any",".","For","this","to","work",",","the","service","account","making","the","request","must","have","domain-wide","delegation","enabled",".",":","param","impersonation_chain",":","Optional","service","account","to","impersonate","using","short-term","credentials",",","or","chained","list","of","accounts","required","to","get","the","access_token","of","the","last","account","in","the","list",",","which","will","be","impersonated","in","the","request",".","If","set","as","a","string",",","the","account","must","grant","the","originating","account","the","Service","Account","Token","Creator","IAM","role",".","If","set","as","a","sequence",",","the","identities","from","the","list","must","grant","Service","Account","Token","Creator","IAM","role","to","the","directly","preceding","identity",",","with","first","account","from","the","list","granting","this","role","to","the","originating","account","."]
docstr: Returns the file id of a Google Drive file.
  
  :param folder_id: The id of the Google Drive folder in which the file resides
  :param file_name: The name of a file in Google Drive
  :param drive_id: Optional. The id of the shared Google Drive in which the file resides.
  :param include_trashed: Whether to include objects in trash or not, default True as in Google API.
  
  :return: Google Drive file id if the file exists, otherwise None
docstr_tok: ["Returns","the","file","id","of","a","Google","Drive","file",".",":","param","folder_id",":","The","id","of","the","Google","Drive","folder","in","which","the","file","resides",":","param","file_name",":","The","name","of","a","file","in","Google","Drive",":","param","drive_id",":","Optional",".","The","id","of","the","shared","Google","Drive","in","which","the","file","resides",".",":","param","include_trashed",":","Whether","to","include","objects","in","trash","or","not",",","default","True","as","in","Google","API",".",":","return",":","Google","Drive","file","id","if","the","file","exists",",","otherwise","None"]
code: def get_file_id(
      self,
      folder_id: str,
      file_name: str,
      drive_id: str | None = None,
      *,
      include_trashed: bool = True,
  ) -> dict:
      """
      Returns the file id of a Google Drive file.
  
      :param folder_id: The id of the Google Drive folder in which the file resides
      :param file_name: The name of a file in Google Drive
      :param drive_id: Optional. The id of the shared Google Drive in which the file resides.
      :param include_trashed: Whether to include objects in trash or not, default True as in Google API.
  
      :return: Google Drive file id if the file exists, otherwise None
      """
      query = f"name = '{file_name}'"
      if folder_id:
          query += f" and parents in '{folder_id}'"
  
      if not include_trashed:
          query += " and trashed=false"
  
      service = self.get_conn()
      if drive_id:
          files = (
              service.files()
              .list(
                  q=query,
                  spaces="drive",
                  fields="files(id, mimeType)",
                  orderBy="modifiedTime desc",
                  driveId=drive_id,
                  includeItemsFromAllDrives=True,
                  supportsAllDrives=True,
                  corpora="drive",
              )
              .execute(num_retries=self.num_retries)
          )
      else:
          files = (
              service.files()
              .list(
                  q=query,
                  spaces="drive",
                  fields="files(id, mimeType)",
                  orderBy="modifiedTime desc",
              )
              .execute(num_retries=self.num_retries)
          )
      file_metadata = {}
      if files["files"]:
          file_metadata = {
              "id": files["files"][0]["id"],
              "mime_type": files["files"][0]["mimeType"],
          }
      return file_metadata
  
file_path: airflow/airflow/providers/google/suite/hooks/drive.py
imports: from __future__ import annotations
  from typing import IO, Any, Sequence
  from googleapiclient.discovery import Resource, build
  from googleapiclient.errors import Error
  from googleapiclient.http import HttpRequest, MediaFileUpload
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
label_desc: Use image node_id 8 for calling the GoogleDriveHook obj's underlying member method code with example usage: obj.get_file_id(folder_id, file_name, drive_id) and returns: file_metadata