{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} -- Module : Network.AWS.DataPipeline.SetTaskStatus -- Copyright : (c) 2013-2014 Brendan Hay -- License : This Source Code Form is subject to the terms of -- the Mozilla Public License, v. 2.0. -- A copy of the MPL can be found in the LICENSE file or -- you can obtain it at http://mozilla.org/MPL/2.0/. -- Maintainer : Brendan Hay -- Stability : experimental -- Portability : non-portable (GHC extensions) -- -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | Task runners call 'SetTaskStatus' to notify AWS Data Pipeline that a task is -- completed and provide information about the final status. A task runner makes -- this call regardless of whether the task was sucessful. A task runner does -- not need to call 'SetTaskStatus' for tasks that are canceled by the web service -- during a call to 'ReportTaskProgress'. -- -- module Network.AWS.DataPipeline.SetTaskStatus ( -- * Request SetTaskStatus -- ** Request constructor , setTaskStatus -- ** Request lenses , stsErrorId , stsErrorMessage , stsErrorStackTrace , stsTaskId , stsTaskStatus -- * Response , SetTaskStatusResponse -- ** Response constructor , setTaskStatusResponse ) where import Network.AWS.Data (Object) import Network.AWS.Prelude import Network.AWS.Request.JSON import Network.AWS.DataPipeline.Types import qualified GHC.Exts data SetTaskStatus = SetTaskStatus { _stsErrorId :: Maybe Text , _stsErrorMessage :: Maybe Text , _stsErrorStackTrace :: Maybe Text , _stsTaskId :: Text , _stsTaskStatus :: TaskStatus } deriving (Eq, Read, Show) -- | 'SetTaskStatus' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'stsErrorId' @::@ 'Maybe' 'Text' -- -- * 'stsErrorMessage' @::@ 'Maybe' 'Text' -- -- * 'stsErrorStackTrace' @::@ 'Maybe' 'Text' -- -- * 'stsTaskId' @::@ 'Text' -- -- * 'stsTaskStatus' @::@ 'TaskStatus' -- setTaskStatus :: Text -- ^ 'stsTaskId' -> TaskStatus -- ^ 'stsTaskStatus' -> SetTaskStatus setTaskStatus p1 p2 = SetTaskStatus { _stsTaskId = p1 , _stsTaskStatus = p2 , _stsErrorId = Nothing , _stsErrorMessage = Nothing , _stsErrorStackTrace = Nothing } -- | If an error occurred during the task, this value specifies the error code. -- This value is set on the physical attempt object. It is used to display error -- information to the user. It should not start with string "Service_" which is -- reserved by the system. stsErrorId :: Lens' SetTaskStatus (Maybe Text) stsErrorId = lens _stsErrorId (\s a -> s { _stsErrorId = a }) -- | If an error occurred during the task, this value specifies a text description -- of the error. This value is set on the physical attempt object. It is used to -- display error information to the user. The web service does not parse this -- value. stsErrorMessage :: Lens' SetTaskStatus (Maybe Text) stsErrorMessage = lens _stsErrorMessage (\s a -> s { _stsErrorMessage = a }) -- | If an error occurred during the task, this value specifies the stack trace -- associated with the error. This value is set on the physical attempt object. -- It is used to display error information to the user. The web service does not -- parse this value. stsErrorStackTrace :: Lens' SetTaskStatus (Maybe Text) stsErrorStackTrace = lens _stsErrorStackTrace (\s a -> s { _stsErrorStackTrace = a }) -- | The ID of the task assigned to the task runner. This value is provided in the -- response for 'PollForTask'. stsTaskId :: Lens' SetTaskStatus Text stsTaskId = lens _stsTaskId (\s a -> s { _stsTaskId = a }) -- | If 'FINISHED', the task successfully completed. If 'FAILED', the task ended -- unsuccessfully. Preconditions use false. stsTaskStatus :: Lens' SetTaskStatus TaskStatus stsTaskStatus = lens _stsTaskStatus (\s a -> s { _stsTaskStatus = a }) data SetTaskStatusResponse = SetTaskStatusResponse deriving (Eq, Ord, Read, Show, Generic) -- | 'SetTaskStatusResponse' constructor. setTaskStatusResponse :: SetTaskStatusResponse setTaskStatusResponse = SetTaskStatusResponse instance ToPath SetTaskStatus where toPath = const "/" instance ToQuery SetTaskStatus where toQuery = const mempty instance ToHeaders SetTaskStatus instance ToJSON SetTaskStatus where toJSON SetTaskStatus{..} = object [ "taskId" .= _stsTaskId , "taskStatus" .= _stsTaskStatus , "errorId" .= _stsErrorId , "errorMessage" .= _stsErrorMessage , "errorStackTrace" .= _stsErrorStackTrace ] instance AWSRequest SetTaskStatus where type Sv SetTaskStatus = DataPipeline type Rs SetTaskStatus = SetTaskStatusResponse request = post "SetTaskStatus" response = nullResponse SetTaskStatusResponse