{-# 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.CognitoIdentity.SetIdentityPoolRoles
(
setIdentityPoolRoles
, SetIdentityPoolRoles
, siprRoleMappings
, siprIdentityPoolId
, siprRoles
, setIdentityPoolRolesResponse
, SetIdentityPoolRolesResponse
) where
import Network.AWS.CognitoIdentity.Types
import Network.AWS.CognitoIdentity.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data SetIdentityPoolRoles = SetIdentityPoolRoles'
{ _siprRoleMappings :: !(Maybe (Map Text RoleMapping))
, _siprIdentityPoolId :: !Text
, _siprRoles :: !(Map Text Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
setIdentityPoolRoles
:: Text
-> SetIdentityPoolRoles
setIdentityPoolRoles pIdentityPoolId_ =
SetIdentityPoolRoles'
{ _siprRoleMappings = Nothing
, _siprIdentityPoolId = pIdentityPoolId_
, _siprRoles = mempty
}
siprRoleMappings :: Lens' SetIdentityPoolRoles (HashMap Text RoleMapping)
siprRoleMappings = lens _siprRoleMappings (\ s a -> s{_siprRoleMappings = a}) . _Default . _Map
siprIdentityPoolId :: Lens' SetIdentityPoolRoles Text
siprIdentityPoolId = lens _siprIdentityPoolId (\ s a -> s{_siprIdentityPoolId = a})
siprRoles :: Lens' SetIdentityPoolRoles (HashMap Text Text)
siprRoles = lens _siprRoles (\ s a -> s{_siprRoles = a}) . _Map
instance AWSRequest SetIdentityPoolRoles where
type Rs SetIdentityPoolRoles =
SetIdentityPoolRolesResponse
request = postJSON cognitoIdentity
response = receiveNull SetIdentityPoolRolesResponse'
instance Hashable SetIdentityPoolRoles where
instance NFData SetIdentityPoolRoles where
instance ToHeaders SetIdentityPoolRoles where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityService.SetIdentityPoolRoles" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON SetIdentityPoolRoles where
toJSON SetIdentityPoolRoles'{..}
= object
(catMaybes
[("RoleMappings" .=) <$> _siprRoleMappings,
Just ("IdentityPoolId" .= _siprIdentityPoolId),
Just ("Roles" .= _siprRoles)])
instance ToPath SetIdentityPoolRoles where
toPath = const "/"
instance ToQuery SetIdentityPoolRoles where
toQuery = const mempty
data SetIdentityPoolRolesResponse =
SetIdentityPoolRolesResponse'
deriving (Eq, Read, Show, Data, Typeable, Generic)
setIdentityPoolRolesResponse
:: SetIdentityPoolRolesResponse
setIdentityPoolRolesResponse = SetIdentityPoolRolesResponse'
instance NFData SetIdentityPoolRolesResponse where