{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.DirectoryService.ShareDirectory
(
ShareDirectory (..),
newShareDirectory,
shareDirectory_shareNotes,
shareDirectory_directoryId,
shareDirectory_shareTarget,
shareDirectory_shareMethod,
ShareDirectoryResponse (..),
newShareDirectoryResponse,
shareDirectoryResponse_sharedDirectoryId,
shareDirectoryResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ShareDirectory = ShareDirectory'
{
ShareDirectory -> Maybe (Sensitive Text)
shareNotes :: Prelude.Maybe (Core.Sensitive Prelude.Text),
ShareDirectory -> Text
directoryId :: Prelude.Text,
ShareDirectory -> ShareTarget
shareTarget :: ShareTarget,
ShareDirectory -> ShareMethod
shareMethod :: ShareMethod
}
deriving (ShareDirectory -> ShareDirectory -> Bool
(ShareDirectory -> ShareDirectory -> Bool)
-> (ShareDirectory -> ShareDirectory -> Bool) -> Eq ShareDirectory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShareDirectory -> ShareDirectory -> Bool
$c/= :: ShareDirectory -> ShareDirectory -> Bool
== :: ShareDirectory -> ShareDirectory -> Bool
$c== :: ShareDirectory -> ShareDirectory -> Bool
Prelude.Eq, Int -> ShareDirectory -> ShowS
[ShareDirectory] -> ShowS
ShareDirectory -> String
(Int -> ShareDirectory -> ShowS)
-> (ShareDirectory -> String)
-> ([ShareDirectory] -> ShowS)
-> Show ShareDirectory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShareDirectory] -> ShowS
$cshowList :: [ShareDirectory] -> ShowS
show :: ShareDirectory -> String
$cshow :: ShareDirectory -> String
showsPrec :: Int -> ShareDirectory -> ShowS
$cshowsPrec :: Int -> ShareDirectory -> ShowS
Prelude.Show, (forall x. ShareDirectory -> Rep ShareDirectory x)
-> (forall x. Rep ShareDirectory x -> ShareDirectory)
-> Generic ShareDirectory
forall x. Rep ShareDirectory x -> ShareDirectory
forall x. ShareDirectory -> Rep ShareDirectory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ShareDirectory x -> ShareDirectory
$cfrom :: forall x. ShareDirectory -> Rep ShareDirectory x
Prelude.Generic)
newShareDirectory ::
Prelude.Text ->
ShareTarget ->
ShareMethod ->
ShareDirectory
newShareDirectory :: Text -> ShareTarget -> ShareMethod -> ShareDirectory
newShareDirectory
Text
pDirectoryId_
ShareTarget
pShareTarget_
ShareMethod
pShareMethod_ =
ShareDirectory' :: Maybe (Sensitive Text)
-> Text -> ShareTarget -> ShareMethod -> ShareDirectory
ShareDirectory'
{ $sel:shareNotes:ShareDirectory' :: Maybe (Sensitive Text)
shareNotes = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:directoryId:ShareDirectory' :: Text
directoryId = Text
pDirectoryId_,
$sel:shareTarget:ShareDirectory' :: ShareTarget
shareTarget = ShareTarget
pShareTarget_,
$sel:shareMethod:ShareDirectory' :: ShareMethod
shareMethod = ShareMethod
pShareMethod_
}
shareDirectory_shareNotes :: Lens.Lens' ShareDirectory (Prelude.Maybe Prelude.Text)
shareDirectory_shareNotes :: (Maybe Text -> f (Maybe Text))
-> ShareDirectory -> f ShareDirectory
shareDirectory_shareNotes = (ShareDirectory -> Maybe (Sensitive Text))
-> (ShareDirectory -> Maybe (Sensitive Text) -> ShareDirectory)
-> Lens
ShareDirectory
ShareDirectory
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareDirectory' {Maybe (Sensitive Text)
shareNotes :: Maybe (Sensitive Text)
$sel:shareNotes:ShareDirectory' :: ShareDirectory -> Maybe (Sensitive Text)
shareNotes} -> Maybe (Sensitive Text)
shareNotes) (\s :: ShareDirectory
s@ShareDirectory' {} Maybe (Sensitive Text)
a -> ShareDirectory
s {$sel:shareNotes:ShareDirectory' :: Maybe (Sensitive Text)
shareNotes = Maybe (Sensitive Text)
a} :: ShareDirectory) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> ShareDirectory -> f ShareDirectory)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ShareDirectory
-> f ShareDirectory
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
shareDirectory_directoryId :: Lens.Lens' ShareDirectory Prelude.Text
shareDirectory_directoryId :: (Text -> f Text) -> ShareDirectory -> f ShareDirectory
shareDirectory_directoryId = (ShareDirectory -> Text)
-> (ShareDirectory -> Text -> ShareDirectory)
-> Lens ShareDirectory ShareDirectory Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareDirectory' {Text
directoryId :: Text
$sel:directoryId:ShareDirectory' :: ShareDirectory -> Text
directoryId} -> Text
directoryId) (\s :: ShareDirectory
s@ShareDirectory' {} Text
a -> ShareDirectory
s {$sel:directoryId:ShareDirectory' :: Text
directoryId = Text
a} :: ShareDirectory)
shareDirectory_shareTarget :: Lens.Lens' ShareDirectory ShareTarget
shareDirectory_shareTarget :: (ShareTarget -> f ShareTarget)
-> ShareDirectory -> f ShareDirectory
shareDirectory_shareTarget = (ShareDirectory -> ShareTarget)
-> (ShareDirectory -> ShareTarget -> ShareDirectory)
-> Lens ShareDirectory ShareDirectory ShareTarget ShareTarget
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareDirectory' {ShareTarget
shareTarget :: ShareTarget
$sel:shareTarget:ShareDirectory' :: ShareDirectory -> ShareTarget
shareTarget} -> ShareTarget
shareTarget) (\s :: ShareDirectory
s@ShareDirectory' {} ShareTarget
a -> ShareDirectory
s {$sel:shareTarget:ShareDirectory' :: ShareTarget
shareTarget = ShareTarget
a} :: ShareDirectory)
shareDirectory_shareMethod :: Lens.Lens' ShareDirectory ShareMethod
shareDirectory_shareMethod :: (ShareMethod -> f ShareMethod)
-> ShareDirectory -> f ShareDirectory
shareDirectory_shareMethod = (ShareDirectory -> ShareMethod)
-> (ShareDirectory -> ShareMethod -> ShareDirectory)
-> Lens ShareDirectory ShareDirectory ShareMethod ShareMethod
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareDirectory' {ShareMethod
shareMethod :: ShareMethod
$sel:shareMethod:ShareDirectory' :: ShareDirectory -> ShareMethod
shareMethod} -> ShareMethod
shareMethod) (\s :: ShareDirectory
s@ShareDirectory' {} ShareMethod
a -> ShareDirectory
s {$sel:shareMethod:ShareDirectory' :: ShareMethod
shareMethod = ShareMethod
a} :: ShareDirectory)
instance Core.AWSRequest ShareDirectory where
type
AWSResponse ShareDirectory =
ShareDirectoryResponse
request :: ShareDirectory -> Request ShareDirectory
request = Service -> ShareDirectory -> Request ShareDirectory
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ShareDirectory
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ShareDirectory)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ShareDirectory))
-> Logger
-> Service
-> Proxy ShareDirectory
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ShareDirectory)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> ShareDirectoryResponse
ShareDirectoryResponse'
(Maybe Text -> Int -> ShareDirectoryResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ShareDirectoryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SharedDirectoryId")
Either String (Int -> ShareDirectoryResponse)
-> Either String Int -> Either String ShareDirectoryResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ShareDirectory
instance Prelude.NFData ShareDirectory
instance Core.ToHeaders ShareDirectory where
toHeaders :: ShareDirectory -> ResponseHeaders
toHeaders =
ResponseHeaders -> ShareDirectory -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"DirectoryService_20150416.ShareDirectory" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON ShareDirectory where
toJSON :: ShareDirectory -> Value
toJSON ShareDirectory' {Maybe (Sensitive Text)
Text
ShareMethod
ShareTarget
shareMethod :: ShareMethod
shareTarget :: ShareTarget
directoryId :: Text
shareNotes :: Maybe (Sensitive Text)
$sel:shareMethod:ShareDirectory' :: ShareDirectory -> ShareMethod
$sel:shareTarget:ShareDirectory' :: ShareDirectory -> ShareTarget
$sel:directoryId:ShareDirectory' :: ShareDirectory -> Text
$sel:shareNotes:ShareDirectory' :: ShareDirectory -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ShareNotes" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
shareNotes,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ShareTarget" Text -> ShareTarget -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ShareTarget
shareTarget),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ShareMethod" Text -> ShareMethod -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ShareMethod
shareMethod)
]
)
instance Core.ToPath ShareDirectory where
toPath :: ShareDirectory -> ByteString
toPath = ByteString -> ShareDirectory -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ShareDirectory where
toQuery :: ShareDirectory -> QueryString
toQuery = QueryString -> ShareDirectory -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ShareDirectoryResponse = ShareDirectoryResponse'
{
ShareDirectoryResponse -> Maybe Text
sharedDirectoryId :: Prelude.Maybe Prelude.Text,
ShareDirectoryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ShareDirectoryResponse -> ShareDirectoryResponse -> Bool
(ShareDirectoryResponse -> ShareDirectoryResponse -> Bool)
-> (ShareDirectoryResponse -> ShareDirectoryResponse -> Bool)
-> Eq ShareDirectoryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShareDirectoryResponse -> ShareDirectoryResponse -> Bool
$c/= :: ShareDirectoryResponse -> ShareDirectoryResponse -> Bool
== :: ShareDirectoryResponse -> ShareDirectoryResponse -> Bool
$c== :: ShareDirectoryResponse -> ShareDirectoryResponse -> Bool
Prelude.Eq, ReadPrec [ShareDirectoryResponse]
ReadPrec ShareDirectoryResponse
Int -> ReadS ShareDirectoryResponse
ReadS [ShareDirectoryResponse]
(Int -> ReadS ShareDirectoryResponse)
-> ReadS [ShareDirectoryResponse]
-> ReadPrec ShareDirectoryResponse
-> ReadPrec [ShareDirectoryResponse]
-> Read ShareDirectoryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ShareDirectoryResponse]
$creadListPrec :: ReadPrec [ShareDirectoryResponse]
readPrec :: ReadPrec ShareDirectoryResponse
$creadPrec :: ReadPrec ShareDirectoryResponse
readList :: ReadS [ShareDirectoryResponse]
$creadList :: ReadS [ShareDirectoryResponse]
readsPrec :: Int -> ReadS ShareDirectoryResponse
$creadsPrec :: Int -> ReadS ShareDirectoryResponse
Prelude.Read, Int -> ShareDirectoryResponse -> ShowS
[ShareDirectoryResponse] -> ShowS
ShareDirectoryResponse -> String
(Int -> ShareDirectoryResponse -> ShowS)
-> (ShareDirectoryResponse -> String)
-> ([ShareDirectoryResponse] -> ShowS)
-> Show ShareDirectoryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShareDirectoryResponse] -> ShowS
$cshowList :: [ShareDirectoryResponse] -> ShowS
show :: ShareDirectoryResponse -> String
$cshow :: ShareDirectoryResponse -> String
showsPrec :: Int -> ShareDirectoryResponse -> ShowS
$cshowsPrec :: Int -> ShareDirectoryResponse -> ShowS
Prelude.Show, (forall x. ShareDirectoryResponse -> Rep ShareDirectoryResponse x)
-> (forall x.
Rep ShareDirectoryResponse x -> ShareDirectoryResponse)
-> Generic ShareDirectoryResponse
forall x. Rep ShareDirectoryResponse x -> ShareDirectoryResponse
forall x. ShareDirectoryResponse -> Rep ShareDirectoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ShareDirectoryResponse x -> ShareDirectoryResponse
$cfrom :: forall x. ShareDirectoryResponse -> Rep ShareDirectoryResponse x
Prelude.Generic)
newShareDirectoryResponse ::
Prelude.Int ->
ShareDirectoryResponse
newShareDirectoryResponse :: Int -> ShareDirectoryResponse
newShareDirectoryResponse Int
pHttpStatus_ =
ShareDirectoryResponse' :: Maybe Text -> Int -> ShareDirectoryResponse
ShareDirectoryResponse'
{ $sel:sharedDirectoryId:ShareDirectoryResponse' :: Maybe Text
sharedDirectoryId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ShareDirectoryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
shareDirectoryResponse_sharedDirectoryId :: Lens.Lens' ShareDirectoryResponse (Prelude.Maybe Prelude.Text)
shareDirectoryResponse_sharedDirectoryId :: (Maybe Text -> f (Maybe Text))
-> ShareDirectoryResponse -> f ShareDirectoryResponse
shareDirectoryResponse_sharedDirectoryId = (ShareDirectoryResponse -> Maybe Text)
-> (ShareDirectoryResponse -> Maybe Text -> ShareDirectoryResponse)
-> Lens
ShareDirectoryResponse
ShareDirectoryResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareDirectoryResponse' {Maybe Text
sharedDirectoryId :: Maybe Text
$sel:sharedDirectoryId:ShareDirectoryResponse' :: ShareDirectoryResponse -> Maybe Text
sharedDirectoryId} -> Maybe Text
sharedDirectoryId) (\s :: ShareDirectoryResponse
s@ShareDirectoryResponse' {} Maybe Text
a -> ShareDirectoryResponse
s {$sel:sharedDirectoryId:ShareDirectoryResponse' :: Maybe Text
sharedDirectoryId = Maybe Text
a} :: ShareDirectoryResponse)
shareDirectoryResponse_httpStatus :: Lens.Lens' ShareDirectoryResponse Prelude.Int
shareDirectoryResponse_httpStatus :: (Int -> f Int)
-> ShareDirectoryResponse -> f ShareDirectoryResponse
shareDirectoryResponse_httpStatus = (ShareDirectoryResponse -> Int)
-> (ShareDirectoryResponse -> Int -> ShareDirectoryResponse)
-> Lens ShareDirectoryResponse ShareDirectoryResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareDirectoryResponse' {Int
httpStatus :: Int
$sel:httpStatus:ShareDirectoryResponse' :: ShareDirectoryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ShareDirectoryResponse
s@ShareDirectoryResponse' {} Int
a -> ShareDirectoryResponse
s {$sel:httpStatus:ShareDirectoryResponse' :: Int
httpStatus = Int
a} :: ShareDirectoryResponse)
instance Prelude.NFData ShareDirectoryResponse