{-# 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.IoT1ClickDevices.Types.DeviceDescription where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DeviceDescription = DeviceDescription'
{
DeviceDescription -> Maybe Double
remainingLife :: Prelude.Maybe Prelude.Double,
DeviceDescription -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
DeviceDescription -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
DeviceDescription -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
DeviceDescription -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text,
DeviceDescription -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
DeviceDescription -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
}
deriving (DeviceDescription -> DeviceDescription -> Bool
(DeviceDescription -> DeviceDescription -> Bool)
-> (DeviceDescription -> DeviceDescription -> Bool)
-> Eq DeviceDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceDescription -> DeviceDescription -> Bool
$c/= :: DeviceDescription -> DeviceDescription -> Bool
== :: DeviceDescription -> DeviceDescription -> Bool
$c== :: DeviceDescription -> DeviceDescription -> Bool
Prelude.Eq, ReadPrec [DeviceDescription]
ReadPrec DeviceDescription
Int -> ReadS DeviceDescription
ReadS [DeviceDescription]
(Int -> ReadS DeviceDescription)
-> ReadS [DeviceDescription]
-> ReadPrec DeviceDescription
-> ReadPrec [DeviceDescription]
-> Read DeviceDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceDescription]
$creadListPrec :: ReadPrec [DeviceDescription]
readPrec :: ReadPrec DeviceDescription
$creadPrec :: ReadPrec DeviceDescription
readList :: ReadS [DeviceDescription]
$creadList :: ReadS [DeviceDescription]
readsPrec :: Int -> ReadS DeviceDescription
$creadsPrec :: Int -> ReadS DeviceDescription
Prelude.Read, Int -> DeviceDescription -> ShowS
[DeviceDescription] -> ShowS
DeviceDescription -> String
(Int -> DeviceDescription -> ShowS)
-> (DeviceDescription -> String)
-> ([DeviceDescription] -> ShowS)
-> Show DeviceDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceDescription] -> ShowS
$cshowList :: [DeviceDescription] -> ShowS
show :: DeviceDescription -> String
$cshow :: DeviceDescription -> String
showsPrec :: Int -> DeviceDescription -> ShowS
$cshowsPrec :: Int -> DeviceDescription -> ShowS
Prelude.Show, (forall x. DeviceDescription -> Rep DeviceDescription x)
-> (forall x. Rep DeviceDescription x -> DeviceDescription)
-> Generic DeviceDescription
forall x. Rep DeviceDescription x -> DeviceDescription
forall x. DeviceDescription -> Rep DeviceDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceDescription x -> DeviceDescription
$cfrom :: forall x. DeviceDescription -> Rep DeviceDescription x
Prelude.Generic)
newDeviceDescription ::
DeviceDescription
newDeviceDescription :: DeviceDescription
newDeviceDescription =
DeviceDescription' :: Maybe Double
-> Maybe Bool
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> DeviceDescription
DeviceDescription'
{ $sel:remainingLife:DeviceDescription' :: Maybe Double
remainingLife = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:enabled:DeviceDescription' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:arn:DeviceDescription' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:attributes:DeviceDescription' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:deviceId:DeviceDescription' :: Maybe Text
deviceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':DeviceDescription' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:DeviceDescription' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
}
deviceDescription_remainingLife :: Lens.Lens' DeviceDescription (Prelude.Maybe Prelude.Double)
deviceDescription_remainingLife :: (Maybe Double -> f (Maybe Double))
-> DeviceDescription -> f DeviceDescription
deviceDescription_remainingLife = (DeviceDescription -> Maybe Double)
-> (DeviceDescription -> Maybe Double -> DeviceDescription)
-> Lens
DeviceDescription DeviceDescription (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceDescription' {Maybe Double
remainingLife :: Maybe Double
$sel:remainingLife:DeviceDescription' :: DeviceDescription -> Maybe Double
remainingLife} -> Maybe Double
remainingLife) (\s :: DeviceDescription
s@DeviceDescription' {} Maybe Double
a -> DeviceDescription
s {$sel:remainingLife:DeviceDescription' :: Maybe Double
remainingLife = Maybe Double
a} :: DeviceDescription)
deviceDescription_enabled :: Lens.Lens' DeviceDescription (Prelude.Maybe Prelude.Bool)
deviceDescription_enabled :: (Maybe Bool -> f (Maybe Bool))
-> DeviceDescription -> f DeviceDescription
deviceDescription_enabled = (DeviceDescription -> Maybe Bool)
-> (DeviceDescription -> Maybe Bool -> DeviceDescription)
-> Lens
DeviceDescription DeviceDescription (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceDescription' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:DeviceDescription' :: DeviceDescription -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: DeviceDescription
s@DeviceDescription' {} Maybe Bool
a -> DeviceDescription
s {$sel:enabled:DeviceDescription' :: Maybe Bool
enabled = Maybe Bool
a} :: DeviceDescription)
deviceDescription_arn :: Lens.Lens' DeviceDescription (Prelude.Maybe Prelude.Text)
deviceDescription_arn :: (Maybe Text -> f (Maybe Text))
-> DeviceDescription -> f DeviceDescription
deviceDescription_arn = (DeviceDescription -> Maybe Text)
-> (DeviceDescription -> Maybe Text -> DeviceDescription)
-> Lens
DeviceDescription DeviceDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceDescription' {Maybe Text
arn :: Maybe Text
$sel:arn:DeviceDescription' :: DeviceDescription -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DeviceDescription
s@DeviceDescription' {} Maybe Text
a -> DeviceDescription
s {$sel:arn:DeviceDescription' :: Maybe Text
arn = Maybe Text
a} :: DeviceDescription)
deviceDescription_attributes :: Lens.Lens' DeviceDescription (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
deviceDescription_attributes :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DeviceDescription -> f DeviceDescription
deviceDescription_attributes = (DeviceDescription -> Maybe (HashMap Text Text))
-> (DeviceDescription
-> Maybe (HashMap Text Text) -> DeviceDescription)
-> Lens
DeviceDescription
DeviceDescription
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceDescription' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:DeviceDescription' :: DeviceDescription -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: DeviceDescription
s@DeviceDescription' {} Maybe (HashMap Text Text)
a -> DeviceDescription
s {$sel:attributes:DeviceDescription' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: DeviceDescription) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DeviceDescription -> f DeviceDescription)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DeviceDescription
-> f DeviceDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
deviceDescription_deviceId :: Lens.Lens' DeviceDescription (Prelude.Maybe Prelude.Text)
deviceDescription_deviceId :: (Maybe Text -> f (Maybe Text))
-> DeviceDescription -> f DeviceDescription
deviceDescription_deviceId = (DeviceDescription -> Maybe Text)
-> (DeviceDescription -> Maybe Text -> DeviceDescription)
-> Lens
DeviceDescription DeviceDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceDescription' {Maybe Text
deviceId :: Maybe Text
$sel:deviceId:DeviceDescription' :: DeviceDescription -> Maybe Text
deviceId} -> Maybe Text
deviceId) (\s :: DeviceDescription
s@DeviceDescription' {} Maybe Text
a -> DeviceDescription
s {$sel:deviceId:DeviceDescription' :: Maybe Text
deviceId = Maybe Text
a} :: DeviceDescription)
deviceDescription_type :: Lens.Lens' DeviceDescription (Prelude.Maybe Prelude.Text)
deviceDescription_type :: (Maybe Text -> f (Maybe Text))
-> DeviceDescription -> f DeviceDescription
deviceDescription_type = (DeviceDescription -> Maybe Text)
-> (DeviceDescription -> Maybe Text -> DeviceDescription)
-> Lens
DeviceDescription DeviceDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceDescription' {Maybe Text
type' :: Maybe Text
$sel:type':DeviceDescription' :: DeviceDescription -> Maybe Text
type'} -> Maybe Text
type') (\s :: DeviceDescription
s@DeviceDescription' {} Maybe Text
a -> DeviceDescription
s {$sel:type':DeviceDescription' :: Maybe Text
type' = Maybe Text
a} :: DeviceDescription)
deviceDescription_tags :: Lens.Lens' DeviceDescription (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
deviceDescription_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DeviceDescription -> f DeviceDescription
deviceDescription_tags = (DeviceDescription -> Maybe (HashMap Text Text))
-> (DeviceDescription
-> Maybe (HashMap Text Text) -> DeviceDescription)
-> Lens
DeviceDescription
DeviceDescription
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceDescription' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:DeviceDescription' :: DeviceDescription -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: DeviceDescription
s@DeviceDescription' {} Maybe (HashMap Text Text)
a -> DeviceDescription
s {$sel:tags:DeviceDescription' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: DeviceDescription) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DeviceDescription -> f DeviceDescription)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DeviceDescription
-> f DeviceDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON DeviceDescription where
parseJSON :: Value -> Parser DeviceDescription
parseJSON =
String
-> (Object -> Parser DeviceDescription)
-> Value
-> Parser DeviceDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DeviceDescription"
( \Object
x ->
Maybe Double
-> Maybe Bool
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> DeviceDescription
DeviceDescription'
(Maybe Double
-> Maybe Bool
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> DeviceDescription)
-> Parser (Maybe Double)
-> Parser
(Maybe Bool
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> DeviceDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"remainingLife")
Parser
(Maybe Bool
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> DeviceDescription)
-> Parser (Maybe Bool)
-> Parser
(Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> DeviceDescription)
forall (f :: * -> *) a b. Applicative f => 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
"enabled")
Parser
(Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> DeviceDescription)
-> Parser (Maybe Text)
-> Parser
(Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> DeviceDescription)
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
"arn")
Parser
(Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> DeviceDescription)
-> Parser (Maybe (HashMap Text Text))
-> Parser
(Maybe Text
-> Maybe Text -> Maybe (HashMap Text Text) -> DeviceDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"attributes" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Text
-> Maybe Text -> Maybe (HashMap Text Text) -> DeviceDescription)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe (HashMap Text Text) -> DeviceDescription)
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
"deviceId")
Parser
(Maybe Text -> Maybe (HashMap Text Text) -> DeviceDescription)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> DeviceDescription)
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
"type")
Parser (Maybe (HashMap Text Text) -> DeviceDescription)
-> Parser (Maybe (HashMap Text Text)) -> Parser DeviceDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable DeviceDescription
instance Prelude.NFData DeviceDescription