The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3907
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) ===
From 52163f788f2a267003679108a8a17076792e2bb4 Mon Sep 17 00:00:00 2001 From: Alberto Donato <[email protected]> Date: Fri, 6 Oct 2017 12:55:44 +0200 Subject: [PATCH] shared/api: split storage in separate files for pools and volumes Signed-off-by: Alberto Donato <[email protected]> --- shared/api/storage_pools.go | 38 +++++++++++++++++++++++++++ shared/api/{storage.go => storage_volumes.go} | 37 -------------------------- 2 files changed, 38 insertions(+), 37 deletions(-) create mode 100644 shared/api/storage_pools.go rename shared/api/{storage.go => storage_volumes.go} (51%) diff --git a/shared/api/storage_pools.go b/shared/api/storage_pools.go new file mode 100644 index 000000000..157d2d275 --- /dev/null +++ b/shared/api/storage_pools.go @@ -0,0 +1,38 @@ +package api + +// StoragePoolsPost represents the fields of a new LXD storage pool +// +// API extension: storage +type StoragePoolsPost struct { + StoragePoolPut `yaml:",inline"` + + Name string `json:"name" yaml:"name"` + Driver string `json:"driver" yaml:"driver"` +} + +// StoragePool represents the fields of a LXD storage pool. +// +// API extension: storage +type StoragePool struct { + StoragePoolPut `yaml:",inline"` + + Name string `json:"name" yaml:"name"` + Driver string `json:"driver" yaml:"driver"` + UsedBy []string `json:"used_by" yaml:"used_by"` +} + +// StoragePoolPut represents the modifiable fields of a LXD storage pool. +// +// API extension: storage +type StoragePoolPut struct { + Config map[string]string `json:"config" yaml:"config"` + + // API extension: entity_description + Description string `json:"description" yaml:"description"` +} + +// Writable converts a full StoragePool struct into a StoragePoolPut struct +// (filters read-only fields). +func (storagePool *StoragePool) Writable() StoragePoolPut { + return storagePool.StoragePoolPut +} diff --git a/shared/api/storage.go b/shared/api/storage_volumes.go similarity index 51% rename from shared/api/storage.go rename to shared/api/storage_volumes.go index f598ae8b0..d887d6490 100644 --- a/shared/api/storage.go +++ b/shared/api/storage_volumes.go @@ -1,36 +1,5 @@ package api -// StoragePoolsPost represents the fields of a new LXD storage pool -// -// API extension: storage -type StoragePoolsPost struct { - StoragePoolPut `yaml:",inline"` - - Name string `json:"name" yaml:"name"` - Driver string `json:"driver" yaml:"driver"` -} - -// StoragePool represents the fields of a LXD storage pool. -// -// API extension: storage -type StoragePool struct { - StoragePoolPut `yaml:",inline"` - - Name string `json:"name" yaml:"name"` - Driver string `json:"driver" yaml:"driver"` - UsedBy []string `json:"used_by" yaml:"used_by"` -} - -// StoragePoolPut represents the modifiable fields of a LXD storage pool. -// -// API extension: storage -type StoragePoolPut struct { - Config map[string]string `json:"config" yaml:"config"` - - // API extension: entity_description - Description string `json:"description" yaml:"description"` -} - // StorageVolumesPost represents the fields of a new LXD storage pool volume // // API extension: storage @@ -61,12 +30,6 @@ type StorageVolumePut struct { Description string `json:"description" yaml:"description"` } -// Writable converts a full StoragePool struct into a StoragePoolPut struct -// (filters read-only fields). -func (storagePool *StoragePool) Writable() StoragePoolPut { - return storagePool.StoragePoolPut -} - // Writable converts a full StorageVolume struct into a StorageVolumePut struct // (filters read-only fields). func (storageVolume *StorageVolume) Writable() StorageVolumePut {
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
