{-# 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.AppMesh.Types.ClientPolicyTls where
import Amazonka.AppMesh.Types.ClientTlsCertificate
import Amazonka.AppMesh.Types.TlsValidationContext
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ClientPolicyTls = ClientPolicyTls'
{
ClientPolicyTls -> Maybe [Natural]
ports :: Prelude.Maybe [Prelude.Natural],
ClientPolicyTls -> Maybe ClientTlsCertificate
certificate :: Prelude.Maybe ClientTlsCertificate,
ClientPolicyTls -> Maybe Bool
enforce :: Prelude.Maybe Prelude.Bool,
ClientPolicyTls -> TlsValidationContext
validation :: TlsValidationContext
}
deriving (ClientPolicyTls -> ClientPolicyTls -> Bool
(ClientPolicyTls -> ClientPolicyTls -> Bool)
-> (ClientPolicyTls -> ClientPolicyTls -> Bool)
-> Eq ClientPolicyTls
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClientPolicyTls -> ClientPolicyTls -> Bool
$c/= :: ClientPolicyTls -> ClientPolicyTls -> Bool
== :: ClientPolicyTls -> ClientPolicyTls -> Bool
$c== :: ClientPolicyTls -> ClientPolicyTls -> Bool
Prelude.Eq, ReadPrec [ClientPolicyTls]
ReadPrec ClientPolicyTls
Int -> ReadS ClientPolicyTls
ReadS [ClientPolicyTls]
(Int -> ReadS ClientPolicyTls)
-> ReadS [ClientPolicyTls]
-> ReadPrec ClientPolicyTls
-> ReadPrec [ClientPolicyTls]
-> Read ClientPolicyTls
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClientPolicyTls]
$creadListPrec :: ReadPrec [ClientPolicyTls]
readPrec :: ReadPrec ClientPolicyTls
$creadPrec :: ReadPrec ClientPolicyTls
readList :: ReadS [ClientPolicyTls]
$creadList :: ReadS [ClientPolicyTls]
readsPrec :: Int -> ReadS ClientPolicyTls
$creadsPrec :: Int -> ReadS ClientPolicyTls
Prelude.Read, Int -> ClientPolicyTls -> ShowS
[ClientPolicyTls] -> ShowS
ClientPolicyTls -> String
(Int -> ClientPolicyTls -> ShowS)
-> (ClientPolicyTls -> String)
-> ([ClientPolicyTls] -> ShowS)
-> Show ClientPolicyTls
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClientPolicyTls] -> ShowS
$cshowList :: [ClientPolicyTls] -> ShowS
show :: ClientPolicyTls -> String
$cshow :: ClientPolicyTls -> String
showsPrec :: Int -> ClientPolicyTls -> ShowS
$cshowsPrec :: Int -> ClientPolicyTls -> ShowS
Prelude.Show, (forall x. ClientPolicyTls -> Rep ClientPolicyTls x)
-> (forall x. Rep ClientPolicyTls x -> ClientPolicyTls)
-> Generic ClientPolicyTls
forall x. Rep ClientPolicyTls x -> ClientPolicyTls
forall x. ClientPolicyTls -> Rep ClientPolicyTls x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClientPolicyTls x -> ClientPolicyTls
$cfrom :: forall x. ClientPolicyTls -> Rep ClientPolicyTls x
Prelude.Generic)
newClientPolicyTls ::
TlsValidationContext ->
ClientPolicyTls
newClientPolicyTls :: TlsValidationContext -> ClientPolicyTls
newClientPolicyTls TlsValidationContext
pValidation_ =
ClientPolicyTls' :: Maybe [Natural]
-> Maybe ClientTlsCertificate
-> Maybe Bool
-> TlsValidationContext
-> ClientPolicyTls
ClientPolicyTls'
{ $sel:ports:ClientPolicyTls' :: Maybe [Natural]
ports = Maybe [Natural]
forall a. Maybe a
Prelude.Nothing,
$sel:certificate:ClientPolicyTls' :: Maybe ClientTlsCertificate
certificate = Maybe ClientTlsCertificate
forall a. Maybe a
Prelude.Nothing,
$sel:enforce:ClientPolicyTls' :: Maybe Bool
enforce = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:validation:ClientPolicyTls' :: TlsValidationContext
validation = TlsValidationContext
pValidation_
}
clientPolicyTls_ports :: Lens.Lens' ClientPolicyTls (Prelude.Maybe [Prelude.Natural])
clientPolicyTls_ports :: (Maybe [Natural] -> f (Maybe [Natural]))
-> ClientPolicyTls -> f ClientPolicyTls
clientPolicyTls_ports = (ClientPolicyTls -> Maybe [Natural])
-> (ClientPolicyTls -> Maybe [Natural] -> ClientPolicyTls)
-> Lens
ClientPolicyTls ClientPolicyTls (Maybe [Natural]) (Maybe [Natural])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientPolicyTls' {Maybe [Natural]
ports :: Maybe [Natural]
$sel:ports:ClientPolicyTls' :: ClientPolicyTls -> Maybe [Natural]
ports} -> Maybe [Natural]
ports) (\s :: ClientPolicyTls
s@ClientPolicyTls' {} Maybe [Natural]
a -> ClientPolicyTls
s {$sel:ports:ClientPolicyTls' :: Maybe [Natural]
ports = Maybe [Natural]
a} :: ClientPolicyTls) ((Maybe [Natural] -> f (Maybe [Natural]))
-> ClientPolicyTls -> f ClientPolicyTls)
-> ((Maybe [Natural] -> f (Maybe [Natural]))
-> Maybe [Natural] -> f (Maybe [Natural]))
-> (Maybe [Natural] -> f (Maybe [Natural]))
-> ClientPolicyTls
-> f ClientPolicyTls
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Natural] [Natural] [Natural] [Natural]
-> Iso
(Maybe [Natural])
(Maybe [Natural])
(Maybe [Natural])
(Maybe [Natural])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Natural] [Natural] [Natural] [Natural]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
clientPolicyTls_certificate :: Lens.Lens' ClientPolicyTls (Prelude.Maybe ClientTlsCertificate)
clientPolicyTls_certificate :: (Maybe ClientTlsCertificate -> f (Maybe ClientTlsCertificate))
-> ClientPolicyTls -> f ClientPolicyTls
clientPolicyTls_certificate = (ClientPolicyTls -> Maybe ClientTlsCertificate)
-> (ClientPolicyTls
-> Maybe ClientTlsCertificate -> ClientPolicyTls)
-> Lens
ClientPolicyTls
ClientPolicyTls
(Maybe ClientTlsCertificate)
(Maybe ClientTlsCertificate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientPolicyTls' {Maybe ClientTlsCertificate
certificate :: Maybe ClientTlsCertificate
$sel:certificate:ClientPolicyTls' :: ClientPolicyTls -> Maybe ClientTlsCertificate
certificate} -> Maybe ClientTlsCertificate
certificate) (\s :: ClientPolicyTls
s@ClientPolicyTls' {} Maybe ClientTlsCertificate
a -> ClientPolicyTls
s {$sel:certificate:ClientPolicyTls' :: Maybe ClientTlsCertificate
certificate = Maybe ClientTlsCertificate
a} :: ClientPolicyTls)
clientPolicyTls_enforce :: Lens.Lens' ClientPolicyTls (Prelude.Maybe Prelude.Bool)
clientPolicyTls_enforce :: (Maybe Bool -> f (Maybe Bool))
-> ClientPolicyTls -> f ClientPolicyTls
clientPolicyTls_enforce = (ClientPolicyTls -> Maybe Bool)
-> (ClientPolicyTls -> Maybe Bool -> ClientPolicyTls)
-> Lens ClientPolicyTls ClientPolicyTls (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientPolicyTls' {Maybe Bool
enforce :: Maybe Bool
$sel:enforce:ClientPolicyTls' :: ClientPolicyTls -> Maybe Bool
enforce} -> Maybe Bool
enforce) (\s :: ClientPolicyTls
s@ClientPolicyTls' {} Maybe Bool
a -> ClientPolicyTls
s {$sel:enforce:ClientPolicyTls' :: Maybe Bool
enforce = Maybe Bool
a} :: ClientPolicyTls)
clientPolicyTls_validation :: Lens.Lens' ClientPolicyTls TlsValidationContext
clientPolicyTls_validation :: (TlsValidationContext -> f TlsValidationContext)
-> ClientPolicyTls -> f ClientPolicyTls
clientPolicyTls_validation = (ClientPolicyTls -> TlsValidationContext)
-> (ClientPolicyTls -> TlsValidationContext -> ClientPolicyTls)
-> Lens
ClientPolicyTls
ClientPolicyTls
TlsValidationContext
TlsValidationContext
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientPolicyTls' {TlsValidationContext
validation :: TlsValidationContext
$sel:validation:ClientPolicyTls' :: ClientPolicyTls -> TlsValidationContext
validation} -> TlsValidationContext
validation) (\s :: ClientPolicyTls
s@ClientPolicyTls' {} TlsValidationContext
a -> ClientPolicyTls
s {$sel:validation:ClientPolicyTls' :: TlsValidationContext
validation = TlsValidationContext
a} :: ClientPolicyTls)
instance Core.FromJSON ClientPolicyTls where
parseJSON :: Value -> Parser ClientPolicyTls
parseJSON =
String
-> (Object -> Parser ClientPolicyTls)
-> Value
-> Parser ClientPolicyTls
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ClientPolicyTls"
( \Object
x ->
Maybe [Natural]
-> Maybe ClientTlsCertificate
-> Maybe Bool
-> TlsValidationContext
-> ClientPolicyTls
ClientPolicyTls'
(Maybe [Natural]
-> Maybe ClientTlsCertificate
-> Maybe Bool
-> TlsValidationContext
-> ClientPolicyTls)
-> Parser (Maybe [Natural])
-> Parser
(Maybe ClientTlsCertificate
-> Maybe Bool -> TlsValidationContext -> ClientPolicyTls)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Natural]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ports" Parser (Maybe (Maybe [Natural]))
-> Maybe [Natural] -> Parser (Maybe [Natural])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Natural]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe ClientTlsCertificate
-> Maybe Bool -> TlsValidationContext -> ClientPolicyTls)
-> Parser (Maybe ClientTlsCertificate)
-> Parser (Maybe Bool -> TlsValidationContext -> ClientPolicyTls)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ClientTlsCertificate)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"certificate")
Parser (Maybe Bool -> TlsValidationContext -> ClientPolicyTls)
-> Parser (Maybe Bool)
-> Parser (TlsValidationContext -> ClientPolicyTls)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"enforce")
Parser (TlsValidationContext -> ClientPolicyTls)
-> Parser TlsValidationContext -> Parser ClientPolicyTls
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser TlsValidationContext
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"validation")
)
instance Prelude.Hashable ClientPolicyTls
instance Prelude.NFData ClientPolicyTls
instance Core.ToJSON ClientPolicyTls where
toJSON :: ClientPolicyTls -> Value
toJSON ClientPolicyTls' {Maybe Bool
Maybe [Natural]
Maybe ClientTlsCertificate
TlsValidationContext
validation :: TlsValidationContext
enforce :: Maybe Bool
certificate :: Maybe ClientTlsCertificate
ports :: Maybe [Natural]
$sel:validation:ClientPolicyTls' :: ClientPolicyTls -> TlsValidationContext
$sel:enforce:ClientPolicyTls' :: ClientPolicyTls -> Maybe Bool
$sel:certificate:ClientPolicyTls' :: ClientPolicyTls -> Maybe ClientTlsCertificate
$sel:ports:ClientPolicyTls' :: ClientPolicyTls -> Maybe [Natural]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ports" Text -> [Natural] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Natural] -> Pair) -> Maybe [Natural] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Natural]
ports,
(Text
"certificate" Text -> ClientTlsCertificate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ClientTlsCertificate -> Pair)
-> Maybe ClientTlsCertificate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ClientTlsCertificate
certificate,
(Text
"enforce" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enforce,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"validation" Text -> TlsValidationContext -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TlsValidationContext
validation)
]
)