{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Lightsail.Types.ContainerServiceLogEvent where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 Data.POSIX,
    -- | The message of the container service log event.
    ContainerServiceLogEvent -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (ContainerServiceLogEvent -> ContainerServiceLogEvent -> Bool
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]
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
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.
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'
    { $sel:createdAt:ContainerServiceLogEvent' :: Maybe POSIX
createdAt =
        forall a. Maybe a
Prelude.Nothing,
      $sel:message:ContainerServiceLogEvent' :: Maybe Text
message = 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 :: Lens' ContainerServiceLogEvent (Maybe UTCTime)
containerServiceLogEvent_createdAt = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The message of the container service log event.
containerServiceLogEvent_message :: Lens.Lens' ContainerServiceLogEvent (Prelude.Maybe Prelude.Text)
containerServiceLogEvent_message :: Lens' ContainerServiceLogEvent (Maybe Text)
containerServiceLogEvent_message = 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 Data.FromJSON ContainerServiceLogEvent where
  parseJSON :: Value -> Parser ContainerServiceLogEvent
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContainerServiceLogEvent"
      ( \Object
x ->
          Maybe POSIX -> Maybe Text -> ContainerServiceLogEvent
ContainerServiceLogEvent'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"createdAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"message")
      )

instance Prelude.Hashable ContainerServiceLogEvent where
  hashWithSalt :: Int -> ContainerServiceLogEvent -> Int
hashWithSalt Int
_salt ContainerServiceLogEvent' {Maybe Text
Maybe POSIX
message :: Maybe Text
createdAt :: Maybe POSIX
$sel:message:ContainerServiceLogEvent' :: ContainerServiceLogEvent -> Maybe Text
$sel:createdAt:ContainerServiceLogEvent' :: ContainerServiceLogEvent -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message

instance Prelude.NFData ContainerServiceLogEvent where
  rnf :: ContainerServiceLogEvent -> ()
rnf ContainerServiceLogEvent' {Maybe Text
Maybe POSIX
message :: Maybe Text
createdAt :: Maybe POSIX
$sel:message:ContainerServiceLogEvent' :: ContainerServiceLogEvent -> Maybe Text
$sel:createdAt:ContainerServiceLogEvent' :: ContainerServiceLogEvent -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message