{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Lightsail.Types.ContainerServiceLogEvent
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Lightsail.Types.ContainerServiceLogEvent where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the log events of a container of an Amazon Lightsail container
-- service.
--
-- /See:/ 'newContainerServiceLogEvent' smart constructor.
data ContainerServiceLogEvent = ContainerServiceLogEvent'
  { -- | The timestamp when the container service log event was created.
    ContainerServiceLogEvent -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The message of the container service log event.
    ContainerServiceLogEvent -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (ContainerServiceLogEvent -> ContainerServiceLogEvent -> Bool
(ContainerServiceLogEvent -> ContainerServiceLogEvent -> Bool)
-> (ContainerServiceLogEvent -> ContainerServiceLogEvent -> Bool)
-> Eq ContainerServiceLogEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContainerServiceLogEvent -> ContainerServiceLogEvent -> Bool
$c/= :: ContainerServiceLogEvent -> ContainerServiceLogEvent -> Bool
== :: ContainerServiceLogEvent -> ContainerServiceLogEvent -> Bool
$c== :: ContainerServiceLogEvent -> ContainerServiceLogEvent -> Bool
Prelude.Eq, ReadPrec [ContainerServiceLogEvent]
ReadPrec ContainerServiceLogEvent
Int -> ReadS ContainerServiceLogEvent
ReadS [ContainerServiceLogEvent]
(Int -> ReadS ContainerServiceLogEvent)
-> ReadS [ContainerServiceLogEvent]
-> ReadPrec ContainerServiceLogEvent
-> ReadPrec [ContainerServiceLogEvent]
-> Read ContainerServiceLogEvent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContainerServiceLogEvent]
$creadListPrec :: ReadPrec [ContainerServiceLogEvent]
readPrec :: ReadPrec ContainerServiceLogEvent
$creadPrec :: ReadPrec ContainerServiceLogEvent
readList :: ReadS [ContainerServiceLogEvent]
$creadList :: ReadS [ContainerServiceLogEvent]
readsPrec :: Int -> ReadS ContainerServiceLogEvent
$creadsPrec :: Int -> ReadS ContainerServiceLogEvent
Prelude.Read, Int -> ContainerServiceLogEvent -> ShowS
[ContainerServiceLogEvent] -> ShowS
ContainerServiceLogEvent -> String
(Int -> ContainerServiceLogEvent -> ShowS)
-> (ContainerServiceLogEvent -> String)
-> ([ContainerServiceLogEvent] -> ShowS)
-> Show ContainerServiceLogEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerServiceLogEvent] -> ShowS
$cshowList :: [ContainerServiceLogEvent] -> ShowS
show :: ContainerServiceLogEvent -> String
$cshow :: ContainerServiceLogEvent -> String
showsPrec :: Int -> ContainerServiceLogEvent -> ShowS
$cshowsPrec :: Int -> ContainerServiceLogEvent -> ShowS
Prelude.Show, (forall x.
 ContainerServiceLogEvent -> Rep ContainerServiceLogEvent x)
-> (forall x.
    Rep ContainerServiceLogEvent x -> ContainerServiceLogEvent)
-> Generic ContainerServiceLogEvent
forall x.
Rep ContainerServiceLogEvent x -> ContainerServiceLogEvent
forall x.
ContainerServiceLogEvent -> Rep ContainerServiceLogEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContainerServiceLogEvent x -> ContainerServiceLogEvent
$cfrom :: forall x.
ContainerServiceLogEvent -> Rep ContainerServiceLogEvent x
Prelude.Generic)

-- |
-- Create a value of 'ContainerServiceLogEvent' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'createdAt', 'containerServiceLogEvent_createdAt' - The timestamp when the container service log event was created.
--
-- 'message', 'containerServiceLogEvent_message' - The message of the container service log event.
newContainerServiceLogEvent ::
  ContainerServiceLogEvent
newContainerServiceLogEvent :: ContainerServiceLogEvent
newContainerServiceLogEvent =
  ContainerServiceLogEvent' :: Maybe POSIX -> Maybe Text -> ContainerServiceLogEvent
ContainerServiceLogEvent'
    { $sel:createdAt:ContainerServiceLogEvent' :: Maybe POSIX
createdAt =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:message:ContainerServiceLogEvent' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The timestamp when the container service log event was created.
containerServiceLogEvent_createdAt :: Lens.Lens' ContainerServiceLogEvent (Prelude.Maybe Prelude.UTCTime)
containerServiceLogEvent_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ContainerServiceLogEvent -> f ContainerServiceLogEvent
containerServiceLogEvent_createdAt = (ContainerServiceLogEvent -> Maybe POSIX)
-> (ContainerServiceLogEvent
    -> Maybe POSIX -> ContainerServiceLogEvent)
-> Lens
     ContainerServiceLogEvent
     ContainerServiceLogEvent
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerServiceLogEvent' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:ContainerServiceLogEvent' :: ContainerServiceLogEvent -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: ContainerServiceLogEvent
s@ContainerServiceLogEvent' {} Maybe POSIX
a -> ContainerServiceLogEvent
s {$sel:createdAt:ContainerServiceLogEvent' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: ContainerServiceLogEvent) ((Maybe POSIX -> f (Maybe POSIX))
 -> ContainerServiceLogEvent -> f ContainerServiceLogEvent)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ContainerServiceLogEvent
-> f ContainerServiceLogEvent
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

-- | The message of the container service log event.
containerServiceLogEvent_message :: Lens.Lens' ContainerServiceLogEvent (Prelude.Maybe Prelude.Text)
containerServiceLogEvent_message :: (Maybe Text -> f (Maybe Text))
-> ContainerServiceLogEvent -> f ContainerServiceLogEvent
containerServiceLogEvent_message = (ContainerServiceLogEvent -> Maybe Text)
-> (ContainerServiceLogEvent
    -> Maybe Text -> ContainerServiceLogEvent)
-> Lens
     ContainerServiceLogEvent
     ContainerServiceLogEvent
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerServiceLogEvent' {Maybe Text
message :: Maybe Text
$sel:message:ContainerServiceLogEvent' :: ContainerServiceLogEvent -> Maybe Text
message} -> Maybe Text
message) (\s :: ContainerServiceLogEvent
s@ContainerServiceLogEvent' {} Maybe Text
a -> ContainerServiceLogEvent
s {$sel:message:ContainerServiceLogEvent' :: Maybe Text
message = Maybe Text
a} :: ContainerServiceLogEvent)

instance Core.FromJSON ContainerServiceLogEvent where
  parseJSON :: Value -> Parser ContainerServiceLogEvent
parseJSON =
    String
-> (Object -> Parser ContainerServiceLogEvent)
-> Value
-> Parser ContainerServiceLogEvent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContainerServiceLogEvent"
      ( \Object
x ->
          Maybe POSIX -> Maybe Text -> ContainerServiceLogEvent
ContainerServiceLogEvent'
            (Maybe POSIX -> Maybe Text -> ContainerServiceLogEvent)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> ContainerServiceLogEvent)
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
"createdAt")
            Parser (Maybe Text -> ContainerServiceLogEvent)
-> Parser (Maybe Text) -> Parser ContainerServiceLogEvent
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
"message")
      )

instance Prelude.Hashable ContainerServiceLogEvent

instance Prelude.NFData ContainerServiceLogEvent