{-# 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.XRay.PutEncryptionConfig
(
PutEncryptionConfig (..),
newPutEncryptionConfig,
putEncryptionConfig_keyId,
putEncryptionConfig_type,
PutEncryptionConfigResponse (..),
newPutEncryptionConfigResponse,
putEncryptionConfigResponse_encryptionConfig,
putEncryptionConfigResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.XRay.Types
data PutEncryptionConfig = PutEncryptionConfig'
{
PutEncryptionConfig -> Maybe Text
keyId :: Prelude.Maybe Prelude.Text,
PutEncryptionConfig -> EncryptionType
type' :: EncryptionType
}
deriving (PutEncryptionConfig -> PutEncryptionConfig -> Bool
(PutEncryptionConfig -> PutEncryptionConfig -> Bool)
-> (PutEncryptionConfig -> PutEncryptionConfig -> Bool)
-> Eq PutEncryptionConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutEncryptionConfig -> PutEncryptionConfig -> Bool
$c/= :: PutEncryptionConfig -> PutEncryptionConfig -> Bool
== :: PutEncryptionConfig -> PutEncryptionConfig -> Bool
$c== :: PutEncryptionConfig -> PutEncryptionConfig -> Bool
Prelude.Eq, ReadPrec [PutEncryptionConfig]
ReadPrec PutEncryptionConfig
Int -> ReadS PutEncryptionConfig
ReadS [PutEncryptionConfig]
(Int -> ReadS PutEncryptionConfig)
-> ReadS [PutEncryptionConfig]
-> ReadPrec PutEncryptionConfig
-> ReadPrec [PutEncryptionConfig]
-> Read PutEncryptionConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutEncryptionConfig]
$creadListPrec :: ReadPrec [PutEncryptionConfig]
readPrec :: ReadPrec PutEncryptionConfig
$creadPrec :: ReadPrec PutEncryptionConfig
readList :: ReadS [PutEncryptionConfig]
$creadList :: ReadS [PutEncryptionConfig]
readsPrec :: Int -> ReadS PutEncryptionConfig
$creadsPrec :: Int -> ReadS PutEncryptionConfig
Prelude.Read, Int -> PutEncryptionConfig -> ShowS
[PutEncryptionConfig] -> ShowS
PutEncryptionConfig -> String
(Int -> PutEncryptionConfig -> ShowS)
-> (PutEncryptionConfig -> String)
-> ([PutEncryptionConfig] -> ShowS)
-> Show PutEncryptionConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutEncryptionConfig] -> ShowS
$cshowList :: [PutEncryptionConfig] -> ShowS
show :: PutEncryptionConfig -> String
$cshow :: PutEncryptionConfig -> String
showsPrec :: Int -> PutEncryptionConfig -> ShowS
$cshowsPrec :: Int -> PutEncryptionConfig -> ShowS
Prelude.Show, (forall x. PutEncryptionConfig -> Rep PutEncryptionConfig x)
-> (forall x. Rep PutEncryptionConfig x -> PutEncryptionConfig)
-> Generic PutEncryptionConfig
forall x. Rep PutEncryptionConfig x -> PutEncryptionConfig
forall x. PutEncryptionConfig -> Rep PutEncryptionConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutEncryptionConfig x -> PutEncryptionConfig
$cfrom :: forall x. PutEncryptionConfig -> Rep PutEncryptionConfig x
Prelude.Generic)
newPutEncryptionConfig ::
EncryptionType ->
PutEncryptionConfig
newPutEncryptionConfig :: EncryptionType -> PutEncryptionConfig
newPutEncryptionConfig EncryptionType
pType_ =
PutEncryptionConfig' :: Maybe Text -> EncryptionType -> PutEncryptionConfig
PutEncryptionConfig'
{ $sel:keyId:PutEncryptionConfig' :: Maybe Text
keyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':PutEncryptionConfig' :: EncryptionType
type' = EncryptionType
pType_
}
putEncryptionConfig_keyId :: Lens.Lens' PutEncryptionConfig (Prelude.Maybe Prelude.Text)
putEncryptionConfig_keyId :: (Maybe Text -> f (Maybe Text))
-> PutEncryptionConfig -> f PutEncryptionConfig
putEncryptionConfig_keyId = (PutEncryptionConfig -> Maybe Text)
-> (PutEncryptionConfig -> Maybe Text -> PutEncryptionConfig)
-> Lens
PutEncryptionConfig PutEncryptionConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEncryptionConfig' {Maybe Text
keyId :: Maybe Text
$sel:keyId:PutEncryptionConfig' :: PutEncryptionConfig -> Maybe Text
keyId} -> Maybe Text
keyId) (\s :: PutEncryptionConfig
s@PutEncryptionConfig' {} Maybe Text
a -> PutEncryptionConfig
s {$sel:keyId:PutEncryptionConfig' :: Maybe Text
keyId = Maybe Text
a} :: PutEncryptionConfig)
putEncryptionConfig_type :: Lens.Lens' PutEncryptionConfig EncryptionType
putEncryptionConfig_type :: (EncryptionType -> f EncryptionType)
-> PutEncryptionConfig -> f PutEncryptionConfig
putEncryptionConfig_type = (PutEncryptionConfig -> EncryptionType)
-> (PutEncryptionConfig -> EncryptionType -> PutEncryptionConfig)
-> Lens
PutEncryptionConfig
PutEncryptionConfig
EncryptionType
EncryptionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEncryptionConfig' {EncryptionType
type' :: EncryptionType
$sel:type':PutEncryptionConfig' :: PutEncryptionConfig -> EncryptionType
type'} -> EncryptionType
type') (\s :: PutEncryptionConfig
s@PutEncryptionConfig' {} EncryptionType
a -> PutEncryptionConfig
s {$sel:type':PutEncryptionConfig' :: EncryptionType
type' = EncryptionType
a} :: PutEncryptionConfig)
instance Core.AWSRequest PutEncryptionConfig where
type
AWSResponse PutEncryptionConfig =
PutEncryptionConfigResponse
request :: PutEncryptionConfig -> Request PutEncryptionConfig
request = Service -> PutEncryptionConfig -> Request PutEncryptionConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutEncryptionConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutEncryptionConfig)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutEncryptionConfig))
-> Logger
-> Service
-> Proxy PutEncryptionConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutEncryptionConfig)))
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 EncryptionConfig -> Int -> PutEncryptionConfigResponse
PutEncryptionConfigResponse'
(Maybe EncryptionConfig -> Int -> PutEncryptionConfigResponse)
-> Either String (Maybe EncryptionConfig)
-> Either String (Int -> PutEncryptionConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe EncryptionConfig)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EncryptionConfig")
Either String (Int -> PutEncryptionConfigResponse)
-> Either String Int -> Either String PutEncryptionConfigResponse
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 PutEncryptionConfig
instance Prelude.NFData PutEncryptionConfig
instance Core.ToHeaders PutEncryptionConfig where
toHeaders :: PutEncryptionConfig -> ResponseHeaders
toHeaders = ResponseHeaders -> PutEncryptionConfig -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON PutEncryptionConfig where
toJSON :: PutEncryptionConfig -> Value
toJSON PutEncryptionConfig' {Maybe Text
EncryptionType
type' :: EncryptionType
keyId :: Maybe Text
$sel:type':PutEncryptionConfig' :: PutEncryptionConfig -> EncryptionType
$sel:keyId:PutEncryptionConfig' :: PutEncryptionConfig -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"KeyId" 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
keyId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> EncryptionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= EncryptionType
type')
]
)
instance Core.ToPath PutEncryptionConfig where
toPath :: PutEncryptionConfig -> ByteString
toPath = ByteString -> PutEncryptionConfig -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/PutEncryptionConfig"
instance Core.ToQuery PutEncryptionConfig where
toQuery :: PutEncryptionConfig -> QueryString
toQuery = QueryString -> PutEncryptionConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutEncryptionConfigResponse = PutEncryptionConfigResponse'
{
PutEncryptionConfigResponse -> Maybe EncryptionConfig
encryptionConfig :: Prelude.Maybe EncryptionConfig,
PutEncryptionConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutEncryptionConfigResponse -> PutEncryptionConfigResponse -> Bool
(PutEncryptionConfigResponse
-> PutEncryptionConfigResponse -> Bool)
-> (PutEncryptionConfigResponse
-> PutEncryptionConfigResponse -> Bool)
-> Eq PutEncryptionConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutEncryptionConfigResponse -> PutEncryptionConfigResponse -> Bool
$c/= :: PutEncryptionConfigResponse -> PutEncryptionConfigResponse -> Bool
== :: PutEncryptionConfigResponse -> PutEncryptionConfigResponse -> Bool
$c== :: PutEncryptionConfigResponse -> PutEncryptionConfigResponse -> Bool
Prelude.Eq, ReadPrec [PutEncryptionConfigResponse]
ReadPrec PutEncryptionConfigResponse
Int -> ReadS PutEncryptionConfigResponse
ReadS [PutEncryptionConfigResponse]
(Int -> ReadS PutEncryptionConfigResponse)
-> ReadS [PutEncryptionConfigResponse]
-> ReadPrec PutEncryptionConfigResponse
-> ReadPrec [PutEncryptionConfigResponse]
-> Read PutEncryptionConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutEncryptionConfigResponse]
$creadListPrec :: ReadPrec [PutEncryptionConfigResponse]
readPrec :: ReadPrec PutEncryptionConfigResponse
$creadPrec :: ReadPrec PutEncryptionConfigResponse
readList :: ReadS [PutEncryptionConfigResponse]
$creadList :: ReadS [PutEncryptionConfigResponse]
readsPrec :: Int -> ReadS PutEncryptionConfigResponse
$creadsPrec :: Int -> ReadS PutEncryptionConfigResponse
Prelude.Read, Int -> PutEncryptionConfigResponse -> ShowS
[PutEncryptionConfigResponse] -> ShowS
PutEncryptionConfigResponse -> String
(Int -> PutEncryptionConfigResponse -> ShowS)
-> (PutEncryptionConfigResponse -> String)
-> ([PutEncryptionConfigResponse] -> ShowS)
-> Show PutEncryptionConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutEncryptionConfigResponse] -> ShowS
$cshowList :: [PutEncryptionConfigResponse] -> ShowS
show :: PutEncryptionConfigResponse -> String
$cshow :: PutEncryptionConfigResponse -> String
showsPrec :: Int -> PutEncryptionConfigResponse -> ShowS
$cshowsPrec :: Int -> PutEncryptionConfigResponse -> ShowS
Prelude.Show, (forall x.
PutEncryptionConfigResponse -> Rep PutEncryptionConfigResponse x)
-> (forall x.
Rep PutEncryptionConfigResponse x -> PutEncryptionConfigResponse)
-> Generic PutEncryptionConfigResponse
forall x.
Rep PutEncryptionConfigResponse x -> PutEncryptionConfigResponse
forall x.
PutEncryptionConfigResponse -> Rep PutEncryptionConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutEncryptionConfigResponse x -> PutEncryptionConfigResponse
$cfrom :: forall x.
PutEncryptionConfigResponse -> Rep PutEncryptionConfigResponse x
Prelude.Generic)
newPutEncryptionConfigResponse ::
Prelude.Int ->
PutEncryptionConfigResponse
newPutEncryptionConfigResponse :: Int -> PutEncryptionConfigResponse
newPutEncryptionConfigResponse Int
pHttpStatus_ =
PutEncryptionConfigResponse' :: Maybe EncryptionConfig -> Int -> PutEncryptionConfigResponse
PutEncryptionConfigResponse'
{ $sel:encryptionConfig:PutEncryptionConfigResponse' :: Maybe EncryptionConfig
encryptionConfig =
Maybe EncryptionConfig
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutEncryptionConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putEncryptionConfigResponse_encryptionConfig :: Lens.Lens' PutEncryptionConfigResponse (Prelude.Maybe EncryptionConfig)
putEncryptionConfigResponse_encryptionConfig :: (Maybe EncryptionConfig -> f (Maybe EncryptionConfig))
-> PutEncryptionConfigResponse -> f PutEncryptionConfigResponse
putEncryptionConfigResponse_encryptionConfig = (PutEncryptionConfigResponse -> Maybe EncryptionConfig)
-> (PutEncryptionConfigResponse
-> Maybe EncryptionConfig -> PutEncryptionConfigResponse)
-> Lens
PutEncryptionConfigResponse
PutEncryptionConfigResponse
(Maybe EncryptionConfig)
(Maybe EncryptionConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEncryptionConfigResponse' {Maybe EncryptionConfig
encryptionConfig :: Maybe EncryptionConfig
$sel:encryptionConfig:PutEncryptionConfigResponse' :: PutEncryptionConfigResponse -> Maybe EncryptionConfig
encryptionConfig} -> Maybe EncryptionConfig
encryptionConfig) (\s :: PutEncryptionConfigResponse
s@PutEncryptionConfigResponse' {} Maybe EncryptionConfig
a -> PutEncryptionConfigResponse
s {$sel:encryptionConfig:PutEncryptionConfigResponse' :: Maybe EncryptionConfig
encryptionConfig = Maybe EncryptionConfig
a} :: PutEncryptionConfigResponse)
putEncryptionConfigResponse_httpStatus :: Lens.Lens' PutEncryptionConfigResponse Prelude.Int
putEncryptionConfigResponse_httpStatus :: (Int -> f Int)
-> PutEncryptionConfigResponse -> f PutEncryptionConfigResponse
putEncryptionConfigResponse_httpStatus = (PutEncryptionConfigResponse -> Int)
-> (PutEncryptionConfigResponse
-> Int -> PutEncryptionConfigResponse)
-> Lens
PutEncryptionConfigResponse PutEncryptionConfigResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEncryptionConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutEncryptionConfigResponse' :: PutEncryptionConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutEncryptionConfigResponse
s@PutEncryptionConfigResponse' {} Int
a -> PutEncryptionConfigResponse
s {$sel:httpStatus:PutEncryptionConfigResponse' :: Int
httpStatus = Int
a} :: PutEncryptionConfigResponse)
instance Prelude.NFData PutEncryptionConfigResponse