{-# 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.Glue.GetMapping
(
getMapping
, GetMapping
, gmSinks
, gmLocation
, gmSource
, getMappingResponse
, GetMappingResponse
, gmrsResponseStatus
, gmrsMapping
) where
import Network.AWS.Glue.Types
import Network.AWS.Glue.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetMapping = GetMapping'
{ _gmSinks :: !(Maybe [CatalogEntry])
, _gmLocation :: !(Maybe Location)
, _gmSource :: !CatalogEntry
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getMapping
:: CatalogEntry
-> GetMapping
getMapping pSource_ =
GetMapping' {_gmSinks = Nothing, _gmLocation = Nothing, _gmSource = pSource_}
gmSinks :: Lens' GetMapping [CatalogEntry]
gmSinks = lens _gmSinks (\ s a -> s{_gmSinks = a}) . _Default . _Coerce
gmLocation :: Lens' GetMapping (Maybe Location)
gmLocation = lens _gmLocation (\ s a -> s{_gmLocation = a})
gmSource :: Lens' GetMapping CatalogEntry
gmSource = lens _gmSource (\ s a -> s{_gmSource = a})
instance AWSRequest GetMapping where
type Rs GetMapping = GetMappingResponse
request = postJSON glue
response
= receiveJSON
(\ s h x ->
GetMappingResponse' <$>
(pure (fromEnum s)) <*> (x .?> "Mapping" .!@ mempty))
instance Hashable GetMapping where
instance NFData GetMapping where
instance ToHeaders GetMapping where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSGlue.GetMapping" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetMapping where
toJSON GetMapping'{..}
= object
(catMaybes
[("Sinks" .=) <$> _gmSinks,
("Location" .=) <$> _gmLocation,
Just ("Source" .= _gmSource)])
instance ToPath GetMapping where
toPath = const "/"
instance ToQuery GetMapping where
toQuery = const mempty
data GetMappingResponse = GetMappingResponse'
{ _gmrsResponseStatus :: !Int
, _gmrsMapping :: ![MappingEntry]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getMappingResponse
:: Int
-> GetMappingResponse
getMappingResponse pResponseStatus_ =
GetMappingResponse'
{_gmrsResponseStatus = pResponseStatus_, _gmrsMapping = mempty}
gmrsResponseStatus :: Lens' GetMappingResponse Int
gmrsResponseStatus = lens _gmrsResponseStatus (\ s a -> s{_gmrsResponseStatus = a})
gmrsMapping :: Lens' GetMappingResponse [MappingEntry]
gmrsMapping = lens _gmrsMapping (\ s a -> s{_gmrsMapping = a}) . _Coerce
instance NFData GetMappingResponse where