{-# 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.Lightsail.ReleaseStaticIP
(
releaseStaticIP
, ReleaseStaticIP
, rsiStaticIPName
, releaseStaticIPResponse
, ReleaseStaticIPResponse
, rsirsOperations
, rsirsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Lightsail.Types
import Network.AWS.Lightsail.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype ReleaseStaticIP = ReleaseStaticIP'
{ _rsiStaticIPName :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
releaseStaticIP
:: Text
-> ReleaseStaticIP
releaseStaticIP pStaticIPName_ =
ReleaseStaticIP' {_rsiStaticIPName = pStaticIPName_}
rsiStaticIPName :: Lens' ReleaseStaticIP Text
rsiStaticIPName = lens _rsiStaticIPName (\ s a -> s{_rsiStaticIPName = a})
instance AWSRequest ReleaseStaticIP where
type Rs ReleaseStaticIP = ReleaseStaticIPResponse
request = postJSON lightsail
response
= receiveJSON
(\ s h x ->
ReleaseStaticIPResponse' <$>
(x .?> "operations" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable ReleaseStaticIP where
instance NFData ReleaseStaticIP where
instance ToHeaders ReleaseStaticIP where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Lightsail_20161128.ReleaseStaticIp" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ReleaseStaticIP where
toJSON ReleaseStaticIP'{..}
= object
(catMaybes
[Just ("staticIpName" .= _rsiStaticIPName)])
instance ToPath ReleaseStaticIP where
toPath = const "/"
instance ToQuery ReleaseStaticIP where
toQuery = const mempty
data ReleaseStaticIPResponse = ReleaseStaticIPResponse'
{ _rsirsOperations :: !(Maybe [Operation])
, _rsirsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
releaseStaticIPResponse
:: Int
-> ReleaseStaticIPResponse
releaseStaticIPResponse pResponseStatus_ =
ReleaseStaticIPResponse'
{_rsirsOperations = Nothing, _rsirsResponseStatus = pResponseStatus_}
rsirsOperations :: Lens' ReleaseStaticIPResponse [Operation]
rsirsOperations = lens _rsirsOperations (\ s a -> s{_rsirsOperations = a}) . _Default . _Coerce
rsirsResponseStatus :: Lens' ReleaseStaticIPResponse Int
rsirsResponseStatus = lens _rsirsResponseStatus (\ s a -> s{_rsirsResponseStatus = a})
instance NFData ReleaseStaticIPResponse where