{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Amazonka.SecretsManager.Types.RotationRulesType -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) module Amazonka.SecretsManager.Types.RotationRulesType 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 -- | A structure that defines the rotation configuration for the secret. -- -- /See:/ 'newRotationRulesType' smart constructor. data RotationRulesType = RotationRulesType' { -- | The number of days between automatic scheduled rotations of the secret. -- You can use this value to check that your secret meets your compliance -- guidelines for how often secrets must be rotated. -- -- In @DescribeSecret@ and @ListSecrets@, this value is calculated from the -- rotation schedule after every successful rotation. In @RotateSecret@, -- you can set the rotation schedule in @RotationRules@ with -- @AutomaticallyAfterDays@ or @ScheduleExpression@, but not both. To set a -- rotation schedule in hours, use @ScheduleExpression@. RotationRulesType -> Maybe Natural automaticallyAfterDays :: Prelude.Maybe Prelude.Natural, -- | The length of the rotation window in hours, for example @3h@ for a three -- hour window. Secrets Manager rotates your secret at any time during this -- window. The window must not extend into the next rotation window or the -- next UTC day. The window starts according to the @ScheduleExpression@. -- If you don\'t specify a @Duration@, for a @ScheduleExpression@ in hours, -- the window automatically closes after one hour. For a -- @ScheduleExpression@ in days, the window automatically closes at the end -- of the UTC day. For more information, including examples, see -- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_schedule.html Schedule expressions in Secrets Manager rotation> -- in the /Secrets Manager Users Guide/. RotationRulesType -> Maybe Text duration :: Prelude.Maybe Prelude.Text, -- | A @cron()@ or @rate()@ expression that defines the schedule for rotating -- your secret. Secrets Manager rotation schedules use UTC time zone. -- Secrets Manager rotates your secret any time during a rotation window. -- -- Secrets Manager @rate()@ expressions represent the interval in hours or -- days that you want to rotate your secret, for example @rate(12 hours)@ -- or @rate(10 days)@. You can rotate a secret as often as every four -- hours. If you use a @rate()@ expression, the rotation window starts at -- midnight. For a rate in hours, the default rotation window closes after -- one hour. For a rate in days, the default rotation window closes at the -- end of the day. You can set the @Duration@ to change the rotation -- window. The rotation window must not extend into the next UTC day or -- into the next rotation window. -- -- You can use a @cron()@ expression to create a rotation schedule that is -- more detailed than a rotation interval. For more information, including -- examples, see -- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_schedule.html Schedule expressions in Secrets Manager rotation> -- in the /Secrets Manager Users Guide/. For a cron expression that -- represents a schedule in hours, the default rotation window closes after -- one hour. For a cron expression that represents a schedule in days, the -- default rotation window closes at the end of the day. You can set the -- @Duration@ to change the rotation window. The rotation window must not -- extend into the next UTC day or into the next rotation window. RotationRulesType -> Maybe Text scheduleExpression :: Prelude.Maybe Prelude.Text } deriving (RotationRulesType -> RotationRulesType -> Bool forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: RotationRulesType -> RotationRulesType -> Bool $c/= :: RotationRulesType -> RotationRulesType -> Bool == :: RotationRulesType -> RotationRulesType -> Bool $c== :: RotationRulesType -> RotationRulesType -> Bool Prelude.Eq, ReadPrec [RotationRulesType] ReadPrec RotationRulesType Int -> ReadS RotationRulesType ReadS [RotationRulesType] forall a. (Int -> ReadS a) -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a readListPrec :: ReadPrec [RotationRulesType] $creadListPrec :: ReadPrec [RotationRulesType] readPrec :: ReadPrec RotationRulesType $creadPrec :: ReadPrec RotationRulesType readList :: ReadS [RotationRulesType] $creadList :: ReadS [RotationRulesType] readsPrec :: Int -> ReadS RotationRulesType $creadsPrec :: Int -> ReadS RotationRulesType Prelude.Read, Int -> RotationRulesType -> ShowS [RotationRulesType] -> ShowS RotationRulesType -> String forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [RotationRulesType] -> ShowS $cshowList :: [RotationRulesType] -> ShowS show :: RotationRulesType -> String $cshow :: RotationRulesType -> String showsPrec :: Int -> RotationRulesType -> ShowS $cshowsPrec :: Int -> RotationRulesType -> ShowS Prelude.Show, forall x. Rep RotationRulesType x -> RotationRulesType forall x. RotationRulesType -> Rep RotationRulesType x forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a $cto :: forall x. Rep RotationRulesType x -> RotationRulesType $cfrom :: forall x. RotationRulesType -> Rep RotationRulesType x Prelude.Generic) -- | -- Create a value of 'RotationRulesType' with all optional fields omitted. -- -- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'automaticallyAfterDays', 'rotationRulesType_automaticallyAfterDays' - The number of days between automatic scheduled rotations of the secret. -- You can use this value to check that your secret meets your compliance -- guidelines for how often secrets must be rotated. -- -- In @DescribeSecret@ and @ListSecrets@, this value is calculated from the -- rotation schedule after every successful rotation. In @RotateSecret@, -- you can set the rotation schedule in @RotationRules@ with -- @AutomaticallyAfterDays@ or @ScheduleExpression@, but not both. To set a -- rotation schedule in hours, use @ScheduleExpression@. -- -- 'duration', 'rotationRulesType_duration' - The length of the rotation window in hours, for example @3h@ for a three -- hour window. Secrets Manager rotates your secret at any time during this -- window. The window must not extend into the next rotation window or the -- next UTC day. The window starts according to the @ScheduleExpression@. -- If you don\'t specify a @Duration@, for a @ScheduleExpression@ in hours, -- the window automatically closes after one hour. For a -- @ScheduleExpression@ in days, the window automatically closes at the end -- of the UTC day. For more information, including examples, see -- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_schedule.html Schedule expressions in Secrets Manager rotation> -- in the /Secrets Manager Users Guide/. -- -- 'scheduleExpression', 'rotationRulesType_scheduleExpression' - A @cron()@ or @rate()@ expression that defines the schedule for rotating -- your secret. Secrets Manager rotation schedules use UTC time zone. -- Secrets Manager rotates your secret any time during a rotation window. -- -- Secrets Manager @rate()@ expressions represent the interval in hours or -- days that you want to rotate your secret, for example @rate(12 hours)@ -- or @rate(10 days)@. You can rotate a secret as often as every four -- hours. If you use a @rate()@ expression, the rotation window starts at -- midnight. For a rate in hours, the default rotation window closes after -- one hour. For a rate in days, the default rotation window closes at the -- end of the day. You can set the @Duration@ to change the rotation -- window. The rotation window must not extend into the next UTC day or -- into the next rotation window. -- -- You can use a @cron()@ expression to create a rotation schedule that is -- more detailed than a rotation interval. For more information, including -- examples, see -- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_schedule.html Schedule expressions in Secrets Manager rotation> -- in the /Secrets Manager Users Guide/. For a cron expression that -- represents a schedule in hours, the default rotation window closes after -- one hour. For a cron expression that represents a schedule in days, the -- default rotation window closes at the end of the day. You can set the -- @Duration@ to change the rotation window. The rotation window must not -- extend into the next UTC day or into the next rotation window. newRotationRulesType :: RotationRulesType newRotationRulesType :: RotationRulesType newRotationRulesType = RotationRulesType' { $sel:automaticallyAfterDays:RotationRulesType' :: Maybe Natural automaticallyAfterDays = forall a. Maybe a Prelude.Nothing, $sel:duration:RotationRulesType' :: Maybe Text duration = forall a. Maybe a Prelude.Nothing, $sel:scheduleExpression:RotationRulesType' :: Maybe Text scheduleExpression = forall a. Maybe a Prelude.Nothing } -- | The number of days between automatic scheduled rotations of the secret. -- You can use this value to check that your secret meets your compliance -- guidelines for how often secrets must be rotated. -- -- In @DescribeSecret@ and @ListSecrets@, this value is calculated from the -- rotation schedule after every successful rotation. In @RotateSecret@, -- you can set the rotation schedule in @RotationRules@ with -- @AutomaticallyAfterDays@ or @ScheduleExpression@, but not both. To set a -- rotation schedule in hours, use @ScheduleExpression@. rotationRulesType_automaticallyAfterDays :: Lens.Lens' RotationRulesType (Prelude.Maybe Prelude.Natural) rotationRulesType_automaticallyAfterDays :: Lens' RotationRulesType (Maybe Natural) rotationRulesType_automaticallyAfterDays = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\RotationRulesType' {Maybe Natural automaticallyAfterDays :: Maybe Natural $sel:automaticallyAfterDays:RotationRulesType' :: RotationRulesType -> Maybe Natural automaticallyAfterDays} -> Maybe Natural automaticallyAfterDays) (\s :: RotationRulesType s@RotationRulesType' {} Maybe Natural a -> RotationRulesType s {$sel:automaticallyAfterDays:RotationRulesType' :: Maybe Natural automaticallyAfterDays = Maybe Natural a} :: RotationRulesType) -- | The length of the rotation window in hours, for example @3h@ for a three -- hour window. Secrets Manager rotates your secret at any time during this -- window. The window must not extend into the next rotation window or the -- next UTC day. The window starts according to the @ScheduleExpression@. -- If you don\'t specify a @Duration@, for a @ScheduleExpression@ in hours, -- the window automatically closes after one hour. For a -- @ScheduleExpression@ in days, the window automatically closes at the end -- of the UTC day. For more information, including examples, see -- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_schedule.html Schedule expressions in Secrets Manager rotation> -- in the /Secrets Manager Users Guide/. rotationRulesType_duration :: Lens.Lens' RotationRulesType (Prelude.Maybe Prelude.Text) rotationRulesType_duration :: Lens' RotationRulesType (Maybe Text) rotationRulesType_duration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\RotationRulesType' {Maybe Text duration :: Maybe Text $sel:duration:RotationRulesType' :: RotationRulesType -> Maybe Text duration} -> Maybe Text duration) (\s :: RotationRulesType s@RotationRulesType' {} Maybe Text a -> RotationRulesType s {$sel:duration:RotationRulesType' :: Maybe Text duration = Maybe Text a} :: RotationRulesType) -- | A @cron()@ or @rate()@ expression that defines the schedule for rotating -- your secret. Secrets Manager rotation schedules use UTC time zone. -- Secrets Manager rotates your secret any time during a rotation window. -- -- Secrets Manager @rate()@ expressions represent the interval in hours or -- days that you want to rotate your secret, for example @rate(12 hours)@ -- or @rate(10 days)@. You can rotate a secret as often as every four -- hours. If you use a @rate()@ expression, the rotation window starts at -- midnight. For a rate in hours, the default rotation window closes after -- one hour. For a rate in days, the default rotation window closes at the -- end of the day. You can set the @Duration@ to change the rotation -- window. The rotation window must not extend into the next UTC day or -- into the next rotation window. -- -- You can use a @cron()@ expression to create a rotation schedule that is -- more detailed than a rotation interval. For more information, including -- examples, see -- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_schedule.html Schedule expressions in Secrets Manager rotation> -- in the /Secrets Manager Users Guide/. For a cron expression that -- represents a schedule in hours, the default rotation window closes after -- one hour. For a cron expression that represents a schedule in days, the -- default rotation window closes at the end of the day. You can set the -- @Duration@ to change the rotation window. The rotation window must not -- extend into the next UTC day or into the next rotation window. rotationRulesType_scheduleExpression :: Lens.Lens' RotationRulesType (Prelude.Maybe Prelude.Text) rotationRulesType_scheduleExpression :: Lens' RotationRulesType (Maybe Text) rotationRulesType_scheduleExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\RotationRulesType' {Maybe Text scheduleExpression :: Maybe Text $sel:scheduleExpression:RotationRulesType' :: RotationRulesType -> Maybe Text scheduleExpression} -> Maybe Text scheduleExpression) (\s :: RotationRulesType s@RotationRulesType' {} Maybe Text a -> RotationRulesType s {$sel:scheduleExpression:RotationRulesType' :: Maybe Text scheduleExpression = Maybe Text a} :: RotationRulesType) instance Data.FromJSON RotationRulesType where parseJSON :: Value -> Parser RotationRulesType parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a Data.withObject String "RotationRulesType" ( \Object x -> Maybe Natural -> Maybe Text -> Maybe Text -> RotationRulesType RotationRulesType' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b Prelude.<$> (Object x forall a. FromJSON a => Object -> Key -> Parser (Maybe a) Data..:? Key "AutomaticallyAfterDays") forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b Prelude.<*> (Object x forall a. FromJSON a => Object -> Key -> Parser (Maybe a) Data..:? Key "Duration") forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b Prelude.<*> (Object x forall a. FromJSON a => Object -> Key -> Parser (Maybe a) Data..:? Key "ScheduleExpression") ) instance Prelude.Hashable RotationRulesType where hashWithSalt :: Int -> RotationRulesType -> Int hashWithSalt Int _salt RotationRulesType' {Maybe Natural Maybe Text scheduleExpression :: Maybe Text duration :: Maybe Text automaticallyAfterDays :: Maybe Natural $sel:scheduleExpression:RotationRulesType' :: RotationRulesType -> Maybe Text $sel:duration:RotationRulesType' :: RotationRulesType -> Maybe Text $sel:automaticallyAfterDays:RotationRulesType' :: RotationRulesType -> Maybe Natural ..} = Int _salt forall a. Hashable a => Int -> a -> Int `Prelude.hashWithSalt` Maybe Natural automaticallyAfterDays forall a. Hashable a => Int -> a -> Int `Prelude.hashWithSalt` Maybe Text duration forall a. Hashable a => Int -> a -> Int `Prelude.hashWithSalt` Maybe Text scheduleExpression instance Prelude.NFData RotationRulesType where rnf :: RotationRulesType -> () rnf RotationRulesType' {Maybe Natural Maybe Text scheduleExpression :: Maybe Text duration :: Maybe Text automaticallyAfterDays :: Maybe Natural $sel:scheduleExpression:RotationRulesType' :: RotationRulesType -> Maybe Text $sel:duration:RotationRulesType' :: RotationRulesType -> Maybe Text $sel:automaticallyAfterDays:RotationRulesType' :: RotationRulesType -> Maybe Natural ..} = forall a. NFData a => a -> () Prelude.rnf Maybe Natural automaticallyAfterDays seq :: forall a b. a -> b -> b `Prelude.seq` forall a. NFData a => a -> () Prelude.rnf Maybe Text duration seq :: forall a b. a -> b -> b `Prelude.seq` forall a. NFData a => a -> () Prelude.rnf Maybe Text scheduleExpression instance Data.ToJSON RotationRulesType where toJSON :: RotationRulesType -> Value toJSON RotationRulesType' {Maybe Natural Maybe Text scheduleExpression :: Maybe Text duration :: Maybe Text automaticallyAfterDays :: Maybe Natural $sel:scheduleExpression:RotationRulesType' :: RotationRulesType -> Maybe Text $sel:duration:RotationRulesType' :: RotationRulesType -> Maybe Text $sel:automaticallyAfterDays:RotationRulesType' :: RotationRulesType -> Maybe Natural ..} = [Pair] -> Value Data.object ( forall a. [Maybe a] -> [a] Prelude.catMaybes [ (Key "AutomaticallyAfterDays" 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 automaticallyAfterDays, (Key "Duration" 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 duration, (Key "ScheduleExpression" 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 scheduleExpression ] )