{-# 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.IoTEvents.Types.FirehoseAction where
import qualified Amazonka.Core as Core
import Amazonka.IoTEvents.Types.Payload
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data FirehoseAction = FirehoseAction'
{
FirehoseAction -> Maybe Text
separator :: Prelude.Maybe Prelude.Text,
FirehoseAction -> Maybe Payload
payload :: Prelude.Maybe Payload,
FirehoseAction -> Text
deliveryStreamName :: Prelude.Text
}
deriving (FirehoseAction -> FirehoseAction -> Bool
(FirehoseAction -> FirehoseAction -> Bool)
-> (FirehoseAction -> FirehoseAction -> Bool) -> Eq FirehoseAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FirehoseAction -> FirehoseAction -> Bool
$c/= :: FirehoseAction -> FirehoseAction -> Bool
== :: FirehoseAction -> FirehoseAction -> Bool
$c== :: FirehoseAction -> FirehoseAction -> Bool
Prelude.Eq, ReadPrec [FirehoseAction]
ReadPrec FirehoseAction
Int -> ReadS FirehoseAction
ReadS [FirehoseAction]
(Int -> ReadS FirehoseAction)
-> ReadS [FirehoseAction]
-> ReadPrec FirehoseAction
-> ReadPrec [FirehoseAction]
-> Read FirehoseAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FirehoseAction]
$creadListPrec :: ReadPrec [FirehoseAction]
readPrec :: ReadPrec FirehoseAction
$creadPrec :: ReadPrec FirehoseAction
readList :: ReadS [FirehoseAction]
$creadList :: ReadS [FirehoseAction]
readsPrec :: Int -> ReadS FirehoseAction
$creadsPrec :: Int -> ReadS FirehoseAction
Prelude.Read, Int -> FirehoseAction -> ShowS
[FirehoseAction] -> ShowS
FirehoseAction -> String
(Int -> FirehoseAction -> ShowS)
-> (FirehoseAction -> String)
-> ([FirehoseAction] -> ShowS)
-> Show FirehoseAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FirehoseAction] -> ShowS
$cshowList :: [FirehoseAction] -> ShowS
show :: FirehoseAction -> String
$cshow :: FirehoseAction -> String
showsPrec :: Int -> FirehoseAction -> ShowS
$cshowsPrec :: Int -> FirehoseAction -> ShowS
Prelude.Show, (forall x. FirehoseAction -> Rep FirehoseAction x)
-> (forall x. Rep FirehoseAction x -> FirehoseAction)
-> Generic FirehoseAction
forall x. Rep FirehoseAction x -> FirehoseAction
forall x. FirehoseAction -> Rep FirehoseAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FirehoseAction x -> FirehoseAction
$cfrom :: forall x. FirehoseAction -> Rep FirehoseAction x
Prelude.Generic)
newFirehoseAction ::
Prelude.Text ->
FirehoseAction
newFirehoseAction :: Text -> FirehoseAction
newFirehoseAction Text
pDeliveryStreamName_ =
FirehoseAction' :: Maybe Text -> Maybe Payload -> Text -> FirehoseAction
FirehoseAction'
{ $sel:separator:FirehoseAction' :: Maybe Text
separator = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:payload:FirehoseAction' :: Maybe Payload
payload = Maybe Payload
forall a. Maybe a
Prelude.Nothing,
$sel:deliveryStreamName:FirehoseAction' :: Text
deliveryStreamName = Text
pDeliveryStreamName_
}
firehoseAction_separator :: Lens.Lens' FirehoseAction (Prelude.Maybe Prelude.Text)
firehoseAction_separator :: (Maybe Text -> f (Maybe Text))
-> FirehoseAction -> f FirehoseAction
firehoseAction_separator = (FirehoseAction -> Maybe Text)
-> (FirehoseAction -> Maybe Text -> FirehoseAction)
-> Lens FirehoseAction FirehoseAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirehoseAction' {Maybe Text
separator :: Maybe Text
$sel:separator:FirehoseAction' :: FirehoseAction -> Maybe Text
separator} -> Maybe Text
separator) (\s :: FirehoseAction
s@FirehoseAction' {} Maybe Text
a -> FirehoseAction
s {$sel:separator:FirehoseAction' :: Maybe Text
separator = Maybe Text
a} :: FirehoseAction)
firehoseAction_payload :: Lens.Lens' FirehoseAction (Prelude.Maybe Payload)
firehoseAction_payload :: (Maybe Payload -> f (Maybe Payload))
-> FirehoseAction -> f FirehoseAction
firehoseAction_payload = (FirehoseAction -> Maybe Payload)
-> (FirehoseAction -> Maybe Payload -> FirehoseAction)
-> Lens
FirehoseAction FirehoseAction (Maybe Payload) (Maybe Payload)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirehoseAction' {Maybe Payload
payload :: Maybe Payload
$sel:payload:FirehoseAction' :: FirehoseAction -> Maybe Payload
payload} -> Maybe Payload
payload) (\s :: FirehoseAction
s@FirehoseAction' {} Maybe Payload
a -> FirehoseAction
s {$sel:payload:FirehoseAction' :: Maybe Payload
payload = Maybe Payload
a} :: FirehoseAction)
firehoseAction_deliveryStreamName :: Lens.Lens' FirehoseAction Prelude.Text
firehoseAction_deliveryStreamName :: (Text -> f Text) -> FirehoseAction -> f FirehoseAction
firehoseAction_deliveryStreamName = (FirehoseAction -> Text)
-> (FirehoseAction -> Text -> FirehoseAction)
-> Lens FirehoseAction FirehoseAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirehoseAction' {Text
deliveryStreamName :: Text
$sel:deliveryStreamName:FirehoseAction' :: FirehoseAction -> Text
deliveryStreamName} -> Text
deliveryStreamName) (\s :: FirehoseAction
s@FirehoseAction' {} Text
a -> FirehoseAction
s {$sel:deliveryStreamName:FirehoseAction' :: Text
deliveryStreamName = Text
a} :: FirehoseAction)
instance Core.FromJSON FirehoseAction where
parseJSON :: Value -> Parser FirehoseAction
parseJSON =
String
-> (Object -> Parser FirehoseAction)
-> Value
-> Parser FirehoseAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"FirehoseAction"
( \Object
x ->
Maybe Text -> Maybe Payload -> Text -> FirehoseAction
FirehoseAction'
(Maybe Text -> Maybe Payload -> Text -> FirehoseAction)
-> Parser (Maybe Text)
-> Parser (Maybe Payload -> Text -> FirehoseAction)
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
"separator")
Parser (Maybe Payload -> Text -> FirehoseAction)
-> Parser (Maybe Payload) -> Parser (Text -> FirehoseAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Payload)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"payload")
Parser (Text -> FirehoseAction)
-> Parser Text -> Parser FirehoseAction
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
"deliveryStreamName")
)
instance Prelude.Hashable FirehoseAction
instance Prelude.NFData FirehoseAction
instance Core.ToJSON FirehoseAction where
toJSON :: FirehoseAction -> Value
toJSON FirehoseAction' {Maybe Text
Maybe Payload
Text
deliveryStreamName :: Text
payload :: Maybe Payload
separator :: Maybe Text
$sel:deliveryStreamName:FirehoseAction' :: FirehoseAction -> Text
$sel:payload:FirehoseAction' :: FirehoseAction -> Maybe Payload
$sel:separator:FirehoseAction' :: FirehoseAction -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"separator" 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
separator,
(Text
"payload" Text -> Payload -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Payload -> Pair) -> Maybe Payload -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Payload
payload,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"deliveryStreamName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deliveryStreamName)
]
)