{-# 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.ResourceGroups.Types.GroupConfigurationItem where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.ResourceGroups.Types.GroupConfigurationParameter
data GroupConfigurationItem = GroupConfigurationItem'
{
GroupConfigurationItem -> Maybe [GroupConfigurationParameter]
parameters :: Prelude.Maybe [GroupConfigurationParameter],
GroupConfigurationItem -> Text
type' :: Prelude.Text
}
deriving (GroupConfigurationItem -> GroupConfigurationItem -> Bool
(GroupConfigurationItem -> GroupConfigurationItem -> Bool)
-> (GroupConfigurationItem -> GroupConfigurationItem -> Bool)
-> Eq GroupConfigurationItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GroupConfigurationItem -> GroupConfigurationItem -> Bool
$c/= :: GroupConfigurationItem -> GroupConfigurationItem -> Bool
== :: GroupConfigurationItem -> GroupConfigurationItem -> Bool
$c== :: GroupConfigurationItem -> GroupConfigurationItem -> Bool
Prelude.Eq, ReadPrec [GroupConfigurationItem]
ReadPrec GroupConfigurationItem
Int -> ReadS GroupConfigurationItem
ReadS [GroupConfigurationItem]
(Int -> ReadS GroupConfigurationItem)
-> ReadS [GroupConfigurationItem]
-> ReadPrec GroupConfigurationItem
-> ReadPrec [GroupConfigurationItem]
-> Read GroupConfigurationItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GroupConfigurationItem]
$creadListPrec :: ReadPrec [GroupConfigurationItem]
readPrec :: ReadPrec GroupConfigurationItem
$creadPrec :: ReadPrec GroupConfigurationItem
readList :: ReadS [GroupConfigurationItem]
$creadList :: ReadS [GroupConfigurationItem]
readsPrec :: Int -> ReadS GroupConfigurationItem
$creadsPrec :: Int -> ReadS GroupConfigurationItem
Prelude.Read, Int -> GroupConfigurationItem -> ShowS
[GroupConfigurationItem] -> ShowS
GroupConfigurationItem -> String
(Int -> GroupConfigurationItem -> ShowS)
-> (GroupConfigurationItem -> String)
-> ([GroupConfigurationItem] -> ShowS)
-> Show GroupConfigurationItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GroupConfigurationItem] -> ShowS
$cshowList :: [GroupConfigurationItem] -> ShowS
show :: GroupConfigurationItem -> String
$cshow :: GroupConfigurationItem -> String
showsPrec :: Int -> GroupConfigurationItem -> ShowS
$cshowsPrec :: Int -> GroupConfigurationItem -> ShowS
Prelude.Show, (forall x. GroupConfigurationItem -> Rep GroupConfigurationItem x)
-> (forall x.
Rep GroupConfigurationItem x -> GroupConfigurationItem)
-> Generic GroupConfigurationItem
forall x. Rep GroupConfigurationItem x -> GroupConfigurationItem
forall x. GroupConfigurationItem -> Rep GroupConfigurationItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GroupConfigurationItem x -> GroupConfigurationItem
$cfrom :: forall x. GroupConfigurationItem -> Rep GroupConfigurationItem x
Prelude.Generic)
newGroupConfigurationItem ::
Prelude.Text ->
GroupConfigurationItem
newGroupConfigurationItem :: Text -> GroupConfigurationItem
newGroupConfigurationItem Text
pType_ =
GroupConfigurationItem' :: Maybe [GroupConfigurationParameter]
-> Text -> GroupConfigurationItem
GroupConfigurationItem'
{ $sel:parameters:GroupConfigurationItem' :: Maybe [GroupConfigurationParameter]
parameters =
Maybe [GroupConfigurationParameter]
forall a. Maybe a
Prelude.Nothing,
$sel:type':GroupConfigurationItem' :: Text
type' = Text
pType_
}
groupConfigurationItem_parameters :: Lens.Lens' GroupConfigurationItem (Prelude.Maybe [GroupConfigurationParameter])
groupConfigurationItem_parameters :: (Maybe [GroupConfigurationParameter]
-> f (Maybe [GroupConfigurationParameter]))
-> GroupConfigurationItem -> f GroupConfigurationItem
groupConfigurationItem_parameters = (GroupConfigurationItem -> Maybe [GroupConfigurationParameter])
-> (GroupConfigurationItem
-> Maybe [GroupConfigurationParameter] -> GroupConfigurationItem)
-> Lens
GroupConfigurationItem
GroupConfigurationItem
(Maybe [GroupConfigurationParameter])
(Maybe [GroupConfigurationParameter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupConfigurationItem' {Maybe [GroupConfigurationParameter]
parameters :: Maybe [GroupConfigurationParameter]
$sel:parameters:GroupConfigurationItem' :: GroupConfigurationItem -> Maybe [GroupConfigurationParameter]
parameters} -> Maybe [GroupConfigurationParameter]
parameters) (\s :: GroupConfigurationItem
s@GroupConfigurationItem' {} Maybe [GroupConfigurationParameter]
a -> GroupConfigurationItem
s {$sel:parameters:GroupConfigurationItem' :: Maybe [GroupConfigurationParameter]
parameters = Maybe [GroupConfigurationParameter]
a} :: GroupConfigurationItem) ((Maybe [GroupConfigurationParameter]
-> f (Maybe [GroupConfigurationParameter]))
-> GroupConfigurationItem -> f GroupConfigurationItem)
-> ((Maybe [GroupConfigurationParameter]
-> f (Maybe [GroupConfigurationParameter]))
-> Maybe [GroupConfigurationParameter]
-> f (Maybe [GroupConfigurationParameter]))
-> (Maybe [GroupConfigurationParameter]
-> f (Maybe [GroupConfigurationParameter]))
-> GroupConfigurationItem
-> f GroupConfigurationItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[GroupConfigurationParameter]
[GroupConfigurationParameter]
[GroupConfigurationParameter]
[GroupConfigurationParameter]
-> Iso
(Maybe [GroupConfigurationParameter])
(Maybe [GroupConfigurationParameter])
(Maybe [GroupConfigurationParameter])
(Maybe [GroupConfigurationParameter])
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
[GroupConfigurationParameter]
[GroupConfigurationParameter]
[GroupConfigurationParameter]
[GroupConfigurationParameter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
groupConfigurationItem_type :: Lens.Lens' GroupConfigurationItem Prelude.Text
groupConfigurationItem_type :: (Text -> f Text)
-> GroupConfigurationItem -> f GroupConfigurationItem
groupConfigurationItem_type = (GroupConfigurationItem -> Text)
-> (GroupConfigurationItem -> Text -> GroupConfigurationItem)
-> Lens GroupConfigurationItem GroupConfigurationItem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupConfigurationItem' {Text
type' :: Text
$sel:type':GroupConfigurationItem' :: GroupConfigurationItem -> Text
type'} -> Text
type') (\s :: GroupConfigurationItem
s@GroupConfigurationItem' {} Text
a -> GroupConfigurationItem
s {$sel:type':GroupConfigurationItem' :: Text
type' = Text
a} :: GroupConfigurationItem)
instance Core.FromJSON GroupConfigurationItem where
parseJSON :: Value -> Parser GroupConfigurationItem
parseJSON =
String
-> (Object -> Parser GroupConfigurationItem)
-> Value
-> Parser GroupConfigurationItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"GroupConfigurationItem"
( \Object
x ->
Maybe [GroupConfigurationParameter]
-> Text -> GroupConfigurationItem
GroupConfigurationItem'
(Maybe [GroupConfigurationParameter]
-> Text -> GroupConfigurationItem)
-> Parser (Maybe [GroupConfigurationParameter])
-> Parser (Text -> GroupConfigurationItem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe (Maybe [GroupConfigurationParameter]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Parameters" Parser (Maybe (Maybe [GroupConfigurationParameter]))
-> Maybe [GroupConfigurationParameter]
-> Parser (Maybe [GroupConfigurationParameter])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [GroupConfigurationParameter]
forall a. Monoid a => a
Prelude.mempty)
Parser (Text -> GroupConfigurationItem)
-> Parser Text -> Parser GroupConfigurationItem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type")
)
instance Prelude.Hashable GroupConfigurationItem
instance Prelude.NFData GroupConfigurationItem
instance Core.ToJSON GroupConfigurationItem where
toJSON :: GroupConfigurationItem -> Value
toJSON GroupConfigurationItem' {Maybe [GroupConfigurationParameter]
Text
type' :: Text
parameters :: Maybe [GroupConfigurationParameter]
$sel:type':GroupConfigurationItem' :: GroupConfigurationItem -> Text
$sel:parameters:GroupConfigurationItem' :: GroupConfigurationItem -> Maybe [GroupConfigurationParameter]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Parameters" Text -> [GroupConfigurationParameter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([GroupConfigurationParameter] -> Pair)
-> Maybe [GroupConfigurationParameter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [GroupConfigurationParameter]
parameters,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
type')
]
)