{-# 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.CodeDeploy.GetApplication
(
getApplication
, GetApplication
, gaApplicationName
, getApplicationResponse
, GetApplicationResponse
, garsApplication
, garsResponseStatus
) where
import Network.AWS.CodeDeploy.Types
import Network.AWS.CodeDeploy.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype GetApplication = GetApplication'
{ _gaApplicationName :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getApplication
:: Text
-> GetApplication
getApplication pApplicationName_ =
GetApplication' {_gaApplicationName = pApplicationName_}
gaApplicationName :: Lens' GetApplication Text
gaApplicationName = lens _gaApplicationName (\ s a -> s{_gaApplicationName = a})
instance AWSRequest GetApplication where
type Rs GetApplication = GetApplicationResponse
request = postJSON codeDeploy
response
= receiveJSON
(\ s h x ->
GetApplicationResponse' <$>
(x .?> "application") <*> (pure (fromEnum s)))
instance Hashable GetApplication where
instance NFData GetApplication where
instance ToHeaders GetApplication where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeDeploy_20141006.GetApplication" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetApplication where
toJSON GetApplication'{..}
= object
(catMaybes
[Just ("applicationName" .= _gaApplicationName)])
instance ToPath GetApplication where
toPath = const "/"
instance ToQuery GetApplication where
toQuery = const mempty
data GetApplicationResponse = GetApplicationResponse'
{ _garsApplication :: !(Maybe ApplicationInfo)
, _garsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getApplicationResponse
:: Int
-> GetApplicationResponse
getApplicationResponse pResponseStatus_ =
GetApplicationResponse'
{_garsApplication = Nothing, _garsResponseStatus = pResponseStatus_}
garsApplication :: Lens' GetApplicationResponse (Maybe ApplicationInfo)
garsApplication = lens _garsApplication (\ s a -> s{_garsApplication = a})
garsResponseStatus :: Lens' GetApplicationResponse Int
garsResponseStatus = lens _garsResponseStatus (\ s a -> s{_garsResponseStatus = a})
instance NFData GetApplicationResponse where