{-# 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.ECS.SubmitContainerStateChange
(
submitContainerStateChange
, SubmitContainerStateChange
, scscNetworkBindings
, scscStatus
, scscCluster
, scscContainerName
, scscReason
, scscExitCode
, scscTask
, submitContainerStateChangeResponse
, SubmitContainerStateChangeResponse
, scscrsAcknowledgment
, scscrsResponseStatus
) where
import Network.AWS.ECS.Types
import Network.AWS.ECS.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data SubmitContainerStateChange = SubmitContainerStateChange'
{ _scscNetworkBindings :: !(Maybe [NetworkBinding])
, _scscStatus :: !(Maybe Text)
, _scscCluster :: !(Maybe Text)
, _scscContainerName :: !(Maybe Text)
, _scscReason :: !(Maybe Text)
, _scscExitCode :: !(Maybe Int)
, _scscTask :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
submitContainerStateChange
:: SubmitContainerStateChange
submitContainerStateChange =
SubmitContainerStateChange'
{ _scscNetworkBindings = Nothing
, _scscStatus = Nothing
, _scscCluster = Nothing
, _scscContainerName = Nothing
, _scscReason = Nothing
, _scscExitCode = Nothing
, _scscTask = Nothing
}
scscNetworkBindings :: Lens' SubmitContainerStateChange [NetworkBinding]
scscNetworkBindings = lens _scscNetworkBindings (\ s a -> s{_scscNetworkBindings = a}) . _Default . _Coerce;
scscStatus :: Lens' SubmitContainerStateChange (Maybe Text)
scscStatus = lens _scscStatus (\ s a -> s{_scscStatus = a});
scscCluster :: Lens' SubmitContainerStateChange (Maybe Text)
scscCluster = lens _scscCluster (\ s a -> s{_scscCluster = a});
scscContainerName :: Lens' SubmitContainerStateChange (Maybe Text)
scscContainerName = lens _scscContainerName (\ s a -> s{_scscContainerName = a});
scscReason :: Lens' SubmitContainerStateChange (Maybe Text)
scscReason = lens _scscReason (\ s a -> s{_scscReason = a});
scscExitCode :: Lens' SubmitContainerStateChange (Maybe Int)
scscExitCode = lens _scscExitCode (\ s a -> s{_scscExitCode = a});
scscTask :: Lens' SubmitContainerStateChange (Maybe Text)
scscTask = lens _scscTask (\ s a -> s{_scscTask = a});
instance AWSRequest SubmitContainerStateChange where
type Rs SubmitContainerStateChange =
SubmitContainerStateChangeResponse
request = postJSON ecs
response
= receiveJSON
(\ s h x ->
SubmitContainerStateChangeResponse' <$>
(x .?> "acknowledgment") <*> (pure (fromEnum s)))
instance Hashable SubmitContainerStateChange
instance NFData SubmitContainerStateChange
instance ToHeaders SubmitContainerStateChange where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerServiceV20141113.SubmitContainerStateChange"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON SubmitContainerStateChange where
toJSON SubmitContainerStateChange'{..}
= object
(catMaybes
[("networkBindings" .=) <$> _scscNetworkBindings,
("status" .=) <$> _scscStatus,
("cluster" .=) <$> _scscCluster,
("containerName" .=) <$> _scscContainerName,
("reason" .=) <$> _scscReason,
("exitCode" .=) <$> _scscExitCode,
("task" .=) <$> _scscTask])
instance ToPath SubmitContainerStateChange where
toPath = const "/"
instance ToQuery SubmitContainerStateChange where
toQuery = const mempty
data SubmitContainerStateChangeResponse = SubmitContainerStateChangeResponse'
{ _scscrsAcknowledgment :: !(Maybe Text)
, _scscrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
submitContainerStateChangeResponse
:: Int
-> SubmitContainerStateChangeResponse
submitContainerStateChangeResponse pResponseStatus_ =
SubmitContainerStateChangeResponse'
{ _scscrsAcknowledgment = Nothing
, _scscrsResponseStatus = pResponseStatus_
}
scscrsAcknowledgment :: Lens' SubmitContainerStateChangeResponse (Maybe Text)
scscrsAcknowledgment = lens _scscrsAcknowledgment (\ s a -> s{_scscrsAcknowledgment = a});
scscrsResponseStatus :: Lens' SubmitContainerStateChangeResponse Int
scscrsResponseStatus = lens _scscrsResponseStatus (\ s a -> s{_scscrsResponseStatus = a});
instance NFData SubmitContainerStateChangeResponse