confcrypt-0.1.0.2

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.

In reality the return type of evalutate is Text, this needs to be cleaned up in the upcoming version.

Minimal complete definition

evaluate

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

Defined in ConfCrypt.Commands

Methods

evaluate :: NewConfCrypt -> ConfCryptM m () () Source #

(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

Methods

evaluate :: EditConfCrypt -> ConfCryptM m key () Source #

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

Defined in ConfCrypt.Commands

Methods

evaluate :: AddConfCrypt -> ConfCryptM m key () Source #

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

Defined in ConfCrypt.Commands

Methods

evaluate :: ReadConfCrypt -> ConfCryptM m key () Source #

evaluate :: Command a m => a -> m () 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 
Instances
(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command ReadConfCrypt (ConfCryptM m key) Source # 
Instance details

Defined in ConfCrypt.Commands

Methods

evaluate :: ReadConfCrypt -> ConfCryptM m key () Source #

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 :: * -> * #

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

Defined in ConfCrypt.Commands

Methods

evaluate :: AddConfCrypt -> ConfCryptM m key () Source #

type Rep AddConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

type Rep AddConfCrypt = D1 (MetaData "AddConfCrypt" "ConfCrypt.Commands" "confcrypt-0.1.0.2-7chRjBoKc1kLQPYLfVMow1" 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 :: * -> * #

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

Defined in ConfCrypt.Commands

Methods

evaluate :: EditConfCrypt -> ConfCryptM m key () Source #

type Rep EditConfCrypt Source # 
Instance details

Defined in ConfCrypt.Commands

type Rep EditConfCrypt = D1 (MetaData "EditConfCrypt" "ConfCrypt.Commands" "confcrypt-0.1.0.2-7chRjBoKc1kLQPYLfVMow1" 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 :: * -> * #

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.1.0.2-7chRjBoKc1kLQPYLfVMow1" 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

Methods

evaluate :: NewConfCrypt -> ConfCryptM m () () Source #

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, MonadWriter [Text] m) => Bool -> Map ConfCryptElement LineNumber -> m () 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.