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