{-# 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.Config.Types.AggregatedSourceStatus
-- 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.Config.Types.AggregatedSourceStatus where

import Amazonka.Config.Types.AggregatedSourceStatusType
import Amazonka.Config.Types.AggregatedSourceType
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

-- | The current sync status between the source and the aggregator account.
--
-- /See:/ 'newAggregatedSourceStatus' smart constructor.
data AggregatedSourceStatus = AggregatedSourceStatus'
  { -- | The region authorized to collect aggregated data.
    AggregatedSourceStatus -> Maybe Text
awsRegion :: Prelude.Maybe Prelude.Text,
    -- | The error code that Config returned when the source account aggregation
    -- last failed.
    AggregatedSourceStatus -> Maybe Text
lastErrorCode :: Prelude.Maybe Prelude.Text,
    -- | The message indicating that the source account aggregation failed due to
    -- an error.
    AggregatedSourceStatus -> Maybe Text
lastErrorMessage :: Prelude.Maybe Prelude.Text,
    -- | Filters the last updated status type.
    --
    -- -   Valid value FAILED indicates errors while moving data.
    --
    -- -   Valid value SUCCEEDED indicates the data was successfully moved.
    --
    -- -   Valid value OUTDATED indicates the data is not the most recent.
    AggregatedSourceStatus -> Maybe AggregatedSourceStatusType
lastUpdateStatus :: Prelude.Maybe AggregatedSourceStatusType,
    -- | The time of the last update.
    AggregatedSourceStatus -> Maybe POSIX
lastUpdateTime :: Prelude.Maybe Data.POSIX,
    -- | The source account ID or an organization.
    AggregatedSourceStatus -> Maybe Text
sourceId :: Prelude.Maybe Prelude.Text,
    -- | The source account or an organization.
    AggregatedSourceStatus -> Maybe AggregatedSourceType
sourceType :: Prelude.Maybe AggregatedSourceType
  }
  deriving (AggregatedSourceStatus -> AggregatedSourceStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggregatedSourceStatus -> AggregatedSourceStatus -> Bool
$c/= :: AggregatedSourceStatus -> AggregatedSourceStatus -> Bool
== :: AggregatedSourceStatus -> AggregatedSourceStatus -> Bool
$c== :: AggregatedSourceStatus -> AggregatedSourceStatus -> Bool
Prelude.Eq, ReadPrec [AggregatedSourceStatus]
ReadPrec AggregatedSourceStatus
Int -> ReadS AggregatedSourceStatus
ReadS [AggregatedSourceStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AggregatedSourceStatus]
$creadListPrec :: ReadPrec [AggregatedSourceStatus]
readPrec :: ReadPrec AggregatedSourceStatus
$creadPrec :: ReadPrec AggregatedSourceStatus
readList :: ReadS [AggregatedSourceStatus]
$creadList :: ReadS [AggregatedSourceStatus]
readsPrec :: Int -> ReadS AggregatedSourceStatus
$creadsPrec :: Int -> ReadS AggregatedSourceStatus
Prelude.Read, Int -> AggregatedSourceStatus -> ShowS
[AggregatedSourceStatus] -> ShowS
AggregatedSourceStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggregatedSourceStatus] -> ShowS
$cshowList :: [AggregatedSourceStatus] -> ShowS
show :: AggregatedSourceStatus -> String
$cshow :: AggregatedSourceStatus -> String
showsPrec :: Int -> AggregatedSourceStatus -> ShowS
$cshowsPrec :: Int -> AggregatedSourceStatus -> ShowS
Prelude.Show, forall x. Rep AggregatedSourceStatus x -> AggregatedSourceStatus
forall x. AggregatedSourceStatus -> Rep AggregatedSourceStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AggregatedSourceStatus x -> AggregatedSourceStatus
$cfrom :: forall x. AggregatedSourceStatus -> Rep AggregatedSourceStatus x
Prelude.Generic)

-- |
-- Create a value of 'AggregatedSourceStatus' 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:
--
-- 'awsRegion', 'aggregatedSourceStatus_awsRegion' - The region authorized to collect aggregated data.
--
-- 'lastErrorCode', 'aggregatedSourceStatus_lastErrorCode' - The error code that Config returned when the source account aggregation
-- last failed.
--
-- 'lastErrorMessage', 'aggregatedSourceStatus_lastErrorMessage' - The message indicating that the source account aggregation failed due to
-- an error.
--
-- 'lastUpdateStatus', 'aggregatedSourceStatus_lastUpdateStatus' - Filters the last updated status type.
--
-- -   Valid value FAILED indicates errors while moving data.
--
-- -   Valid value SUCCEEDED indicates the data was successfully moved.
--
-- -   Valid value OUTDATED indicates the data is not the most recent.
--
-- 'lastUpdateTime', 'aggregatedSourceStatus_lastUpdateTime' - The time of the last update.
--
-- 'sourceId', 'aggregatedSourceStatus_sourceId' - The source account ID or an organization.
--
-- 'sourceType', 'aggregatedSourceStatus_sourceType' - The source account or an organization.
newAggregatedSourceStatus ::
  AggregatedSourceStatus
newAggregatedSourceStatus :: AggregatedSourceStatus
newAggregatedSourceStatus =
  AggregatedSourceStatus'
    { $sel:awsRegion:AggregatedSourceStatus' :: Maybe Text
awsRegion =
        forall a. Maybe a
Prelude.Nothing,
      $sel:lastErrorCode:AggregatedSourceStatus' :: Maybe Text
lastErrorCode = forall a. Maybe a
Prelude.Nothing,
      $sel:lastErrorMessage:AggregatedSourceStatus' :: Maybe Text
lastErrorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdateStatus:AggregatedSourceStatus' :: Maybe AggregatedSourceStatusType
lastUpdateStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdateTime:AggregatedSourceStatus' :: Maybe POSIX
lastUpdateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceId:AggregatedSourceStatus' :: Maybe Text
sourceId = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceType:AggregatedSourceStatus' :: Maybe AggregatedSourceType
sourceType = forall a. Maybe a
Prelude.Nothing
    }

-- | The region authorized to collect aggregated data.
aggregatedSourceStatus_awsRegion :: Lens.Lens' AggregatedSourceStatus (Prelude.Maybe Prelude.Text)
aggregatedSourceStatus_awsRegion :: Lens' AggregatedSourceStatus (Maybe Text)
aggregatedSourceStatus_awsRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedSourceStatus' {Maybe Text
awsRegion :: Maybe Text
$sel:awsRegion:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe Text
awsRegion} -> Maybe Text
awsRegion) (\s :: AggregatedSourceStatus
s@AggregatedSourceStatus' {} Maybe Text
a -> AggregatedSourceStatus
s {$sel:awsRegion:AggregatedSourceStatus' :: Maybe Text
awsRegion = Maybe Text
a} :: AggregatedSourceStatus)

-- | The error code that Config returned when the source account aggregation
-- last failed.
aggregatedSourceStatus_lastErrorCode :: Lens.Lens' AggregatedSourceStatus (Prelude.Maybe Prelude.Text)
aggregatedSourceStatus_lastErrorCode :: Lens' AggregatedSourceStatus (Maybe Text)
aggregatedSourceStatus_lastErrorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedSourceStatus' {Maybe Text
lastErrorCode :: Maybe Text
$sel:lastErrorCode:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe Text
lastErrorCode} -> Maybe Text
lastErrorCode) (\s :: AggregatedSourceStatus
s@AggregatedSourceStatus' {} Maybe Text
a -> AggregatedSourceStatus
s {$sel:lastErrorCode:AggregatedSourceStatus' :: Maybe Text
lastErrorCode = Maybe Text
a} :: AggregatedSourceStatus)

-- | The message indicating that the source account aggregation failed due to
-- an error.
aggregatedSourceStatus_lastErrorMessage :: Lens.Lens' AggregatedSourceStatus (Prelude.Maybe Prelude.Text)
aggregatedSourceStatus_lastErrorMessage :: Lens' AggregatedSourceStatus (Maybe Text)
aggregatedSourceStatus_lastErrorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedSourceStatus' {Maybe Text
lastErrorMessage :: Maybe Text
$sel:lastErrorMessage:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe Text
lastErrorMessage} -> Maybe Text
lastErrorMessage) (\s :: AggregatedSourceStatus
s@AggregatedSourceStatus' {} Maybe Text
a -> AggregatedSourceStatus
s {$sel:lastErrorMessage:AggregatedSourceStatus' :: Maybe Text
lastErrorMessage = Maybe Text
a} :: AggregatedSourceStatus)

-- | Filters the last updated status type.
--
-- -   Valid value FAILED indicates errors while moving data.
--
-- -   Valid value SUCCEEDED indicates the data was successfully moved.
--
-- -   Valid value OUTDATED indicates the data is not the most recent.
aggregatedSourceStatus_lastUpdateStatus :: Lens.Lens' AggregatedSourceStatus (Prelude.Maybe AggregatedSourceStatusType)
aggregatedSourceStatus_lastUpdateStatus :: Lens' AggregatedSourceStatus (Maybe AggregatedSourceStatusType)
aggregatedSourceStatus_lastUpdateStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedSourceStatus' {Maybe AggregatedSourceStatusType
lastUpdateStatus :: Maybe AggregatedSourceStatusType
$sel:lastUpdateStatus:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe AggregatedSourceStatusType
lastUpdateStatus} -> Maybe AggregatedSourceStatusType
lastUpdateStatus) (\s :: AggregatedSourceStatus
s@AggregatedSourceStatus' {} Maybe AggregatedSourceStatusType
a -> AggregatedSourceStatus
s {$sel:lastUpdateStatus:AggregatedSourceStatus' :: Maybe AggregatedSourceStatusType
lastUpdateStatus = Maybe AggregatedSourceStatusType
a} :: AggregatedSourceStatus)

