{-# 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.WorkSpaces.DescribeIPGroups
(
describeIPGroups
, DescribeIPGroups
, dipgGroupIds
, dipgNextToken
, dipgMaxResults
, describeIPGroupsResponse
, DescribeIPGroupsResponse
, digsrsResult
, digsrsNextToken
, digsrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.WorkSpaces.Types
import Network.AWS.WorkSpaces.Types.Product
data DescribeIPGroups = DescribeIPGroups'
{ _dipgGroupIds :: !(Maybe [Text])
, _dipgNextToken :: !(Maybe Text)
, _dipgMaxResults :: !(Maybe Nat)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeIPGroups
:: DescribeIPGroups
describeIPGroups =
DescribeIPGroups'
{ _dipgGroupIds = Nothing
, _dipgNextToken = Nothing
, _dipgMaxResults = Nothing
}
dipgGroupIds :: Lens' DescribeIPGroups [Text]
dipgGroupIds = lens _dipgGroupIds (\ s a -> s{_dipgGroupIds = a}) . _Default . _Coerce
dipgNextToken :: Lens' DescribeIPGroups (Maybe Text)
dipgNextToken = lens _dipgNextToken (\ s a -> s{_dipgNextToken = a})
dipgMaxResults :: Lens' DescribeIPGroups (Maybe Natural)
dipgMaxResults = lens _dipgMaxResults (\ s a -> s{_dipgMaxResults = a}) . mapping _Nat
instance AWSRequest DescribeIPGroups where
type Rs DescribeIPGroups = DescribeIPGroupsResponse
request = postJSON workSpaces
response
= receiveJSON
(\ s h x ->
DescribeIPGroupsResponse' <$>
(x .?> "Result" .!@ mempty) <*> (x .?> "NextToken")
<*> (pure (fromEnum s)))
instance Hashable DescribeIPGroups where
instance NFData DescribeIPGroups where
instance ToHeaders DescribeIPGroups where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("WorkspacesService.DescribeIpGroups" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeIPGroups where
toJSON DescribeIPGroups'{..}
= object
(catMaybes
[("GroupIds" .=) <$> _dipgGroupIds,
("NextToken" .=) <$> _dipgNextToken,
("MaxResults" .=) <$> _dipgMaxResults])
instance ToPath DescribeIPGroups where
toPath = const "/"
instance ToQuery DescribeIPGroups where
toQuery = const mempty
data DescribeIPGroupsResponse = DescribeIPGroupsResponse'
{ _digsrsResult :: !(Maybe [WorkspacesIPGroup])
, _digsrsNextToken :: !(Maybe Text)
, _digsrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeIPGroupsResponse
:: Int
-> DescribeIPGroupsResponse
describeIPGroupsResponse pResponseStatus_ =
DescribeIPGroupsResponse'
{ _digsrsResult = Nothing
, _digsrsNextToken = Nothing
, _digsrsResponseStatus = pResponseStatus_
}
digsrsResult :: Lens' DescribeIPGroupsResponse [WorkspacesIPGroup]
digsrsResult = lens _digsrsResult (\ s a -> s{_digsrsResult = a}) . _Default . _Coerce
digsrsNextToken :: Lens' DescribeIPGroupsResponse (Maybe Text)
digsrsNextToken = lens _digsrsNextToken (\ s a -> s{_digsrsNextToken = a})
digsrsResponseStatus :: Lens' DescribeIPGroupsResponse Int
digsrsResponseStatus = lens _digsrsResponseStatus (\ s a -> s{_digsrsResponseStatus = a})
instance NFData DescribeIPGroupsResponse where