{-# 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.ListenerTls where
import Amazonka.AppMesh.Types.ListenerTlsCertificate
import Amazonka.AppMesh.Types.ListenerTlsMode
import Amazonka.AppMesh.Types.ListenerTlsValidationContext
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ListenerTls = ListenerTls'
{
ListenerTls -> Maybe ListenerTlsValidationContext
validation :: Prelude.Maybe ListenerTlsValidationContext,
ListenerTls -> ListenerTlsCertificate
certificate :: ListenerTlsCertificate,
ListenerTls -> ListenerTlsMode
mode :: ListenerTlsMode
}
deriving (ListenerTls -> ListenerTls -> Bool
(ListenerTls -> ListenerTls -> Bool)
-> (ListenerTls -> ListenerTls -> Bool) -> Eq ListenerTls
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListenerTls -> ListenerTls -> Bool
$c/= :: ListenerTls -> ListenerTls -> Bool
== :: ListenerTls -> ListenerTls -> Bool
$c== :: ListenerTls -> ListenerTls -> Bool
Prelude.Eq, ReadPrec [ListenerTls]
ReadPrec ListenerTls
Int -> ReadS ListenerTls
ReadS [ListenerTls]
(Int -> ReadS ListenerTls)
-> ReadS [ListenerTls]
-> ReadPrec ListenerTls
-> ReadPrec [ListenerTls]
-> Read ListenerTls
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListenerTls]
$creadListPrec :: ReadPrec [ListenerTls]
readPrec :: ReadPrec ListenerTls
$creadPrec :: ReadPrec ListenerTls
readList :: ReadS [ListenerTls]
$creadList :: ReadS [ListenerTls]
readsPrec :: Int -> ReadS ListenerTls
$creadsPrec :: Int -> ReadS ListenerTls
Prelude.Read, Int -> ListenerTls -> ShowS
[ListenerTls] -> ShowS
ListenerTls -> String
(Int -> ListenerTls -> ShowS)
-> (ListenerTls -> String)
-> ([ListenerTls] -> ShowS)
-> Show ListenerTls
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListenerTls] -> ShowS
$cshowList :: [ListenerTls] -> ShowS
show :: ListenerTls -> String
$cshow :: ListenerTls -> String
showsPrec :: Int -> ListenerTls -> ShowS
$cshowsPrec :: Int -> ListenerTls -> ShowS
Prelude.Show, (forall x. ListenerTls -> Rep ListenerTls x)
-> (forall x. Rep ListenerTls x -> ListenerTls)
-> Generic ListenerTls
forall x. Rep ListenerTls x -> ListenerTls
forall x. ListenerTls -> Rep ListenerTls x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListenerTls x -> ListenerTls
$cfrom :: forall x. ListenerTls -> Rep ListenerTls x
Prelude.Generic)
newListenerTls ::
ListenerTlsCertificate ->
ListenerTlsMode ->
ListenerTls
newListenerTls :: ListenerTlsCertificate -> ListenerTlsMode -> ListenerTls
newListenerTls ListenerTlsCertificate
pCertificate_ ListenerTlsMode
pMode_ =
ListenerTls' :: Maybe ListenerTlsValidationContext
-> ListenerTlsCertificate -> ListenerTlsMode -> ListenerTls
ListenerTls'
{ $sel:validation:ListenerTls' :: Maybe ListenerTlsValidationContext
validation = Maybe ListenerTlsValidationContext
forall a. Maybe a
Prelude.Nothing,
$sel:certificate:ListenerTls' :: ListenerTlsCertificate
certificate = ListenerTlsCertificate
pCertificate_,
$sel:mode:ListenerTls' :: ListenerTlsMode
mode = ListenerTlsMode
pMode_
}
listenerTls_validation :: Lens.Lens' ListenerTls (Prelude.Maybe ListenerTlsValidationContext)
listenerTls_validation :: (Maybe ListenerTlsValidationContext
-> f (Maybe ListenerTlsValidationContext))
-> ListenerTls -> f ListenerTls
listenerTls_validation = (ListenerTls -> Maybe ListenerTlsValidationContext)
-> (ListenerTls
-> Maybe ListenerTlsValidationContext -> ListenerTls)
-> Lens
ListenerTls
ListenerTls
(Maybe ListenerTlsValidationContext)
(Maybe ListenerTlsValidationContext)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListenerTls' {Maybe ListenerTlsValidationContext
validation :: Maybe ListenerTlsValidationContext
$sel:validation:ListenerTls' :: ListenerTls -> Maybe ListenerTlsValidationContext
validation} -> Maybe ListenerTlsValidationContext
validation) (\s :: ListenerTls
s@ListenerTls' {} Maybe ListenerTlsValidationContext
a -> ListenerTls
s {$sel:validation:ListenerTls' :: Maybe ListenerTlsValidationContext
validation = Maybe ListenerTlsValidationContext
a} :: ListenerTls)
listenerTls_certificate :: Lens.Lens' ListenerTls ListenerTlsCertificate
listenerTls_certificate :: (ListenerTlsCertificate -> f ListenerTlsCertificate)
-> ListenerTls -> f ListenerTls
listenerTls_certificate = (ListenerTls -> ListenerTlsCertificate)
-> (ListenerTls -> ListenerTlsCertificate -> ListenerTls)
-> Lens
ListenerTls
ListenerTls
ListenerTlsCertificate
ListenerTlsCertificate
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListenerTls' {ListenerTlsCertificate
certificate :: ListenerTlsCertificate
$sel:certificate:ListenerTls' :: ListenerTls -> ListenerTlsCertificate
certificate} -> ListenerTlsCertificate
certificate) (\s :: ListenerTls
s@ListenerTls' {} ListenerTlsCertificate
a -> ListenerTls
s {$sel:certificate:ListenerTls' :: ListenerTlsCertificate
certificate = ListenerTlsCertificate
a} :: ListenerTls)
listenerTls_mode :: Lens.Lens' ListenerTls ListenerTlsMode
listenerTls_mode :: (ListenerTlsMode -> f ListenerTlsMode)
-> ListenerTls -> f ListenerTls
listenerTls_mode = (ListenerTls -> ListenerTlsMode)
-> (ListenerTls -> ListenerTlsMode -> ListenerTls)
-> Lens ListenerTls ListenerTls ListenerTlsMode ListenerTlsMode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListenerTls' {ListenerTlsMode
mode :: ListenerTlsMode
$sel:mode:ListenerTls' :: ListenerTls -> ListenerTlsMode
mode} -> ListenerTlsMode
mode) (\s :: ListenerTls
s@ListenerTls' {} ListenerTlsMode
a -> ListenerTls
s {$sel:mode:ListenerTls' :: ListenerTlsMode
mode = ListenerTlsMode
a} :: ListenerTls)
instance Core.FromJSON ListenerTls where
parseJSON :: Value -> Parser ListenerTls
parseJSON =
String
-> (Object -> Parser ListenerTls) -> Value -> Parser ListenerTls
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ListenerTls"
( \Object
x ->
Maybe ListenerTlsValidationContext
-> ListenerTlsCertificate -> ListenerTlsMode -> ListenerTls
ListenerTls'
(Maybe ListenerTlsValidationContext
-> ListenerTlsCertificate -> ListenerTlsMode -> ListenerTls)
-> Parser (Maybe ListenerTlsValidationContext)
-> Parser
(ListenerTlsCertificate -> ListenerTlsMode -> ListenerTls)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ListenerTlsValidationContext)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"validation")
Parser (ListenerTlsCertificate -> ListenerTlsMode -> ListenerTls)
-> Parser ListenerTlsCertificate
-> Parser (ListenerTlsMode -> ListenerTls)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ListenerTlsCertificate
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"certificate")
Parser (ListenerTlsMode -> ListenerTls)
-> Parser ListenerTlsMode -> Parser ListenerTls
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ListenerTlsMode
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"mode")
)
instance Prelude.Hashable ListenerTls
instance Prelude.NFData ListenerTls
instance Core.ToJSON ListenerTls where
toJSON :: ListenerTls -> Value
toJSON ListenerTls' {Maybe ListenerTlsValidationContext
ListenerTlsMode
ListenerTlsCertificate
mode :: ListenerTlsMode
certificate :: ListenerTlsCertificate
validation :: Maybe ListenerTlsValidationContext
$sel:mode:ListenerTls' :: ListenerTls -> ListenerTlsMode
$sel:certificate:ListenerTls' :: ListenerTls -> ListenerTlsCertificate
$sel:validation:ListenerTls' :: ListenerTls -> Maybe ListenerTlsValidationContext
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"validation" Text -> ListenerTlsValidationContext -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ListenerTlsValidationContext -> Pair)
-> Maybe ListenerTlsValidationContext -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ListenerTlsValidationContext
validation,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"certificate" Text -> ListenerTlsCertificate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ListenerTlsCertificate
certificate),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"mode" Text -> ListenerTlsMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ListenerTlsMode
mode)
]
)