{-# 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.AutoScaling.Types.InstanceMonitoring
-- 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.AutoScaling.Types.InstanceMonitoring 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

-- | Describes whether detailed monitoring is enabled for the Auto Scaling
-- instances.
--
-- /See:/ 'newInstanceMonitoring' smart constructor.
data InstanceMonitoring = InstanceMonitoring'
  { -- | If @true@, detailed monitoring is enabled. Otherwise, basic monitoring
    -- is enabled.
    InstanceMonitoring -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool
  }
  deriving (InstanceMonitoring -> InstanceMonitoring -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceMonitoring -> InstanceMonitoring -> Bool
$c/= :: InstanceMonitoring -> InstanceMonitoring -> Bool
== :: InstanceMonitoring -> InstanceMonitoring -> Bool
$c== :: InstanceMonitoring -> InstanceMonitoring -> Bool
Prelude.Eq, ReadPrec [InstanceMonitoring]
ReadPrec InstanceMonitoring
Int -> ReadS InstanceMonitoring
ReadS [InstanceMonitoring]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceMonitoring]
$creadListPrec :: ReadPrec [InstanceMonitoring]
readPrec :: ReadPrec InstanceMonitoring
$creadPrec :: ReadPrec InstanceMonitoring
readList :: ReadS [InstanceMonitoring]
$creadList :: ReadS [InstanceMonitoring]
readsPrec :: Int -> ReadS InstanceMonitoring
$creadsPrec :: Int -> ReadS InstanceMonitoring
Prelude.Read, Int -> InstanceMonitoring -> ShowS
[InstanceMonitoring] -> ShowS
InstanceMonitoring -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceMonitoring] -> ShowS
$cshowList :: [InstanceMonitoring] -> ShowS
show :: InstanceMonitoring -> String
$cshow :: InstanceMonitoring -> String
showsPrec :: Int -> InstanceMonitoring -> ShowS
$cshowsPrec :: Int -> InstanceMonitoring -> ShowS
Prelude.Show, forall x. Rep InstanceMonitoring x -> InstanceMonitoring
forall x. InstanceMonitoring -> Rep InstanceMonitoring x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceMonitoring x -> InstanceMonitoring
$cfrom :: forall x. InstanceMonitoring -> Rep InstanceMonitoring x
Prelude.Generic)

-- |
-- Create a value of 'InstanceMonitoring' 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:
--
-- 'enabled', 'instanceMonitoring_enabled' - If @true@, detailed monitoring is enabled. Otherwise, basic monitoring
-- is enabled.
newInstanceMonitoring ::
  InstanceMonitoring
newInstanceMonitoring :: InstanceMonitoring
newInstanceMonitoring =
  InstanceMonitoring' {$sel:enabled:InstanceMonitoring' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing}

-- | If @true@, detailed monitoring is enabled. Otherwise, basic monitoring
-- is enabled.
instanceMonitoring_enabled :: Lens.Lens' InstanceMonitoring (Prelude.Maybe Prelude.Bool)
instanceMonitoring_enabled :: Lens' InstanceMonitoring (Maybe Bool)
instanceMonitoring_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceMonitoring' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:InstanceMonitoring' :: InstanceMonitoring -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: InstanceMonitoring
s@InstanceMonitoring' {} Maybe Bool
a -> InstanceMonitoring
s {$sel:enabled:InstanceMonitoring' :: Maybe Bool
enabled = Maybe Bool
a} :: InstanceMonitoring)

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

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

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

instance Data.ToQuery InstanceMonitoring where
  toQuery :: InstanceMonitoring -> QueryString
toQuery InstanceMonitoring' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:InstanceMonitoring' :: InstanceMonitoring -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"Enabled" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
enabled]