{-# 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.RDS.Types.PendingMaintenanceAction
-- 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.RDS.Types.PendingMaintenanceAction 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

-- | Provides information about a pending maintenance action for a resource.
--
-- /See:/ 'newPendingMaintenanceAction' smart constructor.
data PendingMaintenanceAction = PendingMaintenanceAction'
  { -- | The type of pending maintenance action that is available for the
    -- resource. Valid actions are @system-update@, @db-upgrade@,
    -- @hardware-maintenance@, and @ca-certificate-rotation@.
    PendingMaintenanceAction -> Maybe Text
action :: Prelude.Maybe Prelude.Text,
    -- | The date of the maintenance window when the action is applied. The
    -- maintenance action is applied to the resource during its first
    -- maintenance window after this date.
    PendingMaintenanceAction -> Maybe ISO8601
autoAppliedAfterDate :: Prelude.Maybe Data.ISO8601,
    -- | The effective date when the pending maintenance action is applied to the
    -- resource. This date takes into account opt-in requests received from the
    -- @ApplyPendingMaintenanceAction@ API, the @AutoAppliedAfterDate@, and the
    -- @ForcedApplyDate@. This value is blank if an opt-in request has not been
    -- received and nothing has been specified as @AutoAppliedAfterDate@ or
    -- @ForcedApplyDate@.
    PendingMaintenanceAction -> Maybe ISO8601
currentApplyDate :: Prelude.Maybe Data.ISO8601,
    -- | A description providing more detail about the maintenance action.
    PendingMaintenanceAction -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The date when the maintenance action is automatically applied.
    --
    -- On this date, the maintenance action is applied to the resource as soon
    -- as possible, regardless of the maintenance window for the resource.
    -- There might be a delay of one or more days from this date before the
    -- maintenance action is applied.
    PendingMaintenanceAction -> Maybe ISO8601
forcedApplyDate :: Prelude.Maybe Data.ISO8601,
    -- | Indicates the type of opt-in request that has been received for the
    -- resource.
    PendingMaintenanceAction -> Maybe Text
optInStatus :: Prelude.Maybe Prelude.Text
  }
  deriving (PendingMaintenanceAction -> PendingMaintenanceAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PendingMaintenanceAction -> PendingMaintenanceAction -> Bool
$c/= :: PendingMaintenanceAction -> PendingMaintenanceAction -> Bool
== :: PendingMaintenanceAction -> PendingMaintenanceAction -> Bool
$c== :: PendingMaintenanceAction -> PendingMaintenanceAction -> Bool
Prelude.Eq, ReadPrec [PendingMaintenanceAction]
ReadPrec PendingMaintenanceAction
Int -> ReadS PendingMaintenanceAction
ReadS [PendingMaintenanceAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PendingMaintenanceAction]
$creadListPrec :: ReadPrec [PendingMaintenanceAction]
readPrec :: ReadPrec PendingMaintenanceAction
$creadPrec :: ReadPrec PendingMaintenanceAction
readList :: ReadS [PendingMaintenanceAction]
$creadList :: ReadS [PendingMaintenanceAction]
readsPrec :: Int -> ReadS PendingMaintenanceAction
$creadsPrec :: Int -> ReadS PendingMaintenanceAction
Prelude.Read, Int -> PendingMaintenanceAction -> ShowS
[PendingMaintenanceAction] -> ShowS
PendingMaintenanceAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PendingMaintenanceAction] -> ShowS
$cshowList :: [PendingMaintenanceAction] -> ShowS
show :: PendingMaintenanceAction -> String
$cshow :: PendingMaintenanceAction -> String
showsPrec :: Int -> PendingMaintenanceAction -> ShowS
$cshowsPrec :: Int -> PendingMaintenanceAction -> ShowS
Prelude.Show, forall x.
Rep PendingMaintenanceAction x -> PendingMaintenanceAction
forall x.
PendingMaintenanceAction -> Rep PendingMaintenanceAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PendingMaintenanceAction x -> PendingMaintenanceAction
$cfrom :: forall x.
PendingMaintenanceAction -> Rep PendingMaintenanceAction x
Prelude.Generic)

