{-# 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.IoT.UpdateRoleAlias
(
UpdateRoleAlias (..),
newUpdateRoleAlias,
updateRoleAlias_credentialDurationSeconds,
updateRoleAlias_roleArn,
updateRoleAlias_roleAlias,
UpdateRoleAliasResponse (..),
newUpdateRoleAliasResponse,
updateRoleAliasResponse_roleAliasArn,
updateRoleAliasResponse_roleAlias,
updateRoleAliasResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.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 UpdateRoleAlias = UpdateRoleAlias'
{
UpdateRoleAlias -> Maybe Natural
credentialDurationSeconds :: Prelude.Maybe Prelude.Natural,
UpdateRoleAlias -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
UpdateRoleAlias -> Text
roleAlias :: Prelude.Text
}
deriving (UpdateRoleAlias -> UpdateRoleAlias -> Bool
(UpdateRoleAlias -> UpdateRoleAlias -> Bool)
-> (UpdateRoleAlias -> UpdateRoleAlias -> Bool)
-> Eq UpdateRoleAlias
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRoleAlias -> UpdateRoleAlias -> Bool
$c/= :: UpdateRoleAlias -> UpdateRoleAlias -> Bool
== :: UpdateRoleAlias -> UpdateRoleAlias -> Bool
$c== :: UpdateRoleAlias -> UpdateRoleAlias -> Bool
Prelude.Eq, ReadPrec [UpdateRoleAlias]
ReadPrec UpdateRoleAlias
Int -> ReadS UpdateRoleAlias
ReadS [UpdateRoleAlias]
(Int -> ReadS UpdateRoleAlias)
-> ReadS [UpdateRoleAlias]
-> ReadPrec UpdateRoleAlias
-> ReadPrec [UpdateRoleAlias]
-> Read UpdateRoleAlias
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRoleAlias]
$creadListPrec :: ReadPrec [UpdateRoleAlias]
readPrec :: ReadPrec UpdateRoleAlias
$creadPrec :: ReadPrec UpdateRoleAlias
readList :: ReadS [UpdateRoleAlias]
$creadList :: ReadS [UpdateRoleAlias]
readsPrec :: Int -> ReadS UpdateRoleAlias
$creadsPrec :: Int -> ReadS UpdateRoleAlias
Prelude.Read, Int -> UpdateRoleAlias -> ShowS
[UpdateRoleAlias] -> ShowS
UpdateRoleAlias -> String
(Int -> UpdateRoleAlias -> ShowS)
-> (UpdateRoleAlias -> String)
-> ([UpdateRoleAlias] -> ShowS)
-> Show UpdateRoleAlias
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRoleAlias] -> ShowS
$cshowList :: [UpdateRoleAlias] -> ShowS
show :: UpdateRoleAlias -> String
$cshow :: UpdateRoleAlias -> String
showsPrec :: Int -> UpdateRoleAlias -> ShowS
$cshowsPrec :: Int -> UpdateRoleAlias -> ShowS
Prelude.Show, (forall x. UpdateRoleAlias -> Rep UpdateRoleAlias x)
-> (forall x. Rep UpdateRoleAlias x -> UpdateRoleAlias)
-> Generic UpdateRoleAlias
forall x. Rep UpdateRoleAlias x -> UpdateRoleAlias
forall x. UpdateRoleAlias -> Rep UpdateRoleAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRoleAlias x -> UpdateRoleAlias
$cfrom :: forall x. UpdateRoleAlias -> Rep UpdateRoleAlias x
Prelude.Generic)
newUpdateRoleAlias ::
Prelude.Text ->
UpdateRoleAlias
newUpdateRoleAlias :: Text -> UpdateRoleAlias
newUpdateRoleAlias Text
pRoleAlias_ =
UpdateRoleAlias' :: Maybe Natural -> Maybe Text -> Text -> UpdateRoleAlias
UpdateRoleAlias'
{ $sel:credentialDurationSeconds:UpdateRoleAlias' :: Maybe Natural
credentialDurationSeconds =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:UpdateRoleAlias' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:roleAlias:UpdateRoleAlias' :: Text
roleAlias = Text
pRoleAlias_
}
updateRoleAlias_credentialDurationSeconds :: Lens.Lens' UpdateRoleAlias (Prelude.Maybe Prelude.Natural)
updateRoleAlias_credentialDurationSeconds :: (Maybe Natural -> f (Maybe Natural))
-> UpdateRoleAlias -> f UpdateRoleAlias
updateRoleAlias_credentialDurationSeconds = (UpdateRoleAlias -> Maybe Natural)
-> (UpdateRoleAlias -> Maybe Natural -> UpdateRoleAlias)
-> Lens
UpdateRoleAlias UpdateRoleAlias (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoleAlias' {Maybe Natural
credentialDurationSeconds :: Maybe Natural
$sel:credentialDurationSeconds:UpdateRoleAlias' :: UpdateRoleAlias -> Maybe Natural
credentialDurationSeconds} -> Maybe Natural
credentialDurationSeconds) (\s :: UpdateRoleAlias
s@UpdateRoleAlias' {} Maybe Natural
a -> UpdateRoleAlias
s {$sel:credentialDurationSeconds:UpdateRoleAlias' :: Maybe Natural
credentialDurationSeconds = Maybe Natural
a} :: UpdateRoleAlias)
updateRoleAlias_roleArn :: Lens.Lens' UpdateRoleAlias (Prelude.Maybe Prelude.Text)
updateRoleAlias_roleArn :: (Maybe Text -> f (Maybe Text))
-> UpdateRoleAlias -> f UpdateRoleAlias
updateRoleAlias_roleArn = (UpdateRoleAlias -> Maybe Text)
-> (UpdateRoleAlias -> Maybe Text -> UpdateRoleAlias)
-> Lens UpdateRoleAlias UpdateRoleAlias (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoleAlias' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:UpdateRoleAlias' :: UpdateRoleAlias -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: UpdateRoleAlias
s@UpdateRoleAlias' {} Maybe Text
a -> UpdateRoleAlias
s {$sel:roleArn:UpdateRoleAlias' :: Maybe Text
roleArn = Maybe Text
a} :: UpdateRoleAlias)
updateRoleAlias_roleAlias :: Lens.Lens' UpdateRoleAlias Prelude.Text
updateRoleAlias_roleAlias :: (Text -> f Text) -> UpdateRoleAlias -> f UpdateRoleAlias
updateRoleAlias_roleAlias = (UpdateRoleAlias -> Text)
-> (UpdateRoleAlias -> Text -> UpdateRoleAlias)
-> Lens UpdateRoleAlias UpdateRoleAlias Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoleAlias' {Text
roleAlias :: Text
$sel:roleAlias:UpdateRoleAlias' :: UpdateRoleAlias -> Text
roleAlias} -> Text
roleAlias) (\s :: UpdateRoleAlias
s@UpdateRoleAlias' {} Text
a -> UpdateRoleAlias
s {$sel:roleAlias:UpdateRoleAlias' :: Text
roleAlias = Text
a} :: UpdateRoleAlias)
instance Core.AWSRequest UpdateRoleAlias where
type
AWSResponse UpdateRoleAlias =
UpdateRoleAliasResponse
request :: UpdateRoleAlias -> Request UpdateRoleAlias
request = Service -> UpdateRoleAlias -> Request UpdateRoleAlias
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateRoleAlias
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRoleAlias)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateRoleAlias))
-> Logger
-> Service
-> Proxy UpdateRoleAlias
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRoleAlias)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Maybe Text -> Int -> UpdateRoleAliasResponse
UpdateRoleAliasResponse'
(Maybe Text -> Maybe Text -> Int -> UpdateRoleAliasResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> UpdateRoleAliasResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"roleAliasArn")
Either String (Maybe Text -> Int -> UpdateRoleAliasResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateRoleAliasResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"roleAlias")
Either String (Int -> UpdateRoleAliasResponse)
-> Either String Int -> Either String UpdateRoleAliasResponse
forall (f :: * -> *) a b. Applicative f => 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 UpdateRoleAlias
instance Prelude.NFData UpdateRoleAlias
instance Core.ToHeaders UpdateRoleAlias where
toHeaders :: UpdateRoleAlias -> ResponseHeaders
toHeaders = ResponseHeaders -> UpdateRoleAlias -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON UpdateRoleAlias where
toJSON :: UpdateRoleAlias -> Value
toJSON UpdateRoleAlias' {Maybe Natural
Maybe Text
Text
roleAlias :: Text
roleArn :: Maybe Text
credentialDurationSeconds :: Maybe Natural
$sel:roleAlias:UpdateRoleAlias' :: UpdateRoleAlias -> Text
$sel:roleArn:UpdateRoleAlias' :: UpdateRoleAlias -> Maybe Text
$sel:credentialDurationSeconds:UpdateRoleAlias' :: UpdateRoleAlias -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"credentialDurationSeconds" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
credentialDurationSeconds,
(Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleArn
]
)
instance Core.ToPath UpdateRoleAlias where
toPath :: UpdateRoleAlias -> ByteString
toPath UpdateRoleAlias' {Maybe Natural
Maybe Text
Text
roleAlias :: Text
roleArn :: Maybe Text
credentialDurationSeconds :: Maybe Natural
$sel:roleAlias:UpdateRoleAlias' :: UpdateRoleAlias -> Text
$sel:roleArn:UpdateRoleAlias' :: UpdateRoleAlias -> Maybe Text
$sel:credentialDurationSeconds:UpdateRoleAlias' :: UpdateRoleAlias -> Maybe Natural
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/role-aliases/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
roleAlias]
instance Core.ToQuery UpdateRoleAlias where
toQuery :: UpdateRoleAlias -> QueryString
toQuery = QueryString -> UpdateRoleAlias -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateRoleAliasResponse = UpdateRoleAliasResponse'
{
UpdateRoleAliasResponse -> Maybe Text
roleAliasArn :: Prelude.Maybe Prelude.Text,
UpdateRoleAliasResponse -> Maybe Text
roleAlias :: Prelude.Maybe Prelude.Text,
UpdateRoleAliasResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateRoleAliasResponse -> UpdateRoleAliasResponse -> Bool
(UpdateRoleAliasResponse -> UpdateRoleAliasResponse -> Bool)
-> (UpdateRoleAliasResponse -> UpdateRoleAliasResponse -> Bool)
-> Eq UpdateRoleAliasResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRoleAliasResponse -> UpdateRoleAliasResponse -> Bool
$c/= :: UpdateRoleAliasResponse -> UpdateRoleAliasResponse -> Bool
== :: UpdateRoleAliasResponse -> UpdateRoleAliasResponse -> Bool
$c== :: UpdateRoleAliasResponse -> UpdateRoleAliasResponse -> Bool
Prelude.Eq, ReadPrec [UpdateRoleAliasResponse]
ReadPrec UpdateRoleAliasResponse
Int -> ReadS UpdateRoleAliasResponse
ReadS [UpdateRoleAliasResponse]
(Int -> ReadS UpdateRoleAliasResponse)
-> ReadS [UpdateRoleAliasResponse]
-> ReadPrec UpdateRoleAliasResponse
-> ReadPrec [UpdateRoleAliasResponse]
-> Read UpdateRoleAliasResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRoleAliasResponse]
$creadListPrec :: ReadPrec [UpdateRoleAliasResponse]
readPrec :: ReadPrec UpdateRoleAliasResponse
$creadPrec :: ReadPrec UpdateRoleAliasResponse
readList :: ReadS [UpdateRoleAliasResponse]
$creadList :: ReadS [UpdateRoleAliasResponse]
readsPrec :: Int -> ReadS UpdateRoleAliasResponse
$creadsPrec :: Int -> ReadS UpdateRoleAliasResponse
Prelude.Read, Int -> UpdateRoleAliasResponse -> ShowS
[UpdateRoleAliasResponse] -> ShowS
UpdateRoleAliasResponse -> String
(Int -> UpdateRoleAliasResponse -> ShowS)
-> (UpdateRoleAliasResponse -> String)
-> ([UpdateRoleAliasResponse] -> ShowS)
-> Show UpdateRoleAliasResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRoleAliasResponse] -> ShowS
$cshowList :: [UpdateRoleAliasResponse] -> ShowS
show :: UpdateRoleAliasResponse -> String
$cshow :: UpdateRoleAliasResponse -> String
showsPrec :: Int -> UpdateRoleAliasResponse -> ShowS
$cshowsPrec :: Int -> UpdateRoleAliasResponse -> ShowS
Prelude.Show, (forall x.
UpdateRoleAliasResponse -> Rep UpdateRoleAliasResponse x)
-> (forall x.
Rep UpdateRoleAliasResponse x -> UpdateRoleAliasResponse)
-> Generic UpdateRoleAliasResponse
forall x. Rep UpdateRoleAliasResponse x -> UpdateRoleAliasResponse
forall x. UpdateRoleAliasResponse -> Rep UpdateRoleAliasResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRoleAliasResponse x -> UpdateRoleAliasResponse
$cfrom :: forall x. UpdateRoleAliasResponse -> Rep UpdateRoleAliasResponse x
Prelude.Generic)
newUpdateRoleAliasResponse ::
Prelude.Int ->
UpdateRoleAliasResponse
newUpdateRoleAliasResponse :: Int -> UpdateRoleAliasResponse
newUpdateRoleAliasResponse Int
pHttpStatus_ =
UpdateRoleAliasResponse' :: Maybe Text -> Maybe Text -> Int -> UpdateRoleAliasResponse
UpdateRoleAliasResponse'
{ $sel:roleAliasArn:UpdateRoleAliasResponse' :: Maybe Text
roleAliasArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:roleAlias:UpdateRoleAliasResponse' :: Maybe Text
roleAlias = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateRoleAliasResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateRoleAliasResponse_roleAliasArn :: Lens.Lens' UpdateRoleAliasResponse (Prelude.Maybe Prelude.Text)
updateRoleAliasResponse_roleAliasArn :: (Maybe Text -> f (Maybe Text))
-> UpdateRoleAliasResponse -> f UpdateRoleAliasResponse
updateRoleAliasResponse_roleAliasArn = (UpdateRoleAliasResponse -> Maybe Text)
-> (UpdateRoleAliasResponse
-> Maybe Text -> UpdateRoleAliasResponse)
-> Lens
UpdateRoleAliasResponse
UpdateRoleAliasResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoleAliasResponse' {Maybe Text
roleAliasArn :: Maybe Text
$sel:roleAliasArn:UpdateRoleAliasResponse' :: UpdateRoleAliasResponse -> Maybe Text
roleAliasArn} -> Maybe Text
roleAliasArn) (\s :: UpdateRoleAliasResponse
s@UpdateRoleAliasResponse' {} Maybe Text
a -> UpdateRoleAliasResponse
s {$sel:roleAliasArn:UpdateRoleAliasResponse' :: Maybe Text
roleAliasArn = Maybe Text
a} :: UpdateRoleAliasResponse)
updateRoleAliasResponse_roleAlias :: Lens.Lens' UpdateRoleAliasResponse (Prelude.Maybe Prelude.Text)
updateRoleAliasResponse_roleAlias :: (Maybe Text -> f (Maybe Text))
-> UpdateRoleAliasResponse -> f UpdateRoleAliasResponse
updateRoleAliasResponse_roleAlias = (UpdateRoleAliasResponse -> Maybe Text)
-> (UpdateRoleAliasResponse
-> Maybe Text -> UpdateRoleAliasResponse)
-> Lens
UpdateRoleAliasResponse
UpdateRoleAliasResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoleAliasResponse' {Maybe Text
roleAlias :: Maybe Text
$sel:roleAlias:UpdateRoleAliasResponse' :: UpdateRoleAliasResponse -> Maybe Text
roleAlias} -> Maybe Text
roleAlias) (\s :: UpdateRoleAliasResponse
s@UpdateRoleAliasResponse' {} Maybe Text
a -> UpdateRoleAliasResponse
s {$sel:roleAlias:UpdateRoleAliasResponse' :: Maybe Text
roleAlias = Maybe Text
a} :: UpdateRoleAliasResponse)
updateRoleAliasResponse_httpStatus :: Lens.Lens' UpdateRoleAliasResponse Prelude.Int
updateRoleAliasResponse_httpStatus :: (Int -> f Int)
-> UpdateRoleAliasResponse -> f UpdateRoleAliasResponse
updateRoleAliasResponse_httpStatus = (UpdateRoleAliasResponse -> Int)
-> (UpdateRoleAliasResponse -> Int -> UpdateRoleAliasResponse)
-> Lens UpdateRoleAliasResponse UpdateRoleAliasResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoleAliasResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateRoleAliasResponse' :: UpdateRoleAliasResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateRoleAliasResponse
s@UpdateRoleAliasResponse' {} Int
a -> UpdateRoleAliasResponse
s {$sel:httpStatus:UpdateRoleAliasResponse' :: Int
httpStatus = Int
a} :: UpdateRoleAliasResponse)
instance Prelude.NFData UpdateRoleAliasResponse