{-# 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 #-}
module Amazonka.Config.Types.AccountAggregationSource where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AccountAggregationSource = AccountAggregationSource'
{
AccountAggregationSource -> Maybe (NonEmpty Text)
awsRegions :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
AccountAggregationSource -> Maybe Bool
allAwsRegions :: Prelude.Maybe Prelude.Bool,
AccountAggregationSource -> NonEmpty Text
accountIds :: Prelude.NonEmpty Prelude.Text
}
deriving (AccountAggregationSource -> AccountAggregationSource -> Bool
(AccountAggregationSource -> AccountAggregationSource -> Bool)
-> (AccountAggregationSource -> AccountAggregationSource -> Bool)
-> Eq AccountAggregationSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountAggregationSource -> AccountAggregationSource -> Bool
$c/= :: AccountAggregationSource -> AccountAggregationSource -> Bool
== :: AccountAggregationSource -> AccountAggregationSource -> Bool
$c== :: AccountAggregationSource -> AccountAggregationSource -> Bool
Prelude.Eq, ReadPrec [AccountAggregationSource]
ReadPrec AccountAggregationSource
Int -> ReadS AccountAggregationSource
ReadS [AccountAggregationSource]
(Int -> ReadS AccountAggregationSource)
-> ReadS [AccountAggregationSource]
-> ReadPrec AccountAggregationSource
-> ReadPrec [AccountAggregationSource]
-> Read AccountAggregationSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountAggregationSource]
$creadListPrec :: ReadPrec [AccountAggregationSource]
readPrec :: ReadPrec AccountAggregationSource
$creadPrec :: ReadPrec AccountAggregationSource
readList :: ReadS [AccountAggregationSource]
$creadList :: ReadS [AccountAggregationSource]
readsPrec :: Int -> ReadS AccountAggregationSource
$creadsPrec :: Int -> ReadS AccountAggregationSource
Prelude.Read, Int -> AccountAggregationSource -> ShowS
[AccountAggregationSource] -> ShowS
AccountAggregationSource -> String
(Int -> AccountAggregationSource -> ShowS)
-> (AccountAggregationSource -> String)
-> ([AccountAggregationSource] -> ShowS)
-> Show AccountAggregationSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountAggregationSource] -> ShowS
$cshowList :: [AccountAggregationSource] -> ShowS
show :: AccountAggregationSource -> String
$cshow :: AccountAggregationSource -> String
showsPrec :: Int -> AccountAggregationSource -> ShowS
$cshowsPrec :: Int -> AccountAggregationSource -> ShowS
Prelude.Show, (forall x.
AccountAggregationSource -> Rep AccountAggregationSource x)
-> (forall x.
Rep AccountAggregationSource x -> AccountAggregationSource)
-> Generic AccountAggregationSource
forall x.
Rep AccountAggregationSource x -> AccountAggregationSource
forall x.
AccountAggregationSource -> Rep AccountAggregationSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AccountAggregationSource x -> AccountAggregationSource
$cfrom :: forall x.
AccountAggregationSource -> Rep AccountAggregationSource x
Prelude.Generic)
newAccountAggregationSource ::
Prelude.NonEmpty Prelude.Text ->
AccountAggregationSource
newAccountAggregationSource :: NonEmpty Text -> AccountAggregationSource
newAccountAggregationSource NonEmpty Text
pAccountIds_ =
AccountAggregationSource' :: Maybe (NonEmpty Text)
-> Maybe Bool -> NonEmpty Text -> AccountAggregationSource
AccountAggregationSource'
{ $sel:awsRegions:AccountAggregationSource' :: Maybe (NonEmpty Text)
awsRegions =
Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:allAwsRegions:AccountAggregationSource' :: Maybe Bool
allAwsRegions = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:accountIds:AccountAggregationSource' :: NonEmpty Text
accountIds = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pAccountIds_
}
accountAggregationSource_awsRegions :: Lens.Lens' AccountAggregationSource (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
accountAggregationSource_awsRegions :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> AccountAggregationSource -> f AccountAggregationSource
accountAggregationSource_awsRegions = (AccountAggregationSource -> Maybe (NonEmpty Text))
-> (AccountAggregationSource
-> Maybe (NonEmpty Text) -> AccountAggregationSource)
-> Lens
AccountAggregationSource
AccountAggregationSource
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountAggregationSource' {Maybe (NonEmpty Text)
awsRegions :: Maybe (NonEmpty Text)
$sel:awsRegions:AccountAggregationSource' :: AccountAggregationSource -> Maybe (NonEmpty Text)
awsRegions} -> Maybe (NonEmpty Text)
awsRegions) (\s :: AccountAggregationSource
s@AccountAggregationSource' {} Maybe (NonEmpty Text)
a -> AccountAggregationSource
s {$sel:awsRegions:AccountAggregationSource' :: Maybe (NonEmpty Text)
awsRegions = Maybe (NonEmpty Text)
a} :: AccountAggregationSource) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> AccountAggregationSource -> f AccountAggregationSource)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> AccountAggregationSource
-> f AccountAggregationSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
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 AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
accountAggregationSource_allAwsRegions :: Lens.Lens' AccountAggregationSource (Prelude.Maybe Prelude.Bool)
accountAggregationSource_allAwsRegions :: (Maybe Bool -> f (Maybe Bool))
-> AccountAggregationSource -> f AccountAggregationSource
accountAggregationSource_allAwsRegions = (AccountAggregationSource -> Maybe Bool)
-> (AccountAggregationSource
-> Maybe Bool -> AccountAggregationSource)
-> Lens
AccountAggregationSource
AccountAggregationSource
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountAggregationSource' {Maybe Bool
allAwsRegions :: Maybe Bool
$sel:allAwsRegions:AccountAggregationSource' :: AccountAggregationSource -> Maybe Bool
allAwsRegions} -> Maybe Bool
allAwsRegions) (\s :: AccountAggregationSource
s@AccountAggregationSource' {} Maybe Bool
a -> AccountAggregationSource
s {$sel:allAwsRegions:AccountAggregationSource' :: Maybe Bool
allAwsRegions = Maybe Bool
a} :: AccountAggregationSource)
accountAggregationSource_accountIds :: Lens.Lens' AccountAggregationSource (Prelude.NonEmpty Prelude.Text)
accountAggregationSource_accountIds :: (NonEmpty Text -> f (NonEmpty Text))
-> AccountAggregationSource -> f AccountAggregationSource
accountAggregationSource_accountIds = (AccountAggregationSource -> NonEmpty Text)
-> (AccountAggregationSource
-> NonEmpty Text -> AccountAggregationSource)
-> Lens
AccountAggregationSource
AccountAggregationSource
(NonEmpty Text)
(NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountAggregationSource' {NonEmpty Text
accountIds :: NonEmpty Text
$sel:accountIds:AccountAggregationSource' :: AccountAggregationSource -> NonEmpty Text
accountIds} -> NonEmpty Text
accountIds) (\s :: AccountAggregationSource
s@AccountAggregationSource' {} NonEmpty Text
a -> AccountAggregationSource
s {$sel:accountIds:AccountAggregationSource' :: NonEmpty Text
accountIds = NonEmpty Text
a} :: AccountAggregationSource) ((NonEmpty Text -> f (NonEmpty Text))
-> AccountAggregationSource -> f AccountAggregationSource)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> AccountAggregationSource
-> f AccountAggregationSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON AccountAggregationSource where
parseJSON :: Value -> Parser AccountAggregationSource
parseJSON =
String
-> (Object -> Parser AccountAggregationSource)
-> Value
-> Parser AccountAggregationSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AccountAggregationSource"
( \Object
x ->
Maybe (NonEmpty Text)
-> Maybe Bool -> NonEmpty Text -> AccountAggregationSource
AccountAggregationSource'
(Maybe (NonEmpty Text)
-> Maybe Bool -> NonEmpty Text -> AccountAggregationSource)
-> Parser (Maybe (NonEmpty Text))
-> Parser (Maybe Bool -> NonEmpty Text -> AccountAggregationSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AwsRegions")
Parser (Maybe Bool -> NonEmpty Text -> AccountAggregationSource)
-> Parser (Maybe Bool)
-> Parser (NonEmpty Text -> AccountAggregationSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AllAwsRegions")
Parser (NonEmpty Text -> AccountAggregationSource)
-> Parser (NonEmpty Text) -> Parser AccountAggregationSource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"AccountIds")
)
instance Prelude.Hashable AccountAggregationSource
instance Prelude.NFData AccountAggregationSource
instance Core.ToJSON AccountAggregationSource where
toJSON :: AccountAggregationSource -> Value
toJSON AccountAggregationSource' {Maybe Bool
Maybe (NonEmpty Text)
NonEmpty Text
accountIds :: NonEmpty Text
allAwsRegions :: Maybe Bool
awsRegions :: Maybe (NonEmpty Text)
$sel:accountIds:AccountAggregationSource' :: AccountAggregationSource -> NonEmpty Text
$sel:allAwsRegions:AccountAggregationSource' :: AccountAggregationSource -> Maybe Bool
$sel:awsRegions:AccountAggregationSource' :: AccountAggregationSource -> Maybe (NonEmpty Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AwsRegions" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
awsRegions,
(Text
"AllAwsRegions" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
allAwsRegions,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AccountIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
accountIds)
]
)