{-# 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.KMS.UpdateAlias
(
UpdateAlias (..),
newUpdateAlias,
updateAlias_aliasName,
updateAlias_targetKeyId,
UpdateAliasResponse (..),
newUpdateAliasResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KMS.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateAlias = UpdateAlias'
{
UpdateAlias -> Text
aliasName :: Prelude.Text,
UpdateAlias -> Text
targetKeyId :: Prelude.Text
}
deriving (UpdateAlias -> UpdateAlias -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAlias -> UpdateAlias -> Bool
$c/= :: UpdateAlias -> UpdateAlias -> Bool
== :: UpdateAlias -> UpdateAlias -> Bool
$c== :: UpdateAlias -> UpdateAlias -> Bool
Prelude.Eq, ReadPrec [UpdateAlias]
ReadPrec UpdateAlias
Int -> ReadS UpdateAlias
ReadS [UpdateAlias]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAlias]
$creadListPrec :: ReadPrec [UpdateAlias]
readPrec :: ReadPrec UpdateAlias
$creadPrec :: ReadPrec UpdateAlias
readList :: ReadS [UpdateAlias]
$creadList :: ReadS [UpdateAlias]
readsPrec :: Int -> ReadS UpdateAlias
$creadsPrec :: Int -> ReadS UpdateAlias
Prelude.Read, Int -> UpdateAlias -> ShowS
[UpdateAlias] -> ShowS
UpdateAlias -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAlias] -> ShowS
$cshowList :: [UpdateAlias] -> ShowS
show :: UpdateAlias -> String
$cshow :: UpdateAlias -> String
showsPrec :: Int -> UpdateAlias -> ShowS
$cshowsPrec :: Int -> UpdateAlias -> ShowS
Prelude.Show, forall x. Rep UpdateAlias x -> UpdateAlias
forall x. UpdateAlias -> Rep UpdateAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAlias x -> UpdateAlias
$cfrom :: forall x. UpdateAlias -> Rep UpdateAlias x
Prelude.Generic)
newUpdateAlias ::
Prelude.Text ->
Prelude.Text ->
UpdateAlias
newUpdateAlias :: Text -> Text -> UpdateAlias
newUpdateAlias Text
pAliasName_ Text
pTargetKeyId_ =
UpdateAlias'
{ $sel:aliasName:UpdateAlias' :: Text
aliasName = Text
pAliasName_,
$sel:targetKeyId:UpdateAlias' :: Text
targetKeyId = Text
pTargetKeyId_
}
updateAlias_aliasName :: Lens.Lens' UpdateAlias Prelude.Text
updateAlias_aliasName :: Lens' UpdateAlias Text
updateAlias_aliasName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAlias' {Text
aliasName :: Text
$sel:aliasName:UpdateAlias' :: UpdateAlias -> Text
aliasName} -> Text
aliasName) (\s :: UpdateAlias
s@UpdateAlias' {} Text
a -> UpdateAlias
s {$sel:aliasName:UpdateAlias' :: Text
aliasName = Text
a} :: UpdateAlias)
updateAlias_targetKeyId :: Lens.Lens' UpdateAlias Prelude.Text
updateAlias_targetKeyId :: Lens' UpdateAlias Text
updateAlias_targetKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAlias' {Text
targetKeyId :: Text
$sel:targetKeyId:UpdateAlias' :: UpdateAlias -> Text
targetKeyId} -> Text
targetKeyId) (\s :: UpdateAlias
s@UpdateAlias' {} Text
a -> UpdateAlias
s {$sel:targetKeyId:UpdateAlias' :: Text
targetKeyId = Text
a} :: UpdateAlias)
instance Core.AWSRequest UpdateAlias where
type AWSResponse UpdateAlias = UpdateAliasResponse
request :: (Service -> Service) -> UpdateAlias -> Request UpdateAlias
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateAlias
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateAlias)))
response = forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull UpdateAliasResponse
UpdateAliasResponse'
instance Prelude.Hashable UpdateAlias where
hashWithSalt :: Int -> UpdateAlias -> Int
hashWithSalt Int
_salt UpdateAlias' {Text
targetKeyId :: Text
aliasName :: Text
$sel:targetKeyId:UpdateAlias' :: UpdateAlias -> Text
$sel:aliasName:UpdateAlias' :: UpdateAlias -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
aliasName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
targetKeyId
instance Prelude.NFData UpdateAlias where
rnf :: UpdateAlias -> ()
rnf UpdateAlias' {Text
targetKeyId :: Text
aliasName :: Text
$sel:targetKeyId:UpdateAlias' :: UpdateAlias -> Text
$sel:aliasName:UpdateAlias' :: UpdateAlias -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
aliasName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
targetKeyId
instance Data.ToHeaders UpdateAlias where
toHeaders :: UpdateAlias -> [Header]
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# (ByteString
"TrentService.UpdateAlias" :: Prelude.ByteString),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON UpdateAlias where
toJSON :: UpdateAlias -> Value
toJSON UpdateAlias' {Text
targetKeyId :: Text
aliasName :: Text
$sel:targetKeyId:UpdateAlias' :: UpdateAlias -> Text
$sel:aliasName:UpdateAlias' :: UpdateAlias -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"AliasName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
aliasName),
forall a. a -> Maybe a
Prelude.Just (Key
"TargetKeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
targetKeyId)
]
)
instance Data.ToPath UpdateAlias where
toPath :: UpdateAlias -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateAlias where
toQuery :: UpdateAlias -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateAliasResponse = UpdateAliasResponse'
{
}
deriving (UpdateAliasResponse -> UpdateAliasResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAliasResponse -> UpdateAliasResponse -> Bool
$c/= :: UpdateAliasResponse -> UpdateAliasResponse -> Bool
== :: UpdateAliasResponse -> UpdateAliasResponse -> Bool
$c== :: UpdateAliasResponse -> UpdateAliasResponse -> Bool
Prelude.Eq, ReadPrec [UpdateAliasResponse]
ReadPrec UpdateAliasResponse
Int -> ReadS UpdateAliasResponse
ReadS [UpdateAliasResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAliasResponse]
$creadListPrec :: ReadPrec [UpdateAliasResponse]
readPrec :: ReadPrec UpdateAliasResponse
$creadPrec :: ReadPrec UpdateAliasResponse
readList :: ReadS [UpdateAliasResponse]
$creadList :: ReadS [UpdateAliasResponse]
readsPrec :: Int -> ReadS UpdateAliasResponse
$creadsPrec :: Int -> ReadS UpdateAliasResponse
Prelude.Read, Int -> UpdateAliasResponse -> ShowS
[UpdateAliasResponse] -> ShowS
UpdateAliasResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAliasResponse] -> ShowS
$cshowList :: [UpdateAliasResponse] -> ShowS
show :: UpdateAliasResponse -> String
$cshow :: UpdateAliasResponse -> String
showsPrec :: Int -> UpdateAliasResponse -> ShowS
$cshowsPrec :: Int -> UpdateAliasResponse -> ShowS
Prelude.Show, forall x. Rep UpdateAliasResponse x -> UpdateAliasResponse
forall x. UpdateAliasResponse -> Rep UpdateAliasResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAliasResponse x -> UpdateAliasResponse
$cfrom :: forall x. UpdateAliasResponse -> Rep UpdateAliasResponse x
Prelude.Generic)
newUpdateAliasResponse ::
UpdateAliasResponse
newUpdateAliasResponse :: UpdateAliasResponse
newUpdateAliasResponse = UpdateAliasResponse
UpdateAliasResponse'
instance Prelude.NFData UpdateAliasResponse where
rnf :: UpdateAliasResponse -> ()
rnf UpdateAliasResponse
_ = ()