{-# 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.IoT.ListTargetsForPolicy
(
listTargetsForPolicy
, ListTargetsForPolicy
, ltfpMarker
, ltfpPageSize
, ltfpPolicyName
, listTargetsForPolicyResponse
, ListTargetsForPolicyResponse
, ltfprsTargets
, ltfprsNextMarker
, ltfprsResponseStatus
) where
import Network.AWS.IoT.Types
import Network.AWS.IoT.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListTargetsForPolicy = ListTargetsForPolicy'
{ _ltfpMarker :: !(Maybe Text)
, _ltfpPageSize :: !(Maybe Nat)
, _ltfpPolicyName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listTargetsForPolicy
:: Text
-> ListTargetsForPolicy
listTargetsForPolicy pPolicyName_ =
ListTargetsForPolicy'
{ _ltfpMarker = Nothing
, _ltfpPageSize = Nothing
, _ltfpPolicyName = pPolicyName_
}
ltfpMarker :: Lens' ListTargetsForPolicy (Maybe Text)
ltfpMarker = lens _ltfpMarker (\ s a -> s{_ltfpMarker = a})
ltfpPageSize :: Lens' ListTargetsForPolicy (Maybe Natural)
ltfpPageSize = lens _ltfpPageSize (\ s a -> s{_ltfpPageSize = a}) . mapping _Nat
ltfpPolicyName :: Lens' ListTargetsForPolicy Text
ltfpPolicyName = lens _ltfpPolicyName (\ s a -> s{_ltfpPolicyName = a})
instance AWSRequest ListTargetsForPolicy where
type Rs ListTargetsForPolicy =
ListTargetsForPolicyResponse
request = postJSON ioT
response
= receiveJSON
(\ s h x ->
ListTargetsForPolicyResponse' <$>
(x .?> "targets" .!@ mempty) <*> (x .?> "nextMarker")
<*> (pure (fromEnum s)))
instance Hashable ListTargetsForPolicy where
instance NFData ListTargetsForPolicy where
instance ToHeaders ListTargetsForPolicy where
toHeaders = const mempty
instance ToJSON ListTargetsForPolicy where
toJSON = const (Object mempty)
instance ToPath ListTargetsForPolicy where
toPath ListTargetsForPolicy'{..}
= mconcat ["/policy-targets/", toBS _ltfpPolicyName]
instance ToQuery ListTargetsForPolicy where
toQuery ListTargetsForPolicy'{..}
= mconcat
["marker" =: _ltfpMarker,
"pageSize" =: _ltfpPageSize]
data ListTargetsForPolicyResponse = ListTargetsForPolicyResponse'
{ _ltfprsTargets :: !(Maybe [Text])
, _ltfprsNextMarker :: !(Maybe Text)
, _ltfprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listTargetsForPolicyResponse
:: Int
-> ListTargetsForPolicyResponse
listTargetsForPolicyResponse pResponseStatus_ =
ListTargetsForPolicyResponse'
{ _ltfprsTargets = Nothing
, _ltfprsNextMarker = Nothing
, _ltfprsResponseStatus = pResponseStatus_
}
ltfprsTargets :: Lens' ListTargetsForPolicyResponse [Text]
ltfprsTargets = lens _ltfprsTargets (\ s a -> s{_ltfprsTargets = a}) . _Default . _Coerce
ltfprsNextMarker :: Lens' ListTargetsForPolicyResponse (Maybe Text)
ltfprsNextMarker = lens _ltfprsNextMarker (\ s a -> s{_ltfprsNextMarker = a})
ltfprsResponseStatus :: Lens' ListTargetsForPolicyResponse Int
ltfprsResponseStatus = lens _ltfprsResponseStatus (\ s a -> s{_ltfprsResponseStatus = a})
instance NFData ListTargetsForPolicyResponse where