{-# 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.CognitoIdentityProvider.UpdateResourceServer
(
updateResourceServer
, UpdateResourceServer
, ursScopes
, ursUserPoolId
, ursIdentifier
, ursName
, updateResourceServerResponse
, UpdateResourceServerResponse
, ursrsResponseStatus
, ursrsResourceServer
) where
import Network.AWS.CognitoIdentityProvider.Types
import Network.AWS.CognitoIdentityProvider.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdateResourceServer = UpdateResourceServer'
{ _ursScopes :: !(Maybe [ResourceServerScopeType])
, _ursUserPoolId :: !Text
, _ursIdentifier :: !Text
, _ursName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateResourceServer
:: Text
-> Text
-> Text
-> UpdateResourceServer
updateResourceServer pUserPoolId_ pIdentifier_ pName_ =
UpdateResourceServer'
{ _ursScopes = Nothing
, _ursUserPoolId = pUserPoolId_
, _ursIdentifier = pIdentifier_
, _ursName = pName_
}
ursScopes :: Lens' UpdateResourceServer [ResourceServerScopeType]
ursScopes = lens _ursScopes (\ s a -> s{_ursScopes = a}) . _Default . _Coerce
ursUserPoolId :: Lens' UpdateResourceServer Text
ursUserPoolId = lens _ursUserPoolId (\ s a -> s{_ursUserPoolId = a})
ursIdentifier :: Lens' UpdateResourceServer Text
ursIdentifier = lens _ursIdentifier (\ s a -> s{_ursIdentifier = a})
ursName :: Lens' UpdateResourceServer Text
ursName = lens _ursName (\ s a -> s{_ursName = a})
instance AWSRequest UpdateResourceServer where
type Rs UpdateResourceServer =
UpdateResourceServerResponse
request = postJSON cognitoIdentityProvider
response
= receiveJSON
(\ s h x ->
UpdateResourceServerResponse' <$>
(pure (fromEnum s)) <*> (x .:> "ResourceServer"))
instance Hashable UpdateResourceServer where
instance NFData UpdateResourceServer where
instance ToHeaders UpdateResourceServer where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.UpdateResourceServer"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateResourceServer where
toJSON UpdateResourceServer'{..}
= object
(catMaybes
[("Scopes" .=) <$> _ursScopes,
Just ("UserPoolId" .= _ursUserPoolId),
Just ("Identifier" .= _ursIdentifier),
Just ("Name" .= _ursName)])
instance ToPath UpdateResourceServer where
toPath = const "/"
instance ToQuery UpdateResourceServer where
toQuery = const mempty
data UpdateResourceServerResponse = UpdateResourceServerResponse'
{ _ursrsResponseStatus :: !Int
, _ursrsResourceServer :: !ResourceServerType
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateResourceServerResponse
:: Int
-> ResourceServerType
-> UpdateResourceServerResponse
updateResourceServerResponse pResponseStatus_ pResourceServer_ =
UpdateResourceServerResponse'
{ _ursrsResponseStatus = pResponseStatus_
, _ursrsResourceServer = pResourceServer_
}
ursrsResponseStatus :: Lens' UpdateResourceServerResponse Int
ursrsResponseStatus = lens _ursrsResponseStatus (\ s a -> s{_ursrsResponseStatus = a})
ursrsResourceServer :: Lens' UpdateResourceServerResponse ResourceServerType
ursrsResourceServer = lens _ursrsResourceServer (\ s a -> s{_ursrsResourceServer = a})
instance NFData UpdateResourceServerResponse where