{-# 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.UpdateRole
(
UpdateRole (..),
newUpdateRole,
updateRole_maxSessionDuration,
updateRole_description,
updateRole_roleName,
UpdateRoleResponse (..),
newUpdateRoleResponse,
updateRoleResponse_httpStatus,
)
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 UpdateRole = UpdateRole'
{
UpdateRole -> Maybe Natural
maxSessionDuration :: Prelude.Maybe Prelude.Natural,
UpdateRole -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateRole -> Text
roleName :: Prelude.Text
}
deriving (UpdateRole -> UpdateRole -> Bool
(UpdateRole -> UpdateRole -> Bool)
-> (UpdateRole -> UpdateRole -> Bool) -> Eq UpdateRole
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRole -> UpdateRole -> Bool
$c/= :: UpdateRole -> UpdateRole -> Bool
== :: UpdateRole -> UpdateRole -> Bool
$c== :: UpdateRole -> UpdateRole -> Bool
Prelude.Eq, ReadPrec [UpdateRole]
ReadPrec UpdateRole
Int -> ReadS UpdateRole
ReadS [UpdateRole]
(Int -> ReadS UpdateRole)
-> ReadS [UpdateRole]
-> ReadPrec UpdateRole
-> ReadPrec [UpdateRole]
-> Read UpdateRole
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRole]
$creadListPrec :: ReadPrec [UpdateRole]
readPrec :: ReadPrec UpdateRole
$creadPrec :: ReadPrec UpdateRole
readList :: ReadS [UpdateRole]
$creadList :: ReadS [UpdateRole]
readsPrec :: Int -> ReadS UpdateRole
$creadsPrec :: Int -> ReadS UpdateRole
Prelude.Read, Int -> UpdateRole -> ShowS
[UpdateRole] -> ShowS
UpdateRole -> String
(Int -> UpdateRole -> ShowS)
-> (UpdateRole -> String)
-> ([UpdateRole] -> ShowS)
-> Show UpdateRole
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRole] -> ShowS
$cshowList :: [UpdateRole] -> ShowS
show :: UpdateRole -> String
$cshow :: UpdateRole -> String
showsPrec :: Int -> UpdateRole -> ShowS
$cshowsPrec :: Int -> UpdateRole -> ShowS
Prelude.Show, (forall x. UpdateRole -> Rep UpdateRole x)
-> (forall x. Rep UpdateRole x -> UpdateRole) -> Generic UpdateRole
forall x. Rep UpdateRole x -> UpdateRole
forall x. UpdateRole -> Rep UpdateRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRole x -> UpdateRole
$cfrom :: forall x. UpdateRole -> Rep UpdateRole x
Prelude.Generic)
newUpdateRole ::
Prelude.Text ->
UpdateRole
newUpdateRole :: Text -> UpdateRole
newUpdateRole Text
pRoleName_ =
UpdateRole' :: Maybe Natural -> Maybe Text -> Text -> UpdateRole
UpdateRole'
{ $sel:maxSessionDuration:UpdateRole' :: Maybe Natural
maxSessionDuration = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateRole' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:roleName:UpdateRole' :: Text
roleName = Text
pRoleName_
}
updateRole_maxSessionDuration :: Lens.Lens' UpdateRole (Prelude.Maybe Prelude.Natural)
updateRole_maxSessionDuration :: (Maybe Natural -> f (Maybe Natural)) -> UpdateRole -> f UpdateRole
updateRole_maxSessionDuration = (UpdateRole -> Maybe Natural)
-> (UpdateRole -> Maybe Natural -> UpdateRole)
-> Lens UpdateRole UpdateRole (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRole' {Maybe Natural
maxSessionDuration :: Maybe Natural
$sel:maxSessionDuration:UpdateRole' :: UpdateRole -> Maybe Natural
maxSessionDuration} -> Maybe Natural
maxSessionDuration) (\s :: UpdateRole
s@UpdateRole' {} Maybe Natural
a -> UpdateRole
s {$sel:maxSessionDuration:UpdateRole' :: Maybe Natural
maxSessionDuration = Maybe Natural
a} :: UpdateRole)
updateRole_description :: Lens.Lens' UpdateRole (Prelude.Maybe Prelude.Text)
updateRole_description :: (Maybe Text -> f (Maybe Text)) -> UpdateRole -> f UpdateRole
updateRole_description = (UpdateRole -> Maybe Text)
-> (UpdateRole -> Maybe Text -> UpdateRole)
-> Lens UpdateRole UpdateRole (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRole' {Maybe Text
description :: Maybe Text
$sel:description:UpdateRole' :: UpdateRole -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateRole
s@UpdateRole' {} Maybe Text
a -> UpdateRole
s {$sel:description:UpdateRole' :: Maybe Text
description = Maybe Text
a} :: UpdateRole)
updateRole_roleName :: Lens.Lens' UpdateRole Prelude.Text
updateRole_roleName :: (Text -> f Text) -> UpdateRole -> f UpdateRole
updateRole_roleName = (UpdateRole -> Text)
-> (UpdateRole -> Text -> UpdateRole)
-> Lens UpdateRole UpdateRole Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRole' {Text
roleName :: Text
$sel:roleName:UpdateRole' :: UpdateRole -> Text
roleName} -> Text
roleName) (\s :: UpdateRole
s@UpdateRole' {} Text
a -> UpdateRole
s {$sel:roleName:UpdateRole' :: Text
roleName = Text
a} :: UpdateRole)
instance Core.AWSRequest UpdateRole where
type AWSResponse UpdateRole = UpdateRoleResponse
request :: UpdateRole -> Request UpdateRole
request = Service -> UpdateRole -> Request UpdateRole
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateRole
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRole)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse UpdateRole))
-> Logger
-> Service
-> Proxy UpdateRole
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRole)))
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
"UpdateRoleResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> UpdateRoleResponse
UpdateRoleResponse'
(Int -> UpdateRoleResponse)
-> Either String Int -> Either String UpdateRoleResponse
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))
)
instance Prelude.Hashable UpdateRole
instance Prelude.NFData UpdateRole
instance Core.ToHeaders UpdateRole where
toHeaders :: UpdateRole -> ResponseHeaders
toHeaders = ResponseHeaders -> UpdateRole -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath UpdateRole where
toPath :: UpdateRole -> ByteString
toPath = ByteString -> UpdateRole -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateRole where
toQuery :: UpdateRole -> QueryString
toQuery UpdateRole' {Maybe Natural
Maybe Text
Text
roleName :: Text
description :: Maybe Text
maxSessionDuration :: Maybe Natural
$sel:roleName:UpdateRole' :: UpdateRole -> Text
$sel:description:UpdateRole' :: UpdateRole -> Maybe Text
$sel:maxSessionDuration:UpdateRole' :: UpdateRole -> Maybe Natural
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"UpdateRole" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
ByteString
"MaxSessionDuration" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxSessionDuration,
ByteString
"Description" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
description,
ByteString
"RoleName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
roleName
]
data UpdateRoleResponse = UpdateRoleResponse'
{
UpdateRoleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateRoleResponse -> UpdateRoleResponse -> Bool
(UpdateRoleResponse -> UpdateRoleResponse -> Bool)
-> (UpdateRoleResponse -> UpdateRoleResponse -> Bool)
-> Eq UpdateRoleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRoleResponse -> UpdateRoleResponse -> Bool
$c/= :: UpdateRoleResponse -> UpdateRoleResponse -> Bool
== :: UpdateRoleResponse -> UpdateRoleResponse -> Bool
$c== :: UpdateRoleResponse -> UpdateRoleResponse -> Bool
Prelude.Eq, ReadPrec [UpdateRoleResponse]
ReadPrec UpdateRoleResponse
Int -> ReadS UpdateRoleResponse
ReadS [UpdateRoleResponse]
(Int -> ReadS UpdateRoleResponse)
-> ReadS [UpdateRoleResponse]
-> ReadPrec UpdateRoleResponse
-> ReadPrec [UpdateRoleResponse]
-> Read UpdateRoleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRoleResponse]
$creadListPrec :: ReadPrec [UpdateRoleResponse]
readPrec :: ReadPrec UpdateRoleResponse
$creadPrec :: ReadPrec UpdateRoleResponse
readList :: ReadS [UpdateRoleResponse]
$creadList :: ReadS [UpdateRoleResponse]
readsPrec :: Int -> ReadS UpdateRoleResponse
$creadsPrec :: Int -> ReadS UpdateRoleResponse
Prelude.Read, Int -> UpdateRoleResponse -> ShowS
[UpdateRoleResponse] -> ShowS
UpdateRoleResponse -> String
(Int -> UpdateRoleResponse -> ShowS)
-> (UpdateRoleResponse -> String)
-> ([UpdateRoleResponse] -> ShowS)
-> Show UpdateRoleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRoleResponse] -> ShowS
$cshowList :: [UpdateRoleResponse] -> ShowS
show :: UpdateRoleResponse -> String
$cshow :: UpdateRoleResponse -> String
showsPrec :: Int -> UpdateRoleResponse -> ShowS
$cshowsPrec :: Int -> UpdateRoleResponse -> ShowS
Prelude.Show, (forall x. UpdateRoleResponse -> Rep UpdateRoleResponse x)
-> (forall x. Rep UpdateRoleResponse x -> UpdateRoleResponse)
-> Generic UpdateRoleResponse
forall x. Rep UpdateRoleResponse x -> UpdateRoleResponse
forall x. UpdateRoleResponse -> Rep UpdateRoleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRoleResponse x -> UpdateRoleResponse
$cfrom :: forall x. UpdateRoleResponse -> Rep UpdateRoleResponse x
Prelude.Generic)
newUpdateRoleResponse ::
Prelude.Int ->
UpdateRoleResponse
newUpdateRoleResponse :: Int -> UpdateRoleResponse
newUpdateRoleResponse Int
pHttpStatus_ =
UpdateRoleResponse' :: Int -> UpdateRoleResponse
UpdateRoleResponse' {$sel:httpStatus:UpdateRoleResponse' :: Int
httpStatus = Int
pHttpStatus_}
updateRoleResponse_httpStatus :: Lens.Lens' UpdateRoleResponse Prelude.Int
updateRoleResponse_httpStatus :: (Int -> f Int) -> UpdateRoleResponse -> f UpdateRoleResponse
updateRoleResponse_httpStatus = (UpdateRoleResponse -> Int)
-> (UpdateRoleResponse -> Int -> UpdateRoleResponse)
-> Lens UpdateRoleResponse UpdateRoleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoleResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateRoleResponse' :: UpdateRoleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateRoleResponse
s@UpdateRoleResponse' {} Int
a -> UpdateRoleResponse
s {$sel:httpStatus:UpdateRoleResponse' :: Int
httpStatus = Int
a} :: UpdateRoleResponse)
instance Prelude.NFData UpdateRoleResponse