{-# 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.EC2.Types.HibernationOptions
-- 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.EC2.Types.HibernationOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | Indicates whether your instance is configured for hibernation. This
-- parameter is valid only if the instance meets the
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites hibernation prerequisites>.
-- For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html Hibernate your instance>
-- in the /Amazon EC2 User Guide/.
--
-- /See:/ 'newHibernationOptions' smart constructor.
data HibernationOptions = HibernationOptions'
  { -- | If this parameter is set to @true@, your instance is enabled for
    -- hibernation; otherwise, it is not enabled for hibernation.
    HibernationOptions -> Maybe Bool
configured :: Prelude.Maybe Prelude.Bool
  }
  deriving (HibernationOptions -> HibernationOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HibernationOptions -> HibernationOptions -> Bool
$c/= :: HibernationOptions -> HibernationOptions -> Bool
== :: HibernationOptions -> HibernationOptions -> Bool
$c== :: HibernationOptions -> HibernationOptions -> Bool
Prelude.Eq, ReadPrec [HibernationOptions]
ReadPrec HibernationOptions
Int -> ReadS HibernationOptions
ReadS [HibernationOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HibernationOptions]
$creadListPrec :: ReadPrec [HibernationOptions]
readPrec :: ReadPrec HibernationOptions
$creadPrec :: ReadPrec HibernationOptions
readList :: ReadS [HibernationOptions]
$creadList :: ReadS [HibernationOptions]
readsPrec :: Int -> ReadS HibernationOptions
$creadsPrec :: Int -> ReadS HibernationOptions
Prelude.Read, Int -> HibernationOptions -> ShowS
[HibernationOptions] -> ShowS
HibernationOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HibernationOptions] -> ShowS
$cshowList :: [HibernationOptions] -> ShowS
show :: HibernationOptions -> String
$cshow :: HibernationOptions -> String
showsPrec :: Int -> HibernationOptions -> ShowS
$cshowsPrec :: Int -> HibernationOptions -> ShowS
Prelude.Show, forall x. Rep HibernationOptions x -> HibernationOptions
forall x. HibernationOptions -> Rep HibernationOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HibernationOptions x -> HibernationOptions
$cfrom :: forall x. HibernationOptions -> Rep HibernationOptions x
Prelude.Generic)

-- |
-- Create a value of 'HibernationOptions' 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:
--
-- 'configured', 'hibernationOptions_configured' - If this parameter is set to @true@, your instance is enabled for
-- hibernation; otherwise, it is not enabled for hibernation.
newHibernationOptions ::
  HibernationOptions
newHibernationOptions :: HibernationOptions
newHibernationOptions =
  HibernationOptions' {$sel:configured:HibernationOptions' :: Maybe Bool
configured = forall a. Maybe a
Prelude.Nothing}

-- | If this parameter is set to @true@, your instance is enabled for
-- hibernation; otherwise, it is not enabled for hibernation.
hibernationOptions_configured :: Lens.Lens' HibernationOptions (Prelude.Maybe Prelude.Bool)
hibernationOptions_configured :: Lens' HibernationOptions (Maybe Bool)
hibernationOptions_configured = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HibernationOptions' {Maybe Bool
configured :: Maybe Bool
$sel:configured:HibernationOptions' :: HibernationOptions -> Maybe Bool
configured} -> Maybe Bool
configured) (\s :: HibernationOptions
s@HibernationOptions' {} Maybe Bool
a -> HibernationOptions
s {$sel:configured:HibernationOptions' :: Maybe Bool
configured = Maybe Bool
a} :: HibernationOptions)

instance Data.FromXML HibernationOptions where
  parseXML :: [Node] -> Either String HibernationOptions
parseXML [Node]
x =
    Maybe Bool -> HibernationOptions
HibernationOptions'
      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
"configured")

instance Prelude.Hashable HibernationOptions where
  hashWithSalt :: Int -> HibernationOptions -> Int
hashWithSalt Int
_salt HibernationOptions' {Maybe Bool
configured :: Maybe Bool
$sel:configured:HibernationOptions' :: HibernationOptions -> Maybe Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
configured

instance Prelude.NFData HibernationOptions where
  rnf :: HibernationOptions -> ()
rnf HibernationOptions' {Maybe Bool
configured :: Maybe Bool
$sel:configured:HibernationOptions' :: HibernationOptions -> Maybe Bool
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
configured