{-# 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.ListDataSources
(
ListDataSources (..),
newListDataSources,
listDataSources_maxResults,
listDataSources_nextToken,
listDataSources_indexId,
ListDataSourcesResponse (..),
newListDataSourcesResponse,
listDataSourcesResponse_nextToken,
listDataSourcesResponse_summaryItems,
listDataSourcesResponse_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 ListDataSources = ListDataSources'
{
ListDataSources -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListDataSources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDataSources -> Text
indexId :: Prelude.Text
}
deriving (ListDataSources -> ListDataSources -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDataSources -> ListDataSources -> Bool
$c/= :: ListDataSources -> ListDataSources -> Bool
== :: ListDataSources -> ListDataSources -> Bool
$c== :: ListDataSources -> ListDataSources -> Bool
Prelude.Eq, ReadPrec [ListDataSources]
ReadPrec ListDataSources
Int -> ReadS ListDataSources
ReadS [ListDataSources]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDataSources]
$creadListPrec :: ReadPrec [ListDataSources]
readPrec :: ReadPrec ListDataSources
$creadPrec :: ReadPrec ListDataSources
readList :: ReadS [ListDataSources]
$creadList :: ReadS [ListDataSources]
readsPrec :: Int -> ReadS ListDataSources
$creadsPrec :: Int -> ReadS ListDataSources
Prelude.Read, Int -> ListDataSources -> ShowS
[ListDataSources] -> ShowS
ListDataSources -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDataSources] -> ShowS
$cshowList :: [ListDataSources] -> ShowS
show :: ListDataSources -> String
$cshow :: ListDataSources -> String
showsPrec :: Int -> ListDataSources -> ShowS
$cshowsPrec :: Int -> ListDataSources -> ShowS
Prelude.Show, forall x. Rep ListDataSources x -> ListDataSources
forall x. ListDataSources -> Rep ListDataSources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDataSources x -> ListDataSources
$cfrom :: forall x. ListDataSources -> Rep ListDataSources x
Prelude.Generic)
newListDataSources ::
Prelude.Text ->
ListDataSources
newListDataSources :: Text -> ListDataSources
newListDataSources Text
pIndexId_ =
ListDataSources'
{ $sel:maxResults:ListDataSources' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDataSources' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:indexId:ListDataSources' :: Text
indexId = Text
pIndexId_
}
listDataSources_maxResults :: Lens.Lens' ListDataSources (Prelude.Maybe Prelude.Natural)
listDataSources_maxResults :: Lens' ListDataSources (Maybe Natural)
listDataSources_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataSources' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListDataSources' :: ListDataSources -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListDataSources
s@ListDataSources' {} Maybe Natural
a -> ListDataSources
s {$sel:maxResults:ListDataSources' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListDataSources)
listDataSources_nextToken :: Lens.Lens' ListDataSources (Prelude.Maybe Prelude.Text)
listDataSources_nextToken :: Lens' ListDataSources (Maybe Text)
listDataSources_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataSources' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDataSources' :: ListDataSources -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDataSources
s@ListDataSources' {} Maybe Text
a -> ListDataSources
s {$sel:nextToken:ListDataSources' :: Maybe Text
nextToken = Maybe Text
a} :: ListDataSources)
listDataSources_indexId :: Lens.Lens' ListDataSources Prelude.Text
listDataSources_indexId :: Lens' ListDataSources Text
listDataSources_indexId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataSources' {Text
indexId :: Text
$sel:indexId:ListDataSources' :: ListDataSources -> Text
indexId} -> Text
indexId) (\s :: ListDataSources
s@ListDataSources' {} Text
a -> ListDataSources
s {$sel:indexId:ListDataSources' :: Text
indexId = Text
a} :: ListDataSources)
instance Core.AWSRequest ListDataSources where
type
AWSResponse ListDataSources =
ListDataSourcesResponse
request :: (Service -> Service) -> ListDataSources -> Request ListDataSources
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 ListDataSources
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDataSources)))
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 [DataSourceSummary] -> Int -> ListDataSourcesResponse
ListDataSourcesResponse'
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
"SummaryItems" 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 ListDataSources where
hashWithSalt :: Int -> ListDataSources -> Int
hashWithSalt Int
_salt ListDataSources' {Maybe Natural
Maybe Text
Text
indexId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:indexId:ListDataSources' :: ListDataSources -> Text
$sel:nextToken:ListDataSources' :: ListDataSources -> Maybe Text
$sel:maxResults:ListDataSources' :: ListDataSources -> 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 ListDataSources where
rnf :: ListDataSources -> ()
rnf ListDataSources' {Maybe Natural
Maybe Text
Text
indexId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:indexId:ListDataSources' :: ListDataSources -> Text
$sel:nextToken:ListDataSources' :: ListDataSources -> Maybe Text
$sel:maxResults:ListDataSources' :: ListDataSources -> 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 ListDataSources where
toHeaders :: ListDataSources -> 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.ListDataSources" ::
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 ListDataSources where
toJSON :: ListDataSources -> Value
toJSON ListDataSources' {Maybe Natural
Maybe Text
Text
indexId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:indexId:ListDataSources' :: ListDataSources -> Text
$sel:nextToken:ListDataSources' :: ListDataSources -> Maybe Text
$sel:maxResults:ListDataSources' :: ListDataSources -> 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 ListDataSources where
toPath :: ListDataSources -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListDataSources where
toQuery :: ListDataSources -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListDataSourcesResponse = ListDataSourcesResponse'
{
ListDataSourcesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDataSourcesResponse -> Maybe [DataSourceSummary]
summaryItems :: Prelude.Maybe [DataSourceSummary],
ListDataSourcesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListDataSourcesResponse -> ListDataSourcesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDataSourcesResponse -> ListDataSourcesResponse -> Bool
$c/= :: ListDataSourcesResponse -> ListDataSourcesResponse -> Bool
== :: ListDataSourcesResponse -> ListDataSourcesResponse -> Bool
$c== :: ListDataSourcesResponse -> ListDataSourcesResponse -> Bool
Prelude.Eq, ReadPrec [ListDataSourcesResponse]
ReadPrec ListDataSourcesResponse
Int -> ReadS ListDataSourcesResponse
ReadS [ListDataSourcesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDataSourcesResponse]
$creadListPrec :: ReadPrec [ListDataSourcesResponse]
readPrec :: ReadPrec ListDataSourcesResponse
$creadPrec :: ReadPrec ListDataSourcesResponse
readList :: ReadS [ListDataSourcesResponse]
$creadList :: ReadS [ListDataSourcesResponse]
readsPrec :: Int -> ReadS ListDataSourcesResponse
$creadsPrec :: Int -> ReadS ListDataSourcesResponse
Prelude.Read, Int -> ListDataSourcesResponse -> ShowS
[ListDataSourcesResponse] -> ShowS
ListDataSourcesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDataSourcesResponse] -> ShowS
$cshowList :: [ListDataSourcesResponse] -> ShowS
show :: ListDataSourcesResponse -> String
$cshow :: ListDataSourcesResponse -> String
showsPrec :: Int -> ListDataSourcesResponse -> ShowS
$cshowsPrec :: Int -> ListDataSourcesResponse -> ShowS
Prelude.Show, forall x. Rep ListDataSourcesResponse x -> ListDataSourcesResponse
forall x. ListDataSourcesResponse -> Rep ListDataSourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDataSourcesResponse x -> ListDataSourcesResponse
$cfrom :: forall x. ListDataSourcesResponse -> Rep ListDataSourcesResponse x
Prelude.Generic)
newListDataSourcesResponse ::
Prelude.Int ->
ListDataSourcesResponse
newListDataSourcesResponse :: Int -> ListDataSourcesResponse
newListDataSourcesResponse Int
pHttpStatus_ =
ListDataSourcesResponse'
{ $sel:nextToken:ListDataSourcesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:summaryItems:ListDataSourcesResponse' :: Maybe [DataSourceSummary]
summaryItems = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListDataSourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listDataSourcesResponse_nextToken :: Lens.Lens' ListDataSourcesResponse (Prelude.Maybe Prelude.Text)
listDataSourcesResponse_nextToken :: Lens' ListDataSourcesResponse (Maybe Text)
listDataSourcesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataSourcesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDataSourcesResponse' :: ListDataSourcesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDataSourcesResponse
s@ListDataSourcesResponse' {} Maybe Text
a -> ListDataSourcesResponse
s {$sel:nextToken:ListDataSourcesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDataSourcesResponse)
listDataSourcesResponse_summaryItems :: Lens.Lens' ListDataSourcesResponse (Prelude.Maybe [DataSourceSummary])
listDataSourcesResponse_summaryItems :: Lens' ListDataSourcesResponse (Maybe [DataSourceSummary])
listDataSourcesResponse_summaryItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataSourcesResponse' {Maybe [DataSourceSummary]
summaryItems :: Maybe [DataSourceSummary]
$sel:summaryItems:ListDataSourcesResponse' :: ListDataSourcesResponse -> Maybe [DataSourceSummary]
summaryItems} -> Maybe [DataSourceSummary]
summaryItems) (\s :: ListDataSourcesResponse
s@ListDataSourcesResponse' {} Maybe [DataSourceSummary]
a -> ListDataSourcesResponse
s {$sel:summaryItems:ListDataSourcesResponse' :: Maybe [DataSourceSummary]
summaryItems = Maybe [DataSourceSummary]
a} :: ListDataSourcesResponse) 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
listDataSourcesResponse_httpStatus :: Lens.Lens' ListDataSourcesResponse Prelude.Int
listDataSourcesResponse_httpStatus :: Lens' ListDataSourcesResponse Int
listDataSourcesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataSourcesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListDataSourcesResponse' :: ListDataSourcesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListDataSourcesResponse
s@ListDataSourcesResponse' {} Int
a -> ListDataSourcesResponse
s {$sel:httpStatus:ListDataSourcesResponse' :: Int
httpStatus = Int
a} :: ListDataSourcesResponse)
instance Prelude.NFData ListDataSourcesResponse where
rnf :: ListDataSourcesResponse -> ()
rnf ListDataSourcesResponse' {Int
Maybe [DataSourceSummary]
Maybe Text
httpStatus :: Int
summaryItems :: Maybe [DataSourceSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListDataSourcesResponse' :: ListDataSourcesResponse -> Int
$sel:summaryItems:ListDataSourcesResponse' :: ListDataSourcesResponse -> Maybe [DataSourceSummary]
$sel:nextToken:ListDataSourcesResponse' :: ListDataSourcesResponse -> 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 [DataSourceSummary]
summaryItems
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus