{-# 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.GreengrassV2.Types.ComponentPlatform where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ComponentPlatform = ComponentPlatform'
{
ComponentPlatform -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
ComponentPlatform -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
}
deriving (ComponentPlatform -> ComponentPlatform -> Bool
(ComponentPlatform -> ComponentPlatform -> Bool)
-> (ComponentPlatform -> ComponentPlatform -> Bool)
-> Eq ComponentPlatform
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComponentPlatform -> ComponentPlatform -> Bool
$c/= :: ComponentPlatform -> ComponentPlatform -> Bool
== :: ComponentPlatform -> ComponentPlatform -> Bool
$c== :: ComponentPlatform -> ComponentPlatform -> Bool
Prelude.Eq, ReadPrec [ComponentPlatform]
ReadPrec ComponentPlatform
Int -> ReadS ComponentPlatform
ReadS [ComponentPlatform]
(Int -> ReadS ComponentPlatform)
-> ReadS [ComponentPlatform]
-> ReadPrec ComponentPlatform
-> ReadPrec [ComponentPlatform]
-> Read ComponentPlatform
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComponentPlatform]
$creadListPrec :: ReadPrec [ComponentPlatform]
readPrec :: ReadPrec ComponentPlatform
$creadPrec :: ReadPrec ComponentPlatform
readList :: ReadS [ComponentPlatform]
$creadList :: ReadS [ComponentPlatform]
readsPrec :: Int -> ReadS ComponentPlatform
$creadsPrec :: Int -> ReadS ComponentPlatform
Prelude.Read, Int -> ComponentPlatform -> ShowS
[ComponentPlatform] -> ShowS
ComponentPlatform -> String
(Int -> ComponentPlatform -> ShowS)
-> (ComponentPlatform -> String)
-> ([ComponentPlatform] -> ShowS)
-> Show ComponentPlatform
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComponentPlatform] -> ShowS
$cshowList :: [ComponentPlatform] -> ShowS
show :: ComponentPlatform -> String
$cshow :: ComponentPlatform -> String
showsPrec :: Int -> ComponentPlatform -> ShowS
$cshowsPrec :: Int -> ComponentPlatform -> ShowS
Prelude.Show, (forall x. ComponentPlatform -> Rep ComponentPlatform x)
-> (forall x. Rep ComponentPlatform x -> ComponentPlatform)
-> Generic ComponentPlatform
forall x. Rep ComponentPlatform x -> ComponentPlatform
forall x. ComponentPlatform -> Rep ComponentPlatform x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComponentPlatform x -> ComponentPlatform
$cfrom :: forall x. ComponentPlatform -> Rep ComponentPlatform x
Prelude.Generic)
newComponentPlatform ::
ComponentPlatform
newComponentPlatform :: ComponentPlatform
newComponentPlatform =
ComponentPlatform' :: Maybe Text -> Maybe (HashMap Text Text) -> ComponentPlatform
ComponentPlatform'
{ $sel:name:ComponentPlatform' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:attributes:ComponentPlatform' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
}
componentPlatform_name :: Lens.Lens' ComponentPlatform (Prelude.Maybe Prelude.Text)
componentPlatform_name :: (Maybe Text -> f (Maybe Text))
-> ComponentPlatform -> f ComponentPlatform
componentPlatform_name = (ComponentPlatform -> Maybe Text)
-> (ComponentPlatform -> Maybe Text -> ComponentPlatform)
-> Lens
ComponentPlatform ComponentPlatform (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentPlatform' {Maybe Text
name :: Maybe Text
$sel:name:ComponentPlatform' :: ComponentPlatform -> Maybe Text
name} -> Maybe Text
name) (\s :: ComponentPlatform
s@ComponentPlatform' {} Maybe Text
a -> ComponentPlatform
s {$sel:name:ComponentPlatform' :: Maybe Text
name = Maybe Text
a} :: ComponentPlatform)
componentPlatform_attributes :: Lens.Lens' ComponentPlatform (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
componentPlatform_attributes :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ComponentPlatform -> f ComponentPlatform
componentPlatform_attributes = (ComponentPlatform -> Maybe (HashMap Text Text))
-> (ComponentPlatform
-> Maybe (HashMap Text Text) -> ComponentPlatform)
-> Lens
ComponentPlatform
ComponentPlatform
(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 (\ComponentPlatform' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:ComponentPlatform' :: ComponentPlatform -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: ComponentPlatform
s@ComponentPlatform' {} Maybe (HashMap Text Text)
a -> ComponentPlatform
s {$sel:attributes:ComponentPlatform' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: ComponentPlatform) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ComponentPlatform -> f ComponentPlatform)
-> ((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)))
-> ComponentPlatform
-> f ComponentPlatform
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 ComponentPlatform where
parseJSON :: Value -> Parser ComponentPlatform
parseJSON =
String
-> (Object -> Parser ComponentPlatform)
-> Value
-> Parser ComponentPlatform
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ComponentPlatform"
( \Object
x ->
Maybe Text -> Maybe (HashMap Text Text) -> ComponentPlatform
ComponentPlatform'
(Maybe Text -> Maybe (HashMap Text Text) -> ComponentPlatform)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> ComponentPlatform)
forall (f :: * -> *) a b. Functor 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
"name")
Parser (Maybe (HashMap Text Text) -> ComponentPlatform)
-> Parser (Maybe (HashMap Text Text)) -> Parser ComponentPlatform
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)
)
instance Prelude.Hashable ComponentPlatform
instance Prelude.NFData ComponentPlatform
instance Core.ToJSON ComponentPlatform where
toJSON :: ComponentPlatform -> Value
toJSON ComponentPlatform' {Maybe Text
Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
name :: Maybe Text
$sel:attributes:ComponentPlatform' :: ComponentPlatform -> Maybe (HashMap Text Text)
$sel:name:ComponentPlatform' :: ComponentPlatform -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
(Text
"attributes" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
attributes
]
)