class_docstr: Use the Google Cloud connection to interact with Google Cloud Storage.
class_docstr_tok: ["Use","the","Google","Cloud","connection","to","interact","with","Google","Cloud","Storage","."]
docstr: Copies an object from a bucket to another, with renaming if requested.
  
  destination_bucket or destination_object can be omitted, in which case
  source bucket/object is used, but not both.
  
  :param source_bucket: The bucket of the object to copy from.
  :param source_object: The object to copy.
  :param destination_bucket: The destination of the object to copied to.
      Can be omitted; then the same bucket is used.
  :param destination_object: The (renamed) path of the object if given.
      Can be omitted; then the same name is used.
docstr_tok: ["Copies","an","object","from","a","bucket","to","another",",","with","renaming","if","requested",".","destination_bucket","or","destination_object","can","be","omitted",",","in","which","case","source","bucket\/object","is","used",",","but","not","both",".",":","param","source_bucket",":","The","bucket","of","the","object","to","copy","from",".",":","param","source_object",":","The","object","to","copy",".",":","param","destination_bucket",":","The","destination","of","the","object","to","copied","to",".","Can","be","omitted",";","then","the","same","bucket","is","used",".",":","param","destination_object",":","The","(","renamed",")","path","of","the","object","if","given",".","Can","be","omitted",";","then","the","same","name","is","used","."]
code: def copy(
      self,
      source_bucket: str,
      source_object: str,
      destination_bucket: str | None = None,
      destination_object: str | None = None,
  ) -> None:
      """
      Copies an object from a bucket to another, with renaming if requested.
  
      destination_bucket or destination_object can be omitted, in which case
      source bucket/object is used, but not both.
  
      :param source_bucket: The bucket of the object to copy from.
      :param source_object: The object to copy.
      :param destination_bucket: The destination of the object to copied to.
          Can be omitted; then the same bucket is used.
      :param destination_object: The (renamed) path of the object if given.
          Can be omitted; then the same name is used.
      """
      destination_bucket = destination_bucket or source_bucket
      destination_object = destination_object or source_object
  
      if (
          source_bucket == destination_bucket
          and source_object == destination_object
      ):
          raise ValueError(
              f"Either source/destination bucket or source/destination object must be different, "
              f"not both the same: bucket={source_bucket}, object={source_object}"
          )
      if not source_bucket or not source_object:
          raise ValueError(
              "source_bucket and source_object cannot be empty."
          )
  
      client = self.get_conn()
      source_bucket = client.bucket(source_bucket)
      source_object = source_bucket.blob(source_object)  # type: ignore[attr-defined]
      destination_bucket = client.bucket(destination_bucket)
      destination_object = source_bucket.copy_blob(  # type: ignore[attr-defined]
          blob=source_object,
          destination_bucket=destination_bucket,
          new_name=destination_object,
      )
  
      self.log.info(
          "Object %s in bucket %s copied to object %s in bucket %s",
          source_object.name,  # type: ignore[attr-defined]
          source_bucket.name,  # type: ignore[attr-defined]
          destination_object.name,  # type: ignore[union-attr]
          destination_bucket.name,  # type: ignore[union-attr]
      )
  
imports: from __future__ import annotations
  import functools
  import gzip
  import json
  import os
  import shutil
  import time
  import warnings
  from contextlib import contextmanager
  from functools import partial
  from io import BytesIO
  from tempfile import NamedTemporaryFile
  from typing import IO, TYPE_CHECKING, Any, Callable, Generator, Sequence, TypeVar, cast, overload
  from urllib.parse import urlsplit
  from gcloud.aio.storage import Storage
  from google.api_core.exceptions import GoogleAPICallError, NotFound
  from google.cloud import storage
  from google.cloud.exceptions import GoogleCloudError
  from google.cloud.storage.retry import DEFAULT_RETRY
  from requests import Session
  from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
  from airflow.providers.google.cloud.utils.helpers import normalize_directory_path
  from airflow.providers.google.common.consts import CLIENT_INFO
  from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
  from airflow.typing_compat import ParamSpec
  from airflow.utils import timezone
  from airflow.version import version
label_desc: Use image node_id 3 for calling the GCSHook obj's underlying member method code with example usage: obj.copy(source_bucket, source_object, destination_bucket, destination_object) without return types