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