Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
See https://www.vaultproject.io/api/secret/kv/kv-v2.html for HashiCorp Vault KVv2 API details
Synopsis
- data VaultConnection
- vaultConnect :: Maybe VaultAddr -> KVEnginePath -> Maybe VaultToken -> DisableCertValidation -> IO (Either String VaultConnection)
- kvEngineConfig :: VaultConnection -> Int -> Bool -> IO (Either String Value)
- secretConfig :: VaultConnection -> SecretPath -> Int -> Bool -> IO (Either String Value)
- putSecret :: VaultConnection -> CheckAndSet -> SecretPath -> SecretData -> IO (Either String SecretVersion)
- getSecret :: VaultConnection -> SecretPath -> Maybe SecretVersion -> IO (Either String SecretData)
- deleteSecret :: VaultConnection -> SecretPath -> IO (Maybe Error)
- deleteSecretVersions :: VaultConnection -> SecretPath -> SecretVersions -> IO (Maybe Error)
- unDeleteSecretVersions :: VaultConnection -> SecretPath -> SecretVersions -> IO (Maybe Error)
- destroySecret :: VaultConnection -> SecretPath -> IO (Maybe Error)
- destroySecretVersions :: VaultConnection -> SecretPath -> SecretVersions -> IO (Either String Value)
- currentSecretVersion :: VaultConnection -> SecretPath -> IO (Either String SecretVersion)
- readSecretMetadata :: VaultConnection -> SecretPath -> IO (Either String SecretMetadata)
- secretsList :: VaultConnection -> SecretPath -> IO (Either String [VaultKey])
- toSecretData :: [(Text, Text)] -> SecretData
- fromSecretData :: SecretData -> [(Text, Text)]
- toSecretVersions :: [Int] -> SecretVersions
Documentation
data VaultConnection Source #
Instances
Show VaultConnection Source # | |
Defined in Database.Vault.KVv2.Client.Types showsPrec :: Int -> VaultConnection -> ShowS # show :: VaultConnection -> String # showList :: [VaultConnection] -> ShowS # |
Connect & configure Vault KVv2 Engine
:: Maybe VaultAddr | Use |
-> KVEnginePath | KV engine path |
-> Maybe VaultToken | Use |
-> DisableCertValidation | Disable certificate validation |
-> IO (Either String VaultConnection) |
Get a VaultConnection
, or an error message.
λ: vaultConnect (Just "https://vault.local.lan:8200/") "/secret" Nothing False
Set default secret settings for the KVv2 engine.
:: VaultConnection | |
-> SecretPath | |
-> Int | Max versions |
-> Bool | CAS required |
-> IO (Either String Value) |
Override default secret settings for the given secret.
Basic operations
:: VaultConnection | |
-> CheckAndSet | |
-> SecretPath | |
-> SecretData | Data to put at |
-> IO (Either String SecretVersion) |
Put SecretData
into Vault at the given location.
getSecret :: VaultConnection -> SecretPath -> Maybe SecretVersion -> IO (Either String SecretData) Source #
Get a secret from Vault. Give Just
the SecretVersion
to retrieve or Nothing
to get the current one.
λ>getSecret conn (SecretPath "MySecret") Nothing Right (SecretData (fromList [("my","password")]))
Soft secret deletion
deleteSecret :: VaultConnection -> SecretPath -> IO (Maybe Error) Source #
deleteSecretVersions :: VaultConnection -> SecretPath -> SecretVersions -> IO (Maybe Error) Source #
unDeleteSecretVersions :: VaultConnection -> SecretPath -> SecretVersions -> IO (Maybe Error) Source #
Permanent secret deletion
destroySecret :: VaultConnection -> SecretPath -> IO (Maybe Error) Source #
Permanently delete a secret, i.e. all its versions and metadata.
destroySecretVersions :: VaultConnection -> SecretPath -> SecretVersions -> IO (Either String Value) Source #
Get informations
currentSecretVersion :: VaultConnection -> SecretPath -> IO (Either String SecretVersion) Source #
Get version number of the current given secret.
readSecretMetadata :: VaultConnection -> SecretPath -> IO (Either String SecretMetadata) Source #
Retrieve versions history of the given secret.
λ: readSecretMetadata conn (SecretPath "MySecret") Right (SecretMetadata (fromList [(SecretVersion 1,Metadata {destroyed = True, deletion_time = "", created_time = "2019-05-30T13:22:58.416399224Z"}),(SecretVersion 2,Metadata {destroyed = True, deletion_time = "2019-06-29T15:28:46.145302138Z"})]))
secretsList :: VaultConnection -> SecretPath -> IO (Either String [VaultKey]) Source #
Get list of secrets and folders at the given location.
Utils
toSecretData :: [(Text, Text)] -> SecretData Source #
fromSecretData :: SecretData -> [(Text, Text)] Source #
toSecretVersions :: [Int] -> SecretVersions Source #