{-# 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.ScheduleKeyDeletion
(
ScheduleKeyDeletion (..),
newScheduleKeyDeletion,
scheduleKeyDeletion_pendingWindowInDays,
scheduleKeyDeletion_keyId,
ScheduleKeyDeletionResponse (..),
newScheduleKeyDeletionResponse,
scheduleKeyDeletionResponse_deletionDate,
scheduleKeyDeletionResponse_keyId,
scheduleKeyDeletionResponse_keyState,
scheduleKeyDeletionResponse_pendingWindowInDays,
scheduleKeyDeletionResponse_httpStatus,
)
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 ScheduleKeyDeletion = ScheduleKeyDeletion'
{
ScheduleKeyDeletion -> Maybe Natural
pendingWindowInDays :: Prelude.Maybe Prelude.Natural,
ScheduleKeyDeletion -> Text
keyId :: Prelude.Text
}
deriving (ScheduleKeyDeletion -> ScheduleKeyDeletion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduleKeyDeletion -> ScheduleKeyDeletion -> Bool
$c/= :: ScheduleKeyDeletion -> ScheduleKeyDeletion -> Bool
== :: ScheduleKeyDeletion -> ScheduleKeyDeletion -> Bool
$c== :: ScheduleKeyDeletion -> ScheduleKeyDeletion -> Bool
Prelude.Eq, ReadPrec [ScheduleKeyDeletion]
ReadPrec ScheduleKeyDeletion
Int -> ReadS ScheduleKeyDeletion
ReadS [ScheduleKeyDeletion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduleKeyDeletion]
$creadListPrec :: ReadPrec [ScheduleKeyDeletion]
readPrec :: ReadPrec ScheduleKeyDeletion
$creadPrec :: ReadPrec ScheduleKeyDeletion
readList :: ReadS [ScheduleKeyDeletion]
$creadList :: ReadS [ScheduleKeyDeletion]
readsPrec :: Int -> ReadS ScheduleKeyDeletion
$creadsPrec :: Int -> ReadS ScheduleKeyDeletion
Prelude.Read, Int -> ScheduleKeyDeletion -> ShowS
[ScheduleKeyDeletion] -> ShowS
ScheduleKeyDeletion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduleKeyDeletion] -> ShowS
$cshowList :: [ScheduleKeyDeletion] -> ShowS
show :: ScheduleKeyDeletion -> String
$cshow :: ScheduleKeyDeletion -> String
showsPrec :: Int -> ScheduleKeyDeletion -> ShowS
$cshowsPrec :: Int -> ScheduleKeyDeletion -> ShowS
Prelude.Show, forall x. Rep ScheduleKeyDeletion x -> ScheduleKeyDeletion
forall x. ScheduleKeyDeletion -> Rep ScheduleKeyDeletion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScheduleKeyDeletion x -> ScheduleKeyDeletion
$cfrom :: forall x. ScheduleKeyDeletion -> Rep ScheduleKeyDeletion x
Prelude.Generic)
newScheduleKeyDeletion ::
Prelude.Text ->
ScheduleKeyDeletion
newScheduleKeyDeletion :: Text -> ScheduleKeyDeletion
newScheduleKeyDeletion Text
pKeyId_ =
ScheduleKeyDeletion'
{ $sel:pendingWindowInDays:ScheduleKeyDeletion' :: Maybe Natural
pendingWindowInDays =
forall a. Maybe a
Prelude.Nothing,
$sel:keyId:ScheduleKeyDeletion' :: Text
keyId = Text
pKeyId_
}
scheduleKeyDeletion_pendingWindowInDays :: Lens.Lens' ScheduleKeyDeletion (Prelude.Maybe Prelude.Natural)
scheduleKeyDeletion_pendingWindowInDays :: Lens' ScheduleKeyDeletion (Maybe Natural)
scheduleKeyDeletion_pendingWindowInDays = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleKeyDeletion' {Maybe Natural
pendingWindowInDays :: Maybe Natural
$sel:pendingWindowInDays:ScheduleKeyDeletion' :: ScheduleKeyDeletion -> Maybe Natural
pendingWindowInDays} -> Maybe Natural
pendingWindowInDays) (\s :: ScheduleKeyDeletion
s@ScheduleKeyDeletion' {} Maybe Natural
a -> ScheduleKeyDeletion
s {$sel:pendingWindowInDays:ScheduleKeyDeletion' :: Maybe Natural
pendingWindowInDays = Maybe Natural
a} :: ScheduleKeyDeletion)
scheduleKeyDeletion_keyId :: Lens.Lens' ScheduleKeyDeletion Prelude.Text
scheduleKeyDeletion_keyId :: Lens' ScheduleKeyDeletion Text
scheduleKeyDeletion_keyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleKeyDeletion' {Text
keyId :: Text
$sel:keyId:ScheduleKeyDeletion' :: ScheduleKeyDeletion -> Text
keyId} -> Text
keyId) (\s :: ScheduleKeyDeletion
s@ScheduleKeyDeletion' {} Text
a -> ScheduleKeyDeletion
s {$sel:keyId:ScheduleKeyDeletion' :: Text
keyId = Text
a} :: ScheduleKeyDeletion)
instance Core.AWSRequest ScheduleKeyDeletion where
type
AWSResponse ScheduleKeyDeletion =
ScheduleKeyDeletionResponse
request :: (Service -> Service)
-> ScheduleKeyDeletion -> Request ScheduleKeyDeletion
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 ScheduleKeyDeletion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ScheduleKeyDeletion)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe POSIX
-> Maybe Text
-> Maybe KeyState
-> Maybe Natural
-> Int
-> ScheduleKeyDeletionResponse
ScheduleKeyDeletionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DeletionDate")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"KeyId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"KeyState")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PendingWindowInDays")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ScheduleKeyDeletion where
hashWithSalt :: Int -> ScheduleKeyDeletion -> Int
hashWithSalt Int
_salt ScheduleKeyDeletion' {Maybe Natural
Text
keyId :: Text
pendingWindowInDays :: Maybe Natural
$sel:keyId:ScheduleKeyDeletion' :: ScheduleKeyDeletion -> Text
$sel:pendingWindowInDays:ScheduleKeyDeletion' :: ScheduleKeyDeletion -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
pendingWindowInDays
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
keyId
instance Prelude.NFData ScheduleKeyDeletion where
rnf :: ScheduleKeyDeletion -> ()
rnf ScheduleKeyDeletion' {Maybe Natural
Text
keyId :: Text
pendingWindowInDays :: Maybe Natural
$sel:keyId:ScheduleKeyDeletion' :: ScheduleKeyDeletion -> Text
$sel:pendingWindowInDays:ScheduleKeyDeletion' :: ScheduleKeyDeletion -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
pendingWindowInDays
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
keyId
instance Data.ToHeaders ScheduleKeyDeletion where
toHeaders :: ScheduleKeyDeletion -> ResponseHeaders
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 -> ResponseHeaders
Data.=# ( ByteString
"TrentService.ScheduleKeyDeletion" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ScheduleKeyDeletion where
toJSON :: ScheduleKeyDeletion -> Value
toJSON ScheduleKeyDeletion' {Maybe Natural
Text
keyId :: Text
pendingWindowInDays :: Maybe Natural
$sel:keyId:ScheduleKeyDeletion' :: ScheduleKeyDeletion -> Text
$sel:pendingWindowInDays:ScheduleKeyDeletion' :: ScheduleKeyDeletion -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"PendingWindowInDays" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
pendingWindowInDays,
forall a. a -> Maybe a
Prelude.Just (Key
"KeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
keyId)
]
)
instance Data.ToPath ScheduleKeyDeletion where
toPath :: ScheduleKeyDeletion -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ScheduleKeyDeletion where
toQuery :: ScheduleKeyDeletion -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ScheduleKeyDeletionResponse = ScheduleKeyDeletionResponse'
{
ScheduleKeyDeletionResponse -> Maybe POSIX
deletionDate :: Prelude.Maybe Data.POSIX,
ScheduleKeyDeletionResponse -> Maybe Text
keyId :: Prelude.Maybe Prelude.Text,
ScheduleKeyDeletionResponse -> Maybe KeyState
keyState :: Prelude.Maybe KeyState,
ScheduleKeyDeletionResponse -> Maybe Natural
pendingWindowInDays :: Prelude.Maybe Prelude.Natural,
ScheduleKeyDeletionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ScheduleKeyDeletionResponse -> ScheduleKeyDeletionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduleKeyDeletionResponse -> ScheduleKeyDeletionResponse -> Bool
$c/= :: ScheduleKeyDeletionResponse -> ScheduleKeyDeletionResponse -> Bool
== :: ScheduleKeyDeletionResponse -> ScheduleKeyDeletionResponse -> Bool
$c== :: ScheduleKeyDeletionResponse -> ScheduleKeyDeletionResponse -> Bool
Prelude.Eq, ReadPrec [ScheduleKeyDeletionResponse]
ReadPrec ScheduleKeyDeletionResponse
Int -> ReadS ScheduleKeyDeletionResponse
ReadS [ScheduleKeyDeletionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduleKeyDeletionResponse]
$creadListPrec :: ReadPrec [ScheduleKeyDeletionResponse]
readPrec :: ReadPrec ScheduleKeyDeletionResponse
$creadPrec :: ReadPrec ScheduleKeyDeletionResponse
readList :: ReadS [ScheduleKeyDeletionResponse]
$creadList :: ReadS [ScheduleKeyDeletionResponse]
readsPrec :: Int -> ReadS ScheduleKeyDeletionResponse
$creadsPrec :: Int -> ReadS ScheduleKeyDeletionResponse
Prelude.Read, Int -> ScheduleKeyDeletionResponse -> ShowS
[ScheduleKeyDeletionResponse] -> ShowS
ScheduleKeyDeletionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduleKeyDeletionResponse] -> ShowS
$cshowList :: [ScheduleKeyDeletionResponse] -> ShowS
show :: ScheduleKeyDeletionResponse -> String
$cshow :: ScheduleKeyDeletionResponse -> String
showsPrec :: Int -> ScheduleKeyDeletionResponse -> ShowS
$cshowsPrec :: Int -> ScheduleKeyDeletionResponse -> ShowS
Prelude.Show, forall x.
Rep ScheduleKeyDeletionResponse x -> ScheduleKeyDeletionResponse
forall x.
ScheduleKeyDeletionResponse -> Rep ScheduleKeyDeletionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ScheduleKeyDeletionResponse x -> ScheduleKeyDeletionResponse
$cfrom :: forall x.
ScheduleKeyDeletionResponse -> Rep ScheduleKeyDeletionResponse x
Prelude.Generic)
newScheduleKeyDeletionResponse ::
Prelude.Int ->
ScheduleKeyDeletionResponse
newScheduleKeyDeletionResponse :: Int -> ScheduleKeyDeletionResponse
newScheduleKeyDeletionResponse Int
pHttpStatus_ =
ScheduleKeyDeletionResponse'
{ $sel:deletionDate:ScheduleKeyDeletionResponse' :: Maybe POSIX
deletionDate =
forall a. Maybe a
Prelude.Nothing,
$sel:keyId:ScheduleKeyDeletionResponse' :: Maybe Text
keyId = forall a. Maybe a
Prelude.Nothing,
$sel:keyState:ScheduleKeyDeletionResponse' :: Maybe KeyState
keyState = forall a. Maybe a
Prelude.Nothing,
$sel:pendingWindowInDays:ScheduleKeyDeletionResponse' :: Maybe Natural
pendingWindowInDays = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ScheduleKeyDeletionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
scheduleKeyDeletionResponse_deletionDate :: Lens.Lens' ScheduleKeyDeletionResponse (Prelude.Maybe Prelude.UTCTime)
scheduleKeyDeletionResponse_deletionDate :: Lens' ScheduleKeyDeletionResponse (Maybe UTCTime)
scheduleKeyDeletionResponse_deletionDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleKeyDeletionResponse' {Maybe POSIX
deletionDate :: Maybe POSIX
$sel:deletionDate:ScheduleKeyDeletionResponse' :: ScheduleKeyDeletionResponse -> Maybe POSIX
deletionDate} -> Maybe POSIX
deletionDate) (\s :: ScheduleKeyDeletionResponse
s@ScheduleKeyDeletionResponse' {} Maybe POSIX
a -> ScheduleKeyDeletionResponse
s {$sel:deletionDate:ScheduleKeyDeletionResponse' :: Maybe POSIX
deletionDate = Maybe POSIX
a} :: ScheduleKeyDeletionResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
scheduleKeyDeletionResponse_keyId :: Lens.Lens' ScheduleKeyDeletionResponse (Prelude.Maybe Prelude.Text)
scheduleKeyDeletionResponse_keyId :: Lens' ScheduleKeyDeletionResponse (Maybe Text)
scheduleKeyDeletionResponse_keyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleKeyDeletionResponse' {Maybe Text
keyId :: Maybe Text
$sel:keyId:ScheduleKeyDeletionResponse' :: ScheduleKeyDeletionResponse -> Maybe Text
keyId} -> Maybe Text
keyId) (\s :: ScheduleKeyDeletionResponse
s@ScheduleKeyDeletionResponse' {} Maybe Text
a -> ScheduleKeyDeletionResponse
s {$sel:keyId:ScheduleKeyDeletionResponse' :: Maybe Text
keyId = Maybe Text
a} :: ScheduleKeyDeletionResponse)
scheduleKeyDeletionResponse_keyState :: Lens.Lens' ScheduleKeyDeletionResponse (Prelude.Maybe KeyState)
scheduleKeyDeletionResponse_keyState :: Lens' ScheduleKeyDeletionResponse (Maybe KeyState)
scheduleKeyDeletionResponse_keyState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleKeyDeletionResponse' {Maybe KeyState
keyState :: Maybe KeyState
$sel:keyState:ScheduleKeyDeletionResponse' :: ScheduleKeyDeletionResponse -> Maybe KeyState
keyState} -> Maybe KeyState
keyState) (\s :: ScheduleKeyDeletionResponse
s@ScheduleKeyDeletionResponse' {} Maybe KeyState
a -> ScheduleKeyDeletionResponse
s {$sel:keyState:ScheduleKeyDeletionResponse' :: Maybe KeyState
keyState = Maybe KeyState
a} :: ScheduleKeyDeletionResponse)
scheduleKeyDeletionResponse_pendingWindowInDays :: Lens.Lens' ScheduleKeyDeletionResponse (Prelude.Maybe Prelude.Natural)
scheduleKeyDeletionResponse_pendingWindowInDays :: Lens' ScheduleKeyDeletionResponse (Maybe Natural)
scheduleKeyDeletionResponse_pendingWindowInDays = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleKeyDeletionResponse' {Maybe Natural
pendingWindowInDays :: Maybe Natural
$sel:pendingWindowInDays:ScheduleKeyDeletionResponse' :: ScheduleKeyDeletionResponse -> Maybe Natural
pendingWindowInDays} -> Maybe Natural
pendingWindowInDays) (\s :: ScheduleKeyDeletionResponse
s@ScheduleKeyDeletionResponse' {} Maybe Natural
a -> ScheduleKeyDeletionResponse
s {$sel:pendingWindowInDays:ScheduleKeyDeletionResponse' :: Maybe Natural
pendingWindowInDays = Maybe Natural
a} :: ScheduleKeyDeletionResponse)
scheduleKeyDeletionResponse_httpStatus :: Lens.Lens' ScheduleKeyDeletionResponse Prelude.Int
scheduleKeyDeletionResponse_httpStatus :: Lens' ScheduleKeyDeletionResponse Int
scheduleKeyDeletionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleKeyDeletionResponse' {Int
httpStatus :: Int
$sel:httpStatus:ScheduleKeyDeletionResponse' :: ScheduleKeyDeletionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ScheduleKeyDeletionResponse
s@ScheduleKeyDeletionResponse' {} Int
a -> ScheduleKeyDeletionResponse
s {$sel:httpStatus:ScheduleKeyDeletionResponse' :: Int
httpStatus = Int
a} :: ScheduleKeyDeletionResponse)
instance Prelude.NFData ScheduleKeyDeletionResponse where
rnf :: ScheduleKeyDeletionResponse -> ()
rnf ScheduleKeyDeletionResponse' {Int
Maybe Natural
Maybe Text
Maybe POSIX
Maybe KeyState
httpStatus :: Int
pendingWindowInDays :: Maybe Natural
keyState :: Maybe KeyState
keyId :: Maybe Text
deletionDate :: Maybe POSIX
$sel:httpStatus:ScheduleKeyDeletionResponse' :: ScheduleKeyDeletionResponse -> Int
$sel:pendingWindowInDays:ScheduleKeyDeletionResponse' :: ScheduleKeyDeletionResponse -> Maybe Natural
$sel:keyState:ScheduleKeyDeletionResponse' :: ScheduleKeyDeletionResponse -> Maybe KeyState
$sel:keyId:ScheduleKeyDeletionResponse' :: ScheduleKeyDeletionResponse -> Maybe Text
$sel:deletionDate:ScheduleKeyDeletionResponse' :: ScheduleKeyDeletionResponse -> Maybe POSIX
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
deletionDate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
keyId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe KeyState
keyState
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
pendingWindowInDays
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus