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