{-# 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 -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Retrieves information about the specified role, including the role\'s path, GUID, ARN, and the role\'s trust policy that grants permission to assume the role. For more information about roles, see . -- -- Policies returned by this API are URL-encoded compliant with . You can use a URL decoding method to convert the policy back to plain JSON text. For example, if you use Java, you can use the 'decode' method of the 'java.net.URLDecoder' utility class in the Java SDK. Other languages and SDKs provide similar functionality. 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 IAM role to get information about. -- -- The for this parameter is a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: =,.\'- 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}); -- | A structure containing details about the IAM role. grrsRole :: Lens' GetRoleResponse Role grrsRole = lens _grrsRole (\ s a -> s{_grrsRole = a}); instance NFData GetRoleResponse