{-# 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.GetGraphqlAPI
(
getGraphqlAPI
, GetGraphqlAPI
, ggaApiId
, getGraphqlAPIResponse
, GetGraphqlAPIResponse
, ggarsGraphqlAPI
, ggarsResponseStatus
) 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
newtype GetGraphqlAPI = GetGraphqlAPI'
{ _ggaApiId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getGraphqlAPI
:: Text
-> GetGraphqlAPI
getGraphqlAPI pApiId_ = GetGraphqlAPI' {_ggaApiId = pApiId_}
ggaApiId :: Lens' GetGraphqlAPI Text
ggaApiId = lens _ggaApiId (\ s a -> s{_ggaApiId = a})
instance AWSRequest GetGraphqlAPI where
type Rs GetGraphqlAPI = GetGraphqlAPIResponse
request = get appSync
response
= receiveJSON
(\ s h x ->
GetGraphqlAPIResponse' <$>
(x .?> "graphqlApi") <*> (pure (fromEnum s)))
instance Hashable GetGraphqlAPI where
instance NFData GetGraphqlAPI where
instance ToHeaders GetGraphqlAPI where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath GetGraphqlAPI where
toPath GetGraphqlAPI'{..}
= mconcat ["/v1/apis/", toBS _ggaApiId]
instance ToQuery GetGraphqlAPI where
toQuery = const mempty
data GetGraphqlAPIResponse = GetGraphqlAPIResponse'
{ _ggarsGraphqlAPI :: !(Maybe GraphqlAPI)
, _ggarsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getGraphqlAPIResponse
:: Int
-> GetGraphqlAPIResponse
getGraphqlAPIResponse pResponseStatus_ =
GetGraphqlAPIResponse'
{_ggarsGraphqlAPI = Nothing, _ggarsResponseStatus = pResponseStatus_}
ggarsGraphqlAPI :: Lens' GetGraphqlAPIResponse (Maybe GraphqlAPI)
ggarsGraphqlAPI = lens _ggarsGraphqlAPI (\ s a -> s{_ggarsGraphqlAPI = a})
ggarsResponseStatus :: Lens' GetGraphqlAPIResponse Int
ggarsResponseStatus = lens _ggarsResponseStatus (\ s a -> s{_ggarsResponseStatus = a})
instance NFData GetGraphqlAPIResponse where