{-# 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.DirectoryService.Types.Setting
-- 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.DirectoryService.Types.Setting 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

-- | Contains information about the configurable settings for a directory.
--
-- /See:/ 'newSetting' smart constructor.
data Setting = Setting'
  { -- | The name of the directory setting. For example:
    --
    -- @TLS_1_0@
    Setting -> Text
name :: Prelude.Text,
    -- | The value of the directory setting for which to retrieve information.
    -- For example, for @TLS_1_0@, the valid values are: @Enable@ and
    -- @Disable@.
    Setting -> Text
value :: Prelude.Text
  }
  deriving (Setting -> Setting -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Setting -> Setting -> Bool
$c/= :: Setting -> Setting -> Bool
== :: Setting -> Setting -> Bool
$c== :: Setting -> Setting -> Bool
Prelude.Eq, ReadPrec [Setting]
ReadPrec Setting
Int -> ReadS Setting
ReadS [Setting]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Setting]
$creadListPrec :: ReadPrec [Setting]
readPrec :: ReadPrec Setting
$creadPrec :: ReadPrec Setting
readList :: ReadS [Setting]
$creadList :: ReadS [Setting]
readsPrec :: Int -> ReadS Setting
$creadsPrec :: Int -> ReadS Setting
Prelude.Read, Int -> Setting -> ShowS
[Setting] -> ShowS
Setting -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Setting] -> ShowS
$cshowList :: [Setting] -> ShowS
show :: Setting -> String
$cshow :: Setting -> String
showsPrec :: Int -> Setting -> ShowS
$cshowsPrec :: Int -> Setting -> ShowS
Prelude.Show, forall x. Rep Setting x -> Setting
forall x. Setting -> Rep Setting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Setting x -> Setting
$cfrom :: forall x. Setting -> Rep Setting x
Prelude.Generic)

-- |
-- Create a value of 'Setting' 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:
--
-- 'name', 'setting_name' - The name of the directory setting. For example:
--
-- @TLS_1_0@
--
-- 'value', 'setting_value' - The value of the directory setting for which to retrieve information.
-- For example, for @TLS_1_0@, the valid values are: @Enable@ and
-- @Disable@.
newSetting ::
  -- | 'name'
  Prelude.Text ->
  -- | 'value'
  Prelude.Text ->
  Setting
newSetting :: Text -> Text -> Setting
newSetting Text
pName_ Text
pValue_ =
  Setting' {$sel:name:Setting' :: Text
name = Text
pName_, $sel:value:Setting' :: Text
value = Text
pValue_}

-- | The name of the directory setting. For example:
--
-- @TLS_1_0@
setting_name :: Lens.Lens' Setting Prelude.Text
setting_name :: Lens' Setting Text
setting_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Setting' {Text
name :: Text
$sel:name:Setting' :: Setting -> Text
name} -> Text
name) (\s :: Setting
s@Setting' {} Text
a -> Setting
s {$sel:name:Setting' :: Text
name = Text
a} :: Setting)

-- | The value of the directory setting for which to retrieve information.
-- For example, for @TLS_1_0@, the valid values are: @Enable@ and
-- @Disable@.
setting_value :: Lens.Lens' Setting Prelude.Text
setting_value :: Lens' Setting Text
setting_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Setting' {Text
value :: Text
$sel:value:Setting' :: Setting -> Text
value} -> Text
value) (\s :: Setting
s@Setting' {} Text
a -> Setting
s {$sel:value:Setting' :: Text
value = Text
a} :: Setting)

instance Prelude.Hashable Setting where
  hashWithSalt :: Int -> Setting -> Int
hashWithSalt Int
_salt Setting' {Text
value :: Text
name :: Text
$sel:value:Setting' :: Setting -> Text
$sel:name:Setting' :: Setting -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
value

instance Prelude.NFData Setting where
  rnf :: Setting -> ()
rnf Setting' {Text
value :: Text
name :: Text
$sel:value:Setting' :: Setting -> Text
$sel:name:Setting' :: Setting -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
value

instance Data.ToJSON Setting where
  toJSON :: Setting -> Value
toJSON Setting' {Text
value :: Text
name :: Text
$sel:value:Setting' :: Setting -> Text
$sel:name:Setting' :: Setting -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
value)
          ]
      )