{-# 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.OpenSearchServerless.ListCollections
(
ListCollections (..),
newListCollections,
listCollections_collectionFilters,
listCollections_maxResults,
listCollections_nextToken,
ListCollectionsResponse (..),
newListCollectionsResponse,
listCollectionsResponse_collectionSummaries,
listCollectionsResponse_nextToken,
listCollectionsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpenSearchServerless.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListCollections = ListCollections'
{
ListCollections -> Maybe CollectionFilters
collectionFilters :: Prelude.Maybe CollectionFilters,
ListCollections -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListCollections -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListCollections -> ListCollections -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCollections -> ListCollections -> Bool
$c/= :: ListCollections -> ListCollections -> Bool
== :: ListCollections -> ListCollections -> Bool
$c== :: ListCollections -> ListCollections -> Bool
Prelude.Eq, ReadPrec [ListCollections]
ReadPrec ListCollections
Int -> ReadS ListCollections
ReadS [ListCollections]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCollections]
$creadListPrec :: ReadPrec [ListCollections]
readPrec :: ReadPrec ListCollections
$creadPrec :: ReadPrec ListCollections
readList :: ReadS [ListCollections]
$creadList :: ReadS [ListCollections]
readsPrec :: Int -> ReadS ListCollections
$creadsPrec :: Int -> ReadS ListCollections
Prelude.Read, Int -> ListCollections -> ShowS
[ListCollections] -> ShowS
ListCollections -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCollections] -> ShowS
$cshowList :: [ListCollections] -> ShowS
show :: ListCollections -> String
$cshow :: ListCollections -> String
showsPrec :: Int -> ListCollections -> ShowS
$cshowsPrec :: Int -> ListCollections -> ShowS
Prelude.Show, forall x. Rep ListCollections x -> ListCollections
forall x. ListCollections -> Rep ListCollections x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListCollections x -> ListCollections
$cfrom :: forall x. ListCollections -> Rep ListCollections x
Prelude.Generic)
newListCollections ::
ListCollections
newListCollections :: ListCollections
newListCollections =
ListCollections'
{ $sel:collectionFilters:ListCollections' :: Maybe CollectionFilters
collectionFilters =
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListCollections' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListCollections' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listCollections_collectionFilters :: Lens.Lens' ListCollections (Prelude.Maybe CollectionFilters)
listCollections_collectionFilters :: Lens' ListCollections (Maybe CollectionFilters)
listCollections_collectionFilters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCollections' {Maybe CollectionFilters
collectionFilters :: Maybe CollectionFilters
$sel:collectionFilters:ListCollections' :: ListCollections -> Maybe CollectionFilters
collectionFilters} -> Maybe CollectionFilters
collectionFilters) (\s :: ListCollections
s@ListCollections' {} Maybe CollectionFilters
a -> ListCollections
s {$sel:collectionFilters:ListCollections' :: Maybe CollectionFilters
collectionFilters = Maybe CollectionFilters
a} :: ListCollections)
listCollections_maxResults :: Lens.Lens' ListCollections (Prelude.Maybe Prelude.Natural)
listCollections_maxResults :: Lens' ListCollections (Maybe Natural)
listCollections_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCollections' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListCollections' :: ListCollections -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListCollections
s@ListCollections' {} Maybe Natural
a -> ListCollections
s {$sel:maxResults:ListCollections' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListCollections)
listCollections_nextToken :: Lens.Lens' ListCollections (Prelude.Maybe Prelude.Text)
listCollections_nextToken :: Lens' ListCollections (Maybe Text)
listCollections_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCollections' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCollections' :: ListCollections -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCollections
s@ListCollections' {} Maybe Text
a -> ListCollections
s {$sel:nextToken:ListCollections' :: Maybe Text
nextToken = Maybe Text
a} :: ListCollections)
instance Core.AWSRequest ListCollections where
type
AWSResponse ListCollections =
ListCollectionsResponse
request :: (Service -> Service) -> ListCollections -> Request ListCollections
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 ListCollections
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListCollections)))
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 [CollectionSummary]
-> Maybe Text -> Int -> ListCollectionsResponse
ListCollectionsResponse'
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
"collectionSummaries"
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
"nextToken")
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 ListCollections where
hashWithSalt :: Int -> ListCollections -> Int
hashWithSalt Int
_salt ListCollections' {Maybe Natural
Maybe Text
Maybe CollectionFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
collectionFilters :: Maybe CollectionFilters
$sel:nextToken:ListCollections' :: ListCollections -> Maybe Text
$sel:maxResults:ListCollections' :: ListCollections -> Maybe Natural
$sel:collectionFilters:ListCollections' :: ListCollections -> Maybe CollectionFilters
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CollectionFilters
collectionFilters
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListCollections where
rnf :: ListCollections -> ()
rnf ListCollections' {Maybe Natural
Maybe Text
Maybe CollectionFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
collectionFilters :: Maybe CollectionFilters
$sel:nextToken:ListCollections' :: ListCollections -> Maybe Text
$sel:maxResults:ListCollections' :: ListCollections -> Maybe Natural
$sel:collectionFilters:ListCollections' :: ListCollections -> Maybe CollectionFilters
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe CollectionFilters
collectionFilters
seq :: forall a b. a -> b -> b
`Prelude.seq` 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
instance Data.ToHeaders ListCollections where
toHeaders :: ListCollections -> 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
"OpenSearchServerless.ListCollections" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListCollections where
toJSON :: ListCollections -> Value
toJSON ListCollections' {Maybe Natural
Maybe Text
Maybe CollectionFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
collectionFilters :: Maybe CollectionFilters
$sel:nextToken:ListCollections' :: ListCollections -> Maybe Text
$sel:maxResults:ListCollections' :: ListCollections -> Maybe Natural
$sel:collectionFilters:ListCollections' :: ListCollections -> Maybe CollectionFilters
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"collectionFilters" 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 CollectionFilters
collectionFilters,
(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
]
)
instance Data.ToPath ListCollections where
toPath :: ListCollections -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListCollections where
toQuery :: ListCollections -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListCollectionsResponse = ListCollectionsResponse'
{
ListCollectionsResponse -> Maybe [CollectionSummary]
collectionSummaries :: Prelude.Maybe [CollectionSummary],
ListCollectionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListCollectionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListCollectionsResponse -> ListCollectionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCollectionsResponse -> ListCollectionsResponse -> Bool
$c/= :: ListCollectionsResponse -> ListCollectionsResponse -> Bool
== :: ListCollectionsResponse -> ListCollectionsResponse -> Bool
$c== :: ListCollectionsResponse -> ListCollectionsResponse -> Bool
Prelude.Eq, ReadPrec [ListCollectionsResponse]
ReadPrec ListCollectionsResponse
Int -> ReadS ListCollectionsResponse
ReadS [ListCollectionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCollectionsResponse]
$creadListPrec :: ReadPrec [ListCollectionsResponse]
readPrec :: ReadPrec ListCollectionsResponse
$creadPrec :: ReadPrec ListCollectionsResponse
readList :: ReadS [ListCollectionsResponse]
$creadList :: ReadS [ListCollectionsResponse]
readsPrec :: Int -> ReadS ListCollectionsResponse
$creadsPrec :: Int -> ReadS ListCollectionsResponse
Prelude.Read, Int -> ListCollectionsResponse -> ShowS
[ListCollectionsResponse] -> ShowS
ListCollectionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCollectionsResponse] -> ShowS
$cshowList :: [ListCollectionsResponse] -> ShowS
show :: ListCollectionsResponse -> String
$cshow :: ListCollectionsResponse -> String
showsPrec :: Int -> ListCollectionsResponse -> ShowS
$cshowsPrec :: Int -> ListCollectionsResponse -> ShowS
Prelude.Show, forall x. Rep ListCollectionsResponse x -> ListCollectionsResponse
forall x. ListCollectionsResponse -> Rep ListCollectionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListCollectionsResponse x -> ListCollectionsResponse
$cfrom :: forall x. ListCollectionsResponse -> Rep ListCollectionsResponse x
Prelude.Generic)
newListCollectionsResponse ::
Prelude.Int ->
ListCollectionsResponse
newListCollectionsResponse :: Int -> ListCollectionsResponse
newListCollectionsResponse Int
pHttpStatus_ =
ListCollectionsResponse'
{ $sel:collectionSummaries:ListCollectionsResponse' :: Maybe [CollectionSummary]
collectionSummaries =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListCollectionsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListCollectionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listCollectionsResponse_collectionSummaries :: Lens.Lens' ListCollectionsResponse (Prelude.Maybe [CollectionSummary])
listCollectionsResponse_collectionSummaries :: Lens' ListCollectionsResponse (Maybe [CollectionSummary])
listCollectionsResponse_collectionSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCollectionsResponse' {Maybe [CollectionSummary]
collectionSummaries :: Maybe [CollectionSummary]
$sel:collectionSummaries:ListCollectionsResponse' :: ListCollectionsResponse -> Maybe [CollectionSummary]
collectionSummaries} -> Maybe [CollectionSummary]
collectionSummaries) (\s :: ListCollectionsResponse
s@ListCollectionsResponse' {} Maybe [CollectionSummary]
a -> ListCollectionsResponse
s {$sel:collectionSummaries:ListCollectionsResponse' :: Maybe [CollectionSummary]
collectionSummaries = Maybe [CollectionSummary]
a} :: ListCollectionsResponse) 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
listCollectionsResponse_nextToken :: Lens.Lens' ListCollectionsResponse (Prelude.Maybe Prelude.Text)
listCollectionsResponse_nextToken :: Lens' ListCollectionsResponse (Maybe Text)
listCollectionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCollectionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCollectionsResponse' :: ListCollectionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCollectionsResponse
s@ListCollectionsResponse' {} Maybe Text
a -> ListCollectionsResponse
s {$sel:nextToken:ListCollectionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListCollectionsResponse)
listCollectionsResponse_httpStatus :: Lens.Lens' ListCollectionsResponse Prelude.Int
listCollectionsResponse_httpStatus :: Lens' ListCollectionsResponse Int
listCollectionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCollectionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListCollectionsResponse' :: ListCollectionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListCollectionsResponse
s@ListCollectionsResponse' {} Int
a -> ListCollectionsResponse
s {$sel:httpStatus:ListCollectionsResponse' :: Int
httpStatus = Int
a} :: ListCollectionsResponse)
instance Prelude.NFData ListCollectionsResponse where
rnf :: ListCollectionsResponse -> ()
rnf ListCollectionsResponse' {Int
Maybe [CollectionSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
collectionSummaries :: Maybe [CollectionSummary]
$sel:httpStatus:ListCollectionsResponse' :: ListCollectionsResponse -> Int
$sel:nextToken:ListCollectionsResponse' :: ListCollectionsResponse -> Maybe Text
$sel:collectionSummaries:ListCollectionsResponse' :: ListCollectionsResponse -> Maybe [CollectionSummary]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [CollectionSummary]
collectionSummaries
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 Int
httpStatus