{-# 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 #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Network.AWS.SWF.RespondDecisionTaskCompleted -- Copyright : (c) 2013-2018 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Used by deciders to tell the service that the 'DecisionTask' identified by the @taskToken@ has successfully completed. The @decisions@ argument specifies the list of decisions made while processing the task. -- -- -- A @DecisionTaskCompleted@ event is added to the workflow history. The @executionContext@ specified is attached to the event in the workflow execution history. -- -- __Access Control__ -- -- If an IAM policy grants permission to use @RespondDecisionTaskCompleted@ , it can express permissions for the list of decisions in the @decisions@ parameter. Each of the decisions has one or more parameters, much like a regular API call. To allow for policies to be as readable as possible, you can express permissions on decisions as if they were actual API calls, including applying conditions to some parameters. For more information, see in the /Amazon SWF Developer Guide/ . -- module Network.AWS.SWF.RespondDecisionTaskCompleted ( -- * Creating a Request respondDecisionTaskCompleted , RespondDecisionTaskCompleted -- * Request Lenses , rdtcDecisions , rdtcExecutionContext , rdtcTaskToken -- * Destructuring the Response , respondDecisionTaskCompletedResponse , RespondDecisionTaskCompletedResponse ) where import Network.AWS.Lens import Network.AWS.Prelude import Network.AWS.Request import Network.AWS.Response import Network.AWS.SWF.Types import Network.AWS.SWF.Types.Product -- | Input data for a TaskCompleted response to a decision task. -- -- -- -- /See:/ 'respondDecisionTaskCompleted' smart constructor. data RespondDecisionTaskCompleted = RespondDecisionTaskCompleted' { _rdtcDecisions :: !(Maybe [Decision]) , _rdtcExecutionContext :: !(Maybe Text) , _rdtcTaskToken :: !Text } deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'RespondDecisionTaskCompleted' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'rdtcDecisions' - The list of decisions (possibly empty) made by the decider while processing this decision task. See the docs for the 'Decision' structure for details. -- -- * 'rdtcExecutionContext' - User defined context to add to workflow execution. -- -- * 'rdtcTaskToken' - The @taskToken@ from the 'DecisionTask' . /Important:/ @taskToken@ is generated by the service and should be treated as an opaque value. If the task is passed to another process, its @taskToken@ must also be passed. This enables it to provide its progress and respond with results. respondDecisionTaskCompleted :: Text -- ^ 'rdtcTaskToken' -> RespondDecisionTaskCompleted respondDecisionTaskCompleted pTaskToken_ = RespondDecisionTaskCompleted' { _rdtcDecisions = Nothing , _rdtcExecutionContext = Nothing , _rdtcTaskToken = pTaskToken_ } -- | The list of decisions (possibly empty) made by the decider while processing this decision task. See the docs for the 'Decision' structure for details. rdtcDecisions :: Lens' RespondDecisionTaskCompleted [Decision] rdtcDecisions = lens _rdtcDecisions (\ s a -> s{_rdtcDecisions = a}) . _Default . _Coerce -- | User defined context to add to workflow execution. rdtcExecutionContext :: Lens' RespondDecisionTaskCompleted (Maybe Text) rdtcExecutionContext = lens _rdtcExecutionContext (\ s a -> s{_rdtcExecutionContext = a}) -- | The @taskToken@ from the 'DecisionTask' . /Important:/ @taskToken@ is generated by the service and should be treated as an opaque value. If the task is passed to another process, its @taskToken@ must also be passed. This enables it to provide its progress and respond with results. rdtcTaskToken :: Lens' RespondDecisionTaskCompleted Text rdtcTaskToken = lens _rdtcTaskToken (\ s a -> s{_rdtcTaskToken = a}) instance AWSRequest RespondDecisionTaskCompleted where type Rs RespondDecisionTaskCompleted = RespondDecisionTaskCompletedResponse request = postJSON swf response = receiveNull RespondDecisionTaskCompletedResponse' instance Hashable RespondDecisionTaskCompleted where instance NFData RespondDecisionTaskCompleted where instance ToHeaders RespondDecisionTaskCompleted where toHeaders = const (mconcat ["X-Amz-Target" =# ("SimpleWorkflowService.RespondDecisionTaskCompleted" :: ByteString), "Content-Type" =# ("application/x-amz-json-1.0" :: ByteString)]) instance ToJSON RespondDecisionTaskCompleted where toJSON RespondDecisionTaskCompleted'{..} = object (catMaybes [("decisions" .=) <$> _rdtcDecisions, ("executionContext" .=) <$> _rdtcExecutionContext, Just ("taskToken" .= _rdtcTaskToken)]) instance ToPath RespondDecisionTaskCompleted where toPath = const "/" instance ToQuery RespondDecisionTaskCompleted where toQuery = const mempty -- | /See:/ 'respondDecisionTaskCompletedResponse' smart constructor. data RespondDecisionTaskCompletedResponse = RespondDecisionTaskCompletedResponse' deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'RespondDecisionTaskCompletedResponse' with the minimum fields required to make a request. -- respondDecisionTaskCompletedResponse :: RespondDecisionTaskCompletedResponse respondDecisionTaskCompletedResponse = RespondDecisionTaskCompletedResponse' instance NFData RespondDecisionTaskCompletedResponse where