{-# 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.EC2.RunScheduledInstances
(
runScheduledInstances
, RunScheduledInstances
, rsiClientToken
, rsiInstanceCount
, rsiDryRun
, rsiLaunchSpecification
, rsiScheduledInstanceId
, runScheduledInstancesResponse
, RunScheduledInstancesResponse
, rrsInstanceIdSet
, rrsResponseStatus
) where
import Network.AWS.EC2.Types
import Network.AWS.EC2.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data RunScheduledInstances = RunScheduledInstances'
{ _rsiClientToken :: !(Maybe Text)
, _rsiInstanceCount :: !(Maybe Int)
, _rsiDryRun :: !(Maybe Bool)
, _rsiLaunchSpecification :: !ScheduledInstancesLaunchSpecification
, _rsiScheduledInstanceId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
runScheduledInstances
:: ScheduledInstancesLaunchSpecification
-> Text
-> RunScheduledInstances
runScheduledInstances pLaunchSpecification_ pScheduledInstanceId_ =
RunScheduledInstances'
{ _rsiClientToken = Nothing
, _rsiInstanceCount = Nothing
, _rsiDryRun = Nothing
, _rsiLaunchSpecification = pLaunchSpecification_
, _rsiScheduledInstanceId = pScheduledInstanceId_
}
rsiClientToken :: Lens' RunScheduledInstances (Maybe Text)
rsiClientToken = lens _rsiClientToken (\ s a -> s{_rsiClientToken = a})
rsiInstanceCount :: Lens' RunScheduledInstances (Maybe Int)
rsiInstanceCount = lens _rsiInstanceCount (\ s a -> s{_rsiInstanceCount = a})
rsiDryRun :: Lens' RunScheduledInstances (Maybe Bool)
rsiDryRun = lens _rsiDryRun (\ s a -> s{_rsiDryRun = a})
rsiLaunchSpecification :: Lens' RunScheduledInstances ScheduledInstancesLaunchSpecification
rsiLaunchSpecification = lens _rsiLaunchSpecification (\ s a -> s{_rsiLaunchSpecification = a})
rsiScheduledInstanceId :: Lens' RunScheduledInstances Text
rsiScheduledInstanceId = lens _rsiScheduledInstanceId (\ s a -> s{_rsiScheduledInstanceId = a})
instance AWSRequest RunScheduledInstances where
type Rs RunScheduledInstances =
RunScheduledInstancesResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
RunScheduledInstancesResponse' <$>
(x .@? "instanceIdSet" .!@ mempty >>=
may (parseXMLList "item"))
<*> (pure (fromEnum s)))
instance Hashable RunScheduledInstances where
instance NFData RunScheduledInstances where
instance ToHeaders RunScheduledInstances where
toHeaders = const mempty
instance ToPath RunScheduledInstances where
toPath = const "/"
instance ToQuery RunScheduledInstances where
toQuery RunScheduledInstances'{..}
= mconcat
["Action" =: ("RunScheduledInstances" :: ByteString),
"Version" =: ("2016-11-15" :: ByteString),
"ClientToken" =: _rsiClientToken,
"InstanceCount" =: _rsiInstanceCount,
"DryRun" =: _rsiDryRun,
"LaunchSpecification" =: _rsiLaunchSpecification,
"ScheduledInstanceId" =: _rsiScheduledInstanceId]
data RunScheduledInstancesResponse = RunScheduledInstancesResponse'
{ _rrsInstanceIdSet :: !(Maybe [Text])
, _rrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
runScheduledInstancesResponse
:: Int
-> RunScheduledInstancesResponse
runScheduledInstancesResponse pResponseStatus_ =
RunScheduledInstancesResponse'
{_rrsInstanceIdSet = Nothing, _rrsResponseStatus = pResponseStatus_}
rrsInstanceIdSet :: Lens' RunScheduledInstancesResponse [Text]
rrsInstanceIdSet = lens _rrsInstanceIdSet (\ s a -> s{_rrsInstanceIdSet = a}) . _Default . _Coerce
rrsResponseStatus :: Lens' RunScheduledInstancesResponse Int
rrsResponseStatus = lens _rrsResponseStatus (\ s a -> s{_rrsResponseStatus = a})
instance NFData RunScheduledInstancesResponse where