{-# 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 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 GetKeyRotationStatus = GetKeyRotationStatus'
{
GetKeyRotationStatus -> Text
keyId :: Prelude.Text
}
deriving (GetKeyRotationStatus -> GetKeyRotationStatus -> Bool
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]
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
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. 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' {$sel:keyId:GetKeyRotationStatus' :: Text
keyId = Text
pKeyId_}
getKeyRotationStatus_keyId :: Lens.Lens' GetKeyRotationStatus Prelude.Text
getKeyRotationStatus_keyId :: Lens' GetKeyRotationStatus Text
getKeyRotationStatus_keyId = 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 :: (Service -> Service)
-> GetKeyRotationStatus -> Request GetKeyRotationStatus
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 GetKeyRotationStatus
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetKeyRotationStatus)))
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 Bool -> Int -> GetKeyRotationStatusResponse
GetKeyRotationStatusResponse'
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
"KeyRotationEnabled")
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 GetKeyRotationStatus where
hashWithSalt :: Int -> GetKeyRotationStatus -> Int
hashWithSalt Int
_salt GetKeyRotationStatus' {Text
keyId :: Text
$sel:keyId:GetKeyRotationStatus' :: GetKeyRotationStatus -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
keyId
instance Prelude.NFData GetKeyRotationStatus where
rnf :: GetKeyRotationStatus -> ()
rnf GetKeyRotationStatus' {Text
keyId :: Text
$sel:keyId:GetKeyRotationStatus' :: GetKeyRotationStatus -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
keyId
instance Data.ToHeaders GetKeyRotationStatus where
toHeaders :: GetKeyRotationStatus -> 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.GetKeyRotationStatus" ::
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 GetKeyRotationStatus where
toJSON :: GetKeyRotationStatus -> Value
toJSON GetKeyRotationStatus' {Text
keyId :: Text
$sel:keyId:GetKeyRotationStatus' :: GetKeyRotationStatus -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[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 GetKeyRotationStatus where
toPath :: GetKeyRotationStatus -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetKeyRotationStatus where
toQuery :: GetKeyRotationStatus -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:keyRotationEnabled:GetKeyRotationStatusResponse' :: Maybe Bool
keyRotationEnabled =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetKeyRotationStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getKeyRotationStatusResponse_keyRotationEnabled :: Lens.Lens' GetKeyRotationStatusResponse (Prelude.Maybe Prelude.Bool)
getKeyRotationStatusResponse_keyRotationEnabled :: Lens' GetKeyRotationStatusResponse (Maybe Bool)
getKeyRotationStatusResponse_keyRotationEnabled = 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 :: Lens' GetKeyRotationStatusResponse Int
getKeyRotationStatusResponse_httpStatus = 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 where
rnf :: GetKeyRotationStatusResponse -> ()
rnf GetKeyRotationStatusResponse' {Int
Maybe Bool
httpStatus :: Int
keyRotationEnabled :: Maybe Bool
$sel:httpStatus:GetKeyRotationStatusResponse' :: GetKeyRotationStatusResponse -> Int
$sel:keyRotationEnabled:GetKeyRotationStatusResponse' :: GetKeyRotationStatusResponse -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
keyRotationEnabled
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus