root / src / Ganeti / Query / Instance.hs @ d286d795
History | View | Annotate | Download (1.9 kB)
1 |
{-| Implementation of the Ganeti Query2 instance queries. |
---|---|
2 |
|
3 |
-} |
4 |
|
5 |
{- |
6 |
|
7 |
Copyright (C) 2013 Google Inc. |
8 |
|
9 |
This program is free software; you can redistribute it and/or modify |
10 |
it under the terms of the GNU General Public License as published by |
11 |
the Free Software Foundation; either version 2 of the License, or |
12 |
(at your option) any later version. |
13 |
|
14 |
This program is distributed in the hope that it will be useful, but |
15 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 |
General Public License for more details. |
18 |
|
19 |
You should have received a copy of the GNU General Public License |
20 |
along with this program; if not, write to the Free Software |
21 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
22 |
02110-1301, USA. |
23 |
|
24 |
-} |
25 |
|
26 |
module Ganeti.Query.Instance |
27 |
(fieldsMap) where |
28 |
|
29 |
import qualified Data.Map as Map |
30 |
|
31 |
import Ganeti.Objects |
32 |
import Ganeti.Query.Common |
33 |
import Ganeti.Query.Language |
34 |
import Ganeti.Query.Types |
35 |
|
36 |
instanceFields :: FieldList Instance NoDataRuntime |
37 |
instanceFields = |
38 |
[ (FieldDefinition "disk_template" "Disk_template" QFTText |
39 |
"Disk template", |
40 |
FieldSimple (rsNormal . instDiskTemplate), QffNormal) |
41 |
, (FieldDefinition "name" "Instance" QFTText |
42 |
"Instance name", |
43 |
FieldSimple (rsNormal . instName), QffHostname) |
44 |
, (FieldDefinition "hypervisor" "Hypervisor" QFTText |
45 |
"Hypervisor name", |
46 |
FieldSimple (rsNormal . instHypervisor), QffNormal) |
47 |
, (FieldDefinition "network_port" "Network_port" QFTOther |
48 |
"Instance network port if available (e.g. for VNC console)", |
49 |
FieldSimple (rsMaybeNoData . instNetworkPort), QffNormal) |
50 |
, (FieldDefinition "os" "OS" QFTText |
51 |
"Operating system", |
52 |
FieldSimple (rsNormal . instOs), QffNormal) |
53 |
] ++ |
54 |
serialFields "Instance" ++ |
55 |
uuidFields "Instance" |
56 |
|
57 |
fieldsMap :: FieldMap Instance NoDataRuntime |
58 |
fieldsMap = |
59 |
Map.fromList [(fdefName f, v) | v@(f, _, _) <- instanceFields] |