{-# 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.WorkDocs.DescribeGroups
(
describeGroups
, DescribeGroups
, dgAuthenticationToken
, dgMarker
, dgLimit
, dgOrganizationId
, dgSearchQuery
, describeGroupsResponse
, DescribeGroupsResponse
, dgrsGroups
, dgrsMarker
, dgrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.WorkDocs.Types
import Network.AWS.WorkDocs.Types.Product
data DescribeGroups = DescribeGroups'
{ _dgAuthenticationToken :: !(Maybe (Sensitive Text))
, _dgMarker :: !(Maybe Text)
, _dgLimit :: !(Maybe Nat)
, _dgOrganizationId :: !(Maybe Text)
, _dgSearchQuery :: !(Sensitive Text)
} deriving (Eq, Show, Data, Typeable, Generic)
describeGroups
:: Text
-> DescribeGroups
describeGroups pSearchQuery_ =
DescribeGroups'
{ _dgAuthenticationToken = Nothing
, _dgMarker = Nothing
, _dgLimit = Nothing
, _dgOrganizationId = Nothing
, _dgSearchQuery = _Sensitive # pSearchQuery_
}
dgAuthenticationToken :: Lens' DescribeGroups (Maybe Text)
dgAuthenticationToken = lens _dgAuthenticationToken (\ s a -> s{_dgAuthenticationToken = a}) . mapping _Sensitive
dgMarker :: Lens' DescribeGroups (Maybe Text)
dgMarker = lens _dgMarker (\ s a -> s{_dgMarker = a})
dgLimit :: Lens' DescribeGroups (Maybe Natural)
dgLimit = lens _dgLimit (\ s a -> s{_dgLimit = a}) . mapping _Nat
dgOrganizationId :: Lens' DescribeGroups (Maybe Text)
dgOrganizationId = lens _dgOrganizationId (\ s a -> s{_dgOrganizationId = a})
dgSearchQuery :: Lens' DescribeGroups Text
dgSearchQuery = lens _dgSearchQuery (\ s a -> s{_dgSearchQuery = a}) . _Sensitive
instance AWSRequest DescribeGroups where
type Rs DescribeGroups = DescribeGroupsResponse
request = get workDocs
response
= receiveJSON
(\ s h x ->
DescribeGroupsResponse' <$>
(x .?> "Groups" .!@ mempty) <*> (x .?> "Marker") <*>
(pure (fromEnum s)))
instance Hashable DescribeGroups where
instance NFData DescribeGroups where
instance ToHeaders DescribeGroups where
toHeaders DescribeGroups'{..}
= mconcat
["Authentication" =# _dgAuthenticationToken,
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)]
instance ToPath DescribeGroups where
toPath = const "/api/v1/groups"
instance ToQuery DescribeGroups where
toQuery DescribeGroups'{..}
= mconcat
["marker" =: _dgMarker, "limit" =: _dgLimit,
"organizationId" =: _dgOrganizationId,
"searchQuery" =: _dgSearchQuery]
data DescribeGroupsResponse = DescribeGroupsResponse'
{ _dgrsGroups :: !(Maybe [GroupMetadata])
, _dgrsMarker :: !(Maybe Text)
, _dgrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeGroupsResponse
:: Int
-> DescribeGroupsResponse
describeGroupsResponse pResponseStatus_ =
DescribeGroupsResponse'
{ _dgrsGroups = Nothing
, _dgrsMarker = Nothing
, _dgrsResponseStatus = pResponseStatus_
}
dgrsGroups :: Lens' DescribeGroupsResponse [GroupMetadata]
dgrsGroups = lens _dgrsGroups (\ s a -> s{_dgrsGroups = a}) . _Default . _Coerce
dgrsMarker :: Lens' DescribeGroupsResponse (Maybe Text)
dgrsMarker = lens _dgrsMarker (\ s a -> s{_dgrsMarker = a})
dgrsResponseStatus :: Lens' DescribeGroupsResponse Int
dgrsResponseStatus = lens _dgrsResponseStatus (\ s a -> s{_dgrsResponseStatus = a})
instance NFData DescribeGroupsResponse where