{-# 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.CloudDirectory.Types.Directory where
import Amazonka.CloudDirectory.Types.DirectoryState
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Directory = Directory'
{
Directory -> Maybe Text
directoryArn :: Prelude.Maybe Prelude.Text,
Directory -> Maybe DirectoryState
state :: Prelude.Maybe DirectoryState,
Directory -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Directory -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX
}
deriving (Directory -> Directory -> Bool
(Directory -> Directory -> Bool)
-> (Directory -> Directory -> Bool) -> Eq Directory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Directory -> Directory -> Bool
$c/= :: Directory -> Directory -> Bool
== :: Directory -> Directory -> Bool
$c== :: Directory -> Directory -> Bool
Prelude.Eq, ReadPrec [Directory]
ReadPrec Directory
Int -> ReadS Directory
ReadS [Directory]
(Int -> ReadS Directory)
-> ReadS [Directory]
-> ReadPrec Directory
-> ReadPrec [Directory]
-> Read Directory
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Directory]
$creadListPrec :: ReadPrec [Directory]
readPrec :: ReadPrec Directory
$creadPrec :: ReadPrec Directory
readList :: ReadS [Directory]
$creadList :: ReadS [Directory]
readsPrec :: Int -> ReadS Directory
$creadsPrec :: Int -> ReadS Directory
Prelude.Read, Int -> Directory -> ShowS
[Directory] -> ShowS
Directory -> String
(Int -> Directory -> ShowS)
-> (Directory -> String)
-> ([Directory] -> ShowS)
-> Show Directory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Directory] -> ShowS
$cshowList :: [Directory] -> ShowS
show :: Directory -> String
$cshow :: Directory -> String
showsPrec :: Int -> Directory -> ShowS
$cshowsPrec :: Int -> Directory -> ShowS
Prelude.Show, (forall x. Directory -> Rep Directory x)
-> (forall x. Rep Directory x -> Directory) -> Generic Directory
forall x. Rep Directory x -> Directory
forall x. Directory -> Rep Directory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Directory x -> Directory
$cfrom :: forall x. Directory -> Rep Directory x
Prelude.Generic)
newDirectory ::
Directory
newDirectory :: Directory
newDirectory =
Directory' :: Maybe Text
-> Maybe DirectoryState -> Maybe Text -> Maybe POSIX -> Directory
Directory'
{ $sel:directoryArn:Directory' :: Maybe Text
directoryArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:state:Directory' :: Maybe DirectoryState
state = Maybe DirectoryState
forall a. Maybe a
Prelude.Nothing,
$sel:name:Directory' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:creationDateTime:Directory' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
directory_directoryArn :: Lens.Lens' Directory (Prelude.Maybe Prelude.Text)
directory_directoryArn :: (Maybe Text -> f (Maybe Text)) -> Directory -> f Directory
directory_directoryArn = (Directory -> Maybe Text)
-> (Directory -> Maybe Text -> Directory)
-> Lens Directory Directory (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Directory' {Maybe Text
directoryArn :: Maybe Text
$sel:directoryArn:Directory' :: Directory -> Maybe Text
directoryArn} -> Maybe Text
directoryArn) (\s :: Directory
s@Directory' {} Maybe Text
a -> Directory
s {$sel:directoryArn:Directory' :: Maybe Text
directoryArn = Maybe Text
a} :: Directory)
directory_state :: Lens.Lens' Directory (Prelude.Maybe DirectoryState)
directory_state :: (Maybe DirectoryState -> f (Maybe DirectoryState))
-> Directory -> f Directory
directory_state = (Directory -> Maybe DirectoryState)
-> (Directory -> Maybe DirectoryState -> Directory)
-> Lens
Directory Directory (Maybe DirectoryState) (Maybe DirectoryState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Directory' {Maybe DirectoryState
state :: Maybe DirectoryState
$sel:state:Directory' :: Directory -> Maybe DirectoryState
state} -> Maybe DirectoryState
state) (\s :: Directory
s@Directory' {} Maybe DirectoryState
a -> Directory
s {$sel:state:Directory' :: Maybe DirectoryState
state = Maybe DirectoryState
a} :: Directory)
directory_name :: Lens.Lens' Directory (Prelude.Maybe Prelude.Text)
directory_name :: (Maybe Text -> f (Maybe Text)) -> Directory -> f Directory
directory_name = (Directory -> Maybe Text)
-> (Directory -> Maybe Text -> Directory)
-> Lens Directory Directory (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Directory' {Maybe Text
name :: Maybe Text
$sel:name:Directory' :: Directory -> Maybe Text
name} -> Maybe Text
name) (\s :: Directory
s@Directory' {} Maybe Text
a -> Directory
s {$sel:name:Directory' :: Maybe Text
name = Maybe Text
a} :: Directory)
directory_creationDateTime :: Lens.Lens' Directory (Prelude.Maybe Prelude.UTCTime)
directory_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Directory -> f Directory
directory_creationDateTime = (Directory -> Maybe POSIX)
-> (Directory -> Maybe POSIX -> Directory)
-> Lens Directory Directory (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Directory' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:Directory' :: Directory -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: Directory
s@Directory' {} Maybe POSIX
a -> Directory
s {$sel:creationDateTime:Directory' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: Directory) ((Maybe POSIX -> f (Maybe POSIX)) -> Directory -> f Directory)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Directory
-> f Directory
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromJSON Directory where
parseJSON :: Value -> Parser Directory
parseJSON =
String -> (Object -> Parser Directory) -> Value -> Parser Directory
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Directory"
( \Object
x ->
Maybe Text
-> Maybe DirectoryState -> Maybe Text -> Maybe POSIX -> Directory
Directory'
(Maybe Text
-> Maybe DirectoryState -> Maybe Text -> Maybe POSIX -> Directory)
-> Parser (Maybe Text)
-> Parser
(Maybe DirectoryState -> Maybe Text -> Maybe POSIX -> Directory)
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
"DirectoryArn")
Parser
(Maybe DirectoryState -> Maybe Text -> Maybe POSIX -> Directory)
-> Parser (Maybe DirectoryState)
-> Parser (Maybe Text -> Maybe POSIX -> Directory)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DirectoryState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
Parser (Maybe Text -> Maybe POSIX -> Directory)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> Directory)
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
"Name")
Parser (Maybe POSIX -> Directory)
-> Parser (Maybe POSIX) -> Parser Directory
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationDateTime")
)
instance Prelude.Hashable Directory
instance Prelude.NFData Directory