{-# 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.SelectAttributesActivity where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SelectAttributesActivity = SelectAttributesActivity'
{
SelectAttributesActivity -> Maybe Text
next :: Prelude.Maybe Prelude.Text,
SelectAttributesActivity -> Text
name :: Prelude.Text,
SelectAttributesActivity -> NonEmpty Text
attributes :: Prelude.NonEmpty Prelude.Text
}
deriving (SelectAttributesActivity -> SelectAttributesActivity -> Bool
(SelectAttributesActivity -> SelectAttributesActivity -> Bool)
-> (SelectAttributesActivity -> SelectAttributesActivity -> Bool)
-> Eq SelectAttributesActivity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelectAttributesActivity -> SelectAttributesActivity -> Bool
$c/= :: SelectAttributesActivity -> SelectAttributesActivity -> Bool
== :: SelectAttributesActivity -> SelectAttributesActivity -> Bool
$c== :: SelectAttributesActivity -> SelectAttributesActivity -> Bool
Prelude.Eq, ReadPrec [SelectAttributesActivity]
ReadPrec SelectAttributesActivity
Int -> ReadS SelectAttributesActivity
ReadS [SelectAttributesActivity]
(Int -> ReadS SelectAttributesActivity)
-> ReadS [SelectAttributesActivity]
-> ReadPrec SelectAttributesActivity
-> ReadPrec [SelectAttributesActivity]
-> Read SelectAttributesActivity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SelectAttributesActivity]
$creadListPrec :: ReadPrec [SelectAttributesActivity]
readPrec :: ReadPrec SelectAttributesActivity
$creadPrec :: ReadPrec SelectAttributesActivity
readList :: ReadS [SelectAttributesActivity]
$creadList :: ReadS [SelectAttributesActivity]
readsPrec :: Int -> ReadS SelectAttributesActivity
$creadsPrec :: Int -> ReadS SelectAttributesActivity
Prelude.Read, Int -> SelectAttributesActivity -> ShowS
[SelectAttributesActivity] -> ShowS
SelectAttributesActivity -> String
(Int -> SelectAttributesActivity -> ShowS)
-> (SelectAttributesActivity -> String)
-> ([SelectAttributesActivity] -> ShowS)
-> Show SelectAttributesActivity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelectAttributesActivity] -> ShowS
$cshowList :: [SelectAttributesActivity] -> ShowS
show :: SelectAttributesActivity -> String
$cshow :: SelectAttributesActivity -> String
showsPrec :: Int -> SelectAttributesActivity -> ShowS
$cshowsPrec :: Int -> SelectAttributesActivity -> ShowS
Prelude.Show, (forall x.
SelectAttributesActivity -> Rep SelectAttributesActivity x)
-> (forall x.
Rep SelectAttributesActivity x -> SelectAttributesActivity)
-> Generic SelectAttributesActivity
forall x.
Rep SelectAttributesActivity x -> SelectAttributesActivity
forall x.
SelectAttributesActivity -> Rep SelectAttributesActivity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SelectAttributesActivity x -> SelectAttributesActivity
$cfrom :: forall x.
SelectAttributesActivity -> Rep SelectAttributesActivity x
Prelude.Generic)
newSelectAttributesActivity ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
SelectAttributesActivity
newSelectAttributesActivity :: Text -> NonEmpty Text -> SelectAttributesActivity
newSelectAttributesActivity Text
pName_ NonEmpty Text
pAttributes_ =
SelectAttributesActivity' :: Maybe Text -> Text -> NonEmpty Text -> SelectAttributesActivity
SelectAttributesActivity'
{ $sel:next:SelectAttributesActivity' :: Maybe Text
next = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:SelectAttributesActivity' :: Text
name = Text
pName_,
$sel:attributes:SelectAttributesActivity' :: NonEmpty Text
attributes = 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
pAttributes_
}
selectAttributesActivity_next :: Lens.Lens' SelectAttributesActivity (Prelude.Maybe Prelude.Text)
selectAttributesActivity_next :: (Maybe Text -> f (Maybe Text))
-> SelectAttributesActivity -> f SelectAttributesActivity
selectAttributesActivity_next = (SelectAttributesActivity -> Maybe Text)
-> (SelectAttributesActivity
-> Maybe Text -> SelectAttributesActivity)
-> Lens
SelectAttributesActivity
SelectAttributesActivity
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectAttributesActivity' {Maybe Text
next :: Maybe Text
$sel:next:SelectAttributesActivity' :: SelectAttributesActivity -> Maybe Text
next} -> Maybe Text
next) (\s :: SelectAttributesActivity
s@SelectAttributesActivity' {} Maybe Text
a -> SelectAttributesActivity
s {$sel:next:SelectAttributesActivity' :: Maybe Text
next = Maybe Text
a} :: SelectAttributesActivity)
selectAttributesActivity_name :: Lens.Lens' SelectAttributesActivity Prelude.Text
selectAttributesActivity_name :: (Text -> f Text)
-> SelectAttributesActivity -> f SelectAttributesActivity
selectAttributesActivity_name = (SelectAttributesActivity -> Text)
-> (SelectAttributesActivity -> Text -> SelectAttributesActivity)
-> Lens SelectAttributesActivity SelectAttributesActivity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectAttributesActivity' {Text
name :: Text
$sel:name:SelectAttributesActivity' :: SelectAttributesActivity -> Text
name} -> Text
name) (\s :: SelectAttributesActivity
s@SelectAttributesActivity' {} Text
a -> SelectAttributesActivity
s {$sel:name:SelectAttributesActivity' :: Text
name = Text
a} :: SelectAttributesActivity)
selectAttributesActivity_attributes :: Lens.Lens' SelectAttributesActivity (Prelude.NonEmpty Prelude.Text)
selectAttributesActivity_attributes :: (NonEmpty Text -> f (NonEmpty Text))
-> SelectAttributesActivity -> f SelectAttributesActivity
selectAttributesActivity_attributes = (SelectAttributesActivity -> NonEmpty Text)
-> (SelectAttributesActivity
-> NonEmpty Text -> SelectAttributesActivity)
-> Lens
SelectAttributesActivity
SelectAttributesActivity
(NonEmpty Text)
(NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectAttributesActivity' {NonEmpty Text
attributes :: NonEmpty Text
$sel:attributes:SelectAttributesActivity' :: SelectAttributesActivity -> NonEmpty Text
attributes} -> NonEmpty Text
attributes) (\s :: SelectAttributesActivity
s@SelectAttributesActivity' {} NonEmpty Text
a -> SelectAttributesActivity
s {$sel:attributes:SelectAttributesActivity' :: NonEmpty Text
attributes = NonEmpty Text
a} :: SelectAttributesActivity) ((NonEmpty Text -> f (NonEmpty Text))
-> SelectAttributesActivity -> f SelectAttributesActivity)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> SelectAttributesActivity
-> f SelectAttributesActivity
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 SelectAttributesActivity where
parseJSON :: Value -> Parser SelectAttributesActivity
parseJSON =
String
-> (Object -> Parser SelectAttributesActivity)
-> Value
-> Parser SelectAttributesActivity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SelectAttributesActivity"
( \Object
x ->
Maybe Text -> Text -> NonEmpty Text -> SelectAttributesActivity
SelectAttributesActivity'
(Maybe Text -> Text -> NonEmpty Text -> SelectAttributesActivity)
-> Parser (Maybe Text)
-> Parser (Text -> NonEmpty Text -> SelectAttributesActivity)
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 -> NonEmpty Text -> SelectAttributesActivity)
-> Parser Text
-> Parser (NonEmpty Text -> SelectAttributesActivity)
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 (NonEmpty Text -> SelectAttributesActivity)
-> Parser (NonEmpty Text) -> Parser SelectAttributesActivity
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
"attributes")
)
instance Prelude.Hashable SelectAttributesActivity
instance Prelude.NFData SelectAttributesActivity
instance Core.ToJSON SelectAttributesActivity where
toJSON :: SelectAttributesActivity -> Value
toJSON SelectAttributesActivity' {Maybe Text
NonEmpty Text
Text
attributes :: NonEmpty Text
name :: Text
next :: Maybe Text
$sel:attributes:SelectAttributesActivity' :: SelectAttributesActivity -> NonEmpty Text
$sel:name:SelectAttributesActivity' :: SelectAttributesActivity -> Text
$sel:next:SelectAttributesActivity' :: SelectAttributesActivity -> 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 -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
attributes)
]
)