{-# 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.LexModels.GetImport
(
getImport
, GetImport
, giImportId
, getImportResponse
, GetImportResponse
, girsFailureReason
, girsResourceType
, girsImportId
, girsCreatedDate
, girsName
, girsMergeStrategy
, girsImportStatus
, girsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.LexModels.Types
import Network.AWS.LexModels.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype GetImport = GetImport'
{ _giImportId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getImport
:: Text
-> GetImport
getImport pImportId_ = GetImport' {_giImportId = pImportId_}
giImportId :: Lens' GetImport Text
giImportId = lens _giImportId (\ s a -> s{_giImportId = a})
instance AWSRequest GetImport where
type Rs GetImport = GetImportResponse
request = get lexModels
response
= receiveJSON
(\ s h x ->
GetImportResponse' <$>
(x .?> "failureReason" .!@ mempty) <*>
(x .?> "resourceType")
<*> (x .?> "importId")
<*> (x .?> "createdDate")
<*> (x .?> "name")
<*> (x .?> "mergeStrategy")
<*> (x .?> "importStatus")
<*> (pure (fromEnum s)))
instance Hashable GetImport where
instance NFData GetImport where
instance ToHeaders GetImport where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath GetImport where
toPath GetImport'{..}
= mconcat ["/imports/", toBS _giImportId]
instance ToQuery GetImport where
toQuery = const mempty
data GetImportResponse = GetImportResponse'
{ _girsFailureReason :: !(Maybe [Text])
, _girsResourceType :: !(Maybe ResourceType)
, _girsImportId :: !(Maybe Text)
, _girsCreatedDate :: !(Maybe POSIX)
, _girsName :: !(Maybe Text)
, _girsMergeStrategy :: !(Maybe MergeStrategy)
, _girsImportStatus :: !(Maybe ImportStatus)
, _girsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getImportResponse
:: Int
-> GetImportResponse
getImportResponse pResponseStatus_ =
GetImportResponse'
{ _girsFailureReason = Nothing
, _girsResourceType = Nothing
, _girsImportId = Nothing
, _girsCreatedDate = Nothing
, _girsName = Nothing
, _girsMergeStrategy = Nothing
, _girsImportStatus = Nothing
, _girsResponseStatus = pResponseStatus_
}
girsFailureReason :: Lens' GetImportResponse [Text]
girsFailureReason = lens _girsFailureReason (\ s a -> s{_girsFailureReason = a}) . _Default . _Coerce
girsResourceType :: Lens' GetImportResponse (Maybe ResourceType)
girsResourceType = lens _girsResourceType (\ s a -> s{_girsResourceType = a})
girsImportId :: Lens' GetImportResponse (Maybe Text)
girsImportId = lens _girsImportId (\ s a -> s{_girsImportId = a})
girsCreatedDate :: Lens' GetImportResponse (Maybe UTCTime)
girsCreatedDate = lens _girsCreatedDate (\ s a -> s{_girsCreatedDate = a}) . mapping _Time
girsName :: Lens' GetImportResponse (Maybe Text)
girsName = lens _girsName (\ s a -> s{_girsName = a})
girsMergeStrategy :: Lens' GetImportResponse (Maybe MergeStrategy)
girsMergeStrategy = lens _girsMergeStrategy (\ s a -> s{_girsMergeStrategy = a})
girsImportStatus :: Lens' GetImportResponse (Maybe ImportStatus)
girsImportStatus = lens _girsImportStatus (\ s a -> s{_girsImportStatus = a})
girsResponseStatus :: Lens' GetImportResponse Int
girsResponseStatus = lens _girsResponseStatus (\ s a -> s{_girsResponseStatus = a})
instance NFData GetImportResponse where