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