{-# 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.AMP.Types.AlertManagerDefinitionDescription
-- 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.AMP.Types.AlertManagerDefinitionDescription where

import Amazonka.AMP.Types.AlertManagerDefinitionStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the properties of an alert manager definition.
--
-- /See:/ 'newAlertManagerDefinitionDescription' smart constructor.
data AlertManagerDefinitionDescription = AlertManagerDefinitionDescription'
  { -- | The time when the alert manager definition was created.
    AlertManagerDefinitionDescription -> POSIX
createdAt :: Core.POSIX,
    -- | The alert manager definition.
    AlertManagerDefinitionDescription -> Base64
data' :: Core.Base64,
    -- | The time when the alert manager definition was modified.
    AlertManagerDefinitionDescription -> POSIX
modifiedAt :: Core.POSIX,
    -- | The status of alert manager definition.
    AlertManagerDefinitionDescription -> AlertManagerDefinitionStatus
status :: AlertManagerDefinitionStatus
  }
  deriving (AlertManagerDefinitionDescription
-> AlertManagerDefinitionDescription -> Bool
(AlertManagerDefinitionDescription
 -> AlertManagerDefinitionDescription -> Bool)
-> (AlertManagerDefinitionDescription
    -> AlertManagerDefinitionDescription -> Bool)
-> Eq AlertManagerDefinitionDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AlertManagerDefinitionDescription
-> AlertManagerDefinitionDescription -> Bool
$c/= :: AlertManagerDefinitionDescription
-> AlertManagerDefinitionDescription -> Bool
== :: AlertManagerDefinitionDescription
-> AlertManagerDefinitionDescription -> Bool
$c== :: AlertManagerDefinitionDescription
-> AlertManagerDefinitionDescription -> Bool
Prelude.Eq, ReadPrec [AlertManagerDefinitionDescription]
ReadPrec AlertManagerDefinitionDescription
Int -> ReadS AlertManagerDefinitionDescription
ReadS [AlertManagerDefinitionDescription]
(Int -> ReadS AlertManagerDefinitionDescription)
-> ReadS [AlertManagerDefinitionDescription]
-> ReadPrec AlertManagerDefinitionDescription
-> ReadPrec [AlertManagerDefinitionDescription]
-> Read AlertManagerDefinitionDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AlertManagerDefinitionDescription]
$creadListPrec :: ReadPrec [AlertManagerDefinitionDescription]
readPrec :: ReadPrec AlertManagerDefinitionDescription
$creadPrec :: ReadPrec AlertManagerDefinitionDescription
readList :: ReadS [AlertManagerDefinitionDescription]
$creadList :: ReadS [AlertManagerDefinitionDescription]
readsPrec :: Int -> ReadS AlertManagerDefinitionDescription
$creadsPrec :: Int -> ReadS AlertManagerDefinitionDescription
Prelude.Read, Int -> AlertManagerDefinitionDescription -> ShowS
[AlertManagerDefinitionDescription] -> ShowS
AlertManagerDefinitionDescription -> String
(Int -> AlertManagerDefinitionDescription -> ShowS)
-> (AlertManagerDefinitionDescription -> String)
-> ([AlertManagerDefinitionDescription] -> ShowS)
-> Show AlertManagerDefinitionDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AlertManagerDefinitionDescription] -> ShowS
$cshowList :: [AlertManagerDefinitionDescription] -> ShowS
show :: AlertManagerDefinitionDescription -> String
$cshow :: AlertManagerDefinitionDescription -> String
showsPrec :: Int -> AlertManagerDefinitionDescription -> ShowS
$cshowsPrec :: Int -> AlertManagerDefinitionDescription -> ShowS
Prelude.Show, (forall x.
 AlertManagerDefinitionDescription
 -> Rep AlertManagerDefinitionDescription x)
-> (forall x.
    Rep AlertManagerDefinitionDescription x
    -> AlertManagerDefinitionDescription)
-> Generic AlertManagerDefinitionDescription
forall x.
Rep AlertManagerDefinitionDescription x
-> AlertManagerDefinitionDescription
forall x.
AlertManagerDefinitionDescription
-> Rep AlertManagerDefinitionDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AlertManagerDefinitionDescription x
-> AlertManagerDefinitionDescription
$cfrom :: forall x.
AlertManagerDefinitionDescription
-> Rep AlertManagerDefinitionDescription x
Prelude.Generic)

-- |
-- Create a value of 'AlertManagerDefinitionDescription' 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', 'alertManagerDefinitionDescription_createdAt' - The time when the alert manager definition was created.
--
-- 'data'', 'alertManagerDefinitionDescription_data' - The alert manager definition.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
--
-- 'modifiedAt', 'alertManagerDefinitionDescription_modifiedAt' - The time when the alert manager definition was modified.
--
-- 'status', 'alertManagerDefinitionDescription_status' - The status of alert manager definition.
newAlertManagerDefinitionDescription ::
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'data''
  Prelude.ByteString ->
  -- | 'modifiedAt'
  Prelude.UTCTime ->
  -- | 'status'
  AlertManagerDefinitionStatus ->
  AlertManagerDefinitionDescription
