{-# 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.SSMIncidents.Types.RegionInfo
-- 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.SSMIncidents.Types.RegionInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSMIncidents.Types.RegionStatus

-- | Information about a Region in your replication set.
--
-- /See:/ 'newRegionInfo' smart constructor.
data RegionInfo = RegionInfo'
  { -- | Information displayed about the status of the Region.
    RegionInfo -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The ID of the KMS key used to encrypt the data in this Region.
    RegionInfo -> Maybe Text
sseKmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The status of the Region in the replication set.
    RegionInfo -> RegionStatus
status :: RegionStatus,
    -- | The most recent date and time that the Region\'s status was updated.
    RegionInfo -> POSIX
statusUpdateDateTime :: Core.POSIX
  }
  deriving (RegionInfo -> RegionInfo -> Bool
(RegionInfo -> RegionInfo -> Bool)
-> (RegionInfo -> RegionInfo -> Bool) -> Eq RegionInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegionInfo -> RegionInfo -> Bool
$c/= :: RegionInfo -> RegionInfo -> Bool
== :: RegionInfo -> RegionInfo -> Bool
$c== :: RegionInfo -> RegionInfo -> Bool
Prelude.Eq, ReadPrec [RegionInfo]
ReadPrec RegionInfo
Int -> ReadS RegionInfo
ReadS [RegionInfo]
(Int -> ReadS RegionInfo)
-> ReadS [RegionInfo]
-> ReadPrec RegionInfo
-> ReadPrec [RegionInfo]
-> Read RegionInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegionInfo]
$creadListPrec :: ReadPrec [RegionInfo]
readPrec :: ReadPrec RegionInfo
$creadPrec :: ReadPrec RegionInfo
readList :: ReadS [RegionInfo]
$creadList :: ReadS [RegionInfo]
readsPrec :: Int -> ReadS RegionInfo
$creadsPrec :: Int -> ReadS RegionInfo
Prelude.Read, Int -> RegionInfo -> ShowS
[RegionInfo] -> ShowS
RegionInfo -> String
(Int -> RegionInfo -> ShowS)
-> (RegionInfo -> String)
-> ([RegionInfo] -> ShowS)
-> Show RegionInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegionInfo] -> ShowS
$cshowList :: [RegionInfo] -> ShowS
show :: RegionInfo -> String
$cshow :: RegionInfo -> String
showsPrec :: Int -> RegionInfo -> ShowS
$cshowsPrec :: Int -> RegionInfo -> ShowS
Prelude.Show, (forall x. RegionInfo -> Rep RegionInfo x)
-> (forall x. Rep RegionInfo x -> RegionInfo) -> Generic RegionInfo
forall x. Rep RegionInfo x -> RegionInfo
forall x. RegionInfo -> Rep RegionInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegionInfo x -> RegionInfo
$cfrom :: forall x. RegionInfo -> Rep RegionInfo x
Prelude.Generic)

-- |
-- Create a value of 'RegionInfo' 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:
--
-- 'statusMessage', 'regionInfo_statusMessage' - Information displayed about the status of the Region.
--
-- 'sseKmsKeyId', 'regionInfo_sseKmsKeyId' - The ID of the KMS key used to encrypt the data in this Region.
--
-- 'status', 'regionInfo_status' - The status of the Region in the replication set.
--
-- 'statusUpdateDateTime', 'regionInfo_statusUpdateDateTime' - The most recent date and time that the Region\'s status was updated.
newRegionInfo ::
  -- | 'status'
  RegionStatus ->
  -- | 'statusUpdateDateTime'
  Prelude.UTCTime ->
  RegionInfo
newRegionInfo :: RegionStatus -> UTCTime -> RegionInfo
newRegionInfo RegionStatus
pStatus_ UTCTime
pStatusUpdateDateTime_ =
  RegionInfo' :: Maybe Text -> Maybe Text -> RegionStatus -> POSIX -> RegionInfo
RegionInfo'
    { $sel:statusMessage:RegionInfo' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sseKmsKeyId:RegionInfo' :: Maybe Text
sseKmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:RegionInfo' :: RegionStatus
status = RegionStatus
pStatus_,
      $sel:statusUpdateDateTime:RegionInfo' :: POSIX
statusUpdateDateTime =
        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
pStatusUpdateDateTime_
    }

-- | Information displayed about the status of the Region.
regionInfo_statusMessage :: Lens.Lens' RegionInfo (Prelude.Maybe Prelude.Text)
regionInfo_statusMessage :: (Maybe Text -> f (Maybe Text)) -> RegionInfo -> f RegionInfo
regionInfo_statusMessage = (RegionInfo -> Maybe Text)
-> (RegionInfo -> Maybe Text -> RegionInfo)
-> Lens RegionInfo RegionInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegionInfo' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:RegionInfo' :: RegionInfo -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: RegionInfo
s@RegionInfo' {} Maybe Text
a -> RegionInfo
s {$sel:statusMessage:RegionInfo' :: Maybe Text
statusMessage = Maybe Text
a} :: RegionInfo)

-- | The ID of the KMS key used to encrypt the data in this Region.
regionInfo_sseKmsKeyId :: Lens.Lens' RegionInfo (Prelude.Maybe Prelude.Text)
regionInfo_sseKmsKeyId :: (Maybe Text -> f (Maybe Text)) -> RegionInfo -> f RegionInfo
regionInfo_sseKmsKeyId = (RegionInfo -> Maybe Text)
-> (RegionInfo -> Maybe Text -> RegionInfo)
-> Lens RegionInfo RegionInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegionInfo' {Maybe Text
sseKmsKeyId :: Maybe Text
$sel:sseKmsKeyId:RegionInfo' :: RegionInfo -> Maybe Text
sseKmsKeyId} -> Maybe Text
sseKmsKeyId) (\s :: RegionInfo
s@RegionInfo' {} Maybe Text
a -> RegionInfo
s {$sel:sseKmsKeyId:RegionInfo' :: Maybe Text
sseKmsKeyId = Maybe Text
a} :: RegionInfo)

-- | The status of the Region in the replication set.
regionInfo_status :: Lens.Lens' RegionInfo RegionStatus
regionInfo_status :: (RegionStatus -> f RegionStatus) -> RegionInfo -> f RegionInfo
regionInfo_status = (RegionInfo -> RegionStatus)
-> (RegionInfo -> RegionStatus -> RegionInfo)
-> Lens RegionInfo RegionInfo RegionStatus RegionStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegionInfo' {RegionStatus
status :: RegionStatus
$sel:status:RegionInfo' :: RegionInfo -> RegionStatus
status} -> RegionStatus
status) (\s :: RegionInfo
s@RegionInfo' {} RegionStatus
a -> RegionInfo
s {$sel:status:RegionInfo' :: RegionStatus
status = RegionStatus
a} :: RegionInfo)

-- | The most recent date and time that the Region\'s status was updated.
regionInfo_statusUpdateDateTime :: Lens.Lens' RegionInfo Prelude.UTCTime
regionInfo_statusUpdateDateTime :: (UTCTime -> f UTCTime) -> RegionInfo -> f RegionInfo
regionInfo_statusUpdateDateTime = (RegionInfo -> POSIX)
-> (RegionInfo -> POSIX -> RegionInfo)
-> Lens RegionInfo RegionInfo POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegionInfo' {POSIX
statusUpdateDateTime :: POSIX
$sel:statusUpdateDateTime:RegionInfo' :: RegionInfo -> POSIX
statusUpdateDateTime} -> POSIX
statusUpdateDateTime) (\s :: RegionInfo
s@RegionInfo' {} POSIX
a -> RegionInfo
s {$sel:statusUpdateDateTime:RegionInfo' :: POSIX
statusUpdateDateTime = POSIX
a} :: RegionInfo) ((POSIX -> f POSIX) -> RegionInfo -> f RegionInfo)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> RegionInfo
-> f RegionInfo
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

instance Core.FromJSON RegionInfo where
  parseJSON :: Value -> Parser RegionInfo
parseJSON =
    String
-> (Object -> Parser RegionInfo) -> Value -> Parser RegionInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RegionInfo"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> RegionStatus -> POSIX -> RegionInfo
RegionInfo'
            (Maybe Text -> Maybe Text -> RegionStatus -> POSIX -> RegionInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> RegionStatus -> POSIX -> RegionInfo)
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
"statusMessage")
            Parser (Maybe Text -> RegionStatus -> POSIX -> RegionInfo)
-> Parser (Maybe Text)
-> Parser (RegionStatus -> POSIX -> RegionInfo)
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
"sseKmsKeyId")
            Parser (RegionStatus -> POSIX -> RegionInfo)
-> Parser RegionStatus -> Parser (POSIX -> RegionInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RegionStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
            Parser (POSIX -> RegionInfo) -> Parser POSIX -> Parser RegionInfo
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
"statusUpdateDateTime")
      )

instance Prelude.Hashable RegionInfo

instance Prelude.NFData RegionInfo