{-# 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.Kendra.ListThesauri
(
ListThesauri (..),
newListThesauri,
listThesauri_maxResults,
listThesauri_nextToken,
listThesauri_indexId,
ListThesauriResponse (..),
newListThesauriResponse,
listThesauriResponse_nextToken,
listThesauriResponse_thesaurusSummaryItems,
listThesauriResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Kendra.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListThesauri = ListThesauri'
{
ListThesauri -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListThesauri -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListThesauri -> Text
indexId :: Prelude.Text
}
deriving (ListThesauri -> ListThesauri -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListThesauri -> ListThesauri -> Bool
$c/= :: ListThesauri -> ListThesauri -> Bool
== :: ListThesauri -> ListThesauri -> Bool
$c== :: ListThesauri -> ListThesauri -> Bool
Prelude.Eq, ReadPrec [ListThesauri]
ReadPrec ListThesauri
Int -> ReadS ListThesauri
ReadS [ListThesauri]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListThesauri]
$creadListPrec :: ReadPrec [ListThesauri]
readPrec :: ReadPrec ListThesauri
$creadPrec :: ReadPrec ListThesauri
readList :: ReadS [ListThesauri]
$creadList :: ReadS [ListThesauri]
readsPrec :: Int -> ReadS ListThesauri
$creadsPrec :: Int -> ReadS ListThesauri
Prelude.Read, Int -> ListThesauri -> ShowS
[ListThesauri] -> ShowS
ListThesauri -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListThesauri] -> ShowS
$cshowList :: [ListThesauri] -> ShowS
show :: ListThesauri -> String
$cshow :: ListThesauri -> String
showsPrec :: Int -> ListThesauri -> ShowS
$cshowsPrec :: Int -> ListThesauri -> ShowS
Prelude.Show, forall x. Rep ListThesauri x -> ListThesauri
forall x. ListThesauri -> Rep ListThesauri x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListThesauri x -> ListThesauri
$cfrom :: forall x. ListThesauri -> Rep ListThesauri x
Prelude.Generic)
newListThesauri ::
Prelude.Text ->
ListThesauri
newListThesauri :: Text -> ListThesauri
newListThesauri Text
pIndexId_ =
ListThesauri'
{ $sel:maxResults:ListThesauri' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListThesauri' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:indexId:ListThesauri' :: Text
indexId = Text
pIndexId_
}
listThesauri_maxResults :: Lens.Lens' ListThesauri (Prelude.Maybe Prelude.Natural)
listThesauri_maxResults :: Lens' ListThesauri (Maybe Natural)
listThesauri_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThesauri' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListThesauri' :: ListThesauri -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListThesauri
s@ListThesauri' {} Maybe Natural
a -> ListThesauri
s {$sel:maxResults:ListThesauri' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListThesauri)
listThesauri_nextToken :: Lens.Lens' ListThesauri (Prelude.Maybe Prelude.Text)
listThesauri_nextToken :: Lens' ListThesauri (Maybe Text)
listThesauri_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThesauri' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListThesauri' :: ListThesauri -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListThesauri
s@ListThesauri' {} Maybe Text
a -> ListThesauri
s {$sel:nextToken:ListThesauri' :: Maybe Text
nextToken = Maybe Text
a} :: ListThesauri)
listThesauri_indexId :: Lens.Lens' ListThesauri Prelude.Text
listThesauri_indexId :: Lens' ListThesauri Text
listThesauri_indexId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThesauri' {Text
indexId :: Text
$sel:indexId:ListThesauri' :: ListThesauri -> Text
indexId} -> Text
indexId) (\s :: ListThesauri
s@ListThesauri' {} Text
a -> ListThesauri
s {$sel:indexId:ListThesauri' :: Text
indexId = Text
a} :: ListThesauri)
instance Core.AWSRequest ListThesauri where
type AWSResponse ListThesauri = ListThesauriResponse
request :: (Service -> Service) -> ListThesauri -> Request ListThesauri
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListThesauri
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListThesauri)))
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 Text
-> Maybe [ThesaurusSummary] -> Int -> ListThesauriResponse
ListThesauriResponse'
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
"NextToken")
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
"ThesaurusSummaryItems"
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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListThesauri where
hashWithSalt :: Int -> ListThesauri -> Int
hashWithSalt Int
_salt ListThesauri' {Maybe Natural
Maybe Text
Text
indexId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:indexId:ListThesauri' :: ListThesauri -> Text
$sel:nextToken:ListThesauri' :: ListThesauri -> Maybe Text
$sel:maxResults:ListThesauri' :: ListThesauri -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
indexId
instance Prelude.NFData ListThesauri where
rnf :: ListThesauri -> ()
rnf ListThesauri' {Maybe Natural
Maybe Text
Text
indexId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:indexId:ListThesauri' :: ListThesauri -> Text
$sel:nextToken:ListThesauri' :: ListThesauri -> Maybe Text
$sel:maxResults:ListThesauri' :: ListThesauri -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
indexId
instance Data.ToHeaders ListThesauri where
toHeaders :: ListThesauri -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSKendraFrontendService.ListThesauri" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListThesauri where
toJSON :: ListThesauri -> Value
toJSON ListThesauri' {Maybe Natural
Maybe Text
Text
indexId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:indexId:ListThesauri' :: ListThesauri -> Text
$sel:nextToken:ListThesauri' :: ListThesauri -> Maybe Text
$sel:maxResults:ListThesauri' :: ListThesauri -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
forall a. a -> Maybe a
Prelude.Just (Key
"IndexId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
indexId)
]
)
instance Data.ToPath ListThesauri where
toPath :: ListThesauri -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListThesauri where
toQuery :: ListThesauri -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListThesauriResponse = ListThesauriResponse'
{
ListThesauriResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListThesauriResponse -> Maybe [ThesaurusSummary]
thesaurusSummaryItems :: Prelude.Maybe [ThesaurusSummary],
ListThesauriResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListThesauriResponse -> ListThesauriResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListThesauriResponse -> ListThesauriResponse -> Bool
$c/= :: ListThesauriResponse -> ListThesauriResponse -> Bool
== :: ListThesauriResponse -> ListThesauriResponse -> Bool
$c== :: ListThesauriResponse -> ListThesauriResponse -> Bool
Prelude.Eq, ReadPrec [ListThesauriResponse]
ReadPrec ListThesauriResponse
Int -> ReadS ListThesauriResponse
ReadS [ListThesauriResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListThesauriResponse]
$creadListPrec :: ReadPrec [ListThesauriResponse]
readPrec :: ReadPrec ListThesauriResponse
$creadPrec :: ReadPrec ListThesauriResponse
readList :: ReadS [ListThesauriResponse]
$creadList :: ReadS [ListThesauriResponse]
readsPrec :: Int -> ReadS ListThesauriResponse
$creadsPrec :: Int -> ReadS ListThesauriResponse
Prelude.Read, Int -> ListThesauriResponse -> ShowS
[ListThesauriResponse] -> ShowS
ListThesauriResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListThesauriResponse] -> ShowS
$cshowList :: [ListThesauriResponse] -> ShowS
show :: ListThesauriResponse -> String
$cshow :: ListThesauriResponse -> String
showsPrec :: Int -> ListThesauriResponse -> ShowS
$cshowsPrec :: Int -> ListThesauriResponse -> ShowS
Prelude.Show, forall x. Rep ListThesauriResponse x -> ListThesauriResponse
forall x. ListThesauriResponse -> Rep ListThesauriResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListThesauriResponse x -> ListThesauriResponse
$cfrom :: forall x. ListThesauriResponse -> Rep ListThesauriResponse x
Prelude.Generic)
newListThesauriResponse ::
Prelude.Int ->
ListThesauriResponse
newListThesauriResponse :: Int -> ListThesauriResponse
newListThesauriResponse Int
pHttpStatus_ =
ListThesauriResponse'
{ $sel:nextToken:ListThesauriResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:thesaurusSummaryItems:ListThesauriResponse' :: Maybe [ThesaurusSummary]
thesaurusSummaryItems = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListThesauriResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listThesauriResponse_nextToken :: Lens.Lens' ListThesauriResponse (Prelude.Maybe Prelude.Text)
listThesauriResponse_nextToken :: Lens' ListThesauriResponse (Maybe Text)
listThesauriResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThesauriResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListThesauriResponse' :: ListThesauriResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListThesauriResponse
s@ListThesauriResponse' {} Maybe Text
a -> ListThesauriResponse
s {$sel:nextToken:ListThesauriResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListThesauriResponse)
listThesauriResponse_thesaurusSummaryItems :: Lens.Lens' ListThesauriResponse (Prelude.Maybe [ThesaurusSummary])
listThesauriResponse_thesaurusSummaryItems :: Lens' ListThesauriResponse (Maybe [ThesaurusSummary])
listThesauriResponse_thesaurusSummaryItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThesauriResponse' {Maybe [ThesaurusSummary]
thesaurusSummaryItems :: Maybe [ThesaurusSummary]
$sel:thesaurusSummaryItems:ListThesauriResponse' :: ListThesauriResponse -> Maybe [ThesaurusSummary]
thesaurusSummaryItems} -> Maybe [ThesaurusSummary]
thesaurusSummaryItems) (\s :: ListThesauriResponse
s@ListThesauriResponse' {} Maybe [ThesaurusSummary]
a -> ListThesauriResponse
s {$sel:thesaurusSummaryItems:ListThesauriResponse' :: Maybe [ThesaurusSummary]
thesaurusSummaryItems = Maybe [ThesaurusSummary]
a} :: ListThesauriResponse) 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
listThesauriResponse_httpStatus :: Lens.Lens' ListThesauriResponse Prelude.Int
listThesauriResponse_httpStatus :: Lens' ListThesauriResponse Int
listThesauriResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThesauriResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListThesauriResponse' :: ListThesauriResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListThesauriResponse
s@ListThesauriResponse' {} Int
a -> ListThesauriResponse
s {$sel:httpStatus:ListThesauriResponse' :: Int
httpStatus = Int
a} :: ListThesauriResponse)
instance Prelude.NFData ListThesauriResponse where
rnf :: ListThesauriResponse -> ()
rnf ListThesauriResponse' {Int
Maybe [ThesaurusSummary]
Maybe Text
httpStatus :: Int
thesaurusSummaryItems :: Maybe [ThesaurusSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListThesauriResponse' :: ListThesauriResponse -> Int
$sel:thesaurusSummaryItems:ListThesauriResponse' :: ListThesauriResponse -> Maybe [ThesaurusSummary]
$sel:nextToken:ListThesauriResponse' :: ListThesauriResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ThesaurusSummary]
thesaurusSummaryItems
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus