  def CreateInstanceFromArguments(  #pylint: disable=too-many-arguments
      self,
      instance_name: str,
      machine_type: str,
      zone: Optional[str] = None,
      boot_disk: Optional['GoogleComputeDisk'] = None,
      boot_disk_type: str = 'pd-standard',
      boot_disk_size: int = 10,
      boot_image_project: str = 'debian-cloud',
      boot_image_family: str = 'debian-10',
      additional_scopes: Optional[List[str]] = None,
      sa_email: Optional[str] = common.DEFAULT_SA_EMAIL,
      metadata: Optional[Dict[str, str]] = None,
      data_disks: Optional[
          List[Union['GoogleComputeDisk',
          'GoogleRegionComputeDisk']]] = None,
      network_name: str = 'default',
      external_ip: bool = True,
      owner_label: bool = True
  ) -> 'GoogleComputeInstance':
    """Create a compute instance.

    If boot_disk is None then a boot disk need to be created using the
    'boot_disk_size', 'cpu_cores', 'image_project' and 'image_family parameters'.

    Args:
      instance_name: Name of the compute instance
      machine_type: A string, name of the machine type.
      zone: Compute zone to start the instance in, default is self.default_zone.
      boot_disk: Boot disk name.
      boot_disk_type: represents persistent disk types, default "pd-standard".
      boot_disk_size: boot disk size in base-2 GB. If you specify a sourceImage,
          which is required for boot disks, the default size is the size
          of the sourceImage, else default is 10 GB.
      boot_image_project: Name of the project where the boot disk image is stored.
      boot_image_family: Name of the image to use to create the boot disk.
      additional_scopes: additional scopes to be provided to the instance. Default
          scopes https://cloud.google.com/compute/docs/access/service-accounts#associating_a_service_account_to_an_instance  # pylint: disable=line-too-long
      sa_email: Service account email in case default service account is not used.
      metadata: A dictionary mapping metadata keys and values.
      data_disks: List of disks to attach to the instance, default mode is READ_ONLY.
      network_name: Name of the VPC network to use, "default" network is default.
      external_ip: True if the instance should have an external IP.
      owner_label: True if the instance should have an owner label.

    Returns:
      Compute instance object.

    Raises:
      ResourceNotFoundError: If boot disk is not found.
      OperationFailedError: If Get operation on boot disk failed.
    """
    compute_zone = zone if zone else self.default_zone
    request_body = {}  # type: Dict[str, Any]
    request_body['name'] = instance_name
    request_body['machineType'] = self.GetMachineTypes(
        machine_type, compute_zone)['selfLink']
    disks = []
    disk_type_resource = self.GetDiskTypes(boot_disk_type, compute_zone)
    image = self.GetImageFamily(boot_image_family, boot_image_project)
    if boot_disk:
      try:
        boot_disk_api_res = boot_disk.GetOperation()
      except HttpError as e:
        if e.resp.status == 404:
          msg = (
              'No compute disk {0:s} found in project {1:s} in zone '
              '{2:s}').format(boot_disk.name, self.project_id, zone)
          raise errors.ResourceNotFoundError(msg, __name__) from e
        raise errors.OperationFailedError(
            'Error while getting {0:s}'.format(boot_disk.name), __name__) from e
      boot_disk_resource = {
          'autoDelete': False,
          'boot': True,
          'deviceName': boot_disk_api_res['name'],
          'mode': 'READ_WRITE',
          'source': boot_disk_api_res['selfLink']
      }
    else:
      boot_disk_resource = {
          'boot': True,
          'autoDelete': True,
          'initializeParams': {
              'diskType': disk_type_resource['selfLink'],
              'sourceImage': image['selfLink'],
              'diskSizeGb': boot_disk_size
          }
      }
    disks.append(boot_disk_resource)
    for disk in data_disks or []:
      disk_api_res = disk.GetOperation()
      disks.append({
          'autoDelete': False,
          'boot': False,
          'deviceName': disk.name,
          'interface': 'SCSI',
          'mode': 'READ_ONLY',
          'source': disk_api_res['selfLink']
      })
    request_body['disks'] = disks
    scopes = common.DEFAULT_COMPUTE_INSTANCE_SCOPE
    if additional_scopes:
      scopes.extend(additional_scopes)
    request_body['serviceAccounts'] = [{'email': sa_email, 'scopes': scopes}]
    if metadata:
      metadata_res = [
          {
              'key': key, 'value': value
          } for key, value in metadata.items()
      ]
      request_body['metadata'] = {'items': metadata_res}
    network_interface = {
        'network':
            self.GetNetwork(network_name)['selfLink'],
        'accessConfigs': [] if not external_ip else [{
            'name': 'External NAT', 'type': 'ONE_TO_ONE_NAT'
        }]
    }
    request_body['networkInterfaces'] = [network_interface]

    # TODO(ramo-j) Better than OS login would be the user authenticated to gcp,
    # but I cannt find a way to determine that.
    try:
      if owner_label and os.getlogin():
        owner = re.sub('[^-_a-z0-9]', '_', os.getlogin())
        request_body['labels'] = [{'owner': owner}]
    except OSError:
      # If run as an automated user, no user can be found.
      pass
    return self.CreateInstanceFromRequest(request_body, compute_zone)
Create a compute instance.

If boot_disk is None then a boot disk need to be created using the
'boot_disk_size', 'cpu_cores', 'image_project' and 'image_family parameters'.

Args:
instance_name: Name of the compute instance
machine_type: A string, name of the machine type.
zone: Compute zone to start the instance in, default is self.default_zone.
boot_disk: Boot disk name.
boot_disk_type: represents persistent disk types, default "pd-standard".
boot_disk_size: boot disk size in base-2 GB. If you specify a sourceImage,
which is required for boot disks, the default size is the size
of the sourceImage, else default is 10 GB.
boot_image_project: Name of the project where the boot disk image is stored.
boot_image_family: Name of the image to use to create the boot disk.
additional_scopes: additional scopes to be provided to the instance. Default
scopes https://cloud.google.com/compute/docs/access/service-accounts#associating_a_service_account_to_an_instance  # pylint: disable=line-too-long
sa_email: Service account email in case default service account is not used.
metadata: A dictionary mapping metadata keys and values.
data_disks: List of disks to attach to the instance, default mode is READ_ONLY.
network_name: Name of the VPC network to use, "default" network is default.
external_ip: True if the instance should have an external IP.
owner_label: True if the instance should have an owner label.

Returns:
Compute instance object.

Raises:
ResourceNotFoundError: If boot disk is not found.
OperationFailedError: If Get operation on boot disk failed.
libcloudforensics/providers/gcp/internal/compute.py