confcrypt-0.2.3.3

Safe HaskellNone
LanguageHaskell2010

ConfCrypt.Commands

Contents

Synopsis

Commands

class Monad m => Command a m Source #

All confcrypt commands can be generalized into an evaluate call. In reality, instances likely need to provide some environment, although that's not required as everything could be contained as record fields of the command argument itself.

Minimal complete definition

evaluate

Instances
Monad m => Command NewConfCrypt (ConfCryptM m ()) Source # 
Instance details

Defined in ConfCrypt.Commands

(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command ValidateConfCrypt (ConfCryptM m key) Source # 
Instance details

Defined in ConfCrypt.Commands

Monad m => Command DeleteConfCrypt (ConfCryptM m ()) Source # 
Instance details

Defined in ConfCrypt.Commands

(Monad m, MonadRandom m, MonadEncrypt (ConfCryptM m key) key) => Command EditConfCrypt (ConfCryptM m key) Source # 
Instance details

Defined in ConfCrypt.Commands

(Monad m, MonadRandom m, MonadEncrypt (ConfCryptM m key) key) => Command AddConfCrypt (ConfCryptM m key) Source # 
Instance details

Defined in ConfCrypt.Commands

(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command GetConfCrypt (ConfCryptM m key) Source # 
Instance details

Defined in ConfCrypt.Commands

(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command ReadConfCrypt (ConfCryptM m key) Source # 
Instance details

Defined in ConfCrypt.Commands

evaluate :: Command a m => a -> m [Text] Source #

Supported Commands

data ReadConfCrypt Source #

Read and return the full contents of an encrypted file. Provides support for using a local RSA key or an externl KMS service

Constructors

ReadConfCrypt 

Fields

Instances
Eq ReadConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Read ReadConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Show ReadConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Generic ReadConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Associated Types

type Rep ReadConfCrypt :: Type -> Type #

(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command ReadConfCrypt (ConfCryptM m key) Source # 
Instance details

Defined in ConfCrypt.Commands

type Rep ReadConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

type Rep ReadConfCrypt = D1 (MetaData "ReadConfCrypt" "ConfCrypt.Commands" "confcrypt-0.2.3.3-JN2386SeMyBBN6Jeq5fw33" False) (C1 (MetaCons "ReadConfCrypt" PrefixI True) (S1 (MetaSel (Just "rTemplate") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text))))

data GetConfCrypt Source #

Used to get the decrypted value of a single encrypted config parameter

Constructors

GetConfCrypt 

Fields

Instances
Eq GetConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Read GetConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Show GetConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Generic GetConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Associated Types

type Rep GetConfCrypt :: Type -> Type #

(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command GetConfCrypt (ConfCryptM m key) Source # 
Instance details

Defined in ConfCrypt.Commands

type Rep GetConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

type Rep GetConfCrypt = D1 (MetaData "GetConfCrypt" "ConfCrypt.Commands" "confcrypt-0.2.3.3-JN2386SeMyBBN6Jeq5fw33" False) (C1 (MetaCons "GetConfCrypt" PrefixI True) (S1 (MetaSel (Just "gName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data AddConfCrypt Source #

Used to add a new config parameter to the file

Constructors

AddConfCrypt 

Fields

Instances
Eq AddConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Read AddConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Show AddConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Generic AddConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Associated Types

type Rep AddConfCrypt :: Type -> Type #

(Monad m, MonadRandom m, MonadEncrypt (ConfCryptM m key) key) => Command AddConfCrypt (ConfCryptM m key) Source # 
Instance details

Defined in ConfCrypt.Commands

type Rep AddConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

type Rep AddConfCrypt = D1 (MetaData "AddConfCrypt" "ConfCrypt.Commands" "confcrypt-0.2.3.3-JN2386SeMyBBN6Jeq5fw33" False) (C1 (MetaCons "AddConfCrypt" PrefixI True) (S1 (MetaSel (Just "aName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: (S1 (MetaSel (Just "aValue") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: S1 (MetaSel (Just "aType") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SchemaType))))

data EditConfCrypt Source #

Modify the value or type of a parameter in-place. This should result in a diff touching only the impacted lines. Very important that this property holds to make reviews easier.

Constructors

EditConfCrypt 

Fields

Instances
Eq EditConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Read EditConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Show EditConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Generic EditConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Associated Types

type Rep EditConfCrypt :: Type -> Type #

(Monad m, MonadRandom m, MonadEncrypt (ConfCryptM m key) key) => Command EditConfCrypt (ConfCryptM m key) Source # 
Instance details

Defined in ConfCrypt.Commands

type Rep EditConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

type Rep EditConfCrypt = D1 (MetaData "EditConfCrypt" "ConfCrypt.Commands" "confcrypt-0.2.3.3-JN2386SeMyBBN6Jeq5fw33" False) (C1 (MetaCons "EditConfCrypt" PrefixI True) (S1 (MetaSel (Just "eName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: (S1 (MetaSel (Just "eValue") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: S1 (MetaSel (Just "eType") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SchemaType))))

data DeleteConfCrypt Source #

Removes a particular parameter and schema from the config file. This does not require an encryption key because the lines may simply be deleted based on the parameter name.

Constructors

DeleteConfCrypt 

Fields

Instances
Eq DeleteConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Read DeleteConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Show DeleteConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Generic DeleteConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

Associated Types

type Rep DeleteConfCrypt :: Type -> Type #

Monad m => Command DeleteConfCrypt (ConfCryptM m ()) Source # 
Instance details

Defined in ConfCrypt.Commands

type Rep DeleteConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

type Rep DeleteConfCrypt = D1 (MetaData "DeleteConfCrypt" "ConfCrypt.Commands" "confcrypt-0.2.3.3-JN2386SeMyBBN6Jeq5fw33" False) (C1 (MetaCons "DeleteConfCrypt" PrefixI True) (S1 (MetaSel (Just "dName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data ValidateConfCrypt Source #

Run all of the rules in Validation on this file.

Constructors

ValidateConfCrypt 
Instances
(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command ValidateConfCrypt (ConfCryptM m key) Source # 
Instance details

Defined in ConfCrypt.Commands

data NewConfCrypt Source #

Dumps the contents of defaultLines to the output buffer. This is the same example config used in the readme.

Constructors

NewConfCrypt 
Instances
Monad m => Command NewConfCrypt (ConfCryptM m ()) Source # 
Instance details

Defined in ConfCrypt.Commands

Utilities

data FileAction Source #

Commands may perform one of the following operations to a line of a confcrypt file

Constructors

Add 
Edit 
Remove 

Exported for testing

genNewFileState Source #

Arguments

:: (Monad m, MonadError ConfCryptError m) 
=> Map ConfCryptElement LineNumber

initial file state

-> [(ConfCryptElement, FileAction)]

edits

-> m (Map ConfCryptElement LineNumber)

new file, with edits applied in-place

Given a known file state and some edits, apply the edits and produce the new file contents

writeFullContentsToBuffer :: Monad m => Bool -> Map ConfCryptElement LineNumber -> m [Text] Source #

Writes the provided ConfCryptFile (provided as a Map) to the output buffer in line-number order. This allows for producing an easily diffable output and makes in-place edits easy to spot in source control diffs.