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