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