{-# 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.DescribeServices
(
describeServices
, DescribeServices
, dCluster
, dServices
, describeServicesResponse
, DescribeServicesResponse
, dssrsFailures
, dssrsServices
, dssrsResponseStatus
) 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 DescribeServices = DescribeServices'
{ _dCluster :: !(Maybe Text)
, _dServices :: ![Text]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeServices
:: DescribeServices
describeServices =
DescribeServices'
{ _dCluster = Nothing
, _dServices = mempty
}
dCluster :: Lens' DescribeServices (Maybe Text)
dCluster = lens _dCluster (\ s a -> s{_dCluster = a});
dServices :: Lens' DescribeServices [Text]
dServices = lens _dServices (\ s a -> s{_dServices = a}) . _Coerce;
instance AWSRequest DescribeServices where
type Rs DescribeServices = DescribeServicesResponse
request = postJSON ecs
response
= receiveJSON
(\ s h x ->
DescribeServicesResponse' <$>
(x .?> "failures" .!@ mempty) <*>
(x .?> "services" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable DescribeServices
instance NFData DescribeServices
instance ToHeaders DescribeServices where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerServiceV20141113.DescribeServices"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeServices where
toJSON DescribeServices'{..}
= object
(catMaybes
[("cluster" .=) <$> _dCluster,
Just ("services" .= _dServices)])
instance ToPath DescribeServices where
toPath = const "/"
instance ToQuery DescribeServices where
toQuery = const mempty
data DescribeServicesResponse = DescribeServicesResponse'
{ _dssrsFailures :: !(Maybe [Failure])
, _dssrsServices :: !(Maybe [ContainerService])
, _dssrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeServicesResponse
:: Int
-> DescribeServicesResponse
describeServicesResponse pResponseStatus_ =
DescribeServicesResponse'
{ _dssrsFailures = Nothing
, _dssrsServices = Nothing
, _dssrsResponseStatus = pResponseStatus_
}
dssrsFailures :: Lens' DescribeServicesResponse [Failure]
dssrsFailures = lens _dssrsFailures (\ s a -> s{_dssrsFailures = a}) . _Default . _Coerce;
dssrsServices :: Lens' DescribeServicesResponse [ContainerService]
dssrsServices = lens _dssrsServices (\ s a -> s{_dssrsServices = a}) . _Default . _Coerce;
dssrsResponseStatus :: Lens' DescribeServicesResponse Int
dssrsResponseStatus = lens _dssrsResponseStatus (\ s a -> s{_dssrsResponseStatus = a});
instance NFData DescribeServicesResponse