{-# 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.FraudDetector.PutKMSEncryptionKey
(
PutKMSEncryptionKey (..),
newPutKMSEncryptionKey,
putKMSEncryptionKey_kmsEncryptionKeyArn,
PutKMSEncryptionKeyResponse (..),
newPutKMSEncryptionKeyResponse,
putKMSEncryptionKeyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.FraudDetector.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 PutKMSEncryptionKey = PutKMSEncryptionKey'
{
PutKMSEncryptionKey -> Text
kmsEncryptionKeyArn :: Prelude.Text
}
deriving (PutKMSEncryptionKey -> PutKMSEncryptionKey -> Bool
(PutKMSEncryptionKey -> PutKMSEncryptionKey -> Bool)
-> (PutKMSEncryptionKey -> PutKMSEncryptionKey -> Bool)
-> Eq PutKMSEncryptionKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutKMSEncryptionKey -> PutKMSEncryptionKey -> Bool
$c/= :: PutKMSEncryptionKey -> PutKMSEncryptionKey -> Bool
== :: PutKMSEncryptionKey -> PutKMSEncryptionKey -> Bool
$c== :: PutKMSEncryptionKey -> PutKMSEncryptionKey -> Bool
Prelude.Eq, ReadPrec [PutKMSEncryptionKey]
ReadPrec PutKMSEncryptionKey
Int -> ReadS PutKMSEncryptionKey
ReadS [PutKMSEncryptionKey]
(Int -> ReadS PutKMSEncryptionKey)
-> ReadS [PutKMSEncryptionKey]
-> ReadPrec PutKMSEncryptionKey
-> ReadPrec [PutKMSEncryptionKey]
-> Read PutKMSEncryptionKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutKMSEncryptionKey]
$creadListPrec :: ReadPrec [PutKMSEncryptionKey]
readPrec :: ReadPrec PutKMSEncryptionKey
$creadPrec :: ReadPrec PutKMSEncryptionKey
readList :: ReadS [PutKMSEncryptionKey]
$creadList :: ReadS [PutKMSEncryptionKey]
readsPrec :: Int -> ReadS PutKMSEncryptionKey
$creadsPrec :: Int -> ReadS PutKMSEncryptionKey
Prelude.Read, Int -> PutKMSEncryptionKey -> ShowS
[PutKMSEncryptionKey] -> ShowS
PutKMSEncryptionKey -> String
(Int -> PutKMSEncryptionKey -> ShowS)
-> (PutKMSEncryptionKey -> String)
-> ([PutKMSEncryptionKey] -> ShowS)
-> Show PutKMSEncryptionKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutKMSEncryptionKey] -> ShowS
$cshowList :: [PutKMSEncryptionKey] -> ShowS
show :: PutKMSEncryptionKey -> String
$cshow :: PutKMSEncryptionKey -> String
showsPrec :: Int -> PutKMSEncryptionKey -> ShowS
$cshowsPrec :: Int -> PutKMSEncryptionKey -> ShowS
Prelude.Show, (forall x. PutKMSEncryptionKey -> Rep PutKMSEncryptionKey x)
-> (forall x. Rep PutKMSEncryptionKey x -> PutKMSEncryptionKey)
-> Generic PutKMSEncryptionKey
forall x. Rep PutKMSEncryptionKey x -> PutKMSEncryptionKey
forall x. PutKMSEncryptionKey -> Rep PutKMSEncryptionKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutKMSEncryptionKey x -> PutKMSEncryptionKey
$cfrom :: forall x. PutKMSEncryptionKey -> Rep PutKMSEncryptionKey x
Prelude.Generic)
newPutKMSEncryptionKey ::
Prelude.Text ->
PutKMSEncryptionKey
newPutKMSEncryptionKey :: Text -> PutKMSEncryptionKey
newPutKMSEncryptionKey Text
pKmsEncryptionKeyArn_ =
PutKMSEncryptionKey' :: Text -> PutKMSEncryptionKey
PutKMSEncryptionKey'
{ $sel:kmsEncryptionKeyArn:PutKMSEncryptionKey' :: Text
kmsEncryptionKeyArn =
Text
pKmsEncryptionKeyArn_
}
putKMSEncryptionKey_kmsEncryptionKeyArn :: Lens.Lens' PutKMSEncryptionKey Prelude.Text
putKMSEncryptionKey_kmsEncryptionKeyArn :: (Text -> f Text) -> PutKMSEncryptionKey -> f PutKMSEncryptionKey
putKMSEncryptionKey_kmsEncryptionKeyArn = (PutKMSEncryptionKey -> Text)
-> (PutKMSEncryptionKey -> Text -> PutKMSEncryptionKey)
-> Lens PutKMSEncryptionKey PutKMSEncryptionKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutKMSEncryptionKey' {Text
kmsEncryptionKeyArn :: Text
$sel:kmsEncryptionKeyArn:PutKMSEncryptionKey' :: PutKMSEncryptionKey -> Text
kmsEncryptionKeyArn} -> Text
kmsEncryptionKeyArn) (\s :: PutKMSEncryptionKey
s@PutKMSEncryptionKey' {} Text
a -> PutKMSEncryptionKey
s {$sel:kmsEncryptionKeyArn:PutKMSEncryptionKey' :: Text
kmsEncryptionKeyArn = Text
a} :: PutKMSEncryptionKey)
instance Core.AWSRequest PutKMSEncryptionKey where
type
AWSResponse PutKMSEncryptionKey =
PutKMSEncryptionKeyResponse
request :: PutKMSEncryptionKey -> Request PutKMSEncryptionKey
request = Service -> PutKMSEncryptionKey -> Request PutKMSEncryptionKey
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutKMSEncryptionKey
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutKMSEncryptionKey)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse PutKMSEncryptionKey))
-> Logger
-> Service
-> Proxy PutKMSEncryptionKey
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutKMSEncryptionKey)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> PutKMSEncryptionKeyResponse
PutKMSEncryptionKeyResponse'
(Int -> PutKMSEncryptionKeyResponse)
-> Either String Int -> Either String PutKMSEncryptionKeyResponse
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 PutKMSEncryptionKey
instance Prelude.NFData PutKMSEncryptionKey
instance Core.ToHeaders PutKMSEncryptionKey where
toHeaders :: PutKMSEncryptionKey -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutKMSEncryptionKey -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSHawksNestServiceFacade.PutKMSEncryptionKey" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON PutKMSEncryptionKey where
toJSON :: PutKMSEncryptionKey -> Value
toJSON PutKMSEncryptionKey' {Text
kmsEncryptionKeyArn :: Text
$sel:kmsEncryptionKeyArn:PutKMSEncryptionKey' :: PutKMSEncryptionKey -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"kmsEncryptionKeyArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
kmsEncryptionKeyArn)
]
)
instance Core.ToPath PutKMSEncryptionKey where
toPath :: PutKMSEncryptionKey -> ByteString
toPath = ByteString -> PutKMSEncryptionKey -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutKMSEncryptionKey where
toQuery :: PutKMSEncryptionKey -> QueryString
toQuery = QueryString -> PutKMSEncryptionKey -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutKMSEncryptionKeyResponse = PutKMSEncryptionKeyResponse'
{
PutKMSEncryptionKeyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutKMSEncryptionKeyResponse -> PutKMSEncryptionKeyResponse -> Bool
(PutKMSEncryptionKeyResponse
-> PutKMSEncryptionKeyResponse -> Bool)
-> (PutKMSEncryptionKeyResponse
-> PutKMSEncryptionKeyResponse -> Bool)
-> Eq PutKMSEncryptionKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutKMSEncryptionKeyResponse -> PutKMSEncryptionKeyResponse -> Bool
$c/= :: PutKMSEncryptionKeyResponse -> PutKMSEncryptionKeyResponse -> Bool
== :: PutKMSEncryptionKeyResponse -> PutKMSEncryptionKeyResponse -> Bool
$c== :: PutKMSEncryptionKeyResponse -> PutKMSEncryptionKeyResponse -> Bool
Prelude.Eq, ReadPrec [PutKMSEncryptionKeyResponse]
ReadPrec PutKMSEncryptionKeyResponse
Int -> ReadS PutKMSEncryptionKeyResponse
ReadS [PutKMSEncryptionKeyResponse]
(Int -> ReadS PutKMSEncryptionKeyResponse)
-> ReadS [PutKMSEncryptionKeyResponse]
-> ReadPrec PutKMSEncryptionKeyResponse
-> ReadPrec [PutKMSEncryptionKeyResponse]
-> Read PutKMSEncryptionKeyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutKMSEncryptionKeyResponse]
$creadListPrec :: ReadPrec [PutKMSEncryptionKeyResponse]
readPrec :: ReadPrec PutKMSEncryptionKeyResponse
$creadPrec :: ReadPrec PutKMSEncryptionKeyResponse
readList :: ReadS [PutKMSEncryptionKeyResponse]
$creadList :: ReadS [PutKMSEncryptionKeyResponse]
readsPrec :: Int -> ReadS PutKMSEncryptionKeyResponse
$creadsPrec :: Int -> ReadS PutKMSEncryptionKeyResponse
Prelude.Read, Int -> PutKMSEncryptionKeyResponse -> ShowS
[PutKMSEncryptionKeyResponse] -> ShowS
PutKMSEncryptionKeyResponse -> String
(Int -> PutKMSEncryptionKeyResponse -> ShowS)
-> (PutKMSEncryptionKeyResponse -> String)
-> ([PutKMSEncryptionKeyResponse] -> ShowS)
-> Show PutKMSEncryptionKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutKMSEncryptionKeyResponse] -> ShowS
$cshowList :: [PutKMSEncryptionKeyResponse] -> ShowS
show :: PutKMSEncryptionKeyResponse -> String
$cshow :: PutKMSEncryptionKeyResponse -> String
showsPrec :: Int -> PutKMSEncryptionKeyResponse -> ShowS
$cshowsPrec :: Int -> PutKMSEncryptionKeyResponse -> ShowS
Prelude.Show, (forall x.
PutKMSEncryptionKeyResponse -> Rep PutKMSEncryptionKeyResponse x)
-> (forall x.
Rep PutKMSEncryptionKeyResponse x -> PutKMSEncryptionKeyResponse)
-> Generic PutKMSEncryptionKeyResponse
forall x.
Rep PutKMSEncryptionKeyResponse x -> PutKMSEncryptionKeyResponse
forall x.
PutKMSEncryptionKeyResponse -> Rep PutKMSEncryptionKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutKMSEncryptionKeyResponse x -> PutKMSEncryptionKeyResponse
$cfrom :: forall x.
PutKMSEncryptionKeyResponse -> Rep PutKMSEncryptionKeyResponse x
Prelude.Generic)
newPutKMSEncryptionKeyResponse ::
Prelude.Int ->
PutKMSEncryptionKeyResponse
newPutKMSEncryptionKeyResponse :: Int -> PutKMSEncryptionKeyResponse
newPutKMSEncryptionKeyResponse Int
pHttpStatus_ =
PutKMSEncryptionKeyResponse' :: Int -> PutKMSEncryptionKeyResponse
PutKMSEncryptionKeyResponse'
{ $sel:httpStatus:PutKMSEncryptionKeyResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
putKMSEncryptionKeyResponse_httpStatus :: Lens.Lens' PutKMSEncryptionKeyResponse Prelude.Int
putKMSEncryptionKeyResponse_httpStatus :: (Int -> f Int)
-> PutKMSEncryptionKeyResponse -> f PutKMSEncryptionKeyResponse
putKMSEncryptionKeyResponse_httpStatus = (PutKMSEncryptionKeyResponse -> Int)
-> (PutKMSEncryptionKeyResponse
-> Int -> PutKMSEncryptionKeyResponse)
-> Lens
PutKMSEncryptionKeyResponse PutKMSEncryptionKeyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutKMSEncryptionKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutKMSEncryptionKeyResponse' :: PutKMSEncryptionKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutKMSEncryptionKeyResponse
s@PutKMSEncryptionKeyResponse' {} Int
a -> PutKMSEncryptionKeyResponse
s {$sel:httpStatus:PutKMSEncryptionKeyResponse' :: Int
httpStatus = Int
a} :: PutKMSEncryptionKeyResponse)
instance Prelude.NFData PutKMSEncryptionKeyResponse