{-# 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.GetPlan
(
getPlan
, GetPlan
, gpSinks
, gpLocation
, gpLanguage
, gpMapping
, gpSource
, getPlanResponse
, GetPlanResponse
, gpprsPythonScript
, gpprsScalaCode
, gpprsResponseStatus
) 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 GetPlan = GetPlan'
{ _gpSinks :: !(Maybe [CatalogEntry])
, _gpLocation :: !(Maybe Location)
, _gpLanguage :: !(Maybe Language)
, _gpMapping :: ![MappingEntry]
, _gpSource :: !CatalogEntry
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getPlan
:: CatalogEntry
-> GetPlan
getPlan pSource_ =
GetPlan'
{ _gpSinks = Nothing
, _gpLocation = Nothing
, _gpLanguage = Nothing
, _gpMapping = mempty
, _gpSource = pSource_
}
gpSinks :: Lens' GetPlan [CatalogEntry]
gpSinks = lens _gpSinks (\ s a -> s{_gpSinks = a}) . _Default . _Coerce
gpLocation :: Lens' GetPlan (Maybe Location)
gpLocation = lens _gpLocation (\ s a -> s{_gpLocation = a})
gpLanguage :: Lens' GetPlan (Maybe Language)
gpLanguage = lens _gpLanguage (\ s a -> s{_gpLanguage = a})
gpMapping :: Lens' GetPlan [MappingEntry]
gpMapping = lens _gpMapping (\ s a -> s{_gpMapping = a}) . _Coerce
gpSource :: Lens' GetPlan CatalogEntry
gpSource = lens _gpSource (\ s a -> s{_gpSource = a})
instance AWSRequest GetPlan where
type Rs GetPlan = GetPlanResponse
request = postJSON glue
response
= receiveJSON
(\ s h x ->
GetPlanResponse' <$>
(x .?> "PythonScript") <*> (x .?> "ScalaCode") <*>
(pure (fromEnum s)))
instance Hashable GetPlan where
instance NFData GetPlan where
instance ToHeaders GetPlan where
toHeaders
= const
(mconcat
["X-Amz-Target" =# ("AWSGlue.GetPlan" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetPlan where
toJSON GetPlan'{..}
= object
(catMaybes
[("Sinks" .=) <$> _gpSinks,
("Location" .=) <$> _gpLocation,
("Language" .=) <$> _gpLanguage,
Just ("Mapping" .= _gpMapping),
Just ("Source" .= _gpSource)])
instance ToPath GetPlan where
toPath = const "/"
instance ToQuery GetPlan where
toQuery = const mempty
data GetPlanResponse = GetPlanResponse'
{ _gpprsPythonScript :: !(Maybe Text)
, _gpprsScalaCode :: !(Maybe Text)
, _gpprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getPlanResponse
:: Int
-> GetPlanResponse
getPlanResponse pResponseStatus_ =
GetPlanResponse'
{ _gpprsPythonScript = Nothing
, _gpprsScalaCode = Nothing
, _gpprsResponseStatus = pResponseStatus_
}
gpprsPythonScript :: Lens' GetPlanResponse (Maybe Text)
gpprsPythonScript = lens _gpprsPythonScript (\ s a -> s{_gpprsPythonScript = a})
gpprsScalaCode :: Lens' GetPlanResponse (Maybe Text)
gpprsScalaCode = lens _gpprsScalaCode (\ s a -> s{_gpprsScalaCode = a})
gpprsResponseStatus :: Lens' GetPlanResponse Int
gpprsResponseStatus = lens _gpprsResponseStatus (\ s a -> s{_gpprsResponseStatus = a})
instance NFData GetPlanResponse where