amazonka-iam-1.4.3: gen/Network/AWS/IAM/GetRole.hs
{-# 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 #-}
-- Derived from AWS service descriptions, licensed under Apache 2.0.
-- |
-- Module : Network.AWS.IAM.GetRole
-- Copyright : (c) 2013-2016 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves information about the specified role, including the role\'s path, GUID, ARN, and the policy granting permission to assume the role. For more information about ARNs, go to <http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html#Identifiers_ARNs ARNs>. For more information about roles, go to <http://docs.aws.amazon.com/IAM/latest/UserGuide/WorkingWithRoles.html Working with Roles>.
module Network.AWS.IAM.GetRole
(
-- * Creating a Request
getRole
, GetRole
-- * Request Lenses
, grRoleName
-- * Destructuring the Response
, getRoleResponse
, GetRoleResponse
-- * Response Lenses
, grrsResponseStatus
, grrsRole
) where
import Network.AWS.IAM.Types
import Network.AWS.IAM.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
-- | /See:/ 'getRole' smart constructor.
newtype GetRole = GetRole'
{ _grRoleName :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'GetRole' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'grRoleName'
getRole
:: Text -- ^ 'grRoleName'
-> GetRole
getRole pRoleName_ =
GetRole'
{ _grRoleName = pRoleName_
}
-- | The name of the role to get information about.
grRoleName :: Lens' GetRole Text
grRoleName = lens _grRoleName (\ s a -> s{_grRoleName = a});
instance AWSRequest GetRole where
type Rs GetRole = GetRoleResponse
request = postQuery iam
response
= receiveXMLWrapper "GetRoleResult"
(\ s h x ->
GetRoleResponse' <$>
(pure (fromEnum s)) <*> (x .@ "Role"))
instance Hashable GetRole
instance NFData GetRole
instance ToHeaders GetRole where
toHeaders = const mempty
instance ToPath GetRole where
toPath = const "/"
instance ToQuery GetRole where
toQuery GetRole'{..}
= mconcat
["Action" =: ("GetRole" :: ByteString),
"Version" =: ("2010-05-08" :: ByteString),
"RoleName" =: _grRoleName]
-- | Contains the response to a successful < GetRole> request.
--
-- /See:/ 'getRoleResponse' smart constructor.
data GetRoleResponse = GetRoleResponse'
{ _grrsResponseStatus :: !Int
, _grrsRole :: !Role
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'GetRoleResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'grrsResponseStatus'
--
-- * 'grrsRole'
getRoleResponse
:: Int -- ^ 'grrsResponseStatus'
-> Role -- ^ 'grrsRole'
-> GetRoleResponse
getRoleResponse pResponseStatus_ pRole_ =
GetRoleResponse'
{ _grrsResponseStatus = pResponseStatus_
, _grrsRole = pRole_
}
-- | The response status code.
grrsResponseStatus :: Lens' GetRoleResponse Int
grrsResponseStatus = lens _grrsResponseStatus (\ s a -> s{_grrsResponseStatus = a});
-- | Information about the role.
grrsRole :: Lens' GetRoleResponse Role
grrsRole = lens _grrsRole (\ s a -> s{_grrsRole = a});
instance NFData GetRoleResponse