{-# 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.Rekognition.ListCollections
(
ListCollections (..),
newListCollections,
listCollections_maxResults,
listCollections_nextToken,
ListCollectionsResponse (..),
newListCollectionsResponse,
listCollectionsResponse_collectionIds,
listCollectionsResponse_faceModelVersions,
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 qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListCollections = ListCollections'
{
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:maxResults:ListCollections' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListCollections' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
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.AWSPager ListCollections where
page :: ListCollections
-> AWSResponse ListCollections -> Maybe ListCollections
page ListCollections
rq AWSResponse ListCollections
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListCollections
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListCollectionsResponse (Maybe Text)
listCollectionsResponse_nextToken
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 ListCollections
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListCollectionsResponse (Maybe [Text])
listCollectionsResponse_collectionIds
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 ListCollections
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListCollectionsResponse (Maybe [Text])
listCollectionsResponse_faceModelVersions
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.$ ListCollections
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListCollections (Maybe Text)
listCollections_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListCollections
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListCollectionsResponse (Maybe Text)
listCollectionsResponse_nextToken
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 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 [Text]
-> Maybe [Text] -> 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
"CollectionIds" 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
"FaceModelVersions"
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
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListCollections' :: ListCollections -> Maybe Text
$sel:maxResults:ListCollections' :: ListCollections -> 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
instance Prelude.NFData ListCollections where
rnf :: ListCollections -> ()
rnf ListCollections' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListCollections' :: ListCollections -> Maybe Text
$sel:maxResults:ListCollections' :: ListCollections -> 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
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
"RekognitionService.ListCollections" ::
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 ListCollections where
toJSON :: ListCollections -> Value
toJSON ListCollections' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListCollections' :: ListCollections -> Maybe Text
$sel:maxResults:ListCollections' :: ListCollections -> 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
]
)
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 [Text]
collectionIds :: Prelude.Maybe [Prelude.Text],
ListCollectionsResponse -> Maybe [Text]
faceModelVersions :: Prelude.Maybe [Prelude.Text],
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:collectionIds:ListCollectionsResponse' :: Maybe [Text]
collectionIds =
forall a. Maybe a
Prelude.Nothing,
$sel:faceModelVersions:ListCollectionsResponse' :: Maybe [Text]
faceModelVersions = 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_collectionIds :: Lens.Lens' ListCollectionsResponse (Prelude.Maybe [Prelude.Text])
listCollectionsResponse_collectionIds :: Lens' ListCollectionsResponse (Maybe [Text])
listCollectionsResponse_collectionIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCollectionsResponse' {Maybe [Text]
collectionIds :: Maybe [Text]
$sel:collectionIds:ListCollectionsResponse' :: ListCollectionsResponse -> Maybe [Text]
collectionIds} -> Maybe [Text]
collectionIds) (\s :: ListCollectionsResponse
s@ListCollectionsResponse' {} Maybe [Text]
a -> ListCollectionsResponse
s {$sel:collectionIds:ListCollectionsResponse' :: Maybe [Text]
collectionIds = Maybe [Text]
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_faceModelVersions :: Lens.Lens' ListCollectionsResponse (Prelude.Maybe [Prelude.Text])
listCollectionsResponse_faceModelVersions :: Lens' ListCollectionsResponse (Maybe [Text])
listCollectionsResponse_faceModelVersions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCollectionsResponse' {Maybe [Text]
faceModelVersions :: Maybe [Text]
$sel:faceModelVersions:ListCollectionsResponse' :: ListCollectionsResponse -> Maybe [Text]
faceModelVersions} -> Maybe [Text]
faceModelVersions) (\s :: ListCollectionsResponse
s@ListCollectionsResponse' {} Maybe [Text]
a -> ListCollectionsResponse
s {$sel:faceModelVersions:ListCollectionsResponse' :: Maybe [Text]
faceModelVersions = Maybe [Text]
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 [Text]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
faceModelVersions :: Maybe [Text]
collectionIds :: Maybe [Text]
$sel:httpStatus:ListCollectionsResponse' :: ListCollectionsResponse -> Int
$sel:nextToken:ListCollectionsResponse' :: ListCollectionsResponse -> Maybe Text
$sel:faceModelVersions:ListCollectionsResponse' :: ListCollectionsResponse -> Maybe [Text]
$sel:collectionIds:ListCollectionsResponse' :: ListCollectionsResponse -> Maybe [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
collectionIds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
faceModelVersions
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