{-# 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.WorkDocs.GetFolder
(
GetFolder (..),
newGetFolder,
getFolder_authenticationToken,
getFolder_includeCustomMetadata,
getFolder_folderId,
GetFolderResponse (..),
newGetFolderResponse,
getFolderResponse_customMetadata,
getFolderResponse_metadata,
getFolderResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WorkDocs.Types
data GetFolder = GetFolder'
{
GetFolder -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
GetFolder -> Maybe Bool
includeCustomMetadata :: Prelude.Maybe Prelude.Bool,
GetFolder -> Text
folderId :: Prelude.Text
}
deriving (GetFolder -> GetFolder -> Bool
(GetFolder -> GetFolder -> Bool)
-> (GetFolder -> GetFolder -> Bool) -> Eq GetFolder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFolder -> GetFolder -> Bool
$c/= :: GetFolder -> GetFolder -> Bool
== :: GetFolder -> GetFolder -> Bool
$c== :: GetFolder -> GetFolder -> Bool
Prelude.Eq, Int -> GetFolder -> ShowS
[GetFolder] -> ShowS
GetFolder -> String
(Int -> GetFolder -> ShowS)
-> (GetFolder -> String)
-> ([GetFolder] -> ShowS)
-> Show GetFolder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFolder] -> ShowS
$cshowList :: [GetFolder] -> ShowS
show :: GetFolder -> String
$cshow :: GetFolder -> String
showsPrec :: Int -> GetFolder -> ShowS
$cshowsPrec :: Int -> GetFolder -> ShowS
Prelude.Show, (forall x. GetFolder -> Rep GetFolder x)
-> (forall x. Rep GetFolder x -> GetFolder) -> Generic GetFolder
forall x. Rep GetFolder x -> GetFolder
forall x. GetFolder -> Rep GetFolder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFolder x -> GetFolder
$cfrom :: forall x. GetFolder -> Rep GetFolder x
Prelude.Generic)
newGetFolder ::
Prelude.Text ->
GetFolder
newGetFolder :: Text -> GetFolder
newGetFolder Text
pFolderId_ =
GetFolder' :: Maybe (Sensitive Text) -> Maybe Bool -> Text -> GetFolder
GetFolder'
{ $sel:authenticationToken:GetFolder' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:includeCustomMetadata:GetFolder' :: Maybe Bool
includeCustomMetadata = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:folderId:GetFolder' :: Text
folderId = Text
pFolderId_
}
getFolder_authenticationToken :: Lens.Lens' GetFolder (Prelude.Maybe Prelude.Text)
getFolder_authenticationToken :: (Maybe Text -> f (Maybe Text)) -> GetFolder -> f GetFolder
getFolder_authenticationToken = (GetFolder -> Maybe (Sensitive Text))
-> (GetFolder -> Maybe (Sensitive Text) -> GetFolder)
-> Lens
GetFolder
GetFolder
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFolder' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:GetFolder' :: GetFolder -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: GetFolder
s@GetFolder' {} Maybe (Sensitive Text)
a -> GetFolder
s {$sel:authenticationToken:GetFolder' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: GetFolder) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> GetFolder -> f GetFolder)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> GetFolder
-> f GetFolder
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
getFolder_includeCustomMetadata :: Lens.Lens' GetFolder (Prelude.Maybe Prelude.Bool)
getFolder_includeCustomMetadata :: (Maybe Bool -> f (Maybe Bool)) -> GetFolder -> f GetFolder
getFolder_includeCustomMetadata = (GetFolder -> Maybe Bool)
-> (GetFolder -> Maybe Bool -> GetFolder)
-> Lens GetFolder GetFolder (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFolder' {Maybe Bool
includeCustomMetadata :: Maybe Bool
$sel:includeCustomMetadata:GetFolder' :: GetFolder -> Maybe Bool
includeCustomMetadata} -> Maybe Bool
includeCustomMetadata) (\s :: GetFolder
s@GetFolder' {} Maybe Bool
a -> GetFolder
s {$sel:includeCustomMetadata:GetFolder' :: Maybe Bool
includeCustomMetadata = Maybe Bool
a} :: GetFolder)
getFolder_folderId :: Lens.Lens' GetFolder Prelude.Text
getFolder_folderId :: (Text -> f Text) -> GetFolder -> f GetFolder
getFolder_folderId = (GetFolder -> Text)
-> (GetFolder -> Text -> GetFolder)
-> Lens GetFolder GetFolder Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFolder' {Text
folderId :: Text
$sel:folderId:GetFolder' :: GetFolder -> Text
folderId} -> Text
folderId) (\s :: GetFolder
s@GetFolder' {} Text
a -> GetFolder
s {$sel:folderId:GetFolder' :: Text
folderId = Text
a} :: GetFolder)
instance Core.AWSRequest GetFolder where
type AWSResponse GetFolder = GetFolderResponse
request :: GetFolder -> Request GetFolder
request = Service -> GetFolder -> Request GetFolder
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetFolder
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetFolder)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetFolder))
-> Logger
-> Service
-> Proxy GetFolder
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetFolder)))
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 (HashMap Text Text)
-> Maybe FolderMetadata -> Int -> GetFolderResponse
GetFolderResponse'
(Maybe (HashMap Text Text)
-> Maybe FolderMetadata -> Int -> GetFolderResponse)
-> Either String (Maybe (HashMap Text Text))
-> Either String (Maybe FolderMetadata -> Int -> GetFolderResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CustomMetadata" Either String (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text)
-> Either String (Maybe (HashMap Text Text))
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe FolderMetadata -> Int -> GetFolderResponse)
-> Either String (Maybe FolderMetadata)
-> Either String (Int -> GetFolderResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe FolderMetadata)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Metadata")
Either String (Int -> GetFolderResponse)
-> Either String Int -> Either String GetFolderResponse
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 GetFolder
instance Prelude.NFData GetFolder
instance Core.ToHeaders GetFolder where
toHeaders :: GetFolder -> ResponseHeaders
toHeaders GetFolder' {Maybe Bool
Maybe (Sensitive Text)
Text
folderId :: Text
includeCustomMetadata :: Maybe Bool
authenticationToken :: Maybe (Sensitive Text)
$sel:folderId:GetFolder' :: GetFolder -> Text
$sel:includeCustomMetadata:GetFolder' :: GetFolder -> Maybe Bool
$sel:authenticationToken:GetFolder' :: GetFolder -> Maybe (Sensitive Text)
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Authentication" HeaderName -> Maybe (Sensitive Text) -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe (Sensitive Text)
authenticationToken,
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.ToPath GetFolder where
toPath :: GetFolder -> ByteString
toPath GetFolder' {Maybe Bool
Maybe (Sensitive Text)
Text
folderId :: Text
includeCustomMetadata :: Maybe Bool
authenticationToken :: Maybe (Sensitive Text)
$sel:folderId:GetFolder' :: GetFolder -> Text
$sel:includeCustomMetadata:GetFolder' :: GetFolder -> Maybe Bool
$sel:authenticationToken:GetFolder' :: GetFolder -> Maybe (Sensitive Text)
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/api/v1/folders/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
folderId]
instance Core.ToQuery GetFolder where
toQuery :: GetFolder -> QueryString
toQuery GetFolder' {Maybe Bool
Maybe (Sensitive Text)
Text
folderId :: Text
includeCustomMetadata :: Maybe Bool
authenticationToken :: Maybe (Sensitive Text)
$sel:folderId:GetFolder' :: GetFolder -> Text
$sel:includeCustomMetadata:GetFolder' :: GetFolder -> Maybe Bool
$sel:authenticationToken:GetFolder' :: GetFolder -> Maybe (Sensitive Text)
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"includeCustomMetadata"
ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
includeCustomMetadata
]
data GetFolderResponse = GetFolderResponse'
{
GetFolderResponse -> Maybe (HashMap Text Text)
customMetadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
GetFolderResponse -> Maybe FolderMetadata
metadata :: Prelude.Maybe FolderMetadata,
GetFolderResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetFolderResponse -> GetFolderResponse -> Bool
(GetFolderResponse -> GetFolderResponse -> Bool)
-> (GetFolderResponse -> GetFolderResponse -> Bool)
-> Eq GetFolderResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFolderResponse -> GetFolderResponse -> Bool
$c/= :: GetFolderResponse -> GetFolderResponse -> Bool
== :: GetFolderResponse -> GetFolderResponse -> Bool
$c== :: GetFolderResponse -> GetFolderResponse -> Bool
Prelude.Eq, ReadPrec [GetFolderResponse]
ReadPrec GetFolderResponse
Int -> ReadS GetFolderResponse
ReadS [GetFolderResponse]
(Int -> ReadS GetFolderResponse)
-> ReadS [GetFolderResponse]
-> ReadPrec GetFolderResponse
-> ReadPrec [GetFolderResponse]
-> Read GetFolderResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFolderResponse]
$creadListPrec :: ReadPrec [GetFolderResponse]
readPrec :: ReadPrec GetFolderResponse
$creadPrec :: ReadPrec GetFolderResponse
readList :: ReadS [GetFolderResponse]
$creadList :: ReadS [GetFolderResponse]
readsPrec :: Int -> ReadS GetFolderResponse
$creadsPrec :: Int -> ReadS GetFolderResponse
Prelude.Read, Int -> GetFolderResponse -> ShowS
[GetFolderResponse] -> ShowS
GetFolderResponse -> String
(Int -> GetFolderResponse -> ShowS)
-> (GetFolderResponse -> String)
-> ([GetFolderResponse] -> ShowS)
-> Show GetFolderResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFolderResponse] -> ShowS
$cshowList :: [GetFolderResponse] -> ShowS
show :: GetFolderResponse -> String
$cshow :: GetFolderResponse -> String
showsPrec :: Int -> GetFolderResponse -> ShowS
$cshowsPrec :: Int -> GetFolderResponse -> ShowS
Prelude.Show, (forall x. GetFolderResponse -> Rep GetFolderResponse x)
-> (forall x. Rep GetFolderResponse x -> GetFolderResponse)
-> Generic GetFolderResponse
forall x. Rep GetFolderResponse x -> GetFolderResponse
forall x. GetFolderResponse -> Rep GetFolderResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFolderResponse x -> GetFolderResponse
$cfrom :: forall x. GetFolderResponse -> Rep GetFolderResponse x
Prelude.Generic)
newGetFolderResponse ::
Prelude.Int ->
GetFolderResponse
newGetFolderResponse :: Int -> GetFolderResponse
newGetFolderResponse Int
pHttpStatus_ =
GetFolderResponse' :: Maybe (HashMap Text Text)
-> Maybe FolderMetadata -> Int -> GetFolderResponse
GetFolderResponse'
{ $sel:customMetadata:GetFolderResponse' :: Maybe (HashMap Text Text)
customMetadata =
Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:metadata:GetFolderResponse' :: Maybe FolderMetadata
metadata = Maybe FolderMetadata
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetFolderResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getFolderResponse_customMetadata :: Lens.Lens' GetFolderResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getFolderResponse_customMetadata :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetFolderResponse -> f GetFolderResponse
getFolderResponse_customMetadata = (GetFolderResponse -> Maybe (HashMap Text Text))
-> (GetFolderResponse
-> Maybe (HashMap Text Text) -> GetFolderResponse)
-> Lens
GetFolderResponse
GetFolderResponse
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFolderResponse' {Maybe (HashMap Text Text)
customMetadata :: Maybe (HashMap Text Text)
$sel:customMetadata:GetFolderResponse' :: GetFolderResponse -> Maybe (HashMap Text Text)
customMetadata} -> Maybe (HashMap Text Text)
customMetadata) (\s :: GetFolderResponse
s@GetFolderResponse' {} Maybe (HashMap Text Text)
a -> GetFolderResponse
s {$sel:customMetadata:GetFolderResponse' :: Maybe (HashMap Text Text)
customMetadata = Maybe (HashMap Text Text)
a} :: GetFolderResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetFolderResponse -> f GetFolderResponse)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetFolderResponse
-> f GetFolderResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text 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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getFolderResponse_metadata :: Lens.Lens' GetFolderResponse (Prelude.Maybe FolderMetadata)
getFolderResponse_metadata :: (Maybe FolderMetadata -> f (Maybe FolderMetadata))
-> GetFolderResponse -> f GetFolderResponse
getFolderResponse_metadata = (GetFolderResponse -> Maybe FolderMetadata)
-> (GetFolderResponse -> Maybe FolderMetadata -> GetFolderResponse)
-> Lens
GetFolderResponse
GetFolderResponse
(Maybe FolderMetadata)
(Maybe FolderMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFolderResponse' {Maybe FolderMetadata
metadata :: Maybe FolderMetadata
$sel:metadata:GetFolderResponse' :: GetFolderResponse -> Maybe FolderMetadata
metadata} -> Maybe FolderMetadata
metadata) (\s :: GetFolderResponse
s@GetFolderResponse' {} Maybe FolderMetadata
a -> GetFolderResponse
s {$sel:metadata:GetFolderResponse' :: Maybe FolderMetadata
metadata = Maybe FolderMetadata
a} :: GetFolderResponse)
getFolderResponse_httpStatus :: Lens.Lens' GetFolderResponse Prelude.Int
getFolderResponse_httpStatus :: (Int -> f Int) -> GetFolderResponse -> f GetFolderResponse
getFolderResponse_httpStatus = (GetFolderResponse -> Int)
-> (GetFolderResponse -> Int -> GetFolderResponse)
-> Lens GetFolderResponse GetFolderResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFolderResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetFolderResponse' :: GetFolderResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetFolderResponse
s@GetFolderResponse' {} Int
a -> GetFolderResponse
s {$sel:httpStatus:GetFolderResponse' :: Int
httpStatus = Int
a} :: GetFolderResponse)
instance Prelude.NFData GetFolderResponse