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