{-# 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.Greengrass.Types.DeviceDefinitionVersion where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Greengrass.Types.Device
import qualified Amazonka.Prelude as Prelude
data DeviceDefinitionVersion = DeviceDefinitionVersion'
{
DeviceDefinitionVersion -> Maybe [Device]
devices :: Prelude.Maybe [Device]
}
deriving (DeviceDefinitionVersion -> DeviceDefinitionVersion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceDefinitionVersion -> DeviceDefinitionVersion -> Bool
$c/= :: DeviceDefinitionVersion -> DeviceDefinitionVersion -> Bool
== :: DeviceDefinitionVersion -> DeviceDefinitionVersion -> Bool
$c== :: DeviceDefinitionVersion -> DeviceDefinitionVersion -> Bool
Prelude.Eq, ReadPrec [DeviceDefinitionVersion]
ReadPrec DeviceDefinitionVersion
Int -> ReadS DeviceDefinitionVersion
ReadS [DeviceDefinitionVersion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceDefinitionVersion]
$creadListPrec :: ReadPrec [DeviceDefinitionVersion]
readPrec :: ReadPrec DeviceDefinitionVersion
$creadPrec :: ReadPrec DeviceDefinitionVersion
readList :: ReadS [DeviceDefinitionVersion]
$creadList :: ReadS [DeviceDefinitionVersion]
readsPrec :: Int -> ReadS DeviceDefinitionVersion
$creadsPrec :: Int -> ReadS DeviceDefinitionVersion
Prelude.Read, Int -> DeviceDefinitionVersion -> ShowS
[DeviceDefinitionVersion] -> ShowS
DeviceDefinitionVersion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceDefinitionVersion] -> ShowS
$cshowList :: [DeviceDefinitionVersion] -> ShowS
show :: DeviceDefinitionVersion -> String
$cshow :: DeviceDefinitionVersion -> String
showsPrec :: Int -> DeviceDefinitionVersion -> ShowS
$cshowsPrec :: Int -> DeviceDefinitionVersion -> ShowS
Prelude.Show, forall x. Rep DeviceDefinitionVersion x -> DeviceDefinitionVersion
forall x. DeviceDefinitionVersion -> Rep DeviceDefinitionVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceDefinitionVersion x -> DeviceDefinitionVersion
$cfrom :: forall x. DeviceDefinitionVersion -> Rep DeviceDefinitionVersion x
Prelude.Generic)
newDeviceDefinitionVersion ::
DeviceDefinitionVersion
newDeviceDefinitionVersion :: DeviceDefinitionVersion
newDeviceDefinitionVersion =
DeviceDefinitionVersion' {$sel:devices:DeviceDefinitionVersion' :: Maybe [Device]
devices = forall a. Maybe a
Prelude.Nothing}
deviceDefinitionVersion_devices :: Lens.Lens' DeviceDefinitionVersion (Prelude.Maybe [Device])
deviceDefinitionVersion_devices :: Lens' DeviceDefinitionVersion (Maybe [Device])
deviceDefinitionVersion_devices = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceDefinitionVersion' {Maybe [Device]
devices :: Maybe [Device]
$sel:devices:DeviceDefinitionVersion' :: DeviceDefinitionVersion -> Maybe [Device]
devices} -> Maybe [Device]
devices) (\s :: DeviceDefinitionVersion
s@DeviceDefinitionVersion' {} Maybe [Device]
a -> DeviceDefinitionVersion
s {$sel:devices:DeviceDefinitionVersion' :: Maybe [Device]
devices = Maybe [Device]
a} :: DeviceDefinitionVersion) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON DeviceDefinitionVersion where
parseJSON :: Value -> Parser DeviceDefinitionVersion
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DeviceDefinitionVersion"
( \Object
x ->
Maybe [Device] -> DeviceDefinitionVersion
DeviceDefinitionVersion'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Devices" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable DeviceDefinitionVersion where
hashWithSalt :: Int -> DeviceDefinitionVersion -> Int
hashWithSalt Int
_salt DeviceDefinitionVersion' {Maybe [Device]
devices :: Maybe [Device]
$sel:devices:DeviceDefinitionVersion' :: DeviceDefinitionVersion -> Maybe [Device]
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Device]
devices
instance Prelude.NFData DeviceDefinitionVersion where
rnf :: DeviceDefinitionVersion -> ()
rnf DeviceDefinitionVersion' {Maybe [Device]
devices :: Maybe [Device]
$sel:devices:DeviceDefinitionVersion' :: DeviceDefinitionVersion -> Maybe [Device]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Device]
devices
instance Data.ToJSON DeviceDefinitionVersion where
toJSON :: DeviceDefinitionVersion -> Value
toJSON DeviceDefinitionVersion' {Maybe [Device]
devices :: Maybe [Device]
$sel:devices:DeviceDefinitionVersion' :: DeviceDefinitionVersion -> Maybe [Device]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Key
"Devices" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Device]
devices]
)