Safe Haskell | None |
---|
Implementation of the Ganeti Query2 common objects.
Synopsis
- data NoDataRuntime = NoDataRuntime
- vTypeToQFT :: VType -> FieldType
- rsNoData :: ResultEntry
- rsUnavail :: ResultEntry
- rsNormal :: JSON a => a -> ResultEntry
- rsMaybeNoData :: JSON a => Maybe a -> ResultEntry
- rsErrorNoData :: JSON a => ErrorResult a -> ResultEntry
- rsMaybeUnavail :: JSON a => Maybe a -> ResultEntry
- rsErrorMaybeUnavail :: JSON a => ErrorResult (Maybe a) -> ResultEntry
- rsUnknown :: ResultEntry
- missingRuntime :: FieldGetter a b
- rpcErrorToStatus :: RpcError -> ResultStatus
- timeStampFields :: TimeStampObject a => FieldList a b
- forthcomingFields :: ForthcomingObject a => String -> FieldList a b
- uuidFields :: UuidObject a => String -> FieldList a b
- serialFields :: SerialNoObject a => String -> FieldList a b
- tagsFields :: TagsObject a => FieldList a b
- dictFieldGetter :: DictObject a => String -> Maybe a -> ResultEntry
- ndParamTypes :: Map String FieldType
- ndParamTitles :: Map String FieldTitle
- ndParamGetter :: NdParamObject a => String -> ConfigData -> a -> ResultEntry
- buildNdParamField :: NdParamObject a => String -> FieldData a b
- beParamTypes :: Map String FieldType
- buildBeParamField :: (String -> ConfigData -> a -> ResultEntry) -> String -> FieldData a b
- hvParamTypes :: Map String FieldType
- buildHvParamField :: (String -> ConfigData -> a -> ResultEntry) -> String -> FieldData a b
- buildParamField :: String -> String -> Map String String -> Map String FieldType -> (String -> ConfigData -> a -> ResultEntry) -> String -> FieldData a b
- getDefaultHypervisorSpec :: ConfigData -> (Hypervisor, HvParams)
- getHvParamsFromCluster :: ConfigData -> Hypervisor -> HvParams
- aliasFields :: [(FieldName, FieldName)] -> FieldList a b -> FieldList a b
Documentation
Generic functions
Result helpers
rsNoData :: ResultEntry Source #
Helper for a result with no data.
rsUnavail :: ResultEntry Source #
Helper for result for an entity which supports no such field.
rsNormal :: JSON a => a -> ResultEntry Source #
Helper to declare a normal result.
rsMaybeNoData :: JSON a => Maybe a -> ResultEntry Source #
Helper to declare a result from a Maybe
(the item might be
missing, in which case we return no data). Note that there's some
ambiguity here: in some cases, we mean RSNoData
, but in other
RSUnavail
; this is easy to solve in simple cases, but not in
nested dicts. If you want to return RSUnavail
in case of Nothing
use the function rsMaybeUnavail
.
rsErrorNoData :: JSON a => ErrorResult a -> ResultEntry Source #
Helper to declare a result from a ErrorResult
(an error happened
while retrieving the data from a config, or there was no data).
This function should be used if an error signals there was no data.
rsMaybeUnavail :: JSON a => Maybe a -> ResultEntry Source #
Helper to declare a result from a Maybe
. This version returns
a RSUnavail
in case of Nothing
. It should be used for optional
fields that are not set. For cases where Nothing
means that there
was an error, consider using rsMaybe
instead.
rsErrorMaybeUnavail :: JSON a => ErrorResult (Maybe a) -> ResultEntry Source #
Helper to declare a result from 'ErrorResult Maybe'. This version
should be used if an error signals there was no data and at the same
time when we have optional fields that may not be setted (i.e. we
want to return a RSUnavail
in case of Nothing
).
rsUnknown :: ResultEntry Source #
Helper for unknown field result.
missingRuntime :: FieldGetter a b Source #
Helper for a missing runtime parameter.
Error conversion
rpcErrorToStatus :: RpcError -> ResultStatus Source #
Convert RpcError to ResultStatus
Common fields
timeStampFields :: TimeStampObject a => FieldList a b Source #
The list of timestamp fields.
forthcomingFields :: ForthcomingObject a => String -> FieldList a b Source #
The list of the field for the property of being forthcoming.
uuidFields :: UuidObject a => String -> FieldList a b Source #
The list of UUID fields.
serialFields :: SerialNoObject a => String -> FieldList a b Source #
The list of serial number fields.
tagsFields :: TagsObject a => FieldList a b Source #
The list of tag fields.
Generic parameter functions
dictFieldGetter :: DictObject a => String -> Maybe a -> ResultEntry Source #
Returns a field from a (possibly missing) DictObject
. This is
used by parameter dictionaries, usually. Note that we have two
levels of maybe: the top level dict might be missing, or one key in
the dictionary might be.
ndParamTypes :: Map String FieldType Source #
Ndparams optimised lookup map.
ndParamTitles :: Map String FieldTitle Source #
Ndparams title map.
:: NdParamObject a | |
=> String | The field we're building the getter for |
-> ConfigData | |
-> a | |
-> ResultEntry |
Ndparam getter builder: given a field, it returns a FieldConfig getter, that is a function that takes the config and the object and returns the Ndparam field specified when the getter was built.
buildNdParamField :: NdParamObject a => String -> FieldData a b Source #
Builds the ndparam fields for an object.
beParamTypes :: Map String FieldType Source #
Beparams optimised lookup map.
buildBeParamField :: (String -> ConfigData -> a -> ResultEntry) -> String -> FieldData a b Source #
Builds the beparam fields for an object.
hvParamTypes :: Map String FieldType Source #
Hvparams optimised lookup map.
buildHvParamField :: (String -> ConfigData -> a -> ResultEntry) -> String -> FieldData a b Source #
Builds the beparam fields for an object.
:: String | Prefix |
-> String | Parameter group name |
-> Map String String | Parameter title map |
-> Map String FieldType | Parameter type map |
-> (String -> ConfigData -> a -> ResultEntry) | |
-> String | The parameter name |
-> FieldData a b |
Builds a param field for a certain getter class
getDefaultHypervisorSpec :: ConfigData -> (Hypervisor, HvParams) Source #
Looks up the default hypervisor and its hvparams
getHvParamsFromCluster :: ConfigData -> Hypervisor -> HvParams Source #
Looks up the cluster's hvparams of the given hypervisor