{-# 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.CancelReservedInstancesListing
(
cancelReservedInstancesListing
, CancelReservedInstancesListing
, crilReservedInstancesListingId
, cancelReservedInstancesListingResponse
, CancelReservedInstancesListingResponse
, crilrsReservedInstancesListings
, crilrsResponseStatus
) 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
newtype CancelReservedInstancesListing = CancelReservedInstancesListing'
{ _crilReservedInstancesListingId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
cancelReservedInstancesListing
:: Text
-> CancelReservedInstancesListing
cancelReservedInstancesListing pReservedInstancesListingId_ =
CancelReservedInstancesListing'
{_crilReservedInstancesListingId = pReservedInstancesListingId_}
crilReservedInstancesListingId :: Lens' CancelReservedInstancesListing Text
crilReservedInstancesListingId = lens _crilReservedInstancesListingId (\ s a -> s{_crilReservedInstancesListingId = a})
instance AWSRequest CancelReservedInstancesListing
where
type Rs CancelReservedInstancesListing =
CancelReservedInstancesListingResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
CancelReservedInstancesListingResponse' <$>
(x .@? "reservedInstancesListingsSet" .!@ mempty >>=
may (parseXMLList "item"))
<*> (pure (fromEnum s)))
instance Hashable CancelReservedInstancesListing
where
instance NFData CancelReservedInstancesListing where
instance ToHeaders CancelReservedInstancesListing
where
toHeaders = const mempty
instance ToPath CancelReservedInstancesListing where
toPath = const "/"
instance ToQuery CancelReservedInstancesListing where
toQuery CancelReservedInstancesListing'{..}
= mconcat
["Action" =:
("CancelReservedInstancesListing" :: ByteString),
"Version" =: ("2016-11-15" :: ByteString),
"ReservedInstancesListingId" =:
_crilReservedInstancesListingId]
data CancelReservedInstancesListingResponse = CancelReservedInstancesListingResponse'
{ _crilrsReservedInstancesListings :: !(Maybe [ReservedInstancesListing])
, _crilrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
cancelReservedInstancesListingResponse
:: Int
-> CancelReservedInstancesListingResponse
cancelReservedInstancesListingResponse pResponseStatus_ =
CancelReservedInstancesListingResponse'
{ _crilrsReservedInstancesListings = Nothing
, _crilrsResponseStatus = pResponseStatus_
}
crilrsReservedInstancesListings :: Lens' CancelReservedInstancesListingResponse [ReservedInstancesListing]
crilrsReservedInstancesListings = lens _crilrsReservedInstancesListings (\ s a -> s{_crilrsReservedInstancesListings = a}) . _Default . _Coerce
crilrsResponseStatus :: Lens' CancelReservedInstancesListingResponse Int
crilrsResponseStatus = lens _crilrsResponseStatus (\ s a -> s{_crilrsResponseStatus = a})
instance NFData
CancelReservedInstancesListingResponse
where