{-# 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.Transcribe.GetVocabulary
(
getVocabulary
, GetVocabulary
, gvVocabularyName
, getVocabularyResponse
, GetVocabularyResponse
, gvrsFailureReason
, gvrsLanguageCode
, gvrsDownloadURI
, gvrsVocabularyName
, gvrsLastModifiedTime
, gvrsVocabularyState
, gvrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.Transcribe.Types
import Network.AWS.Transcribe.Types.Product
newtype GetVocabulary = GetVocabulary'
{ _gvVocabularyName :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getVocabulary
:: Text
-> GetVocabulary
getVocabulary pVocabularyName_ =
GetVocabulary' {_gvVocabularyName = pVocabularyName_}
gvVocabularyName :: Lens' GetVocabulary Text
gvVocabularyName = lens _gvVocabularyName (\ s a -> s{_gvVocabularyName = a})
instance AWSRequest GetVocabulary where
type Rs GetVocabulary = GetVocabularyResponse
request = postJSON transcribe
response
= receiveJSON
(\ s h x ->
GetVocabularyResponse' <$>
(x .?> "FailureReason") <*> (x .?> "LanguageCode")
<*> (x .?> "DownloadUri")
<*> (x .?> "VocabularyName")
<*> (x .?> "LastModifiedTime")
<*> (x .?> "VocabularyState")
<*> (pure (fromEnum s)))
instance Hashable GetVocabulary where
instance NFData GetVocabulary where
instance ToHeaders GetVocabulary where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Transcribe.GetVocabulary" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetVocabulary where
toJSON GetVocabulary'{..}
= object
(catMaybes
[Just ("VocabularyName" .= _gvVocabularyName)])
instance ToPath GetVocabulary where
toPath = const "/"
instance ToQuery GetVocabulary where
toQuery = const mempty
data GetVocabularyResponse = GetVocabularyResponse'
{ _gvrsFailureReason :: !(Maybe Text)
, _gvrsLanguageCode :: !(Maybe LanguageCode)
, _gvrsDownloadURI :: !(Maybe Text)
, _gvrsVocabularyName :: !(Maybe Text)
, _gvrsLastModifiedTime :: !(Maybe POSIX)
, _gvrsVocabularyState :: !(Maybe VocabularyState)
, _gvrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getVocabularyResponse
:: Int
-> GetVocabularyResponse
getVocabularyResponse pResponseStatus_ =
GetVocabularyResponse'
{ _gvrsFailureReason = Nothing
, _gvrsLanguageCode = Nothing
, _gvrsDownloadURI = Nothing
, _gvrsVocabularyName = Nothing
, _gvrsLastModifiedTime = Nothing
, _gvrsVocabularyState = Nothing
, _gvrsResponseStatus = pResponseStatus_
}
gvrsFailureReason :: Lens' GetVocabularyResponse (Maybe Text)
gvrsFailureReason = lens _gvrsFailureReason (\ s a -> s{_gvrsFailureReason = a})
gvrsLanguageCode :: Lens' GetVocabularyResponse (Maybe LanguageCode)
gvrsLanguageCode = lens _gvrsLanguageCode (\ s a -> s{_gvrsLanguageCode = a})
gvrsDownloadURI :: Lens' GetVocabularyResponse (Maybe Text)
gvrsDownloadURI = lens _gvrsDownloadURI (\ s a -> s{_gvrsDownloadURI = a})
gvrsVocabularyName :: Lens' GetVocabularyResponse (Maybe Text)
gvrsVocabularyName = lens _gvrsVocabularyName (\ s a -> s{_gvrsVocabularyName = a})
gvrsLastModifiedTime :: Lens' GetVocabularyResponse (Maybe UTCTime)
gvrsLastModifiedTime = lens _gvrsLastModifiedTime (\ s a -> s{_gvrsLastModifiedTime = a}) . mapping _Time
gvrsVocabularyState :: Lens' GetVocabularyResponse (Maybe VocabularyState)
gvrsVocabularyState = lens _gvrsVocabularyState (\ s a -> s{_gvrsVocabularyState = a})
gvrsResponseStatus :: Lens' GetVocabularyResponse Int
gvrsResponseStatus = lens _gvrsResponseStatus (\ s a -> s{_gvrsResponseStatus = a})
instance NFData GetVocabularyResponse where