{-# 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.WorkDocs.Types.ResourcePathComponent where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ResourcePathComponent = ResourcePathComponent'
{
ResourcePathComponent -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
ResourcePathComponent -> Maybe Text
id :: Prelude.Maybe Prelude.Text
}
deriving (ResourcePathComponent -> ResourcePathComponent -> Bool
(ResourcePathComponent -> ResourcePathComponent -> Bool)
-> (ResourcePathComponent -> ResourcePathComponent -> Bool)
-> Eq ResourcePathComponent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourcePathComponent -> ResourcePathComponent -> Bool
$c/= :: ResourcePathComponent -> ResourcePathComponent -> Bool
== :: ResourcePathComponent -> ResourcePathComponent -> Bool
$c== :: ResourcePathComponent -> ResourcePathComponent -> Bool
Prelude.Eq, ReadPrec [ResourcePathComponent]
ReadPrec ResourcePathComponent
Int -> ReadS ResourcePathComponent
ReadS [ResourcePathComponent]
(Int -> ReadS ResourcePathComponent)
-> ReadS [ResourcePathComponent]
-> ReadPrec ResourcePathComponent
-> ReadPrec [ResourcePathComponent]
-> Read ResourcePathComponent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourcePathComponent]
$creadListPrec :: ReadPrec [ResourcePathComponent]
readPrec :: ReadPrec ResourcePathComponent
$creadPrec :: ReadPrec ResourcePathComponent
readList :: ReadS [ResourcePathComponent]
$creadList :: ReadS [ResourcePathComponent]
readsPrec :: Int -> ReadS ResourcePathComponent
$creadsPrec :: Int -> ReadS ResourcePathComponent
Prelude.Read, Int -> ResourcePathComponent -> ShowS
[ResourcePathComponent] -> ShowS
ResourcePathComponent -> String
(Int -> ResourcePathComponent -> ShowS)
-> (ResourcePathComponent -> String)
-> ([ResourcePathComponent] -> ShowS)
-> Show ResourcePathComponent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourcePathComponent] -> ShowS
$cshowList :: [ResourcePathComponent] -> ShowS
show :: ResourcePathComponent -> String
$cshow :: ResourcePathComponent -> String
showsPrec :: Int -> ResourcePathComponent -> ShowS
$cshowsPrec :: Int -> ResourcePathComponent -> ShowS
Prelude.Show, (forall x. ResourcePathComponent -> Rep ResourcePathComponent x)
-> (forall x. Rep ResourcePathComponent x -> ResourcePathComponent)
-> Generic ResourcePathComponent
forall x. Rep ResourcePathComponent x -> ResourcePathComponent
forall x. ResourcePathComponent -> Rep ResourcePathComponent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourcePathComponent x -> ResourcePathComponent
$cfrom :: forall x. ResourcePathComponent -> Rep ResourcePathComponent x
Prelude.Generic)
newResourcePathComponent ::
ResourcePathComponent
newResourcePathComponent :: ResourcePathComponent
newResourcePathComponent =
ResourcePathComponent' :: Maybe Text -> Maybe Text -> ResourcePathComponent
ResourcePathComponent'
{ $sel:name:ResourcePathComponent' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:ResourcePathComponent' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
resourcePathComponent_name :: Lens.Lens' ResourcePathComponent (Prelude.Maybe Prelude.Text)
resourcePathComponent_name :: (Maybe Text -> f (Maybe Text))
-> ResourcePathComponent -> f ResourcePathComponent
resourcePathComponent_name = (ResourcePathComponent -> Maybe Text)
-> (ResourcePathComponent -> Maybe Text -> ResourcePathComponent)
-> Lens
ResourcePathComponent
ResourcePathComponent
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourcePathComponent' {Maybe Text
name :: Maybe Text
$sel:name:ResourcePathComponent' :: ResourcePathComponent -> Maybe Text
name} -> Maybe Text
name) (\s :: ResourcePathComponent
s@ResourcePathComponent' {} Maybe Text
a -> ResourcePathComponent
s {$sel:name:ResourcePathComponent' :: Maybe Text
name = Maybe Text
a} :: ResourcePathComponent)
resourcePathComponent_id :: Lens.Lens' ResourcePathComponent (Prelude.Maybe Prelude.Text)
resourcePathComponent_id :: (Maybe Text -> f (Maybe Text))
-> ResourcePathComponent -> f ResourcePathComponent
resourcePathComponent_id = (ResourcePathComponent -> Maybe Text)
-> (ResourcePathComponent -> Maybe Text -> ResourcePathComponent)
-> Lens
ResourcePathComponent
ResourcePathComponent
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourcePathComponent' {Maybe Text
id :: Maybe Text
$sel:id:ResourcePathComponent' :: ResourcePathComponent -> Maybe Text
id} -> Maybe Text
id) (\s :: ResourcePathComponent
s@ResourcePathComponent' {} Maybe Text
a -> ResourcePathComponent
s {$sel:id:ResourcePathComponent' :: Maybe Text
id = Maybe Text
a} :: ResourcePathComponent)
instance Core.FromJSON ResourcePathComponent where
parseJSON :: Value -> Parser ResourcePathComponent
parseJSON =
String
-> (Object -> Parser ResourcePathComponent)
-> Value
-> Parser ResourcePathComponent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ResourcePathComponent"
( \Object
x ->
Maybe Text -> Maybe Text -> ResourcePathComponent
ResourcePathComponent'
(Maybe Text -> Maybe Text -> ResourcePathComponent)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ResourcePathComponent)
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 Text -> ResourcePathComponent)
-> Parser (Maybe Text) -> Parser ResourcePathComponent
forall (f :: * -> *) a b. Applicative f => 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
"Id")
)
instance Prelude.Hashable ResourcePathComponent
instance Prelude.NFData ResourcePathComponent