amazonka-ec2-1.4.3: gen/Network/AWS/EC2/CreateSpotDatafeedSubscription.hs
{-# 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 #-}
-- Derived from AWS service descriptions, licensed under Apache 2.0.
-- |
-- Module : Network.AWS.EC2.CreateSpotDatafeedSubscription
-- Copyright : (c) 2013-2016 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a data feed for Spot instances, enabling you to view Spot instance usage logs. You can create one data feed per AWS account. For more information, see <http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html Spot Instance Data Feed> in the /Amazon Elastic Compute Cloud User Guide/.
module Network.AWS.EC2.CreateSpotDatafeedSubscription
(
-- * Creating a Request
createSpotDatafeedSubscription
, CreateSpotDatafeedSubscription
-- * Request Lenses
, csdsPrefix
, csdsDryRun
, csdsBucket
-- * Destructuring the Response
, createSpotDatafeedSubscriptionResponse
, CreateSpotDatafeedSubscriptionResponse
-- * Response Lenses
, csdsrsSpotDatafeedSubscription
, csdsrsResponseStatus
) 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
-- | Contains the parameters for CreateSpotDatafeedSubscription.
--
-- /See:/ 'createSpotDatafeedSubscription' smart constructor.
data CreateSpotDatafeedSubscription = CreateSpotDatafeedSubscription'
{ _csdsPrefix :: !(Maybe Text)
, _csdsDryRun :: !(Maybe Bool)
, _csdsBucket :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'CreateSpotDatafeedSubscription' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'csdsPrefix'
--
-- * 'csdsDryRun'
--
-- * 'csdsBucket'
createSpotDatafeedSubscription
:: Text -- ^ 'csdsBucket'
-> CreateSpotDatafeedSubscription
createSpotDatafeedSubscription pBucket_ =
CreateSpotDatafeedSubscription'
{ _csdsPrefix = Nothing
, _csdsDryRun = Nothing
, _csdsBucket = pBucket_
}
-- | A prefix for the data feed file names.
csdsPrefix :: Lens' CreateSpotDatafeedSubscription (Maybe Text)
csdsPrefix = lens _csdsPrefix (\ s a -> s{_csdsPrefix = a});
-- | Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is 'DryRunOperation'. Otherwise, it is 'UnauthorizedOperation'.
csdsDryRun :: Lens' CreateSpotDatafeedSubscription (Maybe Bool)
csdsDryRun = lens _csdsDryRun (\ s a -> s{_csdsDryRun = a});
-- | The Amazon S3 bucket in which to store the Spot instance data feed.
csdsBucket :: Lens' CreateSpotDatafeedSubscription Text
csdsBucket = lens _csdsBucket (\ s a -> s{_csdsBucket = a});
instance AWSRequest CreateSpotDatafeedSubscription
where
type Rs CreateSpotDatafeedSubscription =
CreateSpotDatafeedSubscriptionResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
CreateSpotDatafeedSubscriptionResponse' <$>
(x .@? "spotDatafeedSubscription") <*>
(pure (fromEnum s)))
instance Hashable CreateSpotDatafeedSubscription
instance NFData CreateSpotDatafeedSubscription
instance ToHeaders CreateSpotDatafeedSubscription
where
toHeaders = const mempty
instance ToPath CreateSpotDatafeedSubscription where
toPath = const "/"
instance ToQuery CreateSpotDatafeedSubscription where
toQuery CreateSpotDatafeedSubscription'{..}
= mconcat
["Action" =:
("CreateSpotDatafeedSubscription" :: ByteString),
"Version" =: ("2015-10-01" :: ByteString),
"Prefix" =: _csdsPrefix, "DryRun" =: _csdsDryRun,
"Bucket" =: _csdsBucket]
-- | Contains the output of CreateSpotDatafeedSubscription.
--
-- /See:/ 'createSpotDatafeedSubscriptionResponse' smart constructor.
data CreateSpotDatafeedSubscriptionResponse = CreateSpotDatafeedSubscriptionResponse'
{ _csdsrsSpotDatafeedSubscription :: !(Maybe SpotDatafeedSubscription)
, _csdsrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'CreateSpotDatafeedSubscriptionResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'csdsrsSpotDatafeedSubscription'
--
-- * 'csdsrsResponseStatus'
createSpotDatafeedSubscriptionResponse
:: Int -- ^ 'csdsrsResponseStatus'
-> CreateSpotDatafeedSubscriptionResponse
createSpotDatafeedSubscriptionResponse pResponseStatus_ =
CreateSpotDatafeedSubscriptionResponse'
{ _csdsrsSpotDatafeedSubscription = Nothing
, _csdsrsResponseStatus = pResponseStatus_
}
-- | The Spot instance data feed subscription.
csdsrsSpotDatafeedSubscription :: Lens' CreateSpotDatafeedSubscriptionResponse (Maybe SpotDatafeedSubscription)
csdsrsSpotDatafeedSubscription = lens _csdsrsSpotDatafeedSubscription (\ s a -> s{_csdsrsSpotDatafeedSubscription = a});
-- | The response status code.
csdsrsResponseStatus :: Lens' CreateSpotDatafeedSubscriptionResponse Int
csdsrsResponseStatus = lens _csdsrsResponseStatus (\ s a -> s{_csdsrsResponseStatus = a});
instance NFData
CreateSpotDatafeedSubscriptionResponse