github.com/cloud-green/juju@v0.0.0-20151002100041-a00291338d3d/apiserver/params/storage.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package params
     5  
     6  import "github.com/juju/juju/storage"
     7  
     8  // MachineBlockDevices holds a machine tag and the block devices present
     9  // on that machine.
    10  type MachineBlockDevices struct {
    11  	Machine      string                `json:"machine"`
    12  	BlockDevices []storage.BlockDevice `json:"blockdevices,omitempty"`
    13  }
    14  
    15  // SetMachineBlockDevices holds the arguments for recording the block
    16  // devices present on a set of machines.
    17  type SetMachineBlockDevices struct {
    18  	MachineBlockDevices []MachineBlockDevices `json:"machineblockdevices"`
    19  }
    20  
    21  // BlockDeviceResult holds the result of an API call to retrieve details
    22  // of a block device.
    23  type BlockDeviceResult struct {
    24  	Result storage.BlockDevice `json:"result"`
    25  	Error  *Error              `json:"error,omitempty"`
    26  }
    27  
    28  // BlockDeviceResults holds the result of an API call to retrieve details
    29  // of multiple block devices.
    30  type BlockDeviceResults struct {
    31  	Results []BlockDeviceResult `json:"results,omitempty"`
    32  }
    33  
    34  // BlockDevicesResult holds the result of an API call to retrieve details
    35  // of all block devices relating to some entity.
    36  type BlockDevicesResult struct {
    37  	Result []storage.BlockDevice `json:"result"`
    38  	Error  *Error                `json:"error,omitempty"`
    39  }
    40  
    41  // BlockDevicseResults holds the result of an API call to retrieve details
    42  // of all block devices relating to some entities.
    43  type BlockDevicesResults struct {
    44  	Results []BlockDevicesResult `json:"results,omitempty"`
    45  }
    46  
    47  // StorageInstance describes a storage instance.
    48  type StorageInstance struct {
    49  	StorageTag string
    50  	OwnerTag   string
    51  	Kind       StorageKind
    52  }
    53  
    54  // StorageKind is the kind of a storage instance.
    55  type StorageKind int
    56  
    57  const (
    58  	StorageKindUnknown StorageKind = iota
    59  	StorageKindBlock
    60  	StorageKindFilesystem
    61  )
    62  
    63  // String returns representation of StorageKind for readability.
    64  func (k *StorageKind) String() string {
    65  	switch *k {
    66  	case StorageKindBlock:
    67  		return "block"
    68  	case StorageKindFilesystem:
    69  		return "filesystem"
    70  	default:
    71  		return "unknown"
    72  	}
    73  }
    74  
    75  // StorageInstanceResult holds the result of an API call to retrieve details
    76  // of a storage instance.
    77  type StorageInstanceResult struct {
    78  	Result StorageInstance `json:"result"`
    79  	Error  *Error          `json:"error,omitempty"`
    80  }
    81  
    82  // StorageInstanceResults holds the result of an API call to retrieve details
    83  // of multiple storage instances.
    84  type StorageInstanceResults struct {
    85  	Results []StorageInstanceResult `json:"results,omitempty"`
    86  }
    87  
    88  // StorageAttachment describes a unit's attached storage instance.
    89  type StorageAttachment struct {
    90  	StorageTag string
    91  	OwnerTag   string
    92  	UnitTag    string
    93  
    94  	Kind     StorageKind
    95  	Location string
    96  	Life     Life
    97  }
    98  
    99  // StorageAttachmentId identifies a storage attachment by the tags of the
   100  // related unit and storage instance.
   101  type StorageAttachmentId struct {
   102  	StorageTag string `json:"storagetag"`
   103  	UnitTag    string `json:"unittag"`
   104  }
   105  
   106  // StorageAttachmentIds holds a set of storage attachment identifiers.
   107  type StorageAttachmentIds struct {
   108  	Ids []StorageAttachmentId `json:"ids"`
   109  }
   110  
   111  // StorageAttachmentIdsResult holds the result of an API call to retrieve the
   112  // IDs of a unit's attached storage instances.
   113  type StorageAttachmentIdsResult struct {
   114  	Result StorageAttachmentIds `json:"result"`
   115  	Error  *Error               `json:"error,omitempty"`
   116  }
   117  
   118  // StorageAttachmentIdsResult holds the result of an API call to retrieve the
   119  // IDs of multiple units attached storage instances.
   120  type StorageAttachmentIdsResults struct {
   121  	Results []StorageAttachmentIdsResult `json:"results,omitempty"`
   122  }
   123  
   124  // StorageAttachmentsResult holds the result of an API call to retrieve details
   125  // of a unit's attached storage instances.
   126  type StorageAttachmentsResult struct {
   127  	Result []StorageAttachment `json:"result"`
   128  	Error  *Error              `json:"error,omitempty"`
   129  }
   130  
   131  // StorageAttachmentsResults holds the result of an API call to retrieve details
   132  // of multiple units' attached storage instances.
   133  type StorageAttachmentsResults struct {
   134  	Results []StorageAttachmentsResult `json:"results,omitempty"`
   135  }
   136  
   137  // StorageAttachmentResult holds the result of an API call to retrieve details
   138  // of a storage attachment.
   139  type StorageAttachmentResult struct {
   140  	Result StorageAttachment `json:"result"`
   141  	Error  *Error            `json:"error,omitempty"`
   142  }
   143  
   144  // StorageAttachmentResults holds the result of an API call to retrieve details
   145  // of multiple storage attachments.
   146  type StorageAttachmentResults struct {
   147  	Results []StorageAttachmentResult `json:"results,omitempty"`
   148  }
   149  
   150  // MachineStorageId identifies the attachment of a storage entity
   151  // to a machine, by their tags.
   152  type MachineStorageId struct {
   153  	MachineTag string `json:"machinetag"`
   154  	// AttachmentTag is the tag of the volume or filesystem whose
   155  	// attachment to the machine is represented.
   156  	AttachmentTag string `json:"attachmenttag"`
   157  }
   158  
   159  // MachineStorageIds holds a set of machine/storage-entity
   160  // attachment identifiers.
   161  type MachineStorageIds struct {
   162  	Ids []MachineStorageId `json:"ids"`
   163  }
   164  
   165  // Volume identifies and describes a storage volume in the environment.
   166  type Volume struct {
   167  	VolumeTag string     `json:"volumetag"`
   168  	Info      VolumeInfo `json:"info"`
   169  }
   170  
   171  // Volume describes a storage volume in the environment.
   172  type VolumeInfo struct {
   173  	VolumeId   string `json:"volumeid"`
   174  	HardwareId string `json:"hardwareid,omitempty"`
   175  	// Size is the size of the volume in MiB.
   176  	Size       uint64 `json:"size"`
   177  	Persistent bool   `json:"persistent"`
   178  }
   179  
   180  // Volumes describes a set of storage volumes in the environment.
   181  type Volumes struct {
   182  	Volumes []Volume `json:"volumes"`
   183  }
   184  
   185  // VolumeAttachment identifies and describes a volume attachment.
   186  type VolumeAttachment struct {
   187  	VolumeTag  string               `json:"volumetag"`
   188  	MachineTag string               `json:"machinetag"`
   189  	Info       VolumeAttachmentInfo `json:"info"`
   190  }
   191  
   192  // VolumeAttachmentInfo describes a volume attachment.
   193  type VolumeAttachmentInfo struct {
   194  	DeviceName string `json:"devicename,omitempty"`
   195  	DeviceLink string `json:"devicelink,omitempty"`
   196  	BusAddress string `json:"busaddress,omitempty"`
   197  	ReadOnly   bool   `json:"read-only,omitempty"`
   198  }
   199  
   200  // VolumeAttachments describes a set of storage volume attachments.
   201  type VolumeAttachments struct {
   202  	VolumeAttachments []VolumeAttachment `json:"volumeattachments"`
   203  }
   204  
   205  // VolumeParams holds the parameters for creating a storage volume.
   206  type VolumeParams struct {
   207  	VolumeTag  string                  `json:"volumetag"`
   208  	Size       uint64                  `json:"size"`
   209  	Provider   string                  `json:"provider"`
   210  	Attributes map[string]interface{}  `json:"attributes,omitempty"`
   211  	Tags       map[string]string       `json:"tags,omitempty"`
   212  	Attachment *VolumeAttachmentParams `json:"attachment,omitempty"`
   213  }
   214  
   215  // VolumeAttachmentParams holds the parameters for creating a volume
   216  // attachment.
   217  type VolumeAttachmentParams struct {
   218  	VolumeTag  string `json:"volumetag"`
   219  	MachineTag string `json:"machinetag"`
   220  	VolumeId   string `json:"volumeid,omitempty"`
   221  	InstanceId string `json:"instanceid,omitempty"`
   222  	Provider   string `json:"provider"`
   223  	ReadOnly   bool   `json:"read-only,omitempty"`
   224  }
   225  
   226  // VolumeAttachmentsResult holds the volume attachments for a single
   227  // machine, or an error.
   228  type VolumeAttachmentsResult struct {
   229  	Attachments []VolumeAttachment `json:"attachments,omitempty"`
   230  	Error       *Error             `json:"error,omitempty"`
   231  }
   232  
   233  // VolumeAttachmentsResults holds a set of VolumeAttachmentsResults for
   234  // a set of machines.
   235  type VolumeAttachmentsResults struct {
   236  	Results []VolumeAttachmentsResult `json:"results,omitempty"`
   237  }
   238  
   239  // VolumeAttachmentResult holds the details of a single volume attachment,
   240  // or an error.
   241  type VolumeAttachmentResult struct {
   242  	Result VolumeAttachment `json:"result"`
   243  	Error  *Error           `json:"error,omitempty"`
   244  }
   245  
   246  // VolumeAttachmentResults holds a set of VolumeAttachmentResults.
   247  type VolumeAttachmentResults struct {
   248  	Results []VolumeAttachmentResult `json:"results,omitempty"`
   249  }
   250  
   251  // VolumeResult holds information about a volume.
   252  type VolumeResult struct {
   253  	Result Volume `json:"result"`
   254  	Error  *Error `json:"error,omitempty"`
   255  }
   256  
   257  // VolumeResults holds information about multiple volumes.
   258  type VolumeResults struct {
   259  	Results []VolumeResult `json:"results,omitempty"`
   260  }
   261  
   262  // VolumeParamsResults holds provisioning parameters for a volume.
   263  type VolumeParamsResult struct {
   264  	Result VolumeParams `json:"result"`
   265  	Error  *Error       `json:"error,omitempty"`
   266  }
   267  
   268  // VolumeParamsResults holds provisioning parameters for multiple volumes.
   269  type VolumeParamsResults struct {
   270  	Results []VolumeParamsResult `json:"results,omitempty"`
   271  }
   272  
   273  // VolumeAttachmentParamsResults holds provisioning parameters for a volume
   274  // attachment.
   275  type VolumeAttachmentParamsResult struct {
   276  	Result VolumeAttachmentParams `json:"result"`
   277  	Error  *Error                 `json:"error,omitempty"`
   278  }
   279  
   280  // VolumeAttachmentParamsResults holds provisioning parameters for multiple
   281  // volume attachments.
   282  type VolumeAttachmentParamsResults struct {
   283  	Results []VolumeAttachmentParamsResult `json:"results,omitempty"`
   284  }
   285  
   286  // Filesystem identifies and describes a storage filesystem in the environment.
   287  type Filesystem struct {
   288  	FilesystemTag string         `json:"filesystemtag"`
   289  	VolumeTag     string         `json:"volumetag,omitempty"`
   290  	Info          FilesystemInfo `json:"info"`
   291  }
   292  
   293  // Filesystem describes a storage filesystem in the environment.
   294  type FilesystemInfo struct {
   295  	FilesystemId string `json:"filesystemid"`
   296  	// Size is the size of the filesystem in MiB.
   297  	Size uint64 `json:"size"`
   298  }
   299  
   300  // Filesystems describes a set of storage filesystems in the environment.
   301  type Filesystems struct {
   302  	Filesystems []Filesystem `json:"filesystems"`
   303  }
   304  
   305  // FilesystemAttachment identifies and describes a filesystem attachment.
   306  type FilesystemAttachment struct {
   307  	FilesystemTag string                   `json:"filesystemtag"`
   308  	MachineTag    string                   `json:"machinetag"`
   309  	Info          FilesystemAttachmentInfo `json:"info"`
   310  }
   311  
   312  // FilesystemAttachmentInfo describes a filesystem attachment.
   313  type FilesystemAttachmentInfo struct {
   314  	MountPoint string `json:"mountpoint,omitempty"`
   315  	ReadOnly   bool   `json:"read-only,omitempty"`
   316  }
   317  
   318  // FilesystemAttachments describes a set of storage filesystem attachments.
   319  type FilesystemAttachments struct {
   320  	FilesystemAttachments []FilesystemAttachment `json:"filesystemattachments"`
   321  }
   322  
   323  // FilesystemParams holds the parameters for creating a storage filesystem.
   324  type FilesystemParams struct {
   325  	FilesystemTag string                      `json:"filesystemtag"`
   326  	VolumeTag     string                      `json:"volumetag,omitempty"`
   327  	Size          uint64                      `json:"size"`
   328  	Provider      string                      `json:"provider"`
   329  	Attributes    map[string]interface{}      `json:"attributes,omitempty"`
   330  	Tags          map[string]string           `json:"tags,omitempty"`
   331  	Attachment    *FilesystemAttachmentParams `json:"attachment,omitempty"`
   332  }
   333  
   334  // FilesystemAttachmentParams holds the parameters for creating a filesystem
   335  // attachment.
   336  type FilesystemAttachmentParams struct {
   337  	FilesystemTag string `json:"filesystemtag"`
   338  	MachineTag    string `json:"machinetag"`
   339  	FilesystemId  string `json:"filesystemid,omitempty"`
   340  	InstanceId    string `json:"instanceid,omitempty"`
   341  	Provider      string `json:"provider"`
   342  	MountPoint    string `json:"mountpoint,omitempty"`
   343  	ReadOnly      bool   `json:"read-only,omitempty"`
   344  }
   345  
   346  // FilesystemAttachmentResult holds the details of a single filesystem attachment,
   347  // or an error.
   348  type FilesystemAttachmentResult struct {
   349  	Result FilesystemAttachment `json:"result"`
   350  	Error  *Error               `json:"error,omitempty"`
   351  }
   352  
   353  // FilesystemAttachmentResults holds a set of FilesystemAttachmentResults.
   354  type FilesystemAttachmentResults struct {
   355  	Results []FilesystemAttachmentResult `json:"results,omitempty"`
   356  }
   357  
   358  // FilesystemResult holds information about a filesystem.
   359  type FilesystemResult struct {
   360  	Result Filesystem `json:"result"`
   361  	Error  *Error     `json:"error,omitempty"`
   362  }
   363  
   364  // FilesystemResults holds information about multiple filesystems.
   365  type FilesystemResults struct {
   366  	Results []FilesystemResult `json:"results,omitempty"`
   367  }
   368  
   369  // FilesystemParamsResults holds provisioning parameters for a filesystem.
   370  type FilesystemParamsResult struct {
   371  	Result FilesystemParams `json:"result"`
   372  	Error  *Error           `json:"error,omitempty"`
   373  }
   374  
   375  // FilesystemParamsResults holds provisioning parameters for multiple filesystems.
   376  type FilesystemParamsResults struct {
   377  	Results []FilesystemParamsResult `json:"results,omitempty"`
   378  }
   379  
   380  // FilesystemAttachmentParamsResults holds provisioning parameters for a filesystem
   381  // attachment.
   382  type FilesystemAttachmentParamsResult struct {
   383  	Result FilesystemAttachmentParams `json:"result"`
   384  	Error  *Error                     `json:"error,omitempty"`
   385  }
   386  
   387  // FilesystemAttachmentParamsResults holds provisioning parameters for multiple
   388  // filesystem attachments.
   389  type FilesystemAttachmentParamsResults struct {
   390  	Results []FilesystemAttachmentParamsResult `json:"results,omitempty"`
   391  }
   392  
   393  // StorageDetails holds information about storage.
   394  type StorageDetails struct {
   395  	// StorageTag holds tag for this storage.
   396  	StorageTag string `json:"storagetag"`
   397  
   398  	// OwnerTag holds tag for the owner of this storage, unit or service.
   399  	OwnerTag string `json:"ownertag"`
   400  
   401  	// Kind holds what kind of storage this instance is.
   402  	Kind StorageKind `json:"kind"`
   403  
   404  	// Status contains the status of the storage instance.
   405  	Status EntityStatus `json:"status"`
   406  
   407  	// Persistent reports whether or not the underlying volume or
   408  	// filesystem is persistent; i.e. whether or not it outlives
   409  	// the machine that it is attached to.
   410  	Persistent bool
   411  
   412  	// Attachments contains a mapping from unit tag to
   413  	// storage attachment details.
   414  	Attachments map[string]StorageAttachmentDetails `json:"attachments,omitempty"`
   415  }
   416  
   417  // LegacyStorageDetails holds information about storage.
   418  //
   419  // NOTE(axw): this is for backwards compatibility only. This struct
   420  // should not be changed!
   421  type LegacyStorageDetails struct {
   422  	// StorageTag holds tag for this storage.
   423  	StorageTag string `json:"storagetag"`
   424  
   425  	// OwnerTag holds tag for the owner of this storage, unit or service.
   426  	OwnerTag string `json:"ownertag"`
   427  
   428  	// Kind holds what kind of storage this instance is.
   429  	Kind StorageKind `json:"kind"`
   430  
   431  	// Status indicates storage status, e.g. pending, provisioned, attached.
   432  	Status string `json:"status,omitempty"`
   433  
   434  	// UnitTag holds tag for unit for attached instances.
   435  	UnitTag string `json:"unittag,omitempty"`
   436  
   437  	// Location holds location for provisioned attached instances.
   438  	Location string `json:"location,omitempty"`
   439  
   440  	// Persistent indicates whether the storage is persistent or not.
   441  	Persistent bool `json:"persistent"`
   442  }
   443  
   444  // StorageDetailsResult holds information about a storage instance
   445  // or error related to its retrieval.
   446  type StorageDetailsResult struct {
   447  	Result *StorageDetails      `json:"details,omitempty"`
   448  	Legacy LegacyStorageDetails `json:"result"`
   449  	Error  *Error               `json:"error,omitempty"`
   450  }
   451  
   452  // StorageDetailsResults holds results for storage details or related storage error.
   453  type StorageDetailsResults struct {
   454  	Results []StorageDetailsResult `json:"results,omitempty"`
   455  }
   456  
   457  // StorageAttachmentDetails holds detailed information about a storage attachment.
   458  type StorageAttachmentDetails struct {
   459  	// StorageTag is the tag of the storage instance.
   460  	StorageTag string `json:"storagetag"`
   461  
   462  	// UnitTag is the tag of the unit attached to the storage instance.
   463  	UnitTag string `json:"unittag"`
   464  
   465  	// MachineTag is the tag of the machine that the attached unit is assigned to.
   466  	MachineTag string `json:"machinetag"`
   467  
   468  	// Location holds location (mount point/device path) of
   469  	// the attached storage.
   470  	Location string `json:"location,omitempty"`
   471  }
   472  
   473  // StoragePool holds data for a pool instance.
   474  type StoragePool struct {
   475  
   476  	// Name is the pool's name.
   477  	Name string `json:"name"`
   478  
   479  	// Provider is the type of storage provider this pool represents, eg "loop", "ebs".
   480  	Provider string `json:"provider"`
   481  
   482  	// Attrs are the pool's configuration attributes.
   483  	Attrs map[string]interface{} `json:"attrs"`
   484  }
   485  
   486  // StoragePoolFilter holds a filter for pool API call.
   487  type StoragePoolFilter struct {
   488  
   489  	// Names are pool's names to filter on.
   490  	Names []string `json:"names,omitempty"`
   491  
   492  	// Providers are pool's storage provider types to filter on.
   493  	Providers []string `json:"providers,omitempty"`
   494  }
   495  
   496  // StoragePoolsResult holds a collection of pool instances.
   497  type StoragePoolsResult struct {
   498  	Results []StoragePool `json:"results,omitempty"`
   499  }
   500  
   501  // VolumeFilter holds a filter for volume list API call.
   502  type VolumeFilter struct {
   503  	// Machines are machine tags to filter on.
   504  	Machines []string `json:"machines,omitempty"`
   505  }
   506  
   507  // IsEmpty determines if filter is empty
   508  func (f *VolumeFilter) IsEmpty() bool {
   509  	return len(f.Machines) == 0
   510  }
   511  
   512  // FilesystemFilter holds a filter for filter list API call.
   513  type FilesystemFilter struct {
   514  	// Machines are machine tags to filter on.
   515  	Machines []string `json:"machines,omitempty"`
   516  }
   517  
   518  // IsEmpty determines if filter is empty
   519  func (f *FilesystemFilter) IsEmpty() bool {
   520  	return len(f.Machines) == 0
   521  }
   522  
   523  // VolumeDetails describes a storage volume in the environment
   524  // for the purpose of volume CLI commands.
   525  //
   526  // This is kept separate from Volume which contains only information
   527  // specific to the volume model, whereas VolumeDetails is intended
   528  // to contain complete information about a volume and related
   529  // information (status, attachments, storage).
   530  type VolumeDetails struct {
   531  
   532  	// VolumeTag is the tag for the volume.
   533  	VolumeTag string `json:"volumetag"`
   534  
   535  	// Info contains information about the volume.
   536  	Info VolumeInfo `json:"info"`
   537  
   538  	// Status contains the status of the volume.
   539  	Status EntityStatus `json:"status"`
   540  
   541  	// MachineAttachments contains a mapping from
   542  	// machine tag to volume attachment information.
   543  	MachineAttachments map[string]VolumeAttachmentInfo `json:"machineattachments,omitempty"`
   544  
   545  	// Storage contains details about the storage instance
   546  	// that the volume is assigned to, if any.
   547  	Storage *StorageDetails `json:"storage,omitempty"`
   548  }
   549  
   550  // LegacyVolumeDetails describes a storage volume in the environment
   551  // for the purpose of volume CLI commands.
   552  //
   553  // This is kept separate from Volume which contains only information
   554  // specific to the volume model, whereas LegacyVolumeDetails is intended
   555  // to contain complete information about a volume.
   556  //
   557  // NOTE(axw): this is for backwards compatibility only. This struct
   558  // should not be changed!
   559  type LegacyVolumeDetails struct {
   560  
   561  	// VolumeTag is tag for this volume instance.
   562  	VolumeTag string `json:"volumetag"`
   563  
   564  	// StorageInstance returns the tag of the storage instance that this
   565  	// volume is assigned to, if any.
   566  	StorageTag string `json:"storage,omitempty"`
   567  
   568  	// UnitTag is the tag of the unit attached to storage instance
   569  	// for this volume.
   570  	UnitTag string `json:"unit,omitempty"`
   571  
   572  	// VolumeId is a unique provider-supplied ID for the volume.
   573  	VolumeId string `json:"volumeid,omitempty"`
   574  
   575  	// HardwareId is the volume's hardware ID.
   576  	HardwareId string `json:"hardwareid,omitempty"`
   577  
   578  	// Size is the size of the volume in MiB.
   579  	Size uint64 `json:"size,omitempty"`
   580  
   581  	// Persistent reflects whether the volume is destroyed with the
   582  	// machine to which it is attached.
   583  	Persistent bool `json:"persistent"`
   584  
   585  	// Status contains the current status of the volume.
   586  	Status EntityStatus `json:"status"`
   587  }
   588  
   589  // VolumeDetailsResult contains details about a volume, its attachments or
   590  // an error preventing retrieving those details.
   591  type VolumeDetailsResult struct {
   592  
   593  	// Details describes the volume in detail.
   594  	Details *VolumeDetails `json:"details,omitempty"`
   595  
   596  	// LegacyVolume describes the volume in detail.
   597  	//
   598  	// NOTE(axw): VolumeDetails contains redundant and nonsensical
   599  	// information. Use Details if it is available, and only use
   600  	// this for backwards-compatibility.
   601  	LegacyVolume *LegacyVolumeDetails `json:"volume,omitempty"`
   602  
   603  	// LegacyAttachments describes the attachments of the volume to
   604  	// machines.
   605  	//
   606  	// NOTE(axw): this should have gone into VolumeDetails, but it's too
   607  	// late for that now. We'll continue to populate it, and use it
   608  	// if it's defined but Volume.Attachments is not. Please do not
   609  	// copy this structure.
   610  	LegacyAttachments []VolumeAttachment `json:"attachments,omitempty"`
   611  
   612  	// Error contains volume retrieval error.
   613  	Error *Error `json:"error,omitempty"`
   614  }
   615  
   616  // VolumeDetailsResults holds volume details.
   617  type VolumeDetailsResults struct {
   618  	Results []VolumeDetailsResult `json:"results,omitempty"`
   619  }
   620  
   621  // FilesystemDetails describes a storage filesystem in the environment
   622  // for the purpose of filesystem CLI commands.
   623  //
   624  // This is kept separate from Filesystem which contains only information
   625  // specific to the filesystem model, whereas FilesystemDetails is intended
   626  // to contain complete information about a filesystem and related
   627  // information (status, attachments, storage).
   628  type FilesystemDetails struct {
   629  
   630  	// FilesystemTag is the tag for the filesystem.
   631  	FilesystemTag string `json:"filesystemtag"`
   632  
   633  	// VolumeTag is the tag for the volume backing the
   634  	// filesystem, if any.
   635  	VolumeTag string `json:"volumetag,omitempty"`
   636  
   637  	// Info contains information about the filesystem.
   638  	Info FilesystemInfo `json:"info"`
   639  
   640  	// Status contains the status of the filesystem.
   641  	Status EntityStatus `json:"status"`
   642  
   643  	// MachineAttachments contains a mapping from
   644  	// machine tag to filesystem attachment information.
   645  	MachineAttachments map[string]FilesystemAttachmentInfo `json:"machineattachments,omitempty"`
   646  
   647  	// Storage contains details about the storage instance
   648  	// that the volume is assigned to, if any.
   649  	Storage *StorageDetails `json:"storage,omitempty"`
   650  }
   651  
   652  // FilesystemDetailsResult contains details about a filesystem, its attachments or
   653  // an error preventing retrieving those details.
   654  type FilesystemDetailsResult struct {
   655  	Result *FilesystemDetails `json:"result,omitempty"`
   656  	Error  *Error             `json:"error,omitempty"`
   657  }
   658  
   659  // FilesystemDetailsResults holds filesystem details.
   660  type FilesystemDetailsResults struct {
   661  	Results []FilesystemDetailsResult `json:"results,omitempty"`
   662  }
   663  
   664  // StorageConstraints contains constraints for storage instance.
   665  type StorageConstraints struct {
   666  	// Pool is the name of the storage pool from which to provision the
   667  	// storage instance.
   668  	Pool string `bson:"pool,omitempty"`
   669  
   670  	// Size is the required size of the storage instance, in MiB.
   671  	Size *uint64 `bson:"size,omitempty"`
   672  
   673  	// Count is the required number of storage instances.
   674  	Count *uint64 `bson:"count,omitempty"`
   675  }
   676  
   677  // StorageAddParams holds storage details to add to a unit dynamically.
   678  type StorageAddParams struct {
   679  	// UnitTag  is unit name.
   680  	UnitTag string `json:"unit"`
   681  
   682  	// StorageName is the name of the storage as specified in the charm.
   683  	StorageName string `bson:"name"`
   684  
   685  	// Constraints are specified storage constraints.
   686  	Constraints StorageConstraints `json:"storage"`
   687  }
   688  
   689  // StoragesAddParams holds storage details to add to units dynamically.
   690  type StoragesAddParams struct {
   691  	Storages []StorageAddParams `json:"storages"`
   692  }