{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.IAM.GetRole
(
GetRole (..),
newGetRole,
getRole_roleName,
GetRoleResponse (..),
newGetRoleResponse,
getRoleResponse_httpStatus,
getRoleResponse_role,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IAM.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetRole = GetRole'
{
GetRole -> Text
roleName :: Prelude.Text
}
deriving (GetRole -> GetRole -> Bool
(GetRole -> GetRole -> Bool)
-> (GetRole -> GetRole -> Bool) -> Eq GetRole
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRole -> GetRole -> Bool
$c/= :: GetRole -> GetRole -> Bool
== :: GetRole -> GetRole -> Bool
$c== :: GetRole -> GetRole -> Bool
Prelude.Eq, ReadPrec [GetRole]
ReadPrec GetRole
Int -> ReadS GetRole
ReadS [GetRole]
(Int -> ReadS GetRole)
-> ReadS [GetRole]
-> ReadPrec GetRole
-> ReadPrec [GetRole]
-> Read GetRole
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRole]
$creadListPrec :: ReadPrec [GetRole]
readPrec :: ReadPrec GetRole
$creadPrec :: ReadPrec GetRole
readList :: ReadS [GetRole]
$creadList :: ReadS [GetRole]
readsPrec :: Int -> ReadS GetRole
$creadsPrec :: Int -> ReadS GetRole
Prelude.Read, Int -> GetRole -> ShowS
[GetRole] -> ShowS
GetRole -> String
(Int -> GetRole -> ShowS)
-> (GetRole -> String) -> ([GetRole] -> ShowS) -> Show GetRole
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRole] -> ShowS
$cshowList :: [GetRole] -> ShowS
show :: GetRole -> String
$cshow :: GetRole -> String
showsPrec :: Int -> GetRole -> ShowS
$cshowsPrec :: Int -> GetRole -> ShowS
Prelude.Show, (forall x. GetRole -> Rep GetRole x)
-> (forall x. Rep GetRole x -> GetRole) -> Generic GetRole
forall x. Rep GetRole x -> GetRole
forall x. GetRole -> Rep GetRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRole x -> GetRole
$cfrom :: forall x. GetRole -> Rep GetRole x
Prelude.Generic)
newGetRole ::
Prelude.Text ->
GetRole
newGetRole :: Text -> GetRole
newGetRole Text
pRoleName_ =
GetRole' :: Text -> GetRole
GetRole' {$sel:roleName:GetRole' :: Text
roleName = Text
pRoleName_}
getRole_roleName :: Lens.Lens' GetRole Prelude.Text
getRole_roleName :: (Text -> f Text) -> GetRole -> f GetRole
getRole_roleName = (GetRole -> Text)
-> (GetRole -> Text -> GetRole) -> Lens GetRole GetRole Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRole' {Text
roleName :: Text
$sel:roleName:GetRole' :: GetRole -> Text
roleName} -> Text
roleName) (\s :: GetRole
s@GetRole' {} Text
a -> GetRole
s {$sel:roleName:GetRole' :: Text
roleName = Text
a} :: GetRole)
instance Core.AWSRequest GetRole where
type AWSResponse GetRole = GetRoleResponse
request :: GetRole -> Request GetRole
request = Service -> GetRole -> Request GetRole
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetRole
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRole)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetRole))
-> Logger
-> Service
-> Proxy GetRole
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRole)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"GetRoleResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> Role -> GetRoleResponse
GetRoleResponse'
(Int -> Role -> GetRoleResponse)
-> Either String Int -> Either String (Role -> GetRoleResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
Either String (Role -> GetRoleResponse)
-> Either String Role -> Either String GetRoleResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Role
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Role")
)
instance Prelude.Hashable GetRole
instance Prelude.NFData GetRole
instance Core.ToHeaders GetRole where
toHeaders :: GetRole -> ResponseHeaders
toHeaders = ResponseHeaders -> GetRole -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetRole where
toPath :: GetRole -> ByteString
toPath = ByteString -> GetRole -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetRole where
toQuery :: GetRole -> QueryString
toQuery GetRole' {Text
roleName :: Text
$sel:roleName:GetRole' :: GetRole -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action" ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetRole" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
ByteString
"RoleName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
roleName
]
data GetRoleResponse = GetRoleResponse'
{
GetRoleResponse -> Int
httpStatus :: Prelude.Int,
GetRoleResponse -> Role
role' :: Role
}
deriving (GetRoleResponse -> GetRoleResponse -> Bool
(GetRoleResponse -> GetRoleResponse -> Bool)
-> (GetRoleResponse -> GetRoleResponse -> Bool)
-> Eq GetRoleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRoleResponse -> GetRoleResponse -> Bool
$c/= :: GetRoleResponse -> GetRoleResponse -> Bool
== :: GetRoleResponse -> GetRoleResponse -> Bool
$c== :: GetRoleResponse -> GetRoleResponse -> Bool
Prelude.Eq, ReadPrec [GetRoleResponse]
ReadPrec GetRoleResponse
Int -> ReadS GetRoleResponse
ReadS [GetRoleResponse]
(Int -> ReadS GetRoleResponse)
-> ReadS [GetRoleResponse]
-> ReadPrec GetRoleResponse
-> ReadPrec [GetRoleResponse]
-> Read GetRoleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRoleResponse]
$creadListPrec :: ReadPrec [GetRoleResponse]
readPrec :: ReadPrec GetRoleResponse
$creadPrec :: ReadPrec GetRoleResponse
readList :: ReadS [GetRoleResponse]
$creadList :: ReadS [GetRoleResponse]
readsPrec :: Int -> ReadS GetRoleResponse
$creadsPrec :: Int -> ReadS GetRoleResponse
Prelude.Read, Int -> GetRoleResponse -> ShowS
[GetRoleResponse] -> ShowS
GetRoleResponse -> String
(Int -> GetRoleResponse -> ShowS)
-> (GetRoleResponse -> String)
-> ([GetRoleResponse] -> ShowS)
-> Show GetRoleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRoleResponse] -> ShowS
$cshowList :: [GetRoleResponse] -> ShowS
show :: GetRoleResponse -> String
$cshow :: GetRoleResponse -> String
showsPrec :: Int -> GetRoleResponse -> ShowS
$cshowsPrec :: Int -> GetRoleResponse -> ShowS
Prelude.Show, (forall x. GetRoleResponse -> Rep GetRoleResponse x)
-> (forall x. Rep GetRoleResponse x -> GetRoleResponse)
-> Generic GetRoleResponse
forall x. Rep GetRoleResponse x -> GetRoleResponse
forall x. GetRoleResponse -> Rep GetRoleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRoleResponse x -> GetRoleResponse
$cfrom :: forall x. GetRoleResponse -> Rep GetRoleResponse x
Prelude.Generic)
newGetRoleResponse ::
Prelude.Int ->
Role ->
GetRoleResponse
newGetRoleResponse :: Int -> Role -> GetRoleResponse
newGetRoleResponse Int
pHttpStatus_ Role
pRole_ =
GetRoleResponse' :: Int -> Role -> GetRoleResponse
GetRoleResponse'
{ $sel:httpStatus:GetRoleResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:role':GetRoleResponse' :: Role
role' = Role
pRole_
}
getRoleResponse_httpStatus :: Lens.Lens' GetRoleResponse Prelude.Int
getRoleResponse_httpStatus :: (Int -> f Int) -> GetRoleResponse -> f GetRoleResponse
getRoleResponse_httpStatus = (GetRoleResponse -> Int)
-> (GetRoleResponse -> Int -> GetRoleResponse)
-> Lens GetRoleResponse GetRoleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoleResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRoleResponse' :: GetRoleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRoleResponse
s@GetRoleResponse' {} Int
a -> GetRoleResponse
s {$sel:httpStatus:GetRoleResponse' :: Int
httpStatus = Int
a} :: GetRoleResponse)
getRoleResponse_role :: Lens.Lens' GetRoleResponse Role
getRoleResponse_role :: (Role -> f Role) -> GetRoleResponse -> f GetRoleResponse
getRoleResponse_role = (GetRoleResponse -> Role)
-> (GetRoleResponse -> Role -> GetRoleResponse)
-> Lens GetRoleResponse GetRoleResponse Role Role
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoleResponse' {Role
role' :: Role
$sel:role':GetRoleResponse' :: GetRoleResponse -> Role
role'} -> Role
role') (\s :: GetRoleResponse
s@GetRoleResponse' {} Role
a -> GetRoleResponse
s {$sel:role':GetRoleResponse' :: Role
role' = Role
a} :: GetRoleResponse)
instance Prelude.NFData GetRoleResponse