{-# 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.IotSiteWiseAction where
import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.PutAssetPropertyValueEntry
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data IotSiteWiseAction = IotSiteWiseAction'
{
IotSiteWiseAction -> NonEmpty PutAssetPropertyValueEntry
putAssetPropertyValueEntries :: Prelude.NonEmpty PutAssetPropertyValueEntry,
IotSiteWiseAction -> Text
roleArn :: Prelude.Text
}
deriving (IotSiteWiseAction -> IotSiteWiseAction -> Bool
(IotSiteWiseAction -> IotSiteWiseAction -> Bool)
-> (IotSiteWiseAction -> IotSiteWiseAction -> Bool)
-> Eq IotSiteWiseAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IotSiteWiseAction -> IotSiteWiseAction -> Bool
$c/= :: IotSiteWiseAction -> IotSiteWiseAction -> Bool
== :: IotSiteWiseAction -> IotSiteWiseAction -> Bool
$c== :: IotSiteWiseAction -> IotSiteWiseAction -> Bool
Prelude.Eq, ReadPrec [IotSiteWiseAction]
ReadPrec IotSiteWiseAction
Int -> ReadS IotSiteWiseAction
ReadS [IotSiteWiseAction]
(Int -> ReadS IotSiteWiseAction)
-> ReadS [IotSiteWiseAction]
-> ReadPrec IotSiteWiseAction
-> ReadPrec [IotSiteWiseAction]
-> Read IotSiteWiseAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IotSiteWiseAction]
$creadListPrec :: ReadPrec [IotSiteWiseAction]
readPrec :: ReadPrec IotSiteWiseAction
$creadPrec :: ReadPrec IotSiteWiseAction
readList :: ReadS [IotSiteWiseAction]
$creadList :: ReadS [IotSiteWiseAction]
readsPrec :: Int -> ReadS IotSiteWiseAction
$creadsPrec :: Int -> ReadS IotSiteWiseAction
Prelude.Read, Int -> IotSiteWiseAction -> ShowS
[IotSiteWiseAction] -> ShowS
IotSiteWiseAction -> String
(Int -> IotSiteWiseAction -> ShowS)
-> (IotSiteWiseAction -> String)
-> ([IotSiteWiseAction] -> ShowS)
-> Show IotSiteWiseAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IotSiteWiseAction] -> ShowS
$cshowList :: [IotSiteWiseAction] -> ShowS
show :: IotSiteWiseAction -> String
$cshow :: IotSiteWiseAction -> String
showsPrec :: Int -> IotSiteWiseAction -> ShowS
$cshowsPrec :: Int -> IotSiteWiseAction -> ShowS
Prelude.Show, (forall x. IotSiteWiseAction -> Rep IotSiteWiseAction x)
-> (forall x. Rep IotSiteWiseAction x -> IotSiteWiseAction)
-> Generic IotSiteWiseAction
forall x. Rep IotSiteWiseAction x -> IotSiteWiseAction
forall x. IotSiteWiseAction -> Rep IotSiteWiseAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IotSiteWiseAction x -> IotSiteWiseAction
$cfrom :: forall x. IotSiteWiseAction -> Rep IotSiteWiseAction x
Prelude.Generic)
newIotSiteWiseAction ::
Prelude.NonEmpty PutAssetPropertyValueEntry ->
Prelude.Text ->
IotSiteWiseAction
newIotSiteWiseAction :: NonEmpty PutAssetPropertyValueEntry -> Text -> IotSiteWiseAction
newIotSiteWiseAction
NonEmpty PutAssetPropertyValueEntry
pPutAssetPropertyValueEntries_
Text
pRoleArn_ =
IotSiteWiseAction' :: NonEmpty PutAssetPropertyValueEntry -> Text -> IotSiteWiseAction
IotSiteWiseAction'
{ $sel:putAssetPropertyValueEntries:IotSiteWiseAction' :: NonEmpty PutAssetPropertyValueEntry
putAssetPropertyValueEntries =
Tagged
(NonEmpty PutAssetPropertyValueEntry)
(Identity (NonEmpty PutAssetPropertyValueEntry))
-> Tagged
(NonEmpty PutAssetPropertyValueEntry)
(Identity (NonEmpty PutAssetPropertyValueEntry))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty PutAssetPropertyValueEntry)
(Identity (NonEmpty PutAssetPropertyValueEntry))
-> Tagged
(NonEmpty PutAssetPropertyValueEntry)
(Identity (NonEmpty PutAssetPropertyValueEntry)))
-> NonEmpty PutAssetPropertyValueEntry
-> NonEmpty PutAssetPropertyValueEntry
forall t b. AReview t b -> b -> t
Lens.# NonEmpty PutAssetPropertyValueEntry
pPutAssetPropertyValueEntries_,
$sel:roleArn:IotSiteWiseAction' :: Text
roleArn = Text
pRoleArn_
}
iotSiteWiseAction_putAssetPropertyValueEntries :: Lens.Lens' IotSiteWiseAction (Prelude.NonEmpty PutAssetPropertyValueEntry)
iotSiteWiseAction_putAssetPropertyValueEntries :: (NonEmpty PutAssetPropertyValueEntry
-> f (NonEmpty PutAssetPropertyValueEntry))
-> IotSiteWiseAction -> f IotSiteWiseAction
iotSiteWiseAction_putAssetPropertyValueEntries = (IotSiteWiseAction -> NonEmpty PutAssetPropertyValueEntry)
-> (IotSiteWiseAction
-> NonEmpty PutAssetPropertyValueEntry -> IotSiteWiseAction)
-> Lens
IotSiteWiseAction
IotSiteWiseAction
(NonEmpty PutAssetPropertyValueEntry)
(NonEmpty PutAssetPropertyValueEntry)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IotSiteWiseAction' {NonEmpty PutAssetPropertyValueEntry
putAssetPropertyValueEntries :: NonEmpty PutAssetPropertyValueEntry
$sel:putAssetPropertyValueEntries:IotSiteWiseAction' :: IotSiteWiseAction -> NonEmpty PutAssetPropertyValueEntry
putAssetPropertyValueEntries} -> NonEmpty PutAssetPropertyValueEntry
putAssetPropertyValueEntries) (\s :: IotSiteWiseAction
s@IotSiteWiseAction' {} NonEmpty PutAssetPropertyValueEntry
a -> IotSiteWiseAction
s {$sel:putAssetPropertyValueEntries:IotSiteWiseAction' :: NonEmpty PutAssetPropertyValueEntry
putAssetPropertyValueEntries = NonEmpty PutAssetPropertyValueEntry
a} :: IotSiteWiseAction) ((NonEmpty PutAssetPropertyValueEntry
-> f (NonEmpty PutAssetPropertyValueEntry))
-> IotSiteWiseAction -> f IotSiteWiseAction)
-> ((NonEmpty PutAssetPropertyValueEntry
-> f (NonEmpty PutAssetPropertyValueEntry))
-> NonEmpty PutAssetPropertyValueEntry
-> f (NonEmpty PutAssetPropertyValueEntry))
-> (NonEmpty PutAssetPropertyValueEntry
-> f (NonEmpty PutAssetPropertyValueEntry))
-> IotSiteWiseAction
-> f IotSiteWiseAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty PutAssetPropertyValueEntry
-> f (NonEmpty PutAssetPropertyValueEntry))
-> NonEmpty PutAssetPropertyValueEntry
-> f (NonEmpty PutAssetPropertyValueEntry)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
iotSiteWiseAction_roleArn :: Lens.Lens' IotSiteWiseAction Prelude.Text
iotSiteWiseAction_roleArn :: (Text -> f Text) -> IotSiteWiseAction -> f IotSiteWiseAction
iotSiteWiseAction_roleArn = (IotSiteWiseAction -> Text)
-> (IotSiteWiseAction -> Text -> IotSiteWiseAction)
-> Lens IotSiteWiseAction IotSiteWiseAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IotSiteWiseAction' {Text
roleArn :: Text
$sel:roleArn:IotSiteWiseAction' :: IotSiteWiseAction -> Text
roleArn} -> Text
roleArn) (\s :: IotSiteWiseAction
s@IotSiteWiseAction' {} Text
a -> IotSiteWiseAction
s {$sel:roleArn:IotSiteWiseAction' :: Text
roleArn = Text
a} :: IotSiteWiseAction)
instance Core.FromJSON IotSiteWiseAction where
parseJSON :: Value -> Parser IotSiteWiseAction
parseJSON =
String
-> (Object -> Parser IotSiteWiseAction)
-> Value
-> Parser IotSiteWiseAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"IotSiteWiseAction"
( \Object
x ->
NonEmpty PutAssetPropertyValueEntry -> Text -> IotSiteWiseAction
IotSiteWiseAction'
(NonEmpty PutAssetPropertyValueEntry -> Text -> IotSiteWiseAction)
-> Parser (NonEmpty PutAssetPropertyValueEntry)
-> Parser (Text -> IotSiteWiseAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (NonEmpty PutAssetPropertyValueEntry)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"putAssetPropertyValueEntries")
Parser (Text -> IotSiteWiseAction)
-> Parser Text -> Parser IotSiteWiseAction
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
"roleArn")
)
instance Prelude.Hashable IotSiteWiseAction
instance Prelude.NFData IotSiteWiseAction
instance Core.ToJSON IotSiteWiseAction where
toJSON :: IotSiteWiseAction -> Value
toJSON IotSiteWiseAction' {NonEmpty PutAssetPropertyValueEntry
Text
roleArn :: Text
putAssetPropertyValueEntries :: NonEmpty PutAssetPropertyValueEntry
$sel:roleArn:IotSiteWiseAction' :: IotSiteWiseAction -> Text
$sel:putAssetPropertyValueEntries:IotSiteWiseAction' :: IotSiteWiseAction -> NonEmpty PutAssetPropertyValueEntry
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"putAssetPropertyValueEntries"
Text -> NonEmpty PutAssetPropertyValueEntry -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty PutAssetPropertyValueEntry
putAssetPropertyValueEntries
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
]
)