{-# 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.ECS.Types.ManagedAgent where
import qualified Amazonka.Core as Core
import Amazonka.ECS.Types.ManagedAgentName
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ManagedAgent = ManagedAgent'
{
ManagedAgent -> Maybe Text
lastStatus :: Prelude.Maybe Prelude.Text,
ManagedAgent -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
ManagedAgent -> Maybe ManagedAgentName
name :: Prelude.Maybe ManagedAgentName,
ManagedAgent -> Maybe POSIX
lastStartedAt :: Prelude.Maybe Core.POSIX
}
deriving (ManagedAgent -> ManagedAgent -> Bool
(ManagedAgent -> ManagedAgent -> Bool)
-> (ManagedAgent -> ManagedAgent -> Bool) -> Eq ManagedAgent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ManagedAgent -> ManagedAgent -> Bool
$c/= :: ManagedAgent -> ManagedAgent -> Bool
== :: ManagedAgent -> ManagedAgent -> Bool
$c== :: ManagedAgent -> ManagedAgent -> Bool
Prelude.Eq, ReadPrec [ManagedAgent]
ReadPrec ManagedAgent
Int -> ReadS ManagedAgent
ReadS [ManagedAgent]
(Int -> ReadS ManagedAgent)
-> ReadS [ManagedAgent]
-> ReadPrec ManagedAgent
-> ReadPrec [ManagedAgent]
-> Read ManagedAgent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ManagedAgent]
$creadListPrec :: ReadPrec [ManagedAgent]
readPrec :: ReadPrec ManagedAgent
$creadPrec :: ReadPrec ManagedAgent
readList :: ReadS [ManagedAgent]
$creadList :: ReadS [ManagedAgent]
readsPrec :: Int -> ReadS ManagedAgent
$creadsPrec :: Int -> ReadS ManagedAgent
Prelude.Read, Int -> ManagedAgent -> ShowS
[ManagedAgent] -> ShowS
ManagedAgent -> String
(Int -> ManagedAgent -> ShowS)
-> (ManagedAgent -> String)
-> ([ManagedAgent] -> ShowS)
-> Show ManagedAgent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ManagedAgent] -> ShowS
$cshowList :: [ManagedAgent] -> ShowS
show :: ManagedAgent -> String
$cshow :: ManagedAgent -> String
showsPrec :: Int -> ManagedAgent -> ShowS
$cshowsPrec :: Int -> ManagedAgent -> ShowS
Prelude.Show, (forall x. ManagedAgent -> Rep ManagedAgent x)
-> (forall x. Rep ManagedAgent x -> ManagedAgent)
-> Generic ManagedAgent
forall x. Rep ManagedAgent x -> ManagedAgent
forall x. ManagedAgent -> Rep ManagedAgent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ManagedAgent x -> ManagedAgent
$cfrom :: forall x. ManagedAgent -> Rep ManagedAgent x
Prelude.Generic)
newManagedAgent ::
ManagedAgent
newManagedAgent :: ManagedAgent
newManagedAgent =
ManagedAgent' :: Maybe Text
-> Maybe Text
-> Maybe ManagedAgentName
-> Maybe POSIX
-> ManagedAgent
ManagedAgent'
{ $sel:lastStatus:ManagedAgent' :: Maybe Text
lastStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:reason:ManagedAgent' :: Maybe Text
reason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:ManagedAgent' :: Maybe ManagedAgentName
name = Maybe ManagedAgentName
forall a. Maybe a
Prelude.Nothing,
$sel:lastStartedAt:ManagedAgent' :: Maybe POSIX
lastStartedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
managedAgent_lastStatus :: Lens.Lens' ManagedAgent (Prelude.Maybe Prelude.Text)
managedAgent_lastStatus :: (Maybe Text -> f (Maybe Text)) -> ManagedAgent -> f ManagedAgent
managedAgent_lastStatus = (ManagedAgent -> Maybe Text)
-> (ManagedAgent -> Maybe Text -> ManagedAgent)
-> Lens ManagedAgent ManagedAgent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedAgent' {Maybe Text
lastStatus :: Maybe Text
$sel:lastStatus:ManagedAgent' :: ManagedAgent -> Maybe Text
lastStatus} -> Maybe Text
lastStatus) (\s :: ManagedAgent
s@ManagedAgent' {} Maybe Text
a -> ManagedAgent
s {$sel:lastStatus:ManagedAgent' :: Maybe Text
lastStatus = Maybe Text
a} :: ManagedAgent)
managedAgent_reason :: Lens.Lens' ManagedAgent (Prelude.Maybe Prelude.Text)
managedAgent_reason :: (Maybe Text -> f (Maybe Text)) -> ManagedAgent -> f ManagedAgent
managedAgent_reason = (ManagedAgent -> Maybe Text)
-> (ManagedAgent -> Maybe Text -> ManagedAgent)
-> Lens ManagedAgent ManagedAgent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedAgent' {Maybe Text
reason :: Maybe Text
$sel:reason:ManagedAgent' :: ManagedAgent -> Maybe Text
reason} -> Maybe Text
reason) (\s :: ManagedAgent
s@ManagedAgent' {} Maybe Text
a -> ManagedAgent
s {$sel:reason:ManagedAgent' :: Maybe Text
reason = Maybe Text
a} :: ManagedAgent)
managedAgent_name :: Lens.Lens' ManagedAgent (Prelude.Maybe ManagedAgentName)
managedAgent_name :: (Maybe ManagedAgentName -> f (Maybe ManagedAgentName))
-> ManagedAgent -> f ManagedAgent
managedAgent_name = (ManagedAgent -> Maybe ManagedAgentName)
-> (ManagedAgent -> Maybe ManagedAgentName -> ManagedAgent)
-> Lens
ManagedAgent
ManagedAgent
(Maybe ManagedAgentName)
(Maybe ManagedAgentName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedAgent' {Maybe ManagedAgentName
name :: Maybe ManagedAgentName
$sel:name:ManagedAgent' :: ManagedAgent -> Maybe ManagedAgentName
name} -> Maybe ManagedAgentName
name) (\s :: ManagedAgent
s@ManagedAgent' {} Maybe ManagedAgentName
a -> ManagedAgent
s {$sel:name:ManagedAgent' :: Maybe ManagedAgentName
name = Maybe ManagedAgentName
a} :: ManagedAgent)
managedAgent_lastStartedAt :: Lens.Lens' ManagedAgent (Prelude.Maybe Prelude.UTCTime)
managedAgent_lastStartedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ManagedAgent -> f ManagedAgent
managedAgent_lastStartedAt = (ManagedAgent -> Maybe POSIX)
-> (ManagedAgent -> Maybe POSIX -> ManagedAgent)
-> Lens ManagedAgent ManagedAgent (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedAgent' {Maybe POSIX
lastStartedAt :: Maybe POSIX
$sel:lastStartedAt:ManagedAgent' :: ManagedAgent -> Maybe POSIX
lastStartedAt} -> Maybe POSIX
lastStartedAt) (\s :: ManagedAgent
s@ManagedAgent' {} Maybe POSIX
a -> ManagedAgent
s {$sel:lastStartedAt:ManagedAgent' :: Maybe POSIX
lastStartedAt = Maybe POSIX
a} :: ManagedAgent) ((Maybe POSIX -> f (Maybe POSIX))
-> ManagedAgent -> f ManagedAgent)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ManagedAgent
-> f ManagedAgent
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
instance Core.FromJSON ManagedAgent where
parseJSON :: Value -> Parser ManagedAgent
parseJSON =
String
-> (Object -> Parser ManagedAgent) -> Value -> Parser ManagedAgent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ManagedAgent"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe ManagedAgentName
-> Maybe POSIX
-> ManagedAgent
ManagedAgent'
(Maybe Text
-> Maybe Text
-> Maybe ManagedAgentName
-> Maybe POSIX
-> ManagedAgent)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe ManagedAgentName -> Maybe POSIX -> ManagedAgent)
forall (f :: * -> *) a b. Functor 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
"lastStatus")
Parser
(Maybe Text
-> Maybe ManagedAgentName -> Maybe POSIX -> ManagedAgent)
-> Parser (Maybe Text)
-> Parser (Maybe ManagedAgentName -> Maybe POSIX -> ManagedAgent)
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
"reason")
Parser (Maybe ManagedAgentName -> Maybe POSIX -> ManagedAgent)
-> Parser (Maybe ManagedAgentName)
-> Parser (Maybe POSIX -> ManagedAgent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ManagedAgentName)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
Parser (Maybe POSIX -> ManagedAgent)
-> Parser (Maybe POSIX) -> Parser ManagedAgent
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
"lastStartedAt")
)
instance Prelude.Hashable ManagedAgent
instance Prelude.NFData ManagedAgent