{-# 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.AttributeBooleanValue
-- 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.AttributeBooleanValue 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

-- | Describes a value for a resource attribute that is a Boolean value.
--
-- /See:/ 'newAttributeBooleanValue' smart constructor.
data AttributeBooleanValue = AttributeBooleanValue'
  { -- | The attribute value. The valid values are @true@ or @false@.
    AttributeBooleanValue -> Maybe Bool
value :: Prelude.Maybe Prelude.Bool
  }
  deriving (AttributeBooleanValue -> AttributeBooleanValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttributeBooleanValue -> AttributeBooleanValue -> Bool
$c/= :: AttributeBooleanValue -> AttributeBooleanValue -> Bool
== :: AttributeBooleanValue -> AttributeBooleanValue -> Bool
$c== :: AttributeBooleanValue -> AttributeBooleanValue -> Bool
Prelude.Eq, ReadPrec [AttributeBooleanValue]
ReadPrec AttributeBooleanValue
Int -> ReadS AttributeBooleanValue
ReadS [AttributeBooleanValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttributeBooleanValue]
$creadListPrec :: ReadPrec [AttributeBooleanValue]
readPrec :: ReadPrec AttributeBooleanValue
$creadPrec :: ReadPrec AttributeBooleanValue
readList :: ReadS [AttributeBooleanValue]
$creadList :: ReadS [AttributeBooleanValue]
readsPrec :: Int -> ReadS AttributeBooleanValue
$creadsPrec :: Int -> ReadS AttributeBooleanValue
Prelude.Read, Int -> AttributeBooleanValue -> ShowS
[AttributeBooleanValue] -> ShowS
AttributeBooleanValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttributeBooleanValue] -> ShowS
$cshowList :: [AttributeBooleanValue] -> ShowS
show :: AttributeBooleanValue -> String
$cshow :: AttributeBooleanValue -> String
showsPrec :: Int -> AttributeBooleanValue -> ShowS
$cshowsPrec :: Int -> AttributeBooleanValue -> ShowS
Prelude.Show, forall x. Rep AttributeBooleanValue x -> AttributeBooleanValue
forall x. AttributeBooleanValue -> Rep AttributeBooleanValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttributeBooleanValue x -> AttributeBooleanValue
$cfrom :: forall x. AttributeBooleanValue -> Rep AttributeBooleanValue x
Prelude.Generic)

-- |
-- Create a value of 'AttributeBooleanValue' 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:
--
-- 'value', 'attributeBooleanValue_value' - The attribute value. The valid values are @true@ or @false@.
newAttributeBooleanValue ::
  AttributeBooleanValue
newAttributeBooleanValue :: AttributeBooleanValue
newAttributeBooleanValue =
  AttributeBooleanValue' {$sel:value:AttributeBooleanValue' :: Maybe Bool
value = forall a. Maybe a
Prelude.Nothing}

-- | The attribute value. The valid values are @true@ or @false@.
attributeBooleanValue_value :: Lens.Lens' AttributeBooleanValue (Prelude.Maybe Prelude.Bool)
attributeBooleanValue_value :: Lens' AttributeBooleanValue (Maybe Bool)
attributeBooleanValue_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeBooleanValue' {Maybe Bool
value :: Maybe Bool
$sel:value:AttributeBooleanValue' :: AttributeBooleanValue -> Maybe Bool
value} -> Maybe Bool
value) (\s :: AttributeBooleanValue
s@AttributeBooleanValue' {} Maybe Bool
a -> AttributeBooleanValue
s {$sel:value:AttributeBooleanValue' :: Maybe Bool
value = Maybe Bool
a} :: AttributeBooleanValue)

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

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

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

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