{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data ComponentPlatform = ComponentPlatform'
{
ComponentPlatform -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
ComponentPlatform -> Maybe Text
name :: Prelude.Maybe Prelude.Text
}
deriving (ComponentPlatform -> ComponentPlatform -> Bool
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]
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
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. 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'
{ $sel:attributes:ComponentPlatform' :: Maybe (HashMap Text Text)
attributes = forall a. Maybe a
Prelude.Nothing,
$sel:name:ComponentPlatform' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
}
componentPlatform_attributes :: Lens.Lens' ComponentPlatform (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
componentPlatform_attributes :: Lens' ComponentPlatform (Maybe (HashMap Text Text))
componentPlatform_attributes = 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) 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
componentPlatform_name :: Lens.Lens' ComponentPlatform (Prelude.Maybe Prelude.Text)
componentPlatform_name :: Lens' ComponentPlatform (Maybe Text)
componentPlatform_name = 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)
instance Data.FromJSON ComponentPlatform where
parseJSON :: Value -> Parser ComponentPlatform
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ComponentPlatform"
( \Object
x ->
Maybe (HashMap Text Text) -> Maybe Text -> ComponentPlatform
ComponentPlatform'
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
"attributes" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"name")
)
instance Prelude.Hashable ComponentPlatform where
hashWithSalt :: Int -> ComponentPlatform -> Int
hashWithSalt Int
_salt ComponentPlatform' {Maybe Text
Maybe (HashMap Text Text)
name :: Maybe Text
attributes :: Maybe (HashMap Text Text)
$sel:name:ComponentPlatform' :: ComponentPlatform -> Maybe Text
$sel:attributes:ComponentPlatform' :: ComponentPlatform -> Maybe (HashMap Text Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
attributes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
instance Prelude.NFData ComponentPlatform where
rnf :: ComponentPlatform -> ()
rnf ComponentPlatform' {Maybe Text
Maybe (HashMap Text Text)
name :: Maybe Text
attributes :: Maybe (HashMap Text Text)
$sel:name:ComponentPlatform' :: ComponentPlatform -> Maybe Text
$sel:attributes:ComponentPlatform' :: ComponentPlatform -> Maybe (HashMap Text Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
attributes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
instance Data.ToJSON ComponentPlatform where
toJSON :: ComponentPlatform -> Value
toJSON ComponentPlatform' {Maybe Text
Maybe (HashMap Text Text)
name :: Maybe Text
attributes :: Maybe (HashMap Text Text)
$sel:name:ComponentPlatform' :: ComponentPlatform -> Maybe Text
$sel:attributes:ComponentPlatform' :: ComponentPlatform -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"attributes" 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 (HashMap Text Text)
attributes,
(Key
"name" 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 Text
name
]
)