{-# 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.GetOperation
(
getOperation
, GetOperation
, goOperationId
, getOperationResponse
, GetOperationResponse
, gorsOperation
, gorsResponseStatus
) 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 GetOperation = GetOperation'
{ _goOperationId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getOperation
:: Text
-> GetOperation
getOperation pOperationId_ = GetOperation' {_goOperationId = pOperationId_}
goOperationId :: Lens' GetOperation Text
goOperationId = lens _goOperationId (\ s a -> s{_goOperationId = a})
instance AWSRequest GetOperation where
type Rs GetOperation = GetOperationResponse
request = postJSON lightsail
response
= receiveJSON
(\ s h x ->
GetOperationResponse' <$>
(x .?> "operation") <*> (pure (fromEnum s)))
instance Hashable GetOperation where
instance NFData GetOperation where
instance ToHeaders GetOperation where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Lightsail_20161128.GetOperation" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetOperation where
toJSON GetOperation'{..}
= object
(catMaybes [Just ("operationId" .= _goOperationId)])
instance ToPath GetOperation where
toPath = const "/"
instance ToQuery GetOperation where
toQuery = const mempty
data GetOperationResponse = GetOperationResponse'
{ _gorsOperation :: !(Maybe Operation)
, _gorsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getOperationResponse
:: Int
-> GetOperationResponse
getOperationResponse pResponseStatus_ =
GetOperationResponse'
{_gorsOperation = Nothing, _gorsResponseStatus = pResponseStatus_}
gorsOperation :: Lens' GetOperationResponse (Maybe Operation)
gorsOperation = lens _gorsOperation (\ s a -> s{_gorsOperation = a})
gorsResponseStatus :: Lens' GetOperationResponse Int
gorsResponseStatus = lens _gorsResponseStatus (\ s a -> s{_gorsResponseStatus = a})
instance NFData GetOperationResponse where