  def AttachDisk(
      self, disk: Union['GoogleComputeDisk', 'GoogleRegionComputeDisk'],
      read_write: bool = False) -> None:
    """Attach a disk to the virtual machine.

    Args:
      disk: Disk to attach.
      read_write: Boolean indicating whether the disk should
          be attached in RW mode. Default is False (read-only).
    """

    mode = 'READ_ONLY'  # Default mode
    if read_write:
      mode = 'READ_WRITE'

    logger.info(
        self.FormatLogMessage(
            'Attaching {0:s} to VM {1:s} in {2:s} mode'.format(
                disk.name, self.name, mode)))

    operation_config = {
        'mode': mode,
        'source': disk.GetSourceString(),
        'deviceName': disk.name,
        'boot': False,
        'autoDelete': False,
    }
    gce_instance_client = self.GceApi().instances() # pylint: disable=no-member
    request = gce_instance_client.attachDisk(
        instance=self.name,
        project=self.project_id,
        zone=self.zone,
        body=operation_config)
    response = request.execute()
    self.BlockOperation(response, zone=self.zone)
Attach a disk to the virtual machine.

Args:
disk: Disk to attach.
read_write: Boolean indicating whether the disk should
be attached in RW mode. Default is False (read-only).
libcloudforensics/providers/gcp/internal/compute.py