{-# 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.SecretsManager.RotateSecret
(
RotateSecret (..),
newRotateSecret,
rotateSecret_clientRequestToken,
rotateSecret_rotateImmediately,
rotateSecret_rotationLambdaARN,
rotateSecret_rotationRules,
rotateSecret_secretId,
RotateSecretResponse (..),
newRotateSecretResponse,
rotateSecretResponse_arn,
rotateSecretResponse_name,
rotateSecretResponse_versionId,
rotateSecretResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SecretsManager.Types
data RotateSecret = RotateSecret'
{
RotateSecret -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
RotateSecret -> Maybe Bool
rotateImmediately :: Prelude.Maybe Prelude.Bool,
RotateSecret -> Maybe Text
rotationLambdaARN :: Prelude.Maybe Prelude.Text,
RotateSecret -> Maybe RotationRulesType
rotationRules :: Prelude.Maybe RotationRulesType,
RotateSecret -> Text
secretId :: Prelude.Text
}
deriving (RotateSecret -> RotateSecret -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RotateSecret -> RotateSecret -> Bool
$c/= :: RotateSecret -> RotateSecret -> Bool
== :: RotateSecret -> RotateSecret -> Bool
$c== :: RotateSecret -> RotateSecret -> Bool
Prelude.Eq, ReadPrec [RotateSecret]
ReadPrec RotateSecret
Int -> ReadS RotateSecret
ReadS [RotateSecret]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RotateSecret]
$creadListPrec :: ReadPrec [RotateSecret]
readPrec :: ReadPrec RotateSecret
$creadPrec :: ReadPrec RotateSecret
readList :: ReadS [RotateSecret]
$creadList :: ReadS [RotateSecret]
readsPrec :: Int -> ReadS RotateSecret
$creadsPrec :: Int -> ReadS RotateSecret
Prelude.Read, Int -> RotateSecret -> ShowS
[RotateSecret] -> ShowS
RotateSecret -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RotateSecret] -> ShowS
$cshowList :: [RotateSecret] -> ShowS
show :: RotateSecret -> String
$cshow :: RotateSecret -> String
showsPrec :: Int -> RotateSecret -> ShowS
$cshowsPrec :: Int -> RotateSecret -> ShowS
Prelude.Show, forall x. Rep RotateSecret x -> RotateSecret
forall x. RotateSecret -> Rep RotateSecret x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RotateSecret x -> RotateSecret
$cfrom :: forall x. RotateSecret -> Rep RotateSecret x
Prelude.Generic)
newRotateSecret ::
Prelude.Text ->
RotateSecret
newRotateSecret :: Text -> RotateSecret
newRotateSecret Text
pSecretId_ =
RotateSecret'
{ $sel:clientRequestToken:RotateSecret' :: Maybe Text
clientRequestToken = forall a. Maybe a
Prelude.Nothing,
$sel:rotateImmediately:RotateSecret' :: Maybe Bool
rotateImmediately = forall a. Maybe a
Prelude.Nothing,
$sel:rotationLambdaARN:RotateSecret' :: Maybe Text
rotationLambdaARN = forall a. Maybe a
Prelude.Nothing,
$sel:rotationRules:RotateSecret' :: Maybe RotationRulesType
rotationRules = forall a. Maybe a
Prelude.Nothing,
$sel:secretId:RotateSecret' :: Text
secretId = Text
pSecretId_
}
rotateSecret_clientRequestToken :: Lens.Lens' RotateSecret (Prelude.Maybe Prelude.Text)
rotateSecret_clientRequestToken :: Lens' RotateSecret (Maybe Text)
rotateSecret_clientRequestToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecret' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:RotateSecret' :: RotateSecret -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: RotateSecret
s@RotateSecret' {} Maybe Text
a -> RotateSecret
s {$sel:clientRequestToken:RotateSecret' :: Maybe Text
clientRequestToken = Maybe Text
a} :: RotateSecret)
rotateSecret_rotateImmediately :: Lens.Lens' RotateSecret (Prelude.Maybe Prelude.Bool)
rotateSecret_rotateImmediately :: Lens' RotateSecret (Maybe Bool)
rotateSecret_rotateImmediately = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecret' {Maybe Bool
rotateImmediately :: Maybe Bool
$sel:rotateImmediately:RotateSecret' :: RotateSecret -> Maybe Bool
rotateImmediately} -> Maybe Bool
rotateImmediately) (\s :: RotateSecret
s@RotateSecret' {} Maybe Bool
a -> RotateSecret
s {$sel:rotateImmediately:RotateSecret' :: Maybe Bool
rotateImmediately = Maybe Bool
a} :: RotateSecret)
rotateSecret_rotationLambdaARN :: Lens.Lens' RotateSecret (Prelude.Maybe Prelude.Text)
rotateSecret_rotationLambdaARN :: Lens' RotateSecret (Maybe Text)
rotateSecret_rotationLambdaARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecret' {Maybe Text
rotationLambdaARN :: Maybe Text
$sel:rotationLambdaARN:RotateSecret' :: RotateSecret -> Maybe Text
rotationLambdaARN} -> Maybe Text
rotationLambdaARN) (\s :: RotateSecret
s@RotateSecret' {} Maybe Text
a -> RotateSecret
s {$sel:rotationLambdaARN:RotateSecret' :: Maybe Text
rotationLambdaARN = Maybe Text
a} :: RotateSecret)
rotateSecret_rotationRules :: Lens.Lens' RotateSecret (Prelude.Maybe RotationRulesType)
rotateSecret_rotationRules :: Lens' RotateSecret (Maybe RotationRulesType)
rotateSecret_rotationRules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecret' {Maybe RotationRulesType
rotationRules :: Maybe RotationRulesType
$sel:rotationRules:RotateSecret' :: RotateSecret -> Maybe RotationRulesType
rotationRules} -> Maybe RotationRulesType
rotationRules) (\s :: RotateSecret
s@RotateSecret' {} Maybe RotationRulesType
a -> RotateSecret
s {$sel:rotationRules:RotateSecret' :: Maybe RotationRulesType
rotationRules = Maybe RotationRulesType
a} :: RotateSecret)
rotateSecret_secretId :: Lens.Lens' RotateSecret Prelude.Text
rotateSecret_secretId :: Lens' RotateSecret Text
rotateSecret_secretId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecret' {Text
secretId :: Text
$sel:secretId:RotateSecret' :: RotateSecret -> Text
secretId} -> Text
secretId) (\s :: RotateSecret
s@RotateSecret' {} Text
a -> RotateSecret
s {$sel:secretId:RotateSecret' :: Text
secretId = Text
a} :: RotateSecret)
instance Core.AWSRequest RotateSecret where
type AWSResponse RotateSecret = RotateSecretResponse
request :: (Service -> Service) -> RotateSecret -> Request RotateSecret
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 RotateSecret
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RotateSecret)))
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 Text
-> Maybe Text -> Maybe Text -> Int -> RotateSecretResponse
RotateSecretResponse'
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
"ARN")
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
"Name")
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
"VersionId")
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 RotateSecret where
hashWithSalt :: Int -> RotateSecret -> Int
hashWithSalt Int
_salt RotateSecret' {Maybe Bool
Maybe Text
Maybe RotationRulesType
Text
secretId :: Text
rotationRules :: Maybe RotationRulesType
rotationLambdaARN :: Maybe Text
rotateImmediately :: Maybe Bool
clientRequestToken :: Maybe Text
$sel:secretId:RotateSecret' :: RotateSecret -> Text
$sel:rotationRules:RotateSecret' :: RotateSecret -> Maybe RotationRulesType
$sel:rotationLambdaARN:RotateSecret' :: RotateSecret -> Maybe Text
$sel:rotateImmediately:RotateSecret' :: RotateSecret -> Maybe Bool
$sel:clientRequestToken:RotateSecret' :: RotateSecret -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientRequestToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
rotateImmediately
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
rotationLambdaARN
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RotationRulesType
rotationRules
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
secretId
instance Prelude.NFData RotateSecret where
rnf :: RotateSecret -> ()
rnf RotateSecret' {Maybe Bool
Maybe Text
Maybe RotationRulesType
Text
secretId :: Text
rotationRules :: Maybe RotationRulesType
rotationLambdaARN :: Maybe Text
rotateImmediately :: Maybe Bool
clientRequestToken :: Maybe Text
$sel:secretId:RotateSecret' :: RotateSecret -> Text
$sel:rotationRules:RotateSecret' :: RotateSecret -> Maybe RotationRulesType
$sel:rotationLambdaARN:RotateSecret' :: RotateSecret -> Maybe Text
$sel:rotateImmediately:RotateSecret' :: RotateSecret -> Maybe Bool
$sel:clientRequestToken:RotateSecret' :: RotateSecret -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientRequestToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
rotateImmediately
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
rotationLambdaARN
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RotationRulesType
rotationRules
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
secretId
instance Data.ToHeaders RotateSecret where
toHeaders :: RotateSecret -> 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
"secretsmanager.RotateSecret" ::
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 RotateSecret where
toJSON :: RotateSecret -> Value
toJSON RotateSecret' {Maybe Bool
Maybe Text
Maybe RotationRulesType
Text
secretId :: Text
rotationRules :: Maybe RotationRulesType
rotationLambdaARN :: Maybe Text
rotateImmediately :: Maybe Bool
clientRequestToken :: Maybe Text
$sel:secretId:RotateSecret' :: RotateSecret -> Text
$sel:rotationRules:RotateSecret' :: RotateSecret -> Maybe RotationRulesType
$sel:rotationLambdaARN:RotateSecret' :: RotateSecret -> Maybe Text
$sel:rotateImmediately:RotateSecret' :: RotateSecret -> Maybe Bool
$sel:clientRequestToken:RotateSecret' :: RotateSecret -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ClientRequestToken" 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 Text
clientRequestToken,
(Key
"RotateImmediately" 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 Bool
rotateImmediately,
(Key
"RotationLambdaARN" 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 Text
rotationLambdaARN,
(Key
"RotationRules" 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 RotationRulesType
rotationRules,
forall a. a -> Maybe a
Prelude.Just (Key
"SecretId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
secretId)
]
)
instance Data.ToPath RotateSecret where
toPath :: RotateSecret -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery RotateSecret where
toQuery :: RotateSecret -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data RotateSecretResponse = RotateSecretResponse'
{
RotateSecretResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
RotateSecretResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
RotateSecretResponse -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
RotateSecretResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RotateSecretResponse -> RotateSecretResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RotateSecretResponse -> RotateSecretResponse -> Bool
$c/= :: RotateSecretResponse -> RotateSecretResponse -> Bool
== :: RotateSecretResponse -> RotateSecretResponse -> Bool
$c== :: RotateSecretResponse -> RotateSecretResponse -> Bool
Prelude.Eq, ReadPrec [RotateSecretResponse]
ReadPrec RotateSecretResponse
Int -> ReadS RotateSecretResponse
ReadS [RotateSecretResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RotateSecretResponse]
$creadListPrec :: ReadPrec [RotateSecretResponse]
readPrec :: ReadPrec RotateSecretResponse
$creadPrec :: ReadPrec RotateSecretResponse
readList :: ReadS [RotateSecretResponse]
$creadList :: ReadS [RotateSecretResponse]
readsPrec :: Int -> ReadS RotateSecretResponse
$creadsPrec :: Int -> ReadS RotateSecretResponse
Prelude.Read, Int -> RotateSecretResponse -> ShowS
[RotateSecretResponse] -> ShowS
RotateSecretResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RotateSecretResponse] -> ShowS
$cshowList :: [RotateSecretResponse] -> ShowS
show :: RotateSecretResponse -> String
$cshow :: RotateSecretResponse -> String
showsPrec :: Int -> RotateSecretResponse -> ShowS
$cshowsPrec :: Int -> RotateSecretResponse -> ShowS
Prelude.Show, forall x. Rep RotateSecretResponse x -> RotateSecretResponse
forall x. RotateSecretResponse -> Rep RotateSecretResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RotateSecretResponse x -> RotateSecretResponse
$cfrom :: forall x. RotateSecretResponse -> Rep RotateSecretResponse x
Prelude.Generic)
newRotateSecretResponse ::
Prelude.Int ->
RotateSecretResponse
newRotateSecretResponse :: Int -> RotateSecretResponse
newRotateSecretResponse Int
pHttpStatus_ =
RotateSecretResponse'
{ $sel:arn:RotateSecretResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
$sel:name:RotateSecretResponse' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:versionId:RotateSecretResponse' :: Maybe Text
versionId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RotateSecretResponse' :: Int
httpStatus = Int
pHttpStatus_
}
rotateSecretResponse_arn :: Lens.Lens' RotateSecretResponse (Prelude.Maybe Prelude.Text)
rotateSecretResponse_arn :: Lens' RotateSecretResponse (Maybe Text)
rotateSecretResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecretResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:RotateSecretResponse' :: RotateSecretResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: RotateSecretResponse
s@RotateSecretResponse' {} Maybe Text
a -> RotateSecretResponse
s {$sel:arn:RotateSecretResponse' :: Maybe Text
arn = Maybe Text
a} :: RotateSecretResponse)
rotateSecretResponse_name :: Lens.Lens' RotateSecretResponse (Prelude.Maybe Prelude.Text)
rotateSecretResponse_name :: Lens' RotateSecretResponse (Maybe Text)
rotateSecretResponse_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecretResponse' {Maybe Text
name :: Maybe Text
$sel:name:RotateSecretResponse' :: RotateSecretResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: RotateSecretResponse
s@RotateSecretResponse' {} Maybe Text
a -> RotateSecretResponse
s {$sel:name:RotateSecretResponse' :: Maybe Text
name = Maybe Text
a} :: RotateSecretResponse)
rotateSecretResponse_versionId :: Lens.Lens' RotateSecretResponse (Prelude.Maybe Prelude.Text)
rotateSecretResponse_versionId :: Lens' RotateSecretResponse (Maybe Text)
rotateSecretResponse_versionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecretResponse' {Maybe Text
versionId :: Maybe Text
$sel:versionId:RotateSecretResponse' :: RotateSecretResponse -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: RotateSecretResponse
s@RotateSecretResponse' {} Maybe Text
a -> RotateSecretResponse
s {$sel:versionId:RotateSecretResponse' :: Maybe Text
versionId = Maybe Text
a} :: RotateSecretResponse)
rotateSecretResponse_httpStatus :: Lens.Lens' RotateSecretResponse Prelude.Int
rotateSecretResponse_httpStatus :: Lens' RotateSecretResponse Int
rotateSecretResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RotateSecretResponse' {Int
httpStatus :: Int
$sel:httpStatus:RotateSecretResponse' :: RotateSecretResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RotateSecretResponse
s@RotateSecretResponse' {} Int
a -> RotateSecretResponse
s {$sel:httpStatus:RotateSecretResponse' :: Int
httpStatus = Int
a} :: RotateSecretResponse)
instance Prelude.NFData RotateSecretResponse where
rnf :: RotateSecretResponse -> ()
rnf RotateSecretResponse' {Int
Maybe Text
httpStatus :: Int
versionId :: Maybe Text
name :: Maybe Text
arn :: Maybe Text
$sel:httpStatus:RotateSecretResponse' :: RotateSecretResponse -> Int
$sel:versionId:RotateSecretResponse' :: RotateSecretResponse -> Maybe Text
$sel:name:RotateSecretResponse' :: RotateSecretResponse -> Maybe Text
$sel:arn:RotateSecretResponse' :: RotateSecretResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus