{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.AppConfig.Types.Validator where
import Amazonka.AppConfig.Types.ValidatorType
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data Validator = Validator'
{
Validator -> ValidatorType
type' :: ValidatorType,
Validator -> Sensitive Text
content :: Data.Sensitive Prelude.Text
}
deriving (Validator -> Validator -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Validator -> Validator -> Bool
$c/= :: Validator -> Validator -> Bool
== :: Validator -> Validator -> Bool
$c== :: Validator -> Validator -> Bool
Prelude.Eq, Int -> Validator -> ShowS
[Validator] -> ShowS
Validator -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Validator] -> ShowS
$cshowList :: [Validator] -> ShowS
show :: Validator -> String
$cshow :: Validator -> String
showsPrec :: Int -> Validator -> ShowS
$cshowsPrec :: Int -> Validator -> ShowS
Prelude.Show, forall x. Rep Validator x -> Validator
forall x. Validator -> Rep Validator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Validator x -> Validator
$cfrom :: forall x. Validator -> Rep Validator x
Prelude.Generic)
newValidator ::
ValidatorType ->
Prelude.Text ->
Validator
newValidator :: ValidatorType -> Text -> Validator
newValidator ValidatorType
pType_ Text
pContent_ =
Validator'
{ $sel:type':Validator' :: ValidatorType
type' = ValidatorType
pType_,
$sel:content:Validator' :: Sensitive Text
content = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pContent_
}
validator_type :: Lens.Lens' Validator ValidatorType
validator_type :: Lens' Validator ValidatorType
validator_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Validator' {ValidatorType
type' :: ValidatorType
$sel:type':Validator' :: Validator -> ValidatorType
type'} -> ValidatorType
type') (\s :: Validator
s@Validator' {} ValidatorType
a -> Validator
s {$sel:type':Validator' :: ValidatorType
type' = ValidatorType
a} :: Validator)
validator_content :: Lens.Lens' Validator Prelude.Text
validator_content :: Lens' Validator Text
validator_content = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Validator' {Sensitive Text
content :: Sensitive Text
$sel:content:Validator' :: Validator -> Sensitive Text
content} -> Sensitive Text
content) (\s :: Validator
s@Validator' {} Sensitive Text
a -> Validator
s {$sel:content:Validator' :: Sensitive Text
content = Sensitive Text
a} :: Validator) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
instance Data.FromJSON Validator where
parseJSON :: Value -> Parser Validator
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Validator"
( \Object
x ->
ValidatorType -> Sensitive Text -> Validator
Validator'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Type")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Content")
)
instance Prelude.Hashable Validator where
hashWithSalt :: Int -> Validator -> Int
hashWithSalt Int
_salt Validator' {Sensitive Text
ValidatorType
content :: Sensitive Text
type' :: ValidatorType
$sel:content:Validator' :: Validator -> Sensitive Text
$sel:type':Validator' :: Validator -> ValidatorType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ValidatorType
type'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
content
instance Prelude.NFData Validator where
rnf :: Validator -> ()
rnf Validator' {Sensitive Text
ValidatorType
content :: Sensitive Text
type' :: ValidatorType
$sel:content:Validator' :: Validator -> Sensitive Text
$sel:type':Validator' :: Validator -> ValidatorType
..} =
forall a. NFData a => a -> ()
Prelude.rnf ValidatorType
type' seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
content
instance Data.ToJSON Validator where
toJSON :: Validator -> Value
toJSON Validator' {Sensitive Text
ValidatorType
content :: Sensitive Text
type' :: ValidatorType
$sel:content:Validator' :: Validator -> Sensitive Text
$sel:type':Validator' :: Validator -> ValidatorType
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ValidatorType
type'),
forall a. a -> Maybe a
Prelude.Just (Key
"Content" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
content)
]
)