{-# 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.AppSync.GetType
(
getType
, GetType
, gtApiId
, gtTypeName
, gtFormat
, getTypeResponse
, GetTypeResponse
, gtrsType
, gtrsResponseStatus
) where
import Network.AWS.AppSync.Types
import Network.AWS.AppSync.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetType = GetType'
{ _gtApiId :: !Text
, _gtTypeName :: !Text
, _gtFormat :: !TypeDefinitionFormat
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getType
:: Text
-> Text
-> TypeDefinitionFormat
-> GetType
getType pApiId_ pTypeName_ pFormat_ =
GetType' {_gtApiId = pApiId_, _gtTypeName = pTypeName_, _gtFormat = pFormat_}
gtApiId :: Lens' GetType Text
gtApiId = lens _gtApiId (\ s a -> s{_gtApiId = a})
gtTypeName :: Lens' GetType Text
gtTypeName = lens _gtTypeName (\ s a -> s{_gtTypeName = a})
gtFormat :: Lens' GetType TypeDefinitionFormat
gtFormat = lens _gtFormat (\ s a -> s{_gtFormat = a})
instance AWSRequest GetType where
type Rs GetType = GetTypeResponse
request = get appSync
response
= receiveJSON
(\ s h x ->
GetTypeResponse' <$>
(x .?> "type") <*> (pure (fromEnum s)))
instance Hashable GetType where
instance NFData GetType where
instance ToHeaders GetType where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath GetType where
toPath GetType'{..}
= mconcat
["/v1/apis/", toBS _gtApiId, "/types/",
toBS _gtTypeName]
instance ToQuery GetType where
toQuery GetType'{..}
= mconcat ["format" =: _gtFormat]
data GetTypeResponse = GetTypeResponse'
{ _gtrsType :: !(Maybe Type)
, _gtrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getTypeResponse
:: Int
-> GetTypeResponse
getTypeResponse pResponseStatus_ =
GetTypeResponse' {_gtrsType = Nothing, _gtrsResponseStatus = pResponseStatus_}
gtrsType :: Lens' GetTypeResponse (Maybe Type)
gtrsType = lens _gtrsType (\ s a -> s{_gtrsType = a})
gtrsResponseStatus :: Lens' GetTypeResponse Int
gtrsResponseStatus = lens _gtrsResponseStatus (\ s a -> s{_gtrsResponseStatus = a})
instance NFData GetTypeResponse where