{-# 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.ConfigurationAggregator
-- 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.ConfigurationAggregator where

import Amazonka.Config.Types.AccountAggregationSource
import Amazonka.Config.Types.OrganizationAggregationSource
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 details about the configuration aggregator, including information
-- about source accounts, regions, and metadata of the aggregator.
--
-- /See:/ 'newConfigurationAggregator' smart constructor.
data ConfigurationAggregator = ConfigurationAggregator'
  { -- | Provides a list of source accounts and regions to be aggregated.
    ConfigurationAggregator -> Maybe [AccountAggregationSource]
accountAggregationSources :: Prelude.Maybe [AccountAggregationSource],
    -- | The Amazon Resource Name (ARN) of the aggregator.
    ConfigurationAggregator -> Maybe Text
configurationAggregatorArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the aggregator.
    ConfigurationAggregator -> Maybe Text
configurationAggregatorName :: Prelude.Maybe Prelude.Text,
    -- | Amazon Web Services service that created the configuration aggregator.
    ConfigurationAggregator -> Maybe Text
createdBy :: Prelude.Maybe Prelude.Text,
    -- | The time stamp when the configuration aggregator was created.
    ConfigurationAggregator -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | The time of the last update.
    ConfigurationAggregator -> Maybe POSIX
lastUpdatedTime :: Prelude.Maybe Data.POSIX,
    -- | Provides an organization and list of regions to be aggregated.
    ConfigurationAggregator -> Maybe OrganizationAggregationSource
organizationAggregationSource :: Prelude.Maybe OrganizationAggregationSource
  }
  deriving (ConfigurationAggregator -> ConfigurationAggregator -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigurationAggregator -> ConfigurationAggregator -> Bool
$c/= :: ConfigurationAggregator -> ConfigurationAggregator -> Bool
== :: ConfigurationAggregator -> ConfigurationAggregator -> Bool
$c== :: ConfigurationAggregator -> ConfigurationAggregator -> Bool
Prelude.Eq, ReadPrec [ConfigurationAggregator]
ReadPrec ConfigurationAggregator
Int -> ReadS ConfigurationAggregator
ReadS [ConfigurationAggregator]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfigurationAggregator]
$creadListPrec :: ReadPrec [ConfigurationAggregator]
readPrec :: ReadPrec ConfigurationAggregator
$creadPrec :: ReadPrec ConfigurationAggregator
readList :: ReadS [ConfigurationAggregator]
$creadList :: ReadS [ConfigurationAggregator]
readsPrec :: Int -> ReadS ConfigurationAggregator
$creadsPrec :: Int -> ReadS ConfigurationAggregator
Prelude.Read, Int -> ConfigurationAggregator -> ShowS
[ConfigurationAggregator] -> ShowS
ConfigurationAggregator -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigurationAggregator] -> ShowS
$cshowList :: [ConfigurationAggregator] -> ShowS
show :: ConfigurationAggregator -> String
$cshow :: ConfigurationAggregator -> String
showsPrec :: Int -> ConfigurationAggregator -> ShowS
$cshowsPrec :: Int -> ConfigurationAggregator -> ShowS
Prelude.Show, forall x. Rep ConfigurationAggregator x -> ConfigurationAggregator
forall x. ConfigurationAggregator -> Rep ConfigurationAggregator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfigurationAggregator x -> ConfigurationAggregator
$cfrom :: forall x. ConfigurationAggregator -> Rep ConfigurationAggregator x
Prelude.Generic)

-- |
-- Create a value of 'ConfigurationAggregator' 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:
--
-- 'accountAggregationSources', 'configurationAggregator_accountAggregationSources' - Provides a list of source accounts and regions to be aggregated.
--
-- 'configurationAggregatorArn', 'configurationAggregator_configurationAggregatorArn' - The Amazon Resource Name (ARN) of the aggregator.
--
-- 'configurationAggregatorName', 'configurationAggregator_configurationAggregatorName' - The name of the aggregator.
--
-- 'createdBy', 'configurationAggregator_createdBy' - Amazon Web Services service that created the configuration aggregator.
--
-- 'creationTime', 'configurationAggregator_creationTime' - The time stamp when the configuration aggregator was created.
--
-- 'lastUpdatedTime', 'configurationAggregator_lastUpdatedTime' - The time of the last update.
--
-- 'organizationAggregationSource', 'configurationAggregator_organizationAggregationSource' - Provides an organization and list of regions to be aggregated.
newConfigurationAggregator ::
  ConfigurationAggregator
