{-# 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.IoT.Types.IotAnalyticsAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data IotAnalyticsAction = IotAnalyticsAction'
{
IotAnalyticsAction -> Maybe Bool
batchMode :: Prelude.Maybe Prelude.Bool,
IotAnalyticsAction -> Maybe Text
channelArn :: Prelude.Maybe Prelude.Text,
IotAnalyticsAction -> Maybe Text
channelName :: Prelude.Maybe Prelude.Text,
IotAnalyticsAction -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text
}
deriving (IotAnalyticsAction -> IotAnalyticsAction -> Bool
(IotAnalyticsAction -> IotAnalyticsAction -> Bool)
-> (IotAnalyticsAction -> IotAnalyticsAction -> Bool)
-> Eq IotAnalyticsAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IotAnalyticsAction -> IotAnalyticsAction -> Bool
$c/= :: IotAnalyticsAction -> IotAnalyticsAction -> Bool
== :: IotAnalyticsAction -> IotAnalyticsAction -> Bool
$c== :: IotAnalyticsAction -> IotAnalyticsAction -> Bool
Prelude.Eq, ReadPrec [IotAnalyticsAction]
ReadPrec IotAnalyticsAction
Int -> ReadS IotAnalyticsAction
ReadS [IotAnalyticsAction]
(Int -> ReadS IotAnalyticsAction)
-> ReadS [IotAnalyticsAction]
-> ReadPrec IotAnalyticsAction
-> ReadPrec [IotAnalyticsAction]
-> Read IotAnalyticsAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IotAnalyticsAction]
$creadListPrec :: ReadPrec [IotAnalyticsAction]
readPrec :: ReadPrec IotAnalyticsAction
$creadPrec :: ReadPrec IotAnalyticsAction
readList :: ReadS [IotAnalyticsAction]
$creadList :: ReadS [IotAnalyticsAction]
readsPrec :: Int -> ReadS IotAnalyticsAction
$creadsPrec :: Int -> ReadS IotAnalyticsAction
Prelude.Read, Int -> IotAnalyticsAction -> ShowS
[IotAnalyticsAction] -> ShowS
IotAnalyticsAction -> String
(Int -> IotAnalyticsAction -> ShowS)
-> (IotAnalyticsAction -> String)
-> ([IotAnalyticsAction] -> ShowS)
-> Show IotAnalyticsAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IotAnalyticsAction] -> ShowS
$cshowList :: [IotAnalyticsAction] -> ShowS
show :: IotAnalyticsAction -> String
$cshow :: IotAnalyticsAction -> String
showsPrec :: Int -> IotAnalyticsAction -> ShowS
$cshowsPrec :: Int -> IotAnalyticsAction -> ShowS
Prelude.Show, (forall x. IotAnalyticsAction -> Rep IotAnalyticsAction x)
-> (forall x. Rep IotAnalyticsAction x -> IotAnalyticsAction)
-> Generic IotAnalyticsAction
forall x. Rep IotAnalyticsAction x -> IotAnalyticsAction
forall x. IotAnalyticsAction -> Rep IotAnalyticsAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IotAnalyticsAction x -> IotAnalyticsAction
$cfrom :: forall x. IotAnalyticsAction -> Rep IotAnalyticsAction x
Prelude.Generic)
newIotAnalyticsAction ::
IotAnalyticsAction
newIotAnalyticsAction :: IotAnalyticsAction
newIotAnalyticsAction =
IotAnalyticsAction' :: Maybe Bool
-> Maybe Text -> Maybe Text -> Maybe Text -> IotAnalyticsAction
IotAnalyticsAction'
{ $sel:batchMode:IotAnalyticsAction' :: Maybe Bool
batchMode = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:channelArn:IotAnalyticsAction' :: Maybe Text
channelArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:channelName:IotAnalyticsAction' :: Maybe Text
channelName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:IotAnalyticsAction' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
iotAnalyticsAction_batchMode :: Lens.Lens' IotAnalyticsAction (Prelude.Maybe Prelude.Bool)
iotAnalyticsAction_batchMode :: (Maybe Bool -> f (Maybe Bool))
-> IotAnalyticsAction -> f IotAnalyticsAction
iotAnalyticsAction_batchMode = (IotAnalyticsAction -> Maybe Bool)
-> (IotAnalyticsAction -> Maybe Bool -> IotAnalyticsAction)
-> Lens
IotAnalyticsAction IotAnalyticsAction (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IotAnalyticsAction' {Maybe Bool
batchMode :: Maybe Bool
$sel:batchMode:IotAnalyticsAction' :: IotAnalyticsAction -> Maybe Bool
batchMode} -> Maybe Bool
batchMode) (\s :: IotAnalyticsAction
s@IotAnalyticsAction' {} Maybe Bool
a -> IotAnalyticsAction
s {$sel:batchMode:IotAnalyticsAction' :: Maybe Bool
batchMode = Maybe Bool
a} :: IotAnalyticsAction)
iotAnalyticsAction_channelArn :: Lens.Lens' IotAnalyticsAction (Prelude.Maybe Prelude.Text)
iotAnalyticsAction_channelArn :: (Maybe Text -> f (Maybe Text))
-> IotAnalyticsAction -> f IotAnalyticsAction
iotAnalyticsAction_channelArn = (IotAnalyticsAction -> Maybe Text)
-> (IotAnalyticsAction -> Maybe Text -> IotAnalyticsAction)
-> Lens
IotAnalyticsAction IotAnalyticsAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IotAnalyticsAction' {Maybe Text
channelArn :: Maybe Text
$sel:channelArn:IotAnalyticsAction' :: IotAnalyticsAction -> Maybe Text
channelArn} -> Maybe Text
channelArn) (\s :: IotAnalyticsAction
s@IotAnalyticsAction' {} Maybe Text
a -> IotAnalyticsAction
s {$sel:channelArn:IotAnalyticsAction' :: Maybe Text
channelArn = Maybe Text
a} :: IotAnalyticsAction)
iotAnalyticsAction_channelName :: Lens.Lens' IotAnalyticsAction (Prelude.Maybe Prelude.Text)
iotAnalyticsAction_channelName :: (Maybe Text -> f (Maybe Text))
-> IotAnalyticsAction -> f IotAnalyticsAction
iotAnalyticsAction_channelName = (IotAnalyticsAction -> Maybe Text)
-> (IotAnalyticsAction -> Maybe Text -> IotAnalyticsAction)
-> Lens
IotAnalyticsAction IotAnalyticsAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IotAnalyticsAction' {Maybe Text
channelName :: Maybe Text
$sel:channelName:IotAnalyticsAction' :: IotAnalyticsAction -> Maybe Text
channelName} -> Maybe Text
channelName) (\s :: IotAnalyticsAction
s@IotAnalyticsAction' {} Maybe Text
a -> IotAnalyticsAction
s {$sel:channelName:IotAnalyticsAction' :: Maybe Text
channelName = Maybe Text
a} :: IotAnalyticsAction)
iotAnalyticsAction_roleArn :: Lens.Lens' IotAnalyticsAction (Prelude.Maybe Prelude.Text)
iotAnalyticsAction_roleArn :: (Maybe Text -> f (Maybe Text))
-> IotAnalyticsAction -> f IotAnalyticsAction
iotAnalyticsAction_roleArn = (IotAnalyticsAction -> Maybe Text)
-> (IotAnalyticsAction -> Maybe Text -> IotAnalyticsAction)
-> Lens
IotAnalyticsAction IotAnalyticsAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IotAnalyticsAction' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:IotAnalyticsAction' :: IotAnalyticsAction -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: IotAnalyticsAction
s@IotAnalyticsAction' {} Maybe Text
a -> IotAnalyticsAction
s {$sel:roleArn:IotAnalyticsAction' :: Maybe Text
roleArn = Maybe Text
a} :: IotAnalyticsAction)
instance Core.FromJSON IotAnalyticsAction where
parseJSON :: Value -> Parser IotAnalyticsAction
parseJSON =
String
-> (Object -> Parser IotAnalyticsAction)
-> Value
-> Parser IotAnalyticsAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"IotAnalyticsAction"
( \Object
x ->
Maybe Bool
-> Maybe Text -> Maybe Text -> Maybe Text -> IotAnalyticsAction
IotAnalyticsAction'
(Maybe Bool
-> Maybe Text -> Maybe Text -> Maybe Text -> IotAnalyticsAction)
-> Parser (Maybe Bool)
-> Parser
(Maybe Text -> Maybe Text -> Maybe Text -> IotAnalyticsAction)
forall (f :: * -> *) a b. Functor 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
"batchMode")
Parser
(Maybe Text -> Maybe Text -> Maybe Text -> IotAnalyticsAction)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> IotAnalyticsAction)
forall (f :: * -> *) a b. Applicative f => 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
"channelArn")
Parser (Maybe Text -> Maybe Text -> IotAnalyticsAction)
-> Parser (Maybe Text) -> Parser (Maybe Text -> IotAnalyticsAction)
forall (f :: * -> *) a b. Applicative f => 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
"channelName")
Parser (Maybe Text -> IotAnalyticsAction)
-> Parser (Maybe Text) -> Parser IotAnalyticsAction
forall (f :: * -> *) a b. Applicative f => 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
"roleArn")
)
instance Prelude.Hashable IotAnalyticsAction
instance Prelude.NFData IotAnalyticsAction
instance Core.ToJSON IotAnalyticsAction where
toJSON :: IotAnalyticsAction -> Value
toJSON IotAnalyticsAction' {Maybe Bool
Maybe Text
roleArn :: Maybe Text
channelName :: Maybe Text
channelArn :: Maybe Text
batchMode :: Maybe Bool
$sel:roleArn:IotAnalyticsAction' :: IotAnalyticsAction -> Maybe Text
$sel:channelName:IotAnalyticsAction' :: IotAnalyticsAction -> Maybe Text
$sel:channelArn:IotAnalyticsAction' :: IotAnalyticsAction -> Maybe Text
$sel:batchMode:IotAnalyticsAction' :: IotAnalyticsAction -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"batchMode" 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
batchMode,
(Text
"channelArn" 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
channelArn,
(Text
"channelName" 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
channelName,
(Text
"roleArn" 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
roleArn
]
)