{-# 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.DescribeRootFolders
(
DescribeRootFolders (..),
newDescribeRootFolders,
describeRootFolders_limit,
describeRootFolders_marker,
describeRootFolders_authenticationToken,
DescribeRootFoldersResponse (..),
newDescribeRootFoldersResponse,
describeRootFoldersResponse_folders,
describeRootFoldersResponse_marker,
describeRootFoldersResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WorkDocs.Types
data DescribeRootFolders = DescribeRootFolders'
{
DescribeRootFolders -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
DescribeRootFolders -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
DescribeRootFolders -> Sensitive Text
authenticationToken :: Data.Sensitive Prelude.Text
}
deriving (DescribeRootFolders -> DescribeRootFolders -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRootFolders -> DescribeRootFolders -> Bool
$c/= :: DescribeRootFolders -> DescribeRootFolders -> Bool
== :: DescribeRootFolders -> DescribeRootFolders -> Bool
$c== :: DescribeRootFolders -> DescribeRootFolders -> Bool
Prelude.Eq, Int -> DescribeRootFolders -> ShowS
[DescribeRootFolders] -> ShowS
DescribeRootFolders -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRootFolders] -> ShowS
$cshowList :: [DescribeRootFolders] -> ShowS
show :: DescribeRootFolders -> String
$cshow :: DescribeRootFolders -> String
showsPrec :: Int -> DescribeRootFolders -> ShowS
$cshowsPrec :: Int -> DescribeRootFolders -> ShowS
Prelude.Show, forall x. Rep DescribeRootFolders x -> DescribeRootFolders
forall x. DescribeRootFolders -> Rep DescribeRootFolders x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeRootFolders x -> DescribeRootFolders
$cfrom :: forall x. DescribeRootFolders -> Rep DescribeRootFolders x
Prelude.Generic)
newDescribeRootFolders ::
Prelude.Text ->
DescribeRootFolders
newDescribeRootFolders :: Text -> DescribeRootFolders
newDescribeRootFolders Text
pAuthenticationToken_ =
DescribeRootFolders'
{ $sel:limit:DescribeRootFolders' :: Maybe Natural
limit = forall a. Maybe a
Prelude.Nothing,
$sel:marker:DescribeRootFolders' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:authenticationToken:DescribeRootFolders' :: Sensitive Text
authenticationToken =
forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pAuthenticationToken_
}
describeRootFolders_limit :: Lens.Lens' DescribeRootFolders (Prelude.Maybe Prelude.Natural)
describeRootFolders_limit :: Lens' DescribeRootFolders (Maybe Natural)
describeRootFolders_limit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRootFolders' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeRootFolders' :: DescribeRootFolders -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeRootFolders
s@DescribeRootFolders' {} Maybe Natural
a -> DescribeRootFolders
s {$sel:limit:DescribeRootFolders' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeRootFolders)
describeRootFolders_marker :: Lens.Lens' DescribeRootFolders (Prelude.Maybe Prelude.Text)
describeRootFolders_marker :: Lens' DescribeRootFolders (Maybe Text)
describeRootFolders_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRootFolders' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeRootFolders' :: DescribeRootFolders -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeRootFolders
s@DescribeRootFolders' {} Maybe Text
a -> DescribeRootFolders
s {$sel:marker:DescribeRootFolders' :: Maybe Text
marker = Maybe Text
a} :: DescribeRootFolders)
describeRootFolders_authenticationToken :: Lens.Lens' DescribeRootFolders Prelude.Text
describeRootFolders_authenticationToken :: Lens' DescribeRootFolders Text
describeRootFolders_authenticationToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRootFolders' {Sensitive Text
authenticationToken :: Sensitive Text
$sel:authenticationToken:DescribeRootFolders' :: DescribeRootFolders -> Sensitive Text
authenticationToken} -> Sensitive Text
authenticationToken) (\s :: DescribeRootFolders
s@DescribeRootFolders' {} Sensitive Text
a -> DescribeRootFolders
s {$sel:authenticationToken:DescribeRootFolders' :: Sensitive Text
authenticationToken = Sensitive Text
a} :: DescribeRootFolders) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
instance Core.AWSPager DescribeRootFolders where
page :: DescribeRootFolders
-> AWSResponse DescribeRootFolders -> Maybe DescribeRootFolders
page DescribeRootFolders
rq AWSResponse DescribeRootFolders
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse DescribeRootFolders
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeRootFoldersResponse (Maybe Text)
describeRootFoldersResponse_marker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse DescribeRootFolders
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeRootFoldersResponse (Maybe [FolderMetadata])
describeRootFoldersResponse_folders
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ DescribeRootFolders
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeRootFolders (Maybe Text)
describeRootFolders_marker
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeRootFolders
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeRootFoldersResponse (Maybe Text)
describeRootFoldersResponse_marker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest DescribeRootFolders where
type
AWSResponse DescribeRootFolders =
DescribeRootFoldersResponse
request :: (Service -> Service)
-> DescribeRootFolders -> Request DescribeRootFolders
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeRootFolders
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeRootFolders)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [FolderMetadata]
-> Maybe Text -> Int -> DescribeRootFoldersResponse
DescribeRootFoldersResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Folders" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Marker")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DescribeRootFolders where
hashWithSalt :: Int -> DescribeRootFolders -> Int
hashWithSalt Int
_salt DescribeRootFolders' {Maybe Natural
Maybe Text
Sensitive Text
authenticationToken :: Sensitive Text
marker :: Maybe Text
limit :: Maybe Natural
$sel:authenticationToken:DescribeRootFolders' :: DescribeRootFolders -> Sensitive Text
$sel:marker:DescribeRootFolders' :: DescribeRootFolders -> Maybe Text
$sel:limit:DescribeRootFolders' :: DescribeRootFolders -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
limit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
authenticationToken
instance Prelude.NFData DescribeRootFolders where
rnf :: DescribeRootFolders -> ()
rnf DescribeRootFolders' {Maybe Natural
Maybe Text
Sensitive Text
authenticationToken :: Sensitive Text
marker :: Maybe Text
limit :: Maybe Natural
$sel:authenticationToken:DescribeRootFolders' :: DescribeRootFolders -> Sensitive Text
$sel:marker:DescribeRootFolders' :: DescribeRootFolders -> Maybe Text
$sel:limit:DescribeRootFolders' :: DescribeRootFolders -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
limit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
authenticationToken
instance Data.ToHeaders DescribeRootFolders where
toHeaders :: DescribeRootFolders -> ResponseHeaders
toHeaders DescribeRootFolders' {Maybe Natural
Maybe Text
Sensitive Text
authenticationToken :: Sensitive Text
marker :: Maybe Text
limit :: Maybe Natural
$sel:authenticationToken:DescribeRootFolders' :: DescribeRootFolders -> Sensitive Text
$sel:marker:DescribeRootFolders' :: DescribeRootFolders -> Maybe Text
$sel:limit:DescribeRootFolders' :: DescribeRootFolders -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Authentication" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Sensitive Text
authenticationToken,
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
]
instance Data.ToPath DescribeRootFolders where
toPath :: DescribeRootFolders -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/api/v1/me/root"
instance Data.ToQuery DescribeRootFolders where
toQuery :: DescribeRootFolders -> QueryString
toQuery DescribeRootFolders' {Maybe Natural
Maybe Text
Sensitive Text
authenticationToken :: Sensitive Text
marker :: Maybe Text
limit :: Maybe Natural
$sel:authenticationToken:DescribeRootFolders' :: DescribeRootFolders -> Sensitive Text
$sel:marker:DescribeRootFolders' :: DescribeRootFolders -> Maybe Text
$sel:limit:DescribeRootFolders' :: DescribeRootFolders -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"limit" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
limit, ByteString
"marker" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
marker]
data DescribeRootFoldersResponse = DescribeRootFoldersResponse'
{
DescribeRootFoldersResponse -> Maybe [FolderMetadata]
folders :: Prelude.Maybe [FolderMetadata],
DescribeRootFoldersResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
DescribeRootFoldersResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeRootFoldersResponse -> DescribeRootFoldersResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRootFoldersResponse -> DescribeRootFoldersResponse -> Bool
$c/= :: DescribeRootFoldersResponse -> DescribeRootFoldersResponse -> Bool
== :: DescribeRootFoldersResponse -> DescribeRootFoldersResponse -> Bool
$c== :: DescribeRootFoldersResponse -> DescribeRootFoldersResponse -> Bool
Prelude.Eq, ReadPrec [DescribeRootFoldersResponse]
ReadPrec DescribeRootFoldersResponse
Int -> ReadS DescribeRootFoldersResponse
ReadS [DescribeRootFoldersResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRootFoldersResponse]
$creadListPrec :: ReadPrec [DescribeRootFoldersResponse]
readPrec :: ReadPrec DescribeRootFoldersResponse
$creadPrec :: ReadPrec DescribeRootFoldersResponse
readList :: ReadS [DescribeRootFoldersResponse]
$creadList :: ReadS [DescribeRootFoldersResponse]
readsPrec :: Int -> ReadS DescribeRootFoldersResponse
$creadsPrec :: Int -> ReadS DescribeRootFoldersResponse
Prelude.Read, Int -> DescribeRootFoldersResponse -> ShowS
[DescribeRootFoldersResponse] -> ShowS
DescribeRootFoldersResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRootFoldersResponse] -> ShowS
$cshowList :: [DescribeRootFoldersResponse] -> ShowS
show :: DescribeRootFoldersResponse -> String
$cshow :: DescribeRootFoldersResponse -> String
showsPrec :: Int -> DescribeRootFoldersResponse -> ShowS
$cshowsPrec :: Int -> DescribeRootFoldersResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeRootFoldersResponse x -> DescribeRootFoldersResponse
forall x.
DescribeRootFoldersResponse -> Rep DescribeRootFoldersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeRootFoldersResponse x -> DescribeRootFoldersResponse
$cfrom :: forall x.
DescribeRootFoldersResponse -> Rep DescribeRootFoldersResponse x
Prelude.Generic)
newDescribeRootFoldersResponse ::
Prelude.Int ->
DescribeRootFoldersResponse
newDescribeRootFoldersResponse :: Int -> DescribeRootFoldersResponse
newDescribeRootFoldersResponse Int
pHttpStatus_ =
DescribeRootFoldersResponse'
{ $sel:folders:DescribeRootFoldersResponse' :: Maybe [FolderMetadata]
folders =
forall a. Maybe a
Prelude.Nothing,
$sel:marker:DescribeRootFoldersResponse' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeRootFoldersResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeRootFoldersResponse_folders :: Lens.Lens' DescribeRootFoldersResponse (Prelude.Maybe [FolderMetadata])
describeRootFoldersResponse_folders :: Lens' DescribeRootFoldersResponse (Maybe [FolderMetadata])
describeRootFoldersResponse_folders = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRootFoldersResponse' {Maybe [FolderMetadata]
folders :: Maybe [FolderMetadata]
$sel:folders:DescribeRootFoldersResponse' :: DescribeRootFoldersResponse -> Maybe [FolderMetadata]
folders} -> Maybe [FolderMetadata]
folders) (\s :: DescribeRootFoldersResponse
s@DescribeRootFoldersResponse' {} Maybe [FolderMetadata]
a -> DescribeRootFoldersResponse
s {$sel:folders:DescribeRootFoldersResponse' :: Maybe [FolderMetadata]
folders = Maybe [FolderMetadata]
a} :: DescribeRootFoldersResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeRootFoldersResponse_marker :: Lens.Lens' DescribeRootFoldersResponse (Prelude.Maybe Prelude.Text)
describeRootFoldersResponse_marker :: Lens' DescribeRootFoldersResponse (Maybe Text)
describeRootFoldersResponse_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRootFoldersResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeRootFoldersResponse' :: DescribeRootFoldersResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeRootFoldersResponse
s@DescribeRootFoldersResponse' {} Maybe Text
a -> DescribeRootFoldersResponse
s {$sel:marker:DescribeRootFoldersResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeRootFoldersResponse)
describeRootFoldersResponse_httpStatus :: Lens.Lens' DescribeRootFoldersResponse Prelude.Int
describeRootFoldersResponse_httpStatus :: Lens' DescribeRootFoldersResponse Int
describeRootFoldersResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRootFoldersResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeRootFoldersResponse' :: DescribeRootFoldersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeRootFoldersResponse
s@DescribeRootFoldersResponse' {} Int
a -> DescribeRootFoldersResponse
s {$sel:httpStatus:DescribeRootFoldersResponse' :: Int
httpStatus = Int
a} :: DescribeRootFoldersResponse)
instance Prelude.NFData DescribeRootFoldersResponse where
rnf :: DescribeRootFoldersResponse -> ()
rnf DescribeRootFoldersResponse' {Int
Maybe [FolderMetadata]
Maybe Text
httpStatus :: Int
marker :: Maybe Text
folders :: Maybe [FolderMetadata]
$sel:httpStatus:DescribeRootFoldersResponse' :: DescribeRootFoldersResponse -> Int
$sel:marker:DescribeRootFoldersResponse' :: DescribeRootFoldersResponse -> Maybe Text
$sel:folders:DescribeRootFoldersResponse' :: DescribeRootFoldersResponse -> Maybe [FolderMetadata]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [FolderMetadata]
folders
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus