amazonka-devicefarm-1.4.1: gen/Network/AWS/DeviceFarm/StopRun.hs
{-# 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.DeviceFarm.StopRun
-- Copyright : (c) 2013-2016 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Initiates a stop request for the current test run. AWS Device Farm will
-- immediately stop the run on devices where tests have not started
-- executing, and you will not be billed for these devices. On devices
-- where tests have started executing, Setup Suite and Teardown Suite tests
-- will run to completion before stopping execution on those devices. You
-- will be billed for Setup, Teardown, and any tests that were in progress
-- or already completed.
module Network.AWS.DeviceFarm.StopRun
(
-- * Creating a Request
stopRun
, StopRun
-- * Request Lenses
, srArn
-- * Destructuring the Response
, stopRunResponse
, StopRunResponse
-- * Response Lenses
, srsRun
, srsResponseStatus
) where
import Network.AWS.DeviceFarm.Types
import Network.AWS.DeviceFarm.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
-- | Represents the request to stop a specific run.
--
-- /See:/ 'stopRun' smart constructor.
newtype StopRun = StopRun'
{ _srArn :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'StopRun' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'srArn'
stopRun
:: Text -- ^ 'srArn'
-> StopRun
stopRun pArn_ =
StopRun'
{ _srArn = pArn_
}
-- | Represents the Amazon Resource Name (ARN) of the Device Farm run you
-- wish to stop.
srArn :: Lens' StopRun Text
srArn = lens _srArn (\ s a -> s{_srArn = a});
instance AWSRequest StopRun where
type Rs StopRun = StopRunResponse
request = postJSON deviceFarm
response
= receiveJSON
(\ s h x ->
StopRunResponse' <$>
(x .?> "run") <*> (pure (fromEnum s)))
instance Hashable StopRun
instance NFData StopRun
instance ToHeaders StopRun where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DeviceFarm_20150623.StopRun" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON StopRun where
toJSON StopRun'{..}
= object (catMaybes [Just ("arn" .= _srArn)])
instance ToPath StopRun where
toPath = const "/"
instance ToQuery StopRun where
toQuery = const mempty
-- | Represents the results of your stop run attempt.
--
-- /See:/ 'stopRunResponse' smart constructor.
data StopRunResponse = StopRunResponse'
{ _srsRun :: !(Maybe Run)
, _srsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'StopRunResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'srsRun'
--
-- * 'srsResponseStatus'
stopRunResponse
:: Int -- ^ 'srsResponseStatus'
-> StopRunResponse
stopRunResponse pResponseStatus_ =
StopRunResponse'
{ _srsRun = Nothing
, _srsResponseStatus = pResponseStatus_
}
-- | Undocumented member.
srsRun :: Lens' StopRunResponse (Maybe Run)
srsRun = lens _srsRun (\ s a -> s{_srsRun = a});
-- | The response status code.
srsResponseStatus :: Lens' StopRunResponse Int
srsResponseStatus = lens _srsResponseStatus (\ s a -> s{_srsResponseStatus = a});
instance NFData StopRunResponse