{-# 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.DAX.DescribeSubnetGroups
    (
    
      describeSubnetGroups
    , DescribeSubnetGroups
    
    , dsgSubnetGroupNames
    , dsgNextToken
    , dsgMaxResults
    
    , describeSubnetGroupsResponse
    , DescribeSubnetGroupsResponse
    
    , dsgsrsSubnetGroups
    , dsgsrsNextToken
    , dsgsrsResponseStatus
    ) where
import Network.AWS.DAX.Types
import Network.AWS.DAX.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeSubnetGroups = DescribeSubnetGroups'
  { _dsgSubnetGroupNames :: !(Maybe [Text])
  , _dsgNextToken        :: !(Maybe Text)
  , _dsgMaxResults       :: !(Maybe Int)
  } deriving (Eq, Read, Show, Data, Typeable, Generic)
describeSubnetGroups
    :: DescribeSubnetGroups
describeSubnetGroups =
  DescribeSubnetGroups'
    { _dsgSubnetGroupNames = Nothing
    , _dsgNextToken = Nothing
    , _dsgMaxResults = Nothing
    }
dsgSubnetGroupNames :: Lens' DescribeSubnetGroups [Text]
dsgSubnetGroupNames = lens _dsgSubnetGroupNames (\ s a -> s{_dsgSubnetGroupNames = a}) . _Default . _Coerce
dsgNextToken :: Lens' DescribeSubnetGroups (Maybe Text)
dsgNextToken = lens _dsgNextToken (\ s a -> s{_dsgNextToken = a})
dsgMaxResults :: Lens' DescribeSubnetGroups (Maybe Int)
dsgMaxResults = lens _dsgMaxResults (\ s a -> s{_dsgMaxResults = a})
instance AWSRequest DescribeSubnetGroups where
        type Rs DescribeSubnetGroups =
             DescribeSubnetGroupsResponse
        request = postJSON dax
        response
          = receiveJSON
              (\ s h x ->
                 DescribeSubnetGroupsResponse' <$>
                   (x .?> "SubnetGroups" .!@ mempty) <*>
                     (x .?> "NextToken")
                     <*> (pure (fromEnum s)))
instance Hashable DescribeSubnetGroups where
instance NFData DescribeSubnetGroups where
instance ToHeaders DescribeSubnetGroups where
        toHeaders
          = const
              (mconcat
                 ["X-Amz-Target" =#
                    ("AmazonDAXV3.DescribeSubnetGroups" :: ByteString),
                  "Content-Type" =#
                    ("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeSubnetGroups where
        toJSON DescribeSubnetGroups'{..}
          = object
              (catMaybes
                 [("SubnetGroupNames" .=) <$> _dsgSubnetGroupNames,
                  ("NextToken" .=) <$> _dsgNextToken,
                  ("MaxResults" .=) <$> _dsgMaxResults])
instance ToPath DescribeSubnetGroups where
        toPath = const "/"
instance ToQuery DescribeSubnetGroups where
        toQuery = const mempty
data DescribeSubnetGroupsResponse = DescribeSubnetGroupsResponse'
  { _dsgsrsSubnetGroups   :: !(Maybe [SubnetGroup])
  , _dsgsrsNextToken      :: !(Maybe Text)
  , _dsgsrsResponseStatus :: !Int
  } deriving (Eq, Read, Show, Data, Typeable, Generic)
describeSubnetGroupsResponse
    :: Int 
    -> DescribeSubnetGroupsResponse
describeSubnetGroupsResponse pResponseStatus_ =
  DescribeSubnetGroupsResponse'
    { _dsgsrsSubnetGroups = Nothing
    , _dsgsrsNextToken = Nothing
    , _dsgsrsResponseStatus = pResponseStatus_
    }
dsgsrsSubnetGroups :: Lens' DescribeSubnetGroupsResponse [SubnetGroup]
dsgsrsSubnetGroups = lens _dsgsrsSubnetGroups (\ s a -> s{_dsgsrsSubnetGroups = a}) . _Default . _Coerce
dsgsrsNextToken :: Lens' DescribeSubnetGroupsResponse (Maybe Text)
dsgsrsNextToken = lens _dsgsrsNextToken (\ s a -> s{_dsgsrsNextToken = a})
dsgsrsResponseStatus :: Lens' DescribeSubnetGroupsResponse Int
dsgsrsResponseStatus = lens _dsgsrsResponseStatus (\ s a -> s{_dsgsrsResponseStatus = a})
instance NFData DescribeSubnetGroupsResponse where