module Network.AWS.CodePipeline.GetPipelineState
(
getPipelineState
, GetPipelineState
, gpsName
, getPipelineStateResponse
, GetPipelineStateResponse
, gpsrsPipelineName
, gpsrsCreated
, gpsrsStageStates
, gpsrsPipelineVersion
, gpsrsUpdated
, gpsrsResponseStatus
) where
import Network.AWS.CodePipeline.Types
import Network.AWS.CodePipeline.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype GetPipelineState = GetPipelineState'
{ _gpsName :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getPipelineState
:: Text
-> GetPipelineState
getPipelineState pName_ =
GetPipelineState'
{ _gpsName = pName_
}
gpsName :: Lens' GetPipelineState Text
gpsName = lens _gpsName (\ s a -> s{_gpsName = a});
instance AWSRequest GetPipelineState where
type Rs GetPipelineState = GetPipelineStateResponse
request = postJSON codePipeline
response
= receiveJSON
(\ s h x ->
GetPipelineStateResponse' <$>
(x .?> "pipelineName") <*> (x .?> "created") <*>
(x .?> "stageStates" .!@ mempty)
<*> (x .?> "pipelineVersion")
<*> (x .?> "updated")
<*> (pure (fromEnum s)))
instance ToHeaders GetPipelineState where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodePipeline_20150709.GetPipelineState" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetPipelineState where
toJSON GetPipelineState'{..}
= object (catMaybes [Just ("name" .= _gpsName)])
instance ToPath GetPipelineState where
toPath = const "/"
instance ToQuery GetPipelineState where
toQuery = const mempty
data GetPipelineStateResponse = GetPipelineStateResponse'
{ _gpsrsPipelineName :: !(Maybe Text)
, _gpsrsCreated :: !(Maybe POSIX)
, _gpsrsStageStates :: !(Maybe [StageState])
, _gpsrsPipelineVersion :: !(Maybe Nat)
, _gpsrsUpdated :: !(Maybe POSIX)
, _gpsrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getPipelineStateResponse
:: Int
-> GetPipelineStateResponse
getPipelineStateResponse pResponseStatus_ =
GetPipelineStateResponse'
{ _gpsrsPipelineName = Nothing
, _gpsrsCreated = Nothing
, _gpsrsStageStates = Nothing
, _gpsrsPipelineVersion = Nothing
, _gpsrsUpdated = Nothing
, _gpsrsResponseStatus = pResponseStatus_
}
gpsrsPipelineName :: Lens' GetPipelineStateResponse (Maybe Text)
gpsrsPipelineName = lens _gpsrsPipelineName (\ s a -> s{_gpsrsPipelineName = a});
gpsrsCreated :: Lens' GetPipelineStateResponse (Maybe UTCTime)
gpsrsCreated = lens _gpsrsCreated (\ s a -> s{_gpsrsCreated = a}) . mapping _Time;
gpsrsStageStates :: Lens' GetPipelineStateResponse [StageState]
gpsrsStageStates = lens _gpsrsStageStates (\ s a -> s{_gpsrsStageStates = a}) . _Default . _Coerce;
gpsrsPipelineVersion :: Lens' GetPipelineStateResponse (Maybe Natural)
gpsrsPipelineVersion = lens _gpsrsPipelineVersion (\ s a -> s{_gpsrsPipelineVersion = a}) . mapping _Nat;
gpsrsUpdated :: Lens' GetPipelineStateResponse (Maybe UTCTime)
gpsrsUpdated = lens _gpsrsUpdated (\ s a -> s{_gpsrsUpdated = a}) . mapping _Time;
gpsrsResponseStatus :: Lens' GetPipelineStateResponse Int
gpsrsResponseStatus = lens _gpsrsResponseStatus (\ s a -> s{_gpsrsResponseStatus = a});