newConfigurationAggregator :: ConfigurationAggregator
newConfigurationAggregator =
  ConfigurationAggregator'
    { $sel:accountAggregationSources:ConfigurationAggregator' :: Maybe [AccountAggregationSource]
accountAggregationSources =
        forall a. Maybe a
Prelude.Nothing,
      $sel:configurationAggregatorArn:ConfigurationAggregator' :: Maybe Text
configurationAggregatorArn = forall a. Maybe a
Prelude.Nothing,
      $sel:configurationAggregatorName:ConfigurationAggregator' :: Maybe Text
configurationAggregatorName = forall a. Maybe a
Prelude.Nothing,
      $sel:createdBy:ConfigurationAggregator' :: Maybe Text
createdBy = forall a. Maybe a
Prelude.Nothing,
      $sel:creationTime:ConfigurationAggregator' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTime:ConfigurationAggregator' :: Maybe POSIX
lastUpdatedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:organizationAggregationSource:ConfigurationAggregator' :: Maybe OrganizationAggregationSource
organizationAggregationSource = forall a. Maybe a
Prelude.Nothing
    }

-- | Provides a list of source accounts and regions to be aggregated.
configurationAggregator_accountAggregationSources :: Lens.Lens' ConfigurationAggregator (Prelude.Maybe [AccountAggregationSource])
configurationAggregator_accountAggregationSources :: Lens' ConfigurationAggregator (Maybe [AccountAggregationSource])
configurationAggregator_accountAggregationSources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationAggregator' {Maybe [AccountAggregationSource]
accountAggregationSources :: Maybe [AccountAggregationSource]
$sel:accountAggregationSources:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe [AccountAggregationSource]
accountAggregationSources} -> Maybe [AccountAggregationSource]
accountAggregationSources) (\s :: ConfigurationAggregator
s@ConfigurationAggregator' {} Maybe [AccountAggregationSource]
a -> ConfigurationAggregator
s {$sel:accountAggregationSources:ConfigurationAggregator' :: Maybe [AccountAggregationSource]
accountAggregationSources = Maybe [AccountAggregationSource]
a} :: ConfigurationAggregator) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the aggregator.
configurationAggregator_configurationAggregatorArn :: Lens.Lens' ConfigurationAggregator (Prelude.Maybe Prelude.Text)
configurationAggregator_configurationAggregatorArn :: Lens' ConfigurationAggregator (Maybe Text)
configurationAggregator_configurationAggregatorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationAggregator' {Maybe Text
configurationAggregatorArn :: Maybe Text
$sel:configurationAggregatorArn:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe Text
configurationAggregatorArn} -> Maybe Text
configurationAggregatorArn) (\s :: ConfigurationAggregator
s@ConfigurationAggregator' {} Maybe Text
a -> ConfigurationAggregator
s {$sel:configurationAggregatorArn:ConfigurationAggregator' :: Maybe Text
configurationAggregatorArn = Maybe Text
a} :: ConfigurationAggregator)

-- | The name of the aggregator.
configurationAggregator_configurationAggregatorName :: Lens.Lens' ConfigurationAggregator (Prelude.Maybe Prelude.Text)
configurationAggregator_configurationAggregatorName :: Lens' ConfigurationAggregator (Maybe Text)
configurationAggregator_configurationAggregatorName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationAggregator' {Maybe Text
configurationAggregatorName :: Maybe Text
$sel:configurationAggregatorName:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe Text
configurationAggregatorName} -> Maybe Text
configurationAggregatorName) (\s :: ConfigurationAggregator
s@ConfigurationAggregator' {} Maybe Text
a -> ConfigurationAggregator
s {$sel:configurationAggregatorName:ConfigurationAggregator' :: Maybe Text
configurationAggregatorName = Maybe Text
a} :: ConfigurationAggregator)

-- | Amazon Web Services service that created the configuration aggregator.
configurationAggregator_createdBy :: Lens.Lens' ConfigurationAggregator (Prelude.Maybe Prelude.Text)
configurationAggregator_createdBy :: Lens' ConfigurationAggregator (Maybe Text)
configurationAggregator_createdBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationAggregator' {Maybe Text
createdBy :: Maybe Text
$sel:createdBy:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe Text
createdBy} -> Maybe Text
createdBy) (\s :: ConfigurationAggregator
s@ConfigurationAggregator' {} Maybe Text
a -> ConfigurationAggregator
s {$sel:createdBy:ConfigurationAggregator' :: Maybe Text
createdBy = Maybe Text
a} :: ConfigurationAggregator)

