{-# 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.IoTAnalytics.CreatePipeline
(
createPipeline
, CreatePipeline
, cpPipelineName
, cpPipelineActivities
, createPipelineResponse
, CreatePipelineResponse
, cprsPipelineName
, cprsPipelineARN
, cprsResponseStatus
) where
import Network.AWS.IoTAnalytics.Types
import Network.AWS.IoTAnalytics.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreatePipeline = CreatePipeline'
{ _cpPipelineName :: !Text
, _cpPipelineActivities :: !(List1 PipelineActivity)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createPipeline
:: Text
-> NonEmpty PipelineActivity
-> CreatePipeline
createPipeline pPipelineName_ pPipelineActivities_ =
CreatePipeline'
{ _cpPipelineName = pPipelineName_
, _cpPipelineActivities = _List1 # pPipelineActivities_
}
cpPipelineName :: Lens' CreatePipeline Text
cpPipelineName = lens _cpPipelineName (\ s a -> s{_cpPipelineName = a})
cpPipelineActivities :: Lens' CreatePipeline (NonEmpty PipelineActivity)
cpPipelineActivities = lens _cpPipelineActivities (\ s a -> s{_cpPipelineActivities = a}) . _List1
instance AWSRequest CreatePipeline where
type Rs CreatePipeline = CreatePipelineResponse
request = postJSON ioTAnalytics
response
= receiveJSON
(\ s h x ->
CreatePipelineResponse' <$>
(x .?> "pipelineName") <*> (x .?> "pipelineArn") <*>
(pure (fromEnum s)))
instance Hashable CreatePipeline where
instance NFData CreatePipeline where
instance ToHeaders CreatePipeline where
toHeaders = const mempty
instance ToJSON CreatePipeline where
toJSON CreatePipeline'{..}
= object
(catMaybes
[Just ("pipelineName" .= _cpPipelineName),
Just
("pipelineActivities" .= _cpPipelineActivities)])
instance ToPath CreatePipeline where
toPath = const "/pipelines"
instance ToQuery CreatePipeline where
toQuery = const mempty
data CreatePipelineResponse = CreatePipelineResponse'
{ _cprsPipelineName :: !(Maybe Text)
, _cprsPipelineARN :: !(Maybe Text)
, _cprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createPipelineResponse
:: Int
-> CreatePipelineResponse
createPipelineResponse pResponseStatus_ =
CreatePipelineResponse'
{ _cprsPipelineName = Nothing
, _cprsPipelineARN = Nothing
, _cprsResponseStatus = pResponseStatus_
}
cprsPipelineName :: Lens' CreatePipelineResponse (Maybe Text)
cprsPipelineName = lens _cprsPipelineName (\ s a -> s{_cprsPipelineName = a})
cprsPipelineARN :: Lens' CreatePipelineResponse (Maybe Text)
cprsPipelineARN = lens _cprsPipelineARN (\ s a -> s{_cprsPipelineARN = a})
cprsResponseStatus :: Lens' CreatePipelineResponse Int
cprsResponseStatus = lens _cprsResponseStatus (\ s a -> s{_cprsResponseStatus = a})
instance NFData CreatePipelineResponse where