block_volume.go raw

   1  package storage
   2  
   3  import (
   4  	liquidweb "github.com/liquidweb/liquidweb-go"
   5  	"github.com/liquidweb/liquidweb-go/types"
   6  )
   7  
   8  // Attachment represents the attachment details for a block volume.
   9  type Attachment struct {
  10  	Device   string `json:"device,omitempty"`
  11  	Resource string `json:"resource,omitempty"`
  12  }
  13  
  14  // BlockVolumeParams is the set of parameters used when creating or updating a block volume
  15  type BlockVolumeParams struct {
  16  	Attach      string `json:"attach,omitempty"`
  17  	CrossAttach bool   `json:"cross_attach,omitempty"`
  18  	DetachFrom  string `json:"detach_from,omitempty"`
  19  	Domain      string `json:"domain,omitempty"`
  20  	NewSize     int    `json:"new_size,omitempty"`
  21  	Region      int    `json:"region,omitempty"`
  22  	Size        int    `json:"size,omitempty"`
  23  	To          string `json:"to,omitempty"`
  24  	UniqID      string `json:"uniq_id,omitempty"`
  25  	Zone        int    `json:"zone,omitempty"`
  26  	liquidweb.PageParams
  27  }
  28  
  29  // BlockVolume is the resource representing a block volume.
  30  type BlockVolume struct {
  31  	AttachedTo       []Attachment           `json:"attachedTo,omitempty"`
  32  	CrossAttach      types.NumericalBoolean `json:"cross_attach,omitempty"`
  33  	Domain           string                 `json:"domain,omitempty"`
  34  	Label            string                 `json:"label,omitempty"`
  35  	Size             types.FlexInt          `json:"size,omitempty"`
  36  	Status           string                 `json:"status,omitempty"`
  37  	UniqID           string                 `json:"uniq_id,omitempty"`
  38  	ZoneAvailability []types.FlexInt        `json:"zoneAvailability,omitempty"`
  39  }
  40  
  41  // BlockVolumeList is an envelope for the API result containing either a list of block volumes or an error.
  42  type BlockVolumeList struct {
  43  	liquidweb.ListMeta
  44  	Items []BlockVolume `json:"items,omitempty"`
  45  }
  46  
  47  // BlockVolumeDeletion represents the API result when deleting a block volume.
  48  type BlockVolumeDeletion struct {
  49  	Deleted string `json:"deleted"`
  50  }
  51  
  52  // BlockVolumeResize represents the API result when resizing a block volume.
  53  type BlockVolumeResize struct {
  54  	NewSize types.FlexInt `json:"new_size,omitempty"`
  55  	OldSize types.FlexInt `json:"old_size,omitempty"`
  56  	UniqID  string        `json:"uniq_id,omitempty"`
  57  }
  58