module Network.AWS.EMR.ListInstanceGroups
(
ListInstanceGroups
, listInstanceGroups
, ligClusterId
, ligMarker
, ListInstanceGroupsResponse
, listInstanceGroupsResponse
, ligrInstanceGroups
, ligrMarker
) where
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.EMR.Types
import qualified GHC.Exts
data ListInstanceGroups = ListInstanceGroups
{ _ligClusterId :: Text
, _ligMarker :: Maybe Text
} deriving (Eq, Ord, Show)
listInstanceGroups :: Text
-> ListInstanceGroups
listInstanceGroups p1 = ListInstanceGroups
{ _ligClusterId = p1
, _ligMarker = Nothing
}
ligClusterId :: Lens' ListInstanceGroups Text
ligClusterId = lens _ligClusterId (\s a -> s { _ligClusterId = a })
ligMarker :: Lens' ListInstanceGroups (Maybe Text)
ligMarker = lens _ligMarker (\s a -> s { _ligMarker = a })
data ListInstanceGroupsResponse = ListInstanceGroupsResponse
{ _ligrInstanceGroups :: List "InstanceGroups" InstanceGroup
, _ligrMarker :: Maybe Text
} deriving (Eq, Show)
listInstanceGroupsResponse :: ListInstanceGroupsResponse
listInstanceGroupsResponse = ListInstanceGroupsResponse
{ _ligrInstanceGroups = mempty
, _ligrMarker = Nothing
}
ligrInstanceGroups :: Lens' ListInstanceGroupsResponse [InstanceGroup]
ligrInstanceGroups =
lens _ligrInstanceGroups (\s a -> s { _ligrInstanceGroups = a })
. _List
ligrMarker :: Lens' ListInstanceGroupsResponse (Maybe Text)
ligrMarker = lens _ligrMarker (\s a -> s { _ligrMarker = a })
instance ToPath ListInstanceGroups where
toPath = const "/"
instance ToQuery ListInstanceGroups where
toQuery = const mempty
instance ToHeaders ListInstanceGroups
instance ToJSON ListInstanceGroups where
toJSON ListInstanceGroups{..} = object
[ "ClusterId" .= _ligClusterId
, "Marker" .= _ligMarker
]
instance AWSRequest ListInstanceGroups where
type Sv ListInstanceGroups = EMR
type Rs ListInstanceGroups = ListInstanceGroupsResponse
request = post "ListInstanceGroups"
response = jsonResponse
instance FromJSON ListInstanceGroupsResponse where
parseJSON = withObject "ListInstanceGroupsResponse" $ \o -> ListInstanceGroupsResponse
<$> o .: "InstanceGroups"
<*> o .:? "Marker"
instance AWSPager ListInstanceGroups where
page rq rs
| stop (rq ^. ligMarker) = Nothing
| otherwise = (\x -> rq & ligMarker ?~ x)
<$> (rs ^. ligrMarker)