-- |
-- Create a value of 'PendingMaintenanceAction' 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:
--
-- 'action', 'pendingMaintenanceAction_action' - The type of pending maintenance action that is available for the
-- resource. Valid actions are @system-update@, @db-upgrade@,
-- @hardware-maintenance@, and @ca-certificate-rotation@.
--
-- 'autoAppliedAfterDate', 'pendingMaintenanceAction_autoAppliedAfterDate' - The date of the maintenance window when the action is applied. The
-- maintenance action is applied to the resource during its first
-- maintenance window after this date.
--
-- 'currentApplyDate', 'pendingMaintenanceAction_currentApplyDate' - The effective date when the pending maintenance action is applied to the
-- resource. This date takes into account opt-in requests received from the
-- @ApplyPendingMaintenanceAction@ API, the @AutoAppliedAfterDate@, and the
-- @ForcedApplyDate@. This value is blank if an opt-in request has not been
-- received and nothing has been specified as @AutoAppliedAfterDate@ or
-- @ForcedApplyDate@.
--
-- 'description', 'pendingMaintenanceAction_description' - A description providing more detail about the maintenance action.
--
-- 'forcedApplyDate', 'pendingMaintenanceAction_forcedApplyDate' - The date when the maintenance action is automatically applied.
--
-- On this date, the maintenance action is applied to the resource as soon
-- as possible, regardless of the maintenance window for the resource.
-- There might be a delay of one or more days from this date before the
-- maintenance action is applied.
--
-- 'optInStatus', 'pendingMaintenanceAction_optInStatus' - Indicates the type of opt-in request that has been received for the
-- resource.
newPendingMaintenanceAction ::
  PendingMaintenanceAction
newPendingMaintenanceAction :: PendingMaintenanceAction
newPendingMaintenanceAction =
  PendingMaintenanceAction'
    { $sel:action:PendingMaintenanceAction' :: Maybe Text
action = forall a. Maybe a
Prelude.Nothing,
      $sel:autoAppliedAfterDate:PendingMaintenanceAction' :: Maybe ISO8601
autoAppliedAfterDate = forall a. Maybe a
Prelude.Nothing,
      $sel:currentApplyDate:PendingMaintenanceAction' :: Maybe ISO8601
currentApplyDate = forall a. Maybe a
Prelude.Nothing,
      $sel:description:PendingMaintenanceAction' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:forcedApplyDate:PendingMaintenanceAction' :: Maybe ISO8601
forcedApplyDate = forall a. Maybe a
Prelude.Nothing,
      $sel:optInStatus:PendingMaintenanceAction' :: Maybe Text
optInStatus = forall a. Maybe a
Prelude.Nothing
    }

-- | The type of pending maintenance action that is available for the
-- resource. Valid actions are @system-update@, @db-upgrade@,
-- @hardware-maintenance@, and @ca-certificate-rotation@.
pendingMaintenanceAction_action :: Lens.Lens' PendingMaintenanceAction (Prelude.Maybe Prelude.Text)
pendingMaintenanceAction_action :: Lens' PendingMaintenanceAction (Maybe Text)
pendingMaintenanceAction_action = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingMaintenanceAction' {Maybe Text
action :: Maybe Text
$sel:action:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe Text
action} -> Maybe Text
action) (\s :: PendingMaintenanceAction
s@PendingMaintenanceAction' {} Maybe Text
a -> PendingMaintenanceAction
s {$sel:action:PendingMaintenanceAction' :: Maybe Text
action = Maybe Text
a} :: PendingMaintenanceAction)

-- | The date of the maintenance window when the action is applied. The
-- maintenance action is applied to the resource during its first
-- maintenance window after this date.
pendingMaintenanceAction_autoAppliedAfterDate :: Lens.Lens' PendingMaintenanceAction (Prelude.Maybe Prelude.UTCTime)
pendingMaintenanceAction_autoAppliedAfterDate :: Lens' PendingMaintenanceAction (Maybe UTCTime)
pendingMaintenanceAction_autoAppliedAfterDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingMaintenanceAction' {Maybe ISO8601
autoAppliedAfterDate :: Maybe ISO8601
$sel:autoAppliedAfterDate:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe ISO8601
autoAppliedAfterDate} -> Maybe ISO8601
autoAppliedAfterDate) (\s :: PendingMaintenanceAction
s@PendingMaintenanceAction' {} Maybe ISO8601
a -> PendingMaintenanceAction
s {$sel:autoAppliedAfterDate:PendingMaintenanceAction' :: Maybe ISO8601
autoAppliedAfterDate = Maybe ISO8601
a} :: PendingMaintenanceAction) 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

-- | The effective date when the pending maintenance action is applied to the
-- resource. This date takes into account opt-in requests received from the
-- @ApplyPendingMaintenanceAction@ API, the @AutoAppliedAfterDate@, and the
-- @ForcedApplyDate@. This value is blank if an opt-in request has not been
-- received and nothing has been specified as @AutoAppliedAfterDate@ or
-- @ForcedApplyDate@.
pendingMaintenanceAction_currentApplyDate :: Lens.Lens' PendingMaintenanceAction (Prelude.Maybe Prelude.UTCTime)
pendingMaintenanceAction_currentApplyDate :: Lens' PendingMaintenanceAction (Maybe UTCTime)
pendingMaintenanceAction_currentApplyDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingMaintenanceAction' {Maybe ISO8601
currentApplyDate :: Maybe ISO8601
$sel:currentApplyDate:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe ISO8601
currentApplyDate} -> Maybe ISO8601
currentApplyDate) (\s :: PendingMaintenanceAction
s@PendingMaintenanceAction' {} Maybe ISO8601
a -> PendingMaintenanceAction
s {$sel:currentApplyDate:PendingMaintenanceAction' :: Maybe ISO8601
currentApplyDate = Maybe ISO8601
a} :: PendingMaintenanceAction) 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

