def CreateLocalSsdMessage(resources, messages, device_name, interface,
                          zone=None):
  """Create a message representing a local ssd."""

  if zone:
    disk_type_ref = resources.Parse('local-ssd',
                                    collection='compute.diskTypes',
                                    params={'zone': zone})
    disk_type = disk_type_ref.SelfLink()
  else:
    disk_type = 'local-ssd'

  maybe_interface_enum = (
      messages.AttachedDisk.InterfaceValueValuesEnum(interface)
      if interface else None)

  return messages.AttachedDisk(
      type=messages.AttachedDisk.TypeValueValuesEnum.SCRATCH,
      autoDelete=True,
      deviceName=device_name,
      interface=maybe_interface_enum,
      mode=messages.AttachedDisk.ModeValueValuesEnum.READ_WRITE,
      initializeParams=messages.AttachedDiskInitializeParams(
          diskType=disk_type),
      )