{-# 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.LaunchTemplateHibernationOptions
-- 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.LaunchTemplateHibernationOptions 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 an instance is configured for hibernation.
--
-- /See:/ 'newLaunchTemplateHibernationOptions' smart constructor.
data LaunchTemplateHibernationOptions = LaunchTemplateHibernationOptions'
  { -- | If this parameter is set to @true@, the instance is enabled for
    -- hibernation; otherwise, it is not enabled for hibernation.
    LaunchTemplateHibernationOptions -> Maybe Bool
configured :: Prelude.Maybe Prelude.Bool
  }
  deriving (LaunchTemplateHibernationOptions
-> LaunchTemplateHibernationOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LaunchTemplateHibernationOptions
-> LaunchTemplateHibernationOptions -> Bool
$c/= :: LaunchTemplateHibernationOptions
-> LaunchTemplateHibernationOptions -> Bool
== :: LaunchTemplateHibernationOptions
-> LaunchTemplateHibernationOptions -> Bool
$c== :: LaunchTemplateHibernationOptions
-> LaunchTemplateHibernationOptions -> Bool
Prelude.Eq, ReadPrec [LaunchTemplateHibernationOptions]
ReadPrec LaunchTemplateHibernationOptions
Int -> ReadS LaunchTemplateHibernationOptions
ReadS [LaunchTemplateHibernationOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LaunchTemplateHibernationOptions]
$creadListPrec :: ReadPrec [LaunchTemplateHibernationOptions]
readPrec :: ReadPrec LaunchTemplateHibernationOptions
$creadPrec :: ReadPrec LaunchTemplateHibernationOptions
readList :: ReadS [LaunchTemplateHibernationOptions]
$creadList :: ReadS [LaunchTemplateHibernationOptions]
readsPrec :: Int -> ReadS LaunchTemplateHibernationOptions
$creadsPrec :: Int -> ReadS LaunchTemplateHibernationOptions
Prelude.Read, Int -> LaunchTemplateHibernationOptions -> ShowS
[LaunchTemplateHibernationOptions] -> ShowS
LaunchTemplateHibernationOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LaunchTemplateHibernationOptions] -> ShowS
$cshowList :: [LaunchTemplateHibernationOptions] -> ShowS
show :: LaunchTemplateHibernationOptions -> String
$cshow :: LaunchTemplateHibernationOptions -> String
showsPrec :: Int -> LaunchTemplateHibernationOptions -> ShowS
$cshowsPrec :: Int -> LaunchTemplateHibernationOptions -> ShowS
Prelude.Show, forall x.
Rep LaunchTemplateHibernationOptions x
-> LaunchTemplateHibernationOptions
forall x.
LaunchTemplateHibernationOptions
-> Rep LaunchTemplateHibernationOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LaunchTemplateHibernationOptions x
-> LaunchTemplateHibernationOptions
$cfrom :: forall x.
LaunchTemplateHibernationOptions
-> Rep LaunchTemplateHibernationOptions x
Prelude.Generic)

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

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

instance
  Data.FromXML
    LaunchTemplateHibernationOptions
  where
  parseXML :: [Node] -> Either String LaunchTemplateHibernationOptions
parseXML [Node]
x =
    Maybe Bool -> LaunchTemplateHibernationOptions
LaunchTemplateHibernationOptions'
      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
    LaunchTemplateHibernationOptions
  where
  hashWithSalt :: Int -> LaunchTemplateHibernationOptions -> Int
hashWithSalt
    Int
_salt
    LaunchTemplateHibernationOptions' {Maybe Bool
configured :: Maybe Bool
$sel:configured:LaunchTemplateHibernationOptions' :: LaunchTemplateHibernationOptions -> Maybe Bool
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
configured

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