-- | A description providing more detail about the maintenance action.
pendingMaintenanceAction_description :: Lens.Lens' PendingMaintenanceAction (Prelude.Maybe Prelude.Text)
pendingMaintenanceAction_description :: Lens' PendingMaintenanceAction (Maybe Text)
pendingMaintenanceAction_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingMaintenanceAction' {Maybe Text
description :: Maybe Text
$sel:description:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe Text
description} -> Maybe Text
description) (\s :: PendingMaintenanceAction
s@PendingMaintenanceAction' {} Maybe Text
a -> PendingMaintenanceAction
s {$sel:description:PendingMaintenanceAction' :: Maybe Text
description = Maybe Text
a} :: PendingMaintenanceAction)

-- | The date when the maintenance action is automatically applied.
--
-- On this date, the maintenance action is applied to the resource as soon
-- as possible, regardless of the maintenance window for the resource.
-- There might be a delay of one or more days from this date before the
-- maintenance action is applied.
pendingMaintenanceAction_forcedApplyDate :: Lens.Lens' PendingMaintenanceAction (Prelude.Maybe Prelude.UTCTime)
pendingMaintenanceAction_forcedApplyDate :: Lens' PendingMaintenanceAction (Maybe UTCTime)
pendingMaintenanceAction_forcedApplyDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingMaintenanceAction' {Maybe ISO8601
forcedApplyDate :: Maybe ISO8601
$sel:forcedApplyDate:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe ISO8601
forcedApplyDate} -> Maybe ISO8601
forcedApplyDate) (\s :: PendingMaintenanceAction
s@PendingMaintenanceAction' {} Maybe ISO8601
a -> PendingMaintenanceAction
s {$sel:forcedApplyDate:PendingMaintenanceAction' :: Maybe ISO8601
forcedApplyDate = Maybe ISO8601
a} :: PendingMaintenanceAction) 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

-- | Indicates the type of opt-in request that has been received for the
-- resource.
pendingMaintenanceAction_optInStatus :: Lens.Lens' PendingMaintenanceAction (Prelude.Maybe Prelude.Text)
pendingMaintenanceAction_optInStatus :: Lens' PendingMaintenanceAction (Maybe Text)
pendingMaintenanceAction_optInStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingMaintenanceAction' {Maybe Text
optInStatus :: Maybe Text
$sel:optInStatus:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe Text
optInStatus} -> Maybe Text
optInStatus) (\s :: PendingMaintenanceAction
s@PendingMaintenanceAction' {} Maybe Text
a -> PendingMaintenanceAction
s {$sel:optInStatus:PendingMaintenanceAction' :: Maybe Text
optInStatus = Maybe Text
a} :: PendingMaintenanceAction)

instance Data.FromXML PendingMaintenanceAction where
  parseXML :: [Node] -> Either String PendingMaintenanceAction
parseXML [Node]
x =
    Maybe Text
-> Maybe ISO8601
-> Maybe ISO8601
-> Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> PendingMaintenanceAction
PendingMaintenanceAction'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Action")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"AutoAppliedAfterDate")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"CurrentApplyDate")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Description")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ForcedApplyDate")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"OptInStatus")

instance Prelude.Hashable PendingMaintenanceAction where
  hashWithSalt :: Int -> PendingMaintenanceAction -> Int
hashWithSalt Int
_salt PendingMaintenanceAction' {Maybe Text
Maybe ISO8601
optInStatus :: Maybe Text
forcedApplyDate :: Maybe ISO8601
description :: Maybe Text
currentApplyDate :: Maybe ISO8601
autoAppliedAfterDate :: Maybe ISO8601
action :: Maybe Text
$sel:optInStatus:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe Text
$sel:forcedApplyDate:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe ISO8601
$sel:description:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe Text
$sel:currentApplyDate:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe ISO8601
$sel:autoAppliedAfterDate:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe ISO8601
$sel:action:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
action
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
autoAppliedAfterDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
currentApplyDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
forcedApplyDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
optInStatus

instance Prelude.NFData PendingMaintenanceAction where
  rnf :: PendingMaintenanceAction -> ()
rnf PendingMaintenanceAction' {Maybe Text
Maybe ISO8601
optInStatus :: Maybe Text
forcedApplyDate :: Maybe ISO8601
description :: Maybe Text
currentApplyDate :: Maybe ISO8601
autoAppliedAfterDate :: Maybe ISO8601
action :: Maybe Text
$sel:optInStatus:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe Text
$sel:forcedApplyDate:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe ISO8601
$sel:description:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe Text
$sel:currentApplyDate:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe ISO8601
$sel:autoAppliedAfterDate:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe ISO8601
$sel:action:PendingMaintenanceAction' :: PendingMaintenanceAction -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
action
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
autoAppliedAfterDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
currentApplyDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
forcedApplyDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
optInStatus