{-# 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.Route53AutoNaming.UpdateService
(
updateService
, UpdateService
, usId
, usService
, updateServiceResponse
, UpdateServiceResponse
, usrsOperationId
, usrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.Route53AutoNaming.Types
import Network.AWS.Route53AutoNaming.Types.Product
data UpdateService = UpdateService'
{ _usId :: !Text
, _usService :: !ServiceChange
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateService
:: Text
-> ServiceChange
-> UpdateService
updateService pId_ pService_ =
UpdateService' {_usId = pId_, _usService = pService_}
usId :: Lens' UpdateService Text
usId = lens _usId (\ s a -> s{_usId = a})
usService :: Lens' UpdateService ServiceChange
usService = lens _usService (\ s a -> s{_usService = a})
instance AWSRequest UpdateService where
type Rs UpdateService = UpdateServiceResponse
request = postJSON route53AutoNaming
response
= receiveJSON
(\ s h x ->
UpdateServiceResponse' <$>
(x .?> "OperationId") <*> (pure (fromEnum s)))
instance Hashable UpdateService where
instance NFData UpdateService where
instance ToHeaders UpdateService where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Route53AutoNaming_v20170314.UpdateService" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateService where
toJSON UpdateService'{..}
= object
(catMaybes
[Just ("Id" .= _usId),
Just ("Service" .= _usService)])
instance ToPath UpdateService where
toPath = const "/"
instance ToQuery UpdateService where
toQuery = const mempty
data UpdateServiceResponse = UpdateServiceResponse'
{ _usrsOperationId :: !(Maybe Text)
, _usrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateServiceResponse
:: Int
-> UpdateServiceResponse
updateServiceResponse pResponseStatus_ =
UpdateServiceResponse'
{_usrsOperationId = Nothing, _usrsResponseStatus = pResponseStatus_}
usrsOperationId :: Lens' UpdateServiceResponse (Maybe Text)
usrsOperationId = lens _usrsOperationId (\ s a -> s{_usrsOperationId = a})
usrsResponseStatus :: Lens' UpdateServiceResponse Int
usrsResponseStatus = lens _usrsResponseStatus (\ s a -> s{_usrsResponseStatus = a})
instance NFData UpdateServiceResponse where