{-# 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.M2.Types.PendingMaintenance
-- 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.M2.Types.PendingMaintenance where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.M2.Types.MaintenanceSchedule
import qualified Amazonka.Prelude as Prelude

-- | The scheduled maintenance for a runtime engine.
--
-- /See:/ 'newPendingMaintenance' smart constructor.
data PendingMaintenance = PendingMaintenance'
  { -- | The specific runtime engine that the maintenance schedule applies to.
    PendingMaintenance -> Maybe Text
engineVersion :: Prelude.Maybe Prelude.Text,
    -- | The maintenance schedule for the runtime engine version.
    PendingMaintenance -> Maybe MaintenanceSchedule
schedule :: Prelude.Maybe MaintenanceSchedule
  }
  deriving (PendingMaintenance -> PendingMaintenance -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PendingMaintenance -> PendingMaintenance -> Bool
$c/= :: PendingMaintenance -> PendingMaintenance -> Bool
== :: PendingMaintenance -> PendingMaintenance -> Bool
$c== :: PendingMaintenance -> PendingMaintenance -> Bool
Prelude.Eq, ReadPrec [PendingMaintenance]
ReadPrec PendingMaintenance
Int -> ReadS PendingMaintenance
ReadS [PendingMaintenance]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PendingMaintenance]
$creadListPrec :: ReadPrec [PendingMaintenance]
readPrec :: ReadPrec PendingMaintenance
$creadPrec :: ReadPrec PendingMaintenance
readList :: ReadS [PendingMaintenance]
$creadList :: ReadS [PendingMaintenance]
readsPrec :: Int -> ReadS PendingMaintenance
$creadsPrec :: Int -> ReadS PendingMaintenance
Prelude.Read, Int -> PendingMaintenance -> ShowS
[PendingMaintenance] -> ShowS
PendingMaintenance -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PendingMaintenance] -> ShowS
$cshowList :: [PendingMaintenance] -> ShowS
show :: PendingMaintenance -> String
$cshow :: PendingMaintenance -> String
showsPrec :: Int -> PendingMaintenance -> ShowS
$cshowsPrec :: Int -> PendingMaintenance -> ShowS
Prelude.Show, forall x. Rep PendingMaintenance x -> PendingMaintenance
forall x. PendingMaintenance -> Rep PendingMaintenance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PendingMaintenance x -> PendingMaintenance
$cfrom :: forall x. PendingMaintenance -> Rep PendingMaintenance x
Prelude.Generic)

-- |
-- Create a value of 'PendingMaintenance' 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:
--
-- 'engineVersion', 'pendingMaintenance_engineVersion' - The specific runtime engine that the maintenance schedule applies to.
--
-- 'schedule', 'pendingMaintenance_schedule' - The maintenance schedule for the runtime engine version.
newPendingMaintenance ::
  PendingMaintenance
newPendingMaintenance :: PendingMaintenance
newPendingMaintenance =
  PendingMaintenance'
    { $sel:engineVersion:PendingMaintenance' :: Maybe Text
engineVersion =
        forall a. Maybe a
Prelude.Nothing,
      $sel:schedule:PendingMaintenance' :: Maybe MaintenanceSchedule
schedule = forall a. Maybe a
Prelude.Nothing
    }

-- | The specific runtime engine that the maintenance schedule applies to.
pendingMaintenance_engineVersion :: Lens.Lens' PendingMaintenance (Prelude.Maybe Prelude.Text)
pendingMaintenance_engineVersion :: Lens' PendingMaintenance (Maybe Text)
pendingMaintenance_engineVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingMaintenance' {Maybe Text
engineVersion :: Maybe Text
$sel:engineVersion:PendingMaintenance' :: PendingMaintenance -> Maybe Text
engineVersion} -> Maybe Text
engineVersion) (\s :: PendingMaintenance
s@PendingMaintenance' {} Maybe Text
a -> PendingMaintenance
s {$sel:engineVersion:PendingMaintenance' :: Maybe Text
engineVersion = Maybe Text
a} :: PendingMaintenance)

-- | The maintenance schedule for the runtime engine version.
pendingMaintenance_schedule :: Lens.Lens' PendingMaintenance (Prelude.Maybe MaintenanceSchedule)
pendingMaintenance_schedule :: Lens' PendingMaintenance (Maybe MaintenanceSchedule)
pendingMaintenance_schedule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingMaintenance' {Maybe MaintenanceSchedule
schedule :: Maybe MaintenanceSchedule
$sel:schedule:PendingMaintenance' :: PendingMaintenance -> Maybe MaintenanceSchedule
schedule} -> Maybe MaintenanceSchedule
schedule) (\s :: PendingMaintenance
s@PendingMaintenance' {} Maybe MaintenanceSchedule
a -> PendingMaintenance
s {$sel:schedule:PendingMaintenance' :: Maybe MaintenanceSchedule
schedule = Maybe MaintenanceSchedule
a} :: PendingMaintenance)

instance Data.FromJSON PendingMaintenance where
  parseJSON :: Value -> Parser PendingMaintenance
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PendingMaintenance"
      ( \Object
x ->
          Maybe Text -> Maybe MaintenanceSchedule -> PendingMaintenance
PendingMaintenance'
            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
"engineVersion")
            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
"schedule")
      )

instance Prelude.Hashable PendingMaintenance where
  hashWithSalt :: Int -> PendingMaintenance -> Int
hashWithSalt Int
_salt PendingMaintenance' {Maybe Text
Maybe MaintenanceSchedule
schedule :: Maybe MaintenanceSchedule
engineVersion :: Maybe Text
$sel:schedule:PendingMaintenance' :: PendingMaintenance -> Maybe MaintenanceSchedule
$sel:engineVersion:PendingMaintenance' :: PendingMaintenance -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
engineVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MaintenanceSchedule
schedule

instance Prelude.NFData PendingMaintenance where
  rnf :: PendingMaintenance -> ()
rnf PendingMaintenance' {Maybe Text
Maybe MaintenanceSchedule
schedule :: Maybe MaintenanceSchedule
engineVersion :: Maybe Text
$sel:schedule:PendingMaintenance' :: PendingMaintenance -> Maybe MaintenanceSchedule
$sel:engineVersion:PendingMaintenance' :: PendingMaintenance -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
engineVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MaintenanceSchedule
schedule