This will allow us to perform validation of opcode params that are SSH key types.
Signed-off-by: Hrvoje Ribicic <[email protected]> --- src/Ganeti/Constants.hs | 6 +++--- src/Ganeti/Types.hs | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs index d20a8da..eedd493 100644 --- a/src/Ganeti/Constants.hs +++ b/src/Ganeti/Constants.hs @@ -4680,13 +4680,13 @@ cryptoOptionSerialNo = "serial_no" -- * SSH key types sshkDsa :: String -sshkDsa = "dsa" +sshkDsa = Types.sshKeyTypeToRaw DSA sshkEcdsa :: String -sshkEcdsa = "ecdsa" +sshkEcdsa = Types.sshKeyTypeToRaw ECDSA sshkRsa :: String -sshkRsa = "rsa" +sshkRsa = Types.sshKeyTypeToRaw RSA sshkAll :: FrozenSet String sshkAll = ConstantUtils.mkSet [sshkRsa, sshkDsa, sshkEcdsa] diff --git a/src/Ganeti/Types.hs b/src/Ganeti/Types.hs index f311827..9823189 100644 --- a/src/Ganeti/Types.hs +++ b/src/Ganeti/Types.hs @@ -172,6 +172,8 @@ module Ganeti.Types , hotplugTargetToRaw , HotplugAction(..) , hotplugActionToRaw + , SshKeyType(..) + , sshKeyTypeToRaw , Private(..) , showPrivateJSObject , Secret(..) @@ -952,6 +954,15 @@ $(THH.declareLADT ''String "HotplugTarget" ]) $(THH.makeJSONInstance ''HotplugTarget) +-- | SSH key type. + +$(THH.declareLADT ''String "SshKeyType" + [ ("RSA", "rsa") + , ("DSA", "dsa") + , ("ECDSA", "ecdsa") + ]) +$(THH.makeJSONInstance ''SshKeyType) + -- * Private type and instances redacted :: String -- 2.6.0.rc2.230.g3dd15c0
