{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.Rekognition.CreateCollection
(
createCollection
, CreateCollection
, ccCollectionId
, createCollectionResponse
, CreateCollectionResponse
, ccrsFaceModelVersion
, ccrsCollectionARN
, ccrsStatusCode
, ccrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Rekognition.Types
import Network.AWS.Rekognition.Types.Product
import Network.AWS.Request
import Network.AWS.Response
newtype CreateCollection = CreateCollection'
{ _ccCollectionId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createCollection
:: Text
-> CreateCollection
createCollection pCollectionId_ =
CreateCollection' {_ccCollectionId = pCollectionId_}
ccCollectionId :: Lens' CreateCollection Text
ccCollectionId = lens _ccCollectionId (\ s a -> s{_ccCollectionId = a})
instance AWSRequest CreateCollection where
type Rs CreateCollection = CreateCollectionResponse
request = postJSON rekognition
response
= receiveJSON
(\ s h x ->
CreateCollectionResponse' <$>
(x .?> "FaceModelVersion") <*>
(x .?> "CollectionArn")
<*> (x .?> "StatusCode")
<*> (pure (fromEnum s)))
instance Hashable CreateCollection where
instance NFData CreateCollection where
instance ToHeaders CreateCollection where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("RekognitionService.CreateCollection" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateCollection where
toJSON CreateCollection'{..}
= object
(catMaybes
[Just ("CollectionId" .= _ccCollectionId)])
instance ToPath CreateCollection where
toPath = const "/"
instance ToQuery CreateCollection where
toQuery = const mempty
data CreateCollectionResponse = CreateCollectionResponse'
{ _ccrsFaceModelVersion :: !(Maybe Text)
, _ccrsCollectionARN :: !(Maybe Text)
, _ccrsStatusCode :: !(Maybe Nat)
, _ccrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createCollectionResponse
:: Int
-> CreateCollectionResponse
createCollectionResponse pResponseStatus_ =
CreateCollectionResponse'
{ _ccrsFaceModelVersion = Nothing
, _ccrsCollectionARN = Nothing
, _ccrsStatusCode = Nothing
, _ccrsResponseStatus = pResponseStatus_
}
ccrsFaceModelVersion :: Lens' CreateCollectionResponse (Maybe Text)
ccrsFaceModelVersion = lens _ccrsFaceModelVersion (\ s a -> s{_ccrsFaceModelVersion = a})
ccrsCollectionARN :: Lens' CreateCollectionResponse (Maybe Text)
ccrsCollectionARN = lens _ccrsCollectionARN (\ s a -> s{_ccrsCollectionARN = a})
ccrsStatusCode :: Lens' CreateCollectionResponse (Maybe Natural)
ccrsStatusCode = lens _ccrsStatusCode (\ s a -> s{_ccrsStatusCode = a}) . mapping _Nat
ccrsResponseStatus :: Lens' CreateCollectionResponse Int
ccrsResponseStatus = lens _ccrsResponseStatus (\ s a -> s{_ccrsResponseStatus = a})
instance NFData CreateCollectionResponse where