{-# 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.GetKeyRotationStatus
(
GetKeyRotationStatus (..),
newGetKeyRotationStatus,
getKeyRotationStatus_keyId,
GetKeyRotationStatusResponse (..),
newGetKeyRotationStatusResponse,
getKeyRotationStatusResponse_keyRotationEnabled,
getKeyRotationStatusResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.KMS.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 GetKeyRotationStatus = GetKeyRotationStatus'
{
GetKeyRotationStatus -> Text
keyId :: Prelude.Text
}
deriving (GetKeyRotationStatus -> GetKeyRotationStatus -> Bool
(GetKeyRotationStatus -> GetKeyRotationStatus -> Bool)
-> (GetKeyRotationStatus -> GetKeyRotationStatus -> Bool)
-> Eq GetKeyRotationStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetKeyRotationStatus -> GetKeyRotationStatus -> Bool
$c/= :: GetKeyRotationStatus -> GetKeyRotationStatus -> Bool
== :: GetKeyRotationStatus -> GetKeyRotationStatus -> Bool
$c== :: GetKeyRotationStatus -> GetKeyRotationStatus -> Bool
Prelude.Eq, ReadPrec [GetKeyRotationStatus]
ReadPrec GetKeyRotationStatus
Int -> ReadS GetKeyRotationStatus
ReadS [GetKeyRotationStatus]
(Int -> ReadS GetKeyRotationStatus)
-> ReadS [GetKeyRotationStatus]
-> ReadPrec GetKeyRotationStatus
-> ReadPrec [GetKeyRotationStatus]
-> Read GetKeyRotationStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetKeyRotationStatus]
$creadListPrec :: ReadPrec [GetKeyRotationStatus]
readPrec :: ReadPrec GetKeyRotationStatus
$creadPrec :: ReadPrec GetKeyRotationStatus
readList :: ReadS [GetKeyRotationStatus]
$creadList :: ReadS [GetKeyRotationStatus]
readsPrec :: Int -> ReadS GetKeyRotationStatus
$creadsPrec :: Int -> ReadS GetKeyRotationStatus
Prelude.Read, Int -> GetKeyRotationStatus -> ShowS
[GetKeyRotationStatus] -> ShowS
GetKeyRotationStatus -> String
(Int -> GetKeyRotationStatus -> ShowS)
-> (GetKeyRotationStatus -> String)
-> ([GetKeyRotationStatus] -> ShowS)
-> Show GetKeyRotationStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetKeyRotationStatus] -> ShowS
$cshowList :: [GetKeyRotationStatus] -> ShowS
show :: GetKeyRotationStatus -> String
$cshow :: GetKeyRotationStatus -> String
showsPrec :: Int -> GetKeyRotationStatus -> ShowS
$cshowsPrec :: Int -> GetKeyRotationStatus -> ShowS
Prelude.Show, (forall x. GetKeyRotationStatus -> Rep GetKeyRotationStatus x)
-> (forall x. Rep GetKeyRotationStatus x -> GetKeyRotationStatus)
-> Generic GetKeyRotationStatus
forall x. Rep GetKeyRotationStatus x -> GetKeyRotationStatus
forall x. GetKeyRotationStatus -> Rep GetKeyRotationStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetKeyRotationStatus x -> GetKeyRotationStatus
$cfrom :: forall x. GetKeyRotationStatus -> Rep GetKeyRotationStatus x
Prelude.Generic)
newGetKeyRotationStatus ::
Prelude.Text ->
GetKeyRotationStatus
newGetKeyRotationStatus :: Text -> GetKeyRotationStatus
newGetKeyRotationStatus Text
pKeyId_ =
GetKeyRotationStatus' :: Text -> GetKeyRotationStatus
GetKeyRotationStatus' {$sel:keyId:GetKeyRotationStatus' :: Text
keyId = Text
pKeyId_}
getKeyRotationStatus_keyId :: Lens.Lens' GetKeyRotationStatus Prelude.Text
getKeyRotationStatus_keyId :: (Text -> f Text) -> GetKeyRotationStatus -> f GetKeyRotationStatus
getKeyRotationStatus_keyId = (GetKeyRotationStatus -> Text)
-> (GetKeyRotationStatus -> Text -> GetKeyRotationStatus)
-> Lens GetKeyRotationStatus GetKeyRotationStatus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetKeyRotationStatus' {Text
keyId :: Text
$sel:keyId:GetKeyRotationStatus' :: GetKeyRotationStatus -> Text
keyId} -> Text
keyId) (\s :: GetKeyRotationStatus
s@GetKeyRotationStatus' {} Text
a -> GetKeyRotationStatus
s {$sel:keyId:GetKeyRotationStatus' :: Text
keyId = Text
a} :: GetKeyRotationStatus)
instance Core.AWSRequest GetKeyRotationStatus where
type
AWSResponse GetKeyRotationStatus =
GetKeyRotationStatusResponse
request :: GetKeyRotationStatus -> Request GetKeyRotationStatus
request = Service -> GetKeyRotationStatus -> Request GetKeyRotationStatus
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetKeyRotationStatus
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetKeyRotationStatus)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetKeyRotationStatus))
-> Logger
-> Service
-> Proxy GetKeyRotationStatus
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetKeyRotationStatus)))
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 Bool -> Int -> GetKeyRotationStatusResponse
GetKeyRotationStatusResponse'
(Maybe Bool -> Int -> GetKeyRotationStatusResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> GetKeyRotationStatusResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"KeyRotationEnabled")
Either String (Int -> GetKeyRotationStatusResponse)
-> Either String Int -> Either String GetKeyRotationStatusResponse
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 GetKeyRotationStatus
instance Prelude.NFData GetKeyRotationStatus
instance Core.ToHeaders GetKeyRotationStatus where
toHeaders :: GetKeyRotationStatus -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetKeyRotationStatus -> 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
"TrentService.GetKeyRotationStatus" ::
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 GetKeyRotationStatus where
toJSON :: GetKeyRotationStatus -> Value
toJSON GetKeyRotationStatus' {Text
keyId :: Text
$sel:keyId:GetKeyRotationStatus' :: GetKeyRotationStatus -> 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
"KeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
keyId)]
)
instance Core.ToPath GetKeyRotationStatus where
toPath :: GetKeyRotationStatus -> ByteString
toPath = ByteString -> GetKeyRotationStatus -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetKeyRotationStatus where
toQuery :: GetKeyRotationStatus -> QueryString
toQuery = QueryString -> GetKeyRotationStatus -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetKeyRotationStatusResponse = GetKeyRotationStatusResponse'
{
GetKeyRotationStatusResponse -> Maybe Bool
keyRotationEnabled :: Prelude.Maybe Prelude.Bool,
GetKeyRotationStatusResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetKeyRotationStatusResponse
-> GetKeyRotationStatusResponse -> Bool
(GetKeyRotationStatusResponse
-> GetKeyRotationStatusResponse -> Bool)
-> (GetKeyRotationStatusResponse
-> GetKeyRotationStatusResponse -> Bool)
-> Eq GetKeyRotationStatusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetKeyRotationStatusResponse
-> GetKeyRotationStatusResponse -> Bool
$c/= :: GetKeyRotationStatusResponse
-> GetKeyRotationStatusResponse -> Bool
== :: GetKeyRotationStatusResponse
-> GetKeyRotationStatusResponse -> Bool
$c== :: GetKeyRotationStatusResponse
-> GetKeyRotationStatusResponse -> Bool
Prelude.Eq, ReadPrec [GetKeyRotationStatusResponse]
ReadPrec GetKeyRotationStatusResponse
Int -> ReadS GetKeyRotationStatusResponse
ReadS [GetKeyRotationStatusResponse]
(Int -> ReadS GetKeyRotationStatusResponse)
-> ReadS [GetKeyRotationStatusResponse]
-> ReadPrec GetKeyRotationStatusResponse
-> ReadPrec [GetKeyRotationStatusResponse]
-> Read GetKeyRotationStatusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetKeyRotationStatusResponse]
$creadListPrec :: ReadPrec [GetKeyRotationStatusResponse]
readPrec :: ReadPrec GetKeyRotationStatusResponse
$creadPrec :: ReadPrec GetKeyRotationStatusResponse
readList :: ReadS [GetKeyRotationStatusResponse]
$creadList :: ReadS [GetKeyRotationStatusResponse]
readsPrec :: Int -> ReadS GetKeyRotationStatusResponse
$creadsPrec :: Int -> ReadS GetKeyRotationStatusResponse
Prelude.Read, Int -> GetKeyRotationStatusResponse -> ShowS
[GetKeyRotationStatusResponse] -> ShowS
GetKeyRotationStatusResponse -> String
(Int -> GetKeyRotationStatusResponse -> ShowS)
-> (GetKeyRotationStatusResponse -> String)
-> ([GetKeyRotationStatusResponse] -> ShowS)
-> Show GetKeyRotationStatusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetKeyRotationStatusResponse] -> ShowS
$cshowList :: [GetKeyRotationStatusResponse] -> ShowS
show :: GetKeyRotationStatusResponse -> String
$cshow :: GetKeyRotationStatusResponse -> String
showsPrec :: Int -> GetKeyRotationStatusResponse -> ShowS
$cshowsPrec :: Int -> GetKeyRotationStatusResponse -> ShowS
Prelude.Show, (forall x.
GetKeyRotationStatusResponse -> Rep GetKeyRotationStatusResponse x)
-> (forall x.
Rep GetKeyRotationStatusResponse x -> GetKeyRotationStatusResponse)
-> Generic GetKeyRotationStatusResponse
forall x.
Rep GetKeyRotationStatusResponse x -> GetKeyRotationStatusResponse
forall x.
GetKeyRotationStatusResponse -> Rep GetKeyRotationStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetKeyRotationStatusResponse x -> GetKeyRotationStatusResponse
$cfrom :: forall x.
GetKeyRotationStatusResponse -> Rep GetKeyRotationStatusResponse x
Prelude.Generic)
newGetKeyRotationStatusResponse ::
Prelude.Int ->
GetKeyRotationStatusResponse
newGetKeyRotationStatusResponse :: Int -> GetKeyRotationStatusResponse
newGetKeyRotationStatusResponse Int
pHttpStatus_ =
GetKeyRotationStatusResponse' :: Maybe Bool -> Int -> GetKeyRotationStatusResponse
GetKeyRotationStatusResponse'
{ $sel:keyRotationEnabled:GetKeyRotationStatusResponse' :: Maybe Bool
keyRotationEnabled =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetKeyRotationStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getKeyRotationStatusResponse_keyRotationEnabled :: Lens.Lens' GetKeyRotationStatusResponse (Prelude.Maybe Prelude.Bool)
getKeyRotationStatusResponse_keyRotationEnabled :: (Maybe Bool -> f (Maybe Bool))
-> GetKeyRotationStatusResponse -> f GetKeyRotationStatusResponse
getKeyRotationStatusResponse_keyRotationEnabled = (GetKeyRotationStatusResponse -> Maybe Bool)
-> (GetKeyRotationStatusResponse
-> Maybe Bool -> GetKeyRotationStatusResponse)
-> Lens
GetKeyRotationStatusResponse
GetKeyRotationStatusResponse
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetKeyRotationStatusResponse' {Maybe Bool
keyRotationEnabled :: Maybe Bool
$sel:keyRotationEnabled:GetKeyRotationStatusResponse' :: GetKeyRotationStatusResponse -> Maybe Bool
keyRotationEnabled} -> Maybe Bool
keyRotationEnabled) (\s :: GetKeyRotationStatusResponse
s@GetKeyRotationStatusResponse' {} Maybe Bool
a -> GetKeyRotationStatusResponse
s {$sel:keyRotationEnabled:GetKeyRotationStatusResponse' :: Maybe Bool
keyRotationEnabled = Maybe Bool
a} :: GetKeyRotationStatusResponse)
getKeyRotationStatusResponse_httpStatus :: Lens.Lens' GetKeyRotationStatusResponse Prelude.Int
getKeyRotationStatusResponse_httpStatus :: (Int -> f Int)
-> GetKeyRotationStatusResponse -> f GetKeyRotationStatusResponse
getKeyRotationStatusResponse_httpStatus = (GetKeyRotationStatusResponse -> Int)
-> (GetKeyRotationStatusResponse
-> Int -> GetKeyRotationStatusResponse)
-> Lens
GetKeyRotationStatusResponse GetKeyRotationStatusResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetKeyRotationStatusResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetKeyRotationStatusResponse' :: GetKeyRotationStatusResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetKeyRotationStatusResponse
s@GetKeyRotationStatusResponse' {} Int
a -> GetKeyRotationStatusResponse
s {$sel:httpStatus:GetKeyRotationStatusResponse' :: Int
httpStatus = Int
a} :: GetKeyRotationStatusResponse)
instance Prelude.NFData GetKeyRotationStatusResponse