-- | The time stamp when the configuration aggregator was created.
configurationAggregator_creationTime :: Lens.Lens' ConfigurationAggregator (Prelude.Maybe Prelude.UTCTime)
configurationAggregator_creationTime :: Lens' ConfigurationAggregator (Maybe UTCTime)
configurationAggregator_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationAggregator' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: ConfigurationAggregator
s@ConfigurationAggregator' {} Maybe POSIX
a -> ConfigurationAggregator
s {$sel:creationTime:ConfigurationAggregator' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: ConfigurationAggregator) 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 time of the last update.
configurationAggregator_lastUpdatedTime :: Lens.Lens' ConfigurationAggregator (Prelude.Maybe Prelude.UTCTime)
configurationAggregator_lastUpdatedTime :: Lens' ConfigurationAggregator (Maybe UTCTime)
configurationAggregator_lastUpdatedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationAggregator' {Maybe POSIX
lastUpdatedTime :: Maybe POSIX
$sel:lastUpdatedTime:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe POSIX
lastUpdatedTime} -> Maybe POSIX
lastUpdatedTime) (\s :: ConfigurationAggregator
s@ConfigurationAggregator' {} Maybe POSIX
a -> ConfigurationAggregator
s {$sel:lastUpdatedTime:ConfigurationAggregator' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
a} :: ConfigurationAggregator) 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

-- | Provides an organization and list of regions to be aggregated.
configurationAggregator_organizationAggregationSource :: Lens.Lens' ConfigurationAggregator (Prelude.Maybe OrganizationAggregationSource)
configurationAggregator_organizationAggregationSource :: Lens' ConfigurationAggregator (Maybe OrganizationAggregationSource)
configurationAggregator_organizationAggregationSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationAggregator' {Maybe OrganizationAggregationSource
organizationAggregationSource :: Maybe OrganizationAggregationSource
$sel:organizationAggregationSource:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe OrganizationAggregationSource
organizationAggregationSource} -> Maybe OrganizationAggregationSource
organizationAggregationSource) (\s :: ConfigurationAggregator
s@ConfigurationAggregator' {} Maybe OrganizationAggregationSource
a -> ConfigurationAggregator
s {$sel:organizationAggregationSource:ConfigurationAggregator' :: Maybe OrganizationAggregationSource
organizationAggregationSource = Maybe OrganizationAggregationSource
a} :: ConfigurationAggregator)

instance Data.FromJSON ConfigurationAggregator where
  parseJSON :: Value -> Parser ConfigurationAggregator
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConfigurationAggregator"
      ( \Object
x ->
          Maybe [AccountAggregationSource]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe OrganizationAggregationSource
-> ConfigurationAggregator
ConfigurationAggregator'
            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
"AccountAggregationSources"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"ConfigurationAggregatorArn")
            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
"ConfigurationAggregatorName")
            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
"CreatedBy")
            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
"CreationTime")
            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
"LastUpdatedTime")
            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
"OrganizationAggregationSource")
      )

instance Prelude.Hashable ConfigurationAggregator where
  hashWithSalt :: Int -> ConfigurationAggregator -> Int
hashWithSalt Int
_salt ConfigurationAggregator' {Maybe [AccountAggregationSource]
Maybe Text
Maybe POSIX
Maybe OrganizationAggregationSource
organizationAggregationSource :: Maybe OrganizationAggregationSource
lastUpdatedTime :: Maybe POSIX
creationTime :: Maybe POSIX
createdBy :: Maybe Text
configurationAggregatorName :: Maybe Text
configurationAggregatorArn :: Maybe Text
accountAggregationSources :: Maybe [AccountAggregationSource]
$sel:organizationAggregationSource:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe OrganizationAggregationSource
$sel:lastUpdatedTime:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe POSIX
$sel:creationTime:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe POSIX
$sel:createdBy:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe Text
$sel:configurationAggregatorName:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe Text
$sel:configurationAggregatorArn:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe Text
$sel:accountAggregationSources:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe [AccountAggregationSource]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AccountAggregationSource]
accountAggregationSources
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
configurationAggregatorArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
configurationAggregatorName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
createdBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OrganizationAggregationSource
organizationAggregationSource

instance Prelude.NFData ConfigurationAggregator where
  rnf :: ConfigurationAggregator -> ()
rnf ConfigurationAggregator' {Maybe [AccountAggregationSource]
Maybe Text
Maybe POSIX
Maybe OrganizationAggregationSource
organizationAggregationSource :: Maybe OrganizationAggregationSource
lastUpdatedTime :: Maybe POSIX
creationTime :: Maybe POSIX
createdBy :: Maybe Text
configurationAggregatorName :: Maybe Text
configurationAggregatorArn :: Maybe Text
accountAggregationSources :: Maybe [AccountAggregationSource]
$sel:organizationAggregationSource:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe OrganizationAggregationSource
$sel:lastUpdatedTime:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe POSIX
$sel:creationTime:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe POSIX
$sel:createdBy:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe Text
$sel:configurationAggregatorName:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe Text
$sel:configurationAggregatorArn:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe Text
$sel:accountAggregationSources:ConfigurationAggregator' :: ConfigurationAggregator -> Maybe [AccountAggregationSource]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AccountAggregationSource]
accountAggregationSources
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
configurationAggregatorArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
configurationAggregatorName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
createdBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OrganizationAggregationSource
organizationAggregationSource