module Network.AWS.EMR.AddInstanceGroups
(
AddInstanceGroups
, addInstanceGroups
, aigInstanceGroups
, aigJobFlowId
, AddInstanceGroupsResponse
, addInstanceGroupsResponse
, aigrInstanceGroupIds
, aigrJobFlowId
) where
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.EMR.Types
import qualified GHC.Exts
data AddInstanceGroups = AddInstanceGroups
{ _aigInstanceGroups :: List "InstanceGroups" InstanceGroupConfig
, _aigJobFlowId :: Text
} deriving (Eq, Show)
addInstanceGroups :: Text
-> AddInstanceGroups
addInstanceGroups p1 = AddInstanceGroups
{ _aigJobFlowId = p1
, _aigInstanceGroups = mempty
}
aigInstanceGroups :: Lens' AddInstanceGroups [InstanceGroupConfig]
aigInstanceGroups =
lens _aigInstanceGroups (\s a -> s { _aigInstanceGroups = a })
. _List
aigJobFlowId :: Lens' AddInstanceGroups Text
aigJobFlowId = lens _aigJobFlowId (\s a -> s { _aigJobFlowId = a })
data AddInstanceGroupsResponse = AddInstanceGroupsResponse
{ _aigrInstanceGroupIds :: List "InstanceGroupIds" Text
, _aigrJobFlowId :: Maybe Text
} deriving (Eq, Ord, Show)
addInstanceGroupsResponse :: AddInstanceGroupsResponse
addInstanceGroupsResponse = AddInstanceGroupsResponse
{ _aigrJobFlowId = Nothing
, _aigrInstanceGroupIds = mempty
}
aigrInstanceGroupIds :: Lens' AddInstanceGroupsResponse [Text]
aigrInstanceGroupIds =
lens _aigrInstanceGroupIds (\s a -> s { _aigrInstanceGroupIds = a })
. _List
aigrJobFlowId :: Lens' AddInstanceGroupsResponse (Maybe Text)
aigrJobFlowId = lens _aigrJobFlowId (\s a -> s { _aigrJobFlowId = a })
instance ToPath AddInstanceGroups where
toPath = const "/"
instance ToQuery AddInstanceGroups where
toQuery = const mempty
instance ToHeaders AddInstanceGroups
instance ToJSON AddInstanceGroups where
toJSON AddInstanceGroups{..} = object
[ "InstanceGroups" .= _aigInstanceGroups
, "JobFlowId" .= _aigJobFlowId
]
instance AWSRequest AddInstanceGroups where
type Sv AddInstanceGroups = EMR
type Rs AddInstanceGroups = AddInstanceGroupsResponse
request = post "AddInstanceGroups"
response = jsonResponse
instance FromJSON AddInstanceGroupsResponse where
parseJSON = withObject "AddInstanceGroupsResponse" $ \o -> AddInstanceGroupsResponse
<$> o .:? "InstanceGroupIds" .!= mempty
<*> o .:? "JobFlowId"