{-# 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.CodePipeline.GetPipeline
(
getPipeline
, GetPipeline
, gpVersion
, gpName
, getPipelineResponse
, GetPipelineResponse
, gprsPipeline
, gprsMetadata
, gprsResponseStatus
) where
import Network.AWS.CodePipeline.Types
import Network.AWS.CodePipeline.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetPipeline = GetPipeline'
{ _gpVersion :: !(Maybe Nat)
, _gpName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getPipeline
:: Text
-> GetPipeline
getPipeline pName_ = GetPipeline' {_gpVersion = Nothing, _gpName = pName_}
gpVersion :: Lens' GetPipeline (Maybe Natural)
gpVersion = lens _gpVersion (\ s a -> s{_gpVersion = a}) . mapping _Nat
gpName :: Lens' GetPipeline Text
gpName = lens _gpName (\ s a -> s{_gpName = a})
instance AWSRequest GetPipeline where
type Rs GetPipeline = GetPipelineResponse
request = postJSON codePipeline
response
= receiveJSON
(\ s h x ->
GetPipelineResponse' <$>
(x .?> "pipeline") <*> (x .?> "metadata") <*>
(pure (fromEnum s)))
instance Hashable GetPipeline where
instance NFData GetPipeline where
instance ToHeaders GetPipeline where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodePipeline_20150709.GetPipeline" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetPipeline where
toJSON GetPipeline'{..}
= object
(catMaybes
[("version" .=) <$> _gpVersion,
Just ("name" .= _gpName)])
instance ToPath GetPipeline where
toPath = const "/"
instance ToQuery GetPipeline where
toQuery = const mempty
data GetPipelineResponse = GetPipelineResponse'
{ _gprsPipeline :: !(Maybe PipelineDeclaration)
, _gprsMetadata :: !(Maybe PipelineMetadata)
, _gprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getPipelineResponse
:: Int
-> GetPipelineResponse
getPipelineResponse pResponseStatus_ =
GetPipelineResponse'
{ _gprsPipeline = Nothing
, _gprsMetadata = Nothing
, _gprsResponseStatus = pResponseStatus_
}
gprsPipeline :: Lens' GetPipelineResponse (Maybe PipelineDeclaration)
gprsPipeline = lens _gprsPipeline (\ s a -> s{_gprsPipeline = a})
gprsMetadata :: Lens' GetPipelineResponse (Maybe PipelineMetadata)
gprsMetadata = lens _gprsMetadata (\ s a -> s{_gprsMetadata = a})
gprsResponseStatus :: Lens' GetPipelineResponse Int
gprsResponseStatus = lens _gprsResponseStatus (\ s a -> s{_gprsResponseStatus = a})
instance NFData GetPipelineResponse where