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