{-# 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.CloudWatchEvents.Types.Connection where
import Amazonka.CloudWatchEvents.Types.ConnectionAuthorizationType
import Amazonka.CloudWatchEvents.Types.ConnectionState
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Connection = Connection'
{
Connection -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
Connection -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Core.POSIX,
Connection -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Connection -> Maybe POSIX
lastAuthorizedTime :: Prelude.Maybe Core.POSIX,
Connection -> Maybe ConnectionAuthorizationType
authorizationType :: Prelude.Maybe ConnectionAuthorizationType,
Connection -> Maybe Text
connectionArn :: Prelude.Maybe Prelude.Text,
Connection -> Maybe Text
stateReason :: Prelude.Maybe Prelude.Text,
Connection -> Maybe ConnectionState
connectionState :: Prelude.Maybe ConnectionState
}
deriving (Connection -> Connection -> Bool
(Connection -> Connection -> Bool)
-> (Connection -> Connection -> Bool) -> Eq Connection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Connection -> Connection -> Bool
$c/= :: Connection -> Connection -> Bool
== :: Connection -> Connection -> Bool
$c== :: Connection -> Connection -> Bool
Prelude.Eq, ReadPrec [Connection]
ReadPrec Connection
Int -> ReadS Connection
ReadS [Connection]
(Int -> ReadS Connection)
-> ReadS [Connection]
-> ReadPrec Connection
-> ReadPrec [Connection]
-> Read Connection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Connection]
$creadListPrec :: ReadPrec [Connection]
readPrec :: ReadPrec Connection
$creadPrec :: ReadPrec Connection
readList :: ReadS [Connection]
$creadList :: ReadS [Connection]
readsPrec :: Int -> ReadS Connection
$creadsPrec :: Int -> ReadS Connection
Prelude.Read, Int -> Connection -> ShowS
[Connection] -> ShowS
Connection -> String
(Int -> Connection -> ShowS)
-> (Connection -> String)
-> ([Connection] -> ShowS)
-> Show Connection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Connection] -> ShowS
$cshowList :: [Connection] -> ShowS
show :: Connection -> String
$cshow :: Connection -> String
showsPrec :: Int -> Connection -> ShowS
$cshowsPrec :: Int -> Connection -> ShowS
Prelude.Show, (forall x. Connection -> Rep Connection x)
-> (forall x. Rep Connection x -> Connection) -> Generic Connection
forall x. Rep Connection x -> Connection
forall x. Connection -> Rep Connection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Connection x -> Connection
$cfrom :: forall x. Connection -> Rep Connection x
Prelude.Generic)
newConnection ::
Connection
newConnection :: Connection
newConnection =
Connection' :: Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe ConnectionAuthorizationType
-> Maybe Text
-> Maybe Text
-> Maybe ConnectionState
-> Connection
Connection'
{ $sel:creationTime:Connection' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:lastModifiedTime:Connection' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:name:Connection' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:lastAuthorizedTime:Connection' :: Maybe POSIX
lastAuthorizedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:authorizationType:Connection' :: Maybe ConnectionAuthorizationType
authorizationType = Maybe ConnectionAuthorizationType
forall a. Maybe a
Prelude.Nothing,
$sel:connectionArn:Connection' :: Maybe Text
connectionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:stateReason:Connection' :: Maybe Text
stateReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:connectionState:Connection' :: Maybe ConnectionState
connectionState = Maybe ConnectionState
forall a. Maybe a
Prelude.Nothing
}
connection_creationTime :: Lens.Lens' Connection (Prelude.Maybe Prelude.UTCTime)
connection_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Connection -> f Connection
connection_creationTime = (Connection -> Maybe POSIX)
-> (Connection -> Maybe POSIX -> Connection)
-> Lens Connection Connection (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Connection' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:Connection' :: Connection -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: Connection
s@Connection' {} Maybe POSIX
a -> Connection
s {$sel:creationTime:Connection' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: Connection) ((Maybe POSIX -> f (Maybe POSIX)) -> Connection -> f Connection)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Connection
-> f Connection
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
connection_lastModifiedTime :: Lens.Lens' Connection (Prelude.Maybe Prelude.UTCTime)
connection_lastModifiedTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Connection -> f Connection
connection_lastModifiedTime = (Connection -> Maybe POSIX)
-> (Connection -> Maybe POSIX -> Connection)
-> Lens Connection Connection (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Connection' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:Connection' :: Connection -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: Connection
s@Connection' {} Maybe POSIX
a -> Connection
s {$sel:lastModifiedTime:Connection' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: Connection) ((Maybe POSIX -> f (Maybe POSIX)) -> Connection -> f Connection)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Connection
-> f Connection
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
connection_name :: Lens.Lens' Connection (Prelude.Maybe Prelude.Text)
connection_name :: (Maybe Text -> f (Maybe Text)) -> Connection -> f Connection
connection_name = (Connection -> Maybe Text)
-> (Connection -> Maybe Text -> Connection)
-> Lens Connection Connection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Connection' {Maybe Text
name :: Maybe Text
$sel:name:Connection' :: Connection -> Maybe Text
name} -> Maybe Text
name) (\s :: Connection
s@Connection' {} Maybe Text
a -> Connection
s {$sel:name:Connection' :: Maybe Text
name = Maybe Text
a} :: Connection)
connection_lastAuthorizedTime :: Lens.Lens' Connection (Prelude.Maybe Prelude.UTCTime)
connection_lastAuthorizedTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Connection -> f Connection
connection_lastAuthorizedTime = (Connection -> Maybe POSIX)
-> (Connection -> Maybe POSIX -> Connection)
-> Lens Connection Connection (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Connection' {Maybe POSIX
lastAuthorizedTime :: Maybe POSIX
$sel:lastAuthorizedTime:Connection' :: Connection -> Maybe POSIX
lastAuthorizedTime} -> Maybe POSIX
lastAuthorizedTime) (\s :: Connection
s@Connection' {} Maybe POSIX
a -> Connection
s {$sel:lastAuthorizedTime:Connection' :: Maybe POSIX
lastAuthorizedTime = Maybe POSIX
a} :: Connection) ((Maybe POSIX -> f (Maybe POSIX)) -> Connection -> f Connection)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Connection
-> f Connection
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
connection_authorizationType :: Lens.Lens' Connection (Prelude.Maybe ConnectionAuthorizationType)
connection_authorizationType :: (Maybe ConnectionAuthorizationType
-> f (Maybe ConnectionAuthorizationType))
-> Connection -> f Connection
connection_authorizationType = (Connection -> Maybe ConnectionAuthorizationType)
-> (Connection -> Maybe ConnectionAuthorizationType -> Connection)
-> Lens
Connection
Connection
(Maybe ConnectionAuthorizationType)
(Maybe ConnectionAuthorizationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Connection' {Maybe ConnectionAuthorizationType
authorizationType :: Maybe ConnectionAuthorizationType
$sel:authorizationType:Connection' :: Connection -> Maybe ConnectionAuthorizationType
authorizationType} -> Maybe ConnectionAuthorizationType
authorizationType) (\s :: Connection
s@Connection' {} Maybe ConnectionAuthorizationType
a -> Connection
s {$sel:authorizationType:Connection' :: Maybe ConnectionAuthorizationType
authorizationType = Maybe ConnectionAuthorizationType
a} :: Connection)
connection_connectionArn :: Lens.Lens' Connection (Prelude.Maybe Prelude.Text)
connection_connectionArn :: (Maybe Text -> f (Maybe Text)) -> Connection -> f Connection
connection_connectionArn = (Connection -> Maybe Text)
-> (Connection -> Maybe Text -> Connection)
-> Lens Connection Connection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Connection' {Maybe Text
connectionArn :: Maybe Text
$sel:connectionArn:Connection' :: Connection -> Maybe Text
connectionArn} -> Maybe Text
connectionArn) (\s :: Connection
s@Connection' {} Maybe Text
a -> Connection
s {$sel:connectionArn:Connection' :: Maybe Text
connectionArn = Maybe Text
a} :: Connection)
connection_stateReason :: Lens.Lens' Connection (Prelude.Maybe Prelude.Text)
connection_stateReason :: (Maybe Text -> f (Maybe Text)) -> Connection -> f Connection
connection_stateReason = (Connection -> Maybe Text)
-> (Connection -> Maybe Text -> Connection)
-> Lens Connection Connection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Connection' {Maybe Text
stateReason :: Maybe Text
$sel:stateReason:Connection' :: Connection -> Maybe Text
stateReason} -> Maybe Text
stateReason) (\s :: Connection
s@Connection' {} Maybe Text
a -> Connection
s {$sel:stateReason:Connection' :: Maybe Text
stateReason = Maybe Text
a} :: Connection)
connection_connectionState :: Lens.Lens' Connection (Prelude.Maybe ConnectionState)
connection_connectionState :: (Maybe ConnectionState -> f (Maybe ConnectionState))
-> Connection -> f Connection
connection_connectionState = (Connection -> Maybe ConnectionState)
-> (Connection -> Maybe ConnectionState -> Connection)
-> Lens
Connection
Connection
(Maybe ConnectionState)
(Maybe ConnectionState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Connection' {Maybe ConnectionState
connectionState :: Maybe ConnectionState
$sel:connectionState:Connection' :: Connection -> Maybe ConnectionState
connectionState} -> Maybe ConnectionState
connectionState) (\s :: Connection
s@Connection' {} Maybe ConnectionState
a -> Connection
s {$sel:connectionState:Connection' :: Maybe ConnectionState
connectionState = Maybe ConnectionState
a} :: Connection)
instance Core.FromJSON Connection where
parseJSON :: Value -> Parser Connection
parseJSON =
String
-> (Object -> Parser Connection) -> Value -> Parser Connection
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Connection"
( \Object
x ->
Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe ConnectionAuthorizationType
-> Maybe Text
-> Maybe Text
-> Maybe ConnectionState
-> Connection
Connection'
(Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe ConnectionAuthorizationType
-> Maybe Text
-> Maybe Text
-> Maybe ConnectionState
-> Connection)
-> Parser (Maybe POSIX)
-> Parser
(Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe ConnectionAuthorizationType
-> Maybe Text
-> Maybe Text
-> Maybe ConnectionState
-> Connection)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationTime")
Parser
(Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe ConnectionAuthorizationType
-> Maybe Text
-> Maybe Text
-> Maybe ConnectionState
-> Connection)
-> Parser (Maybe POSIX)
-> Parser
(Maybe Text
-> Maybe POSIX
-> Maybe ConnectionAuthorizationType
-> Maybe Text
-> Maybe Text
-> Maybe ConnectionState
-> Connection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastModifiedTime")
Parser
(Maybe Text
-> Maybe POSIX
-> Maybe ConnectionAuthorizationType
-> Maybe Text
-> Maybe Text
-> Maybe ConnectionState
-> Connection)
-> Parser (Maybe Text)
-> Parser
(Maybe POSIX
-> Maybe ConnectionAuthorizationType
-> Maybe Text
-> Maybe Text
-> Maybe ConnectionState
-> Connection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
Parser
(Maybe POSIX
-> Maybe ConnectionAuthorizationType
-> Maybe Text
-> Maybe Text
-> Maybe ConnectionState
-> Connection)
-> Parser (Maybe POSIX)
-> Parser
(Maybe ConnectionAuthorizationType
-> Maybe Text -> Maybe Text -> Maybe ConnectionState -> Connection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastAuthorizedTime")
Parser
(Maybe ConnectionAuthorizationType
-> Maybe Text -> Maybe Text -> Maybe ConnectionState -> Connection)
-> Parser (Maybe ConnectionAuthorizationType)
-> Parser
(Maybe Text -> Maybe Text -> Maybe ConnectionState -> Connection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ConnectionAuthorizationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AuthorizationType")
Parser
(Maybe Text -> Maybe Text -> Maybe ConnectionState -> Connection)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe ConnectionState -> Connection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConnectionArn")
Parser (Maybe Text -> Maybe ConnectionState -> Connection)
-> Parser (Maybe Text)
-> Parser (Maybe ConnectionState -> Connection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StateReason")
Parser (Maybe ConnectionState -> Connection)
-> Parser (Maybe ConnectionState) -> Parser Connection
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ConnectionState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConnectionState")
)
instance Prelude.Hashable Connection
instance Prelude.NFData Connection