module Network.AWS.CognitoIdentity.GetIdentityPoolRoles
(
GetIdentityPoolRoles
, getIdentityPoolRoles
, giprIdentityPoolId
, GetIdentityPoolRolesResponse
, getIdentityPoolRolesResponse
, giprrIdentityPoolId
, giprrRoles
) where
import Network.AWS.Data (Object)
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.CognitoIdentity.Types
import qualified GHC.Exts
newtype GetIdentityPoolRoles = GetIdentityPoolRoles
{ _giprIdentityPoolId :: Maybe Text
} deriving (Eq, Ord, Read, Show, Monoid)
getIdentityPoolRoles :: GetIdentityPoolRoles
getIdentityPoolRoles = GetIdentityPoolRoles
{ _giprIdentityPoolId = Nothing
}
giprIdentityPoolId :: Lens' GetIdentityPoolRoles (Maybe Text)
giprIdentityPoolId =
lens _giprIdentityPoolId (\s a -> s { _giprIdentityPoolId = a })
data GetIdentityPoolRolesResponse = GetIdentityPoolRolesResponse
{ _giprrIdentityPoolId :: Maybe Text
, _giprrRoles :: Map Text Text
} deriving (Eq, Read, Show)
getIdentityPoolRolesResponse :: GetIdentityPoolRolesResponse
getIdentityPoolRolesResponse = GetIdentityPoolRolesResponse
{ _giprrIdentityPoolId = Nothing
, _giprrRoles = mempty
}
giprrIdentityPoolId :: Lens' GetIdentityPoolRolesResponse (Maybe Text)
giprrIdentityPoolId =
lens _giprrIdentityPoolId (\s a -> s { _giprrIdentityPoolId = a })
giprrRoles :: Lens' GetIdentityPoolRolesResponse (HashMap Text Text)
giprrRoles = lens _giprrRoles (\s a -> s { _giprrRoles = a }) . _Map
instance ToPath GetIdentityPoolRoles where
toPath = const "/"
instance ToQuery GetIdentityPoolRoles where
toQuery = const mempty
instance ToHeaders GetIdentityPoolRoles
instance ToJSON GetIdentityPoolRoles where
toJSON GetIdentityPoolRoles{..} = object
[ "IdentityPoolId" .= _giprIdentityPoolId
]
instance AWSRequest GetIdentityPoolRoles where
type Sv GetIdentityPoolRoles = CognitoIdentity
type Rs GetIdentityPoolRoles = GetIdentityPoolRolesResponse
request = post "GetIdentityPoolRoles"
response = jsonResponse
instance FromJSON GetIdentityPoolRolesResponse where
parseJSON = withObject "GetIdentityPoolRolesResponse" $ \o -> GetIdentityPoolRolesResponse
<$> o .:? "IdentityPoolId"
<*> o .:? "Roles" .!= mempty