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