{-# 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.Support.DescribeServices
(
describeServices
, DescribeServices
, dsServiceCodeList
, dsLanguage
, describeServicesResponse
, DescribeServicesResponse
, dsrsServices
, dsrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.Support.Types
import Network.AWS.Support.Types.Product
data DescribeServices = DescribeServices'
{ _dsServiceCodeList :: !(Maybe [Text])
, _dsLanguage :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeServices
:: DescribeServices
describeServices =
DescribeServices' {_dsServiceCodeList = Nothing, _dsLanguage = Nothing}
dsServiceCodeList :: Lens' DescribeServices [Text]
dsServiceCodeList = lens _dsServiceCodeList (\ s a -> s{_dsServiceCodeList = a}) . _Default . _Coerce
dsLanguage :: Lens' DescribeServices (Maybe Text)
dsLanguage = lens _dsLanguage (\ s a -> s{_dsLanguage = a})
instance AWSRequest DescribeServices where
type Rs DescribeServices = DescribeServicesResponse
request = postJSON support
response
= receiveJSON
(\ s h x ->
DescribeServicesResponse' <$>
(x .?> "services" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable DescribeServices where
instance NFData DescribeServices where
instance ToHeaders DescribeServices where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSSupport_20130415.DescribeServices" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeServices where
toJSON DescribeServices'{..}
= object
(catMaybes
[("serviceCodeList" .=) <$> _dsServiceCodeList,
("language" .=) <$> _dsLanguage])
instance ToPath DescribeServices where
toPath = const "/"
instance ToQuery DescribeServices where
toQuery = const mempty
data DescribeServicesResponse = DescribeServicesResponse'
{ _dsrsServices :: !(Maybe [SupportService])
, _dsrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeServicesResponse
:: Int
-> DescribeServicesResponse
describeServicesResponse pResponseStatus_ =
DescribeServicesResponse'
{_dsrsServices = Nothing, _dsrsResponseStatus = pResponseStatus_}
dsrsServices :: Lens' DescribeServicesResponse [SupportService]
dsrsServices = lens _dsrsServices (\ s a -> s{_dsrsServices = a}) . _Default . _Coerce
dsrsResponseStatus :: Lens' DescribeServicesResponse Int
dsrsResponseStatus = lens _dsrsResponseStatus (\ s a -> s{_dsrsResponseStatus = a})
instance NFData DescribeServicesResponse where