Safe Haskell | Safe-Infered |
---|
Ganeti.Metad.Config
- mergeConfig :: InstanceParams -> InstanceParams -> InstanceParams
- getOsParams :: String -> String -> JSObject JSValue -> Result (JSObject JSValue)
- getPublicOsParams :: JSObject JSValue -> Result (JSObject JSValue)
- getPrivateOsParams :: JSObject JSValue -> Result (JSObject JSValue)
- getSecretOsParams :: JSObject JSValue -> Result (JSObject JSValue)
- makeInstanceParams :: JSObject JSValue -> JSObject JSValue -> JSObject JSValue -> JSValue
- getOsParamsWithVisibility :: JSValue -> Result JSValue
- getInstanceCommunicationIp :: JSObject JSValue -> Result (Maybe String)
- getInstanceParams :: JSValue -> Result (String, Maybe InstanceParams)
Documentation
mergeConfig :: InstanceParams -> InstanceParams -> InstanceParamsSource
Merges two instance configurations into one.
In the case where instance IPs (i.e., map keys) are repeated, the
old instance configuration is thrown away by union
and
replaced by the new configuration. As a result, the old private
and secret OS parameters are completely lost.
getOsParams :: String -> String -> JSObject JSValue -> Result (JSObject JSValue)Source
Extracts the OS parameters (public, private, secret) from a JSON object.
This function checks whether the OS parameters are in fact a JSON object.
getPublicOsParams :: JSObject JSValue -> Result (JSObject JSValue)Source
getPrivateOsParams :: JSObject JSValue -> Result (JSObject JSValue)Source
getSecretOsParams :: JSObject JSValue -> Result (JSObject JSValue)Source
makeInstanceParams :: JSObject JSValue -> JSObject JSValue -> JSObject JSValue -> JSValueSource
Merges the OS parameters (public, private, secret) in a single data structure containing all parameters and their visibility.
Example:
{ "os-image": ["http://example.com/disk.img", "public"], "os-password": ["mypassword", "secret"] }
getOsParamsWithVisibility :: JSValue -> Result JSValueSource
getInstanceCommunicationIp :: JSObject JSValue -> Result (Maybe String)Source
Finds the IP address of the instance communication NIC in the
instance's NICs. If the corresponding NIC isn't found, Nothing
is returned.
getInstanceParams :: JSValue -> Result (String, Maybe InstanceParams)Source
Extracts the OS parameters from the instance's parameters and returns a data structure containing all the OS parameters and their visibility indexed by the instance's IP address which is used in the instance communication NIC.