module Network.AWS.ECS.DescribeServices
(
describeServices
, DescribeServices
, dCluster
, dServices
, describeServicesResponse
, DescribeServicesResponse
, dssrsFailures
, dssrsServices
, dssrsStatus
) where
import Network.AWS.ECS.Types
import Network.AWS.ECS.Types.Product
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 Sv DescribeServices = ECS
type Rs DescribeServices = DescribeServicesResponse
request = postJSON
response
= receiveJSON
(\ s h x ->
DescribeServicesResponse' <$>
(x .?> "failures" .!@ mempty) <*>
(x .?> "services" .!@ mempty)
<*> (pure (fromEnum s)))
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
["cluster" .= _dCluster, "services" .= _dServices]
instance ToPath DescribeServices where
toPath = const "/"
instance ToQuery DescribeServices where
toQuery = const mempty
data DescribeServicesResponse = DescribeServicesResponse'
{ _dssrsFailures :: !(Maybe [Failure])
, _dssrsServices :: !(Maybe [ContainerService])
, _dssrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeServicesResponse
:: Int
-> DescribeServicesResponse
describeServicesResponse pStatus_ =
DescribeServicesResponse'
{ _dssrsFailures = Nothing
, _dssrsServices = Nothing
, _dssrsStatus = pStatus_
}
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;
dssrsStatus :: Lens' DescribeServicesResponse Int
dssrsStatus = lens _dssrsStatus (\ s a -> s{_dssrsStatus = a});