newAlertManagerDefinitionDescription :: UTCTime
-> ByteString
-> UTCTime
-> AlertManagerDefinitionStatus
-> AlertManagerDefinitionDescription
newAlertManagerDefinitionDescription
  UTCTime
pCreatedAt_
  ByteString
pData_
  UTCTime
pModifiedAt_
  AlertManagerDefinitionStatus
pStatus_ =
    AlertManagerDefinitionDescription' :: POSIX
-> Base64
-> POSIX
-> AlertManagerDefinitionStatus
-> AlertManagerDefinitionDescription
AlertManagerDefinitionDescription'
      { $sel:createdAt:AlertManagerDefinitionDescription' :: POSIX
createdAt =
          Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:data':AlertManagerDefinitionDescription' :: Base64
data' = Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64)
Iso' Base64 ByteString
Core._Base64 (Tagged ByteString (Identity ByteString)
 -> Tagged Base64 (Identity Base64))
-> ByteString -> Base64
forall t b. AReview t b -> b -> t
Lens.# ByteString
pData_,
        $sel:modifiedAt:AlertManagerDefinitionDescription' :: POSIX
modifiedAt =
          Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pModifiedAt_,
        $sel:status:AlertManagerDefinitionDescription' :: AlertManagerDefinitionStatus
status = AlertManagerDefinitionStatus
pStatus_
      }

-- | The time when the alert manager definition was created.
alertManagerDefinitionDescription_createdAt :: Lens.Lens' AlertManagerDefinitionDescription Prelude.UTCTime
alertManagerDefinitionDescription_createdAt :: (UTCTime -> f UTCTime)
-> AlertManagerDefinitionDescription
-> f AlertManagerDefinitionDescription
alertManagerDefinitionDescription_createdAt = (AlertManagerDefinitionDescription -> POSIX)
-> (AlertManagerDefinitionDescription
    -> POSIX -> AlertManagerDefinitionDescription)
-> Lens
     AlertManagerDefinitionDescription
     AlertManagerDefinitionDescription
     POSIX
     POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlertManagerDefinitionDescription' {POSIX
createdAt :: POSIX
$sel:createdAt:AlertManagerDefinitionDescription' :: AlertManagerDefinitionDescription -> POSIX
createdAt} -> POSIX
createdAt) (\s :: AlertManagerDefinitionDescription
s@AlertManagerDefinitionDescription' {} POSIX
a -> AlertManagerDefinitionDescription
s {$sel:createdAt:AlertManagerDefinitionDescription' :: POSIX
createdAt = POSIX
a} :: AlertManagerDefinitionDescription) ((POSIX -> f POSIX)
 -> AlertManagerDefinitionDescription
 -> f AlertManagerDefinitionDescription)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> AlertManagerDefinitionDescription
-> f AlertManagerDefinitionDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The alert manager definition.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
alertManagerDefinitionDescription_data :: Lens.Lens' AlertManagerDefinitionDescription Prelude.ByteString
alertManagerDefinitionDescription_data :: (ByteString -> f ByteString)
-> AlertManagerDefinitionDescription
-> f AlertManagerDefinitionDescription
alertManagerDefinitionDescription_data = (AlertManagerDefinitionDescription -> Base64)
-> (AlertManagerDefinitionDescription
    -> Base64 -> AlertManagerDefinitionDescription)
-> Lens
     AlertManagerDefinitionDescription
     AlertManagerDefinitionDescription
     Base64
     Base64
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlertManagerDefinitionDescription' {Base64
data' :: Base64
$sel:data':AlertManagerDefinitionDescription' :: AlertManagerDefinitionDescription -> Base64
data'} -> Base64
data') (\s :: AlertManagerDefinitionDescription
s@AlertManagerDefinitionDescription' {} Base64
a -> AlertManagerDefinitionDescription
s {$sel:data':AlertManagerDefinitionDescription' :: Base64
data' = Base64
a} :: AlertManagerDefinitionDescription) ((Base64 -> f Base64)
 -> AlertManagerDefinitionDescription
 -> f AlertManagerDefinitionDescription)
-> ((ByteString -> f ByteString) -> Base64 -> f Base64)
-> (ByteString -> f ByteString)
-> AlertManagerDefinitionDescription
-> f AlertManagerDefinitionDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ByteString -> f ByteString) -> Base64 -> f Base64
Iso' Base64 ByteString
Core._Base64

-- | The time when the alert manager definition was modified.
alertManagerDefinitionDescription_modifiedAt :: Lens.Lens' AlertManagerDefinitionDescription Prelude.UTCTime
alertManagerDefinitionDescription_modifiedAt :: (UTCTime -> f UTCTime)
-> AlertManagerDefinitionDescription
-> f AlertManagerDefinitionDescription
alertManagerDefinitionDescription_modifiedAt = (AlertManagerDefinitionDescription -> POSIX)
-> (AlertManagerDefinitionDescription
    -> POSIX -> AlertManagerDefinitionDescription)
-> Lens
     AlertManagerDefinitionDescription
     AlertManagerDefinitionDescription
     POSIX
     POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlertManagerDefinitionDescription' {POSIX
modifiedAt :: POSIX
$sel:modifiedAt:AlertManagerDefinitionDescription' :: AlertManagerDefinitionDescription -> POSIX
modifiedAt} -> POSIX
modifiedAt) (\s :: AlertManagerDefinitionDescription
s@AlertManagerDefinitionDescription' {} POSIX
a -> AlertManagerDefinitionDescription
s {$sel:modifiedAt:AlertManagerDefinitionDescription' :: POSIX
modifiedAt = POSIX
a} :: AlertManagerDefinitionDescription) ((POSIX -> f POSIX)
 -> AlertManagerDefinitionDescription
 -> f AlertManagerDefinitionDescription)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> AlertManagerDefinitionDescription
-> f AlertManagerDefinitionDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The status of alert manager definition.
alertManagerDefinitionDescription_status :: Lens.Lens' AlertManagerDefinitionDescription AlertManagerDefinitionStatus
alertManagerDefinitionDescription_status :: (AlertManagerDefinitionStatus -> f AlertManagerDefinitionStatus)
-> AlertManagerDefinitionDescription
-> f AlertManagerDefinitionDescription
alertManagerDefinitionDescription_status = (AlertManagerDefinitionDescription -> AlertManagerDefinitionStatus)
-> (AlertManagerDefinitionDescription
    -> AlertManagerDefinitionStatus
    -> AlertManagerDefinitionDescription)
-> Lens
     AlertManagerDefinitionDescription
     AlertManagerDefinitionDescription
     AlertManagerDefinitionStatus
     AlertManagerDefinitionStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlertManagerDefinitionDescription' {AlertManagerDefinitionStatus
status :: AlertManagerDefinitionStatus
$sel:status:AlertManagerDefinitionDescription' :: AlertManagerDefinitionDescription -> AlertManagerDefinitionStatus
status} -> AlertManagerDefinitionStatus
status) (\s :: AlertManagerDefinitionDescription
s@AlertManagerDefinitionDescription' {} AlertManagerDefinitionStatus
a -> AlertManagerDefinitionDescription
s {$sel:status:AlertManagerDefinitionDescription' :: AlertManagerDefinitionStatus
status = AlertManagerDefinitionStatus
a} :: AlertManagerDefinitionDescription)

instance
  Core.FromJSON
    AlertManagerDefinitionDescription
  where
  parseJSON :: Value -> Parser AlertManagerDefinitionDescription
parseJSON =
    String
-> (Object -> Parser AlertManagerDefinitionDescription)
-> Value
-> Parser AlertManagerDefinitionDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AlertManagerDefinitionDescription"
      ( \Object
x ->
          POSIX
-> Base64
-> POSIX
-> AlertManagerDefinitionStatus
-> AlertManagerDefinitionDescription
AlertManagerDefinitionDescription'
            (POSIX
 -> Base64
 -> POSIX
 -> AlertManagerDefinitionStatus
 -> AlertManagerDefinitionDescription)
-> Parser POSIX
-> Parser
     (Base64
      -> POSIX
      -> AlertManagerDefinitionStatus
      -> AlertManagerDefinitionDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"createdAt")
            Parser
  (Base64
   -> POSIX
   -> AlertManagerDefinitionStatus
   -> AlertManagerDefinitionDescription)
-> Parser Base64
-> Parser
     (POSIX
      -> AlertManagerDefinitionStatus
      -> AlertManagerDefinitionDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Base64
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"data")
            Parser
  (POSIX
   -> AlertManagerDefinitionStatus
   -> AlertManagerDefinitionDescription)
-> Parser POSIX
-> Parser
     (AlertManagerDefinitionStatus -> AlertManagerDefinitionDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"modifiedAt")
            Parser
  (AlertManagerDefinitionStatus -> AlertManagerDefinitionDescription)
-> Parser AlertManagerDefinitionStatus
-> Parser AlertManagerDefinitionDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser AlertManagerDefinitionStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
      )

instance
  Prelude.Hashable
    AlertManagerDefinitionDescription

instance
  Prelude.NFData
    AlertManagerDefinitionDescription