-- | The time of the last update.
aggregatedSourceStatus_lastUpdateTime :: Lens.Lens' AggregatedSourceStatus (Prelude.Maybe Prelude.UTCTime)
aggregatedSourceStatus_lastUpdateTime :: Lens' AggregatedSourceStatus (Maybe UTCTime)
aggregatedSourceStatus_lastUpdateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedSourceStatus' {Maybe POSIX
lastUpdateTime :: Maybe POSIX
$sel:lastUpdateTime:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe POSIX
lastUpdateTime} -> Maybe POSIX
lastUpdateTime) (\s :: AggregatedSourceStatus
s@AggregatedSourceStatus' {} Maybe POSIX
a -> AggregatedSourceStatus
s {$sel:lastUpdateTime:AggregatedSourceStatus' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
a} :: AggregatedSourceStatus) 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 source account ID or an organization.
aggregatedSourceStatus_sourceId :: Lens.Lens' AggregatedSourceStatus (Prelude.Maybe Prelude.Text)
aggregatedSourceStatus_sourceId :: Lens' AggregatedSourceStatus (Maybe Text)
aggregatedSourceStatus_sourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedSourceStatus' {Maybe Text
sourceId :: Maybe Text
$sel:sourceId:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe Text
sourceId} -> Maybe Text
sourceId) (\s :: AggregatedSourceStatus
s@AggregatedSourceStatus' {} Maybe Text
a -> AggregatedSourceStatus
s {$sel:sourceId:AggregatedSourceStatus' :: Maybe Text
sourceId = Maybe Text
a} :: AggregatedSourceStatus)

-- | The source account or an organization.
aggregatedSourceStatus_sourceType :: Lens.Lens' AggregatedSourceStatus (Prelude.Maybe AggregatedSourceType)
aggregatedSourceStatus_sourceType :: Lens' AggregatedSourceStatus (Maybe AggregatedSourceType)
aggregatedSourceStatus_sourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedSourceStatus' {Maybe AggregatedSourceType
sourceType :: Maybe AggregatedSourceType
$sel:sourceType:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe AggregatedSourceType
sourceType} -> Maybe AggregatedSourceType
sourceType) (\s :: AggregatedSourceStatus
s@AggregatedSourceStatus' {} Maybe AggregatedSourceType
a -> AggregatedSourceStatus
s {$sel:sourceType:AggregatedSourceStatus' :: Maybe AggregatedSourceType
sourceType = Maybe AggregatedSourceType
a} :: AggregatedSourceStatus)

instance Data.FromJSON AggregatedSourceStatus where
  parseJSON :: Value -> Parser AggregatedSourceStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AggregatedSourceStatus"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe AggregatedSourceStatusType
-> Maybe POSIX
-> Maybe Text
-> Maybe AggregatedSourceType
-> AggregatedSourceStatus
AggregatedSourceStatus'
            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
"AwsRegion")
            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
"LastErrorCode")
            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
"LastErrorMessage")
            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
"LastUpdateStatus")
            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
"LastUpdateTime")
            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
"SourceId")
            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
"SourceType")
      )

instance Prelude.Hashable AggregatedSourceStatus where
  hashWithSalt :: Int -> AggregatedSourceStatus -> Int
hashWithSalt Int
_salt AggregatedSourceStatus' {Maybe Text
Maybe POSIX
Maybe AggregatedSourceStatusType
Maybe AggregatedSourceType
sourceType :: Maybe AggregatedSourceType
sourceId :: Maybe Text
lastUpdateTime :: Maybe POSIX
lastUpdateStatus :: Maybe AggregatedSourceStatusType
lastErrorMessage :: Maybe Text
lastErrorCode :: Maybe Text
awsRegion :: Maybe Text
$sel:sourceType:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe AggregatedSourceType
$sel:sourceId:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe Text
$sel:lastUpdateTime:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe POSIX
$sel:lastUpdateStatus:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe AggregatedSourceStatusType
$sel:lastErrorMessage:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe Text
$sel:lastErrorCode:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe Text
$sel:awsRegion:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsRegion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastErrorCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastErrorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AggregatedSourceStatusType
lastUpdateStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AggregatedSourceType
sourceType

instance Prelude.NFData AggregatedSourceStatus where
  rnf :: AggregatedSourceStatus -> ()
rnf AggregatedSourceStatus' {Maybe Text
Maybe POSIX
Maybe AggregatedSourceStatusType
Maybe AggregatedSourceType
sourceType :: Maybe AggregatedSourceType
sourceId :: Maybe Text
lastUpdateTime :: Maybe POSIX
lastUpdateStatus :: Maybe AggregatedSourceStatusType
lastErrorMessage :: Maybe Text
lastErrorCode :: Maybe Text
awsRegion :: Maybe Text
$sel:sourceType:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe AggregatedSourceType
$sel:sourceId:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe Text
$sel:lastUpdateTime:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe POSIX
$sel:lastUpdateStatus:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe AggregatedSourceStatusType
$sel:lastErrorMessage:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe Text
$sel:lastErrorCode:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe Text
$sel:awsRegion:AggregatedSourceStatus' :: AggregatedSourceStatus -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsRegion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastErrorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastErrorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AggregatedSourceStatusType
lastUpdateStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AggregatedSourceType
sourceType