{-# 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.RDS.Types.OptionSetting
-- 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.RDS.Types.OptionSetting 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

-- | Option settings are the actual settings being applied or configured for
-- that option. It is used when you modify an option group or describe
-- option groups. For example, the NATIVE_NETWORK_ENCRYPTION option has a
-- setting called SQLNET.ENCRYPTION_SERVER that can have several different
-- values.
--
-- /See:/ 'newOptionSetting' smart constructor.
data OptionSetting = OptionSetting'
  { -- | The allowed values of the option setting.
    OptionSetting -> Maybe Text
allowedValues :: Prelude.Maybe Prelude.Text,
    -- | The DB engine specific parameter type.
    OptionSetting -> Maybe Text
applyType :: Prelude.Maybe Prelude.Text,
    -- | The data type of the option setting.
    OptionSetting -> Maybe Text
dataType :: Prelude.Maybe Prelude.Text,
    -- | The default value of the option setting.
    OptionSetting -> Maybe Text
defaultValue :: Prelude.Maybe Prelude.Text,
    -- | The description of the option setting.
    OptionSetting -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Indicates if the option setting is part of a collection.
    OptionSetting -> Maybe Bool
isCollection :: Prelude.Maybe Prelude.Bool,
    -- | A Boolean value that, when true, indicates the option setting can be
    -- modified from the default.
    OptionSetting -> Maybe Bool
isModifiable :: Prelude.Maybe Prelude.Bool,
    -- | The name of the option that has settings that you can set.
    OptionSetting -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The current value of the option setting.
    OptionSetting -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (OptionSetting -> OptionSetting -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OptionSetting -> OptionSetting -> Bool
$c/= :: OptionSetting -> OptionSetting -> Bool
== :: OptionSetting -> OptionSetting -> Bool
$c== :: OptionSetting -> OptionSetting -> Bool
Prelude.Eq, ReadPrec [OptionSetting]
ReadPrec OptionSetting
Int -> ReadS OptionSetting
ReadS [OptionSetting]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OptionSetting]
$creadListPrec :: ReadPrec [OptionSetting]
readPrec :: ReadPrec OptionSetting
$creadPrec :: ReadPrec OptionSetting
readList :: ReadS [OptionSetting]
$creadList :: ReadS [OptionSetting]
readsPrec :: Int -> ReadS OptionSetting
$creadsPrec :: Int -> ReadS OptionSetting
Prelude.Read, Int -> OptionSetting -> ShowS
[OptionSetting] -> ShowS
OptionSetting -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OptionSetting] -> ShowS
$cshowList :: [OptionSetting] -> ShowS
show :: OptionSetting -> String
$cshow :: OptionSetting -> String
showsPrec :: Int -> OptionSetting -> ShowS
$cshowsPrec :: Int -> OptionSetting -> ShowS
Prelude.Show, forall x. Rep OptionSetting x -> OptionSetting
forall x. OptionSetting -> Rep OptionSetting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OptionSetting x -> OptionSetting
$cfrom :: forall x. OptionSetting -> Rep OptionSetting x
Prelude.Generic)

-- |
-- Create a value of 'OptionSetting' 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:
--
-- 'allowedValues', 'optionSetting_allowedValues' - The allowed values of the option setting.
--
-- 'applyType', 'optionSetting_applyType' - The DB engine specific parameter type.
--
-- 'dataType', 'optionSetting_dataType' - The data type of the option setting.
--
-- 'defaultValue', 'optionSetting_defaultValue' - The default value of the option setting.
--
-- 'description', 'optionSetting_description' - The description of the option setting.
--
-- 'isCollection', 'optionSetting_isCollection' - Indicates if the option setting is part of a collection.
--
-- 'isModifiable', 'optionSetting_isModifiable' - A Boolean value that, when true, indicates the option setting can be
-- modified from the default.
--
-- 'name', 'optionSetting_name' - The name of the option that has settings that you can set.
--
-- 'value', 'optionSetting_value' - The current value of the option setting.
newOptionSetting ::
  OptionSetting
newOptionSetting :: OptionSetting
newOptionSetting =
  OptionSetting'
    { $sel:allowedValues:OptionSetting' :: Maybe Text
allowedValues = forall a. Maybe a
Prelude.Nothing,
      $sel:applyType:OptionSetting' :: Maybe Text
applyType = forall a. Maybe a
Prelude.Nothing,
      $sel:dataType:OptionSetting' :: Maybe Text
dataType = forall a. Maybe a
Prelude.Nothing,
      $sel:defaultValue:OptionSetting' :: Maybe Text
defaultValue = forall a. Maybe a
Prelude.Nothing,
      $sel:description:OptionSetting' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:isCollection:OptionSetting' :: Maybe Bool
isCollection = forall a. Maybe a
Prelude.Nothing,
      $sel:isModifiable:OptionSetting' :: Maybe Bool
isModifiable = forall a. Maybe a
Prelude.Nothing,
      $sel:name:OptionSetting' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:value:OptionSetting' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
    }

-- | The allowed values of the option setting.
optionSetting_allowedValues :: Lens.Lens' OptionSetting (Prelude.Maybe Prelude.Text)
optionSetting_allowedValues :: Lens' OptionSetting (Maybe Text)
optionSetting_allowedValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionSetting' {Maybe Text
allowedValues :: Maybe Text
$sel:allowedValues:OptionSetting' :: OptionSetting -> Maybe Text
allowedValues} -> Maybe Text
allowedValues) (\s :: OptionSetting
s@OptionSetting' {} Maybe Text
a -> OptionSetting
s {$sel:allowedValues:OptionSetting' :: Maybe Text
allowedValues = Maybe Text
a} :: OptionSetting)

-- | The DB engine specific parameter type.
optionSetting_applyType :: Lens.Lens' OptionSetting (Prelude.Maybe Prelude.Text)
optionSetting_applyType :: Lens' OptionSetting (Maybe Text)
optionSetting_applyType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionSetting' {Maybe Text
applyType :: Maybe Text
$sel:applyType:OptionSetting' :: OptionSetting -> Maybe Text
applyType} -> Maybe Text
applyType) (\s :: OptionSetting
s@OptionSetting' {} Maybe Text
a -> OptionSetting
s {$sel:applyType:OptionSetting' :: Maybe Text
applyType = Maybe Text
a} :: OptionSetting)

-- | The data type of the option setting.
optionSetting_dataType :: Lens.Lens' OptionSetting (Prelude.Maybe Prelude.Text)
optionSetting_dataType :: Lens' OptionSetting (Maybe Text)
optionSetting_dataType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionSetting' {Maybe Text
dataType :: Maybe Text
$sel:dataType:OptionSetting' :: OptionSetting -> Maybe Text
dataType} -> Maybe Text
dataType) (\s :: OptionSetting
s@OptionSetting' {} Maybe Text
a -> OptionSetting
s {$sel:dataType:OptionSetting' :: Maybe Text
dataType = Maybe Text
a} :: OptionSetting)

-- | The default value of the option setting.
optionSetting_defaultValue :: Lens.Lens' OptionSetting (Prelude.Maybe Prelude.Text)
optionSetting_defaultValue :: Lens' OptionSetting (Maybe Text)
optionSetting_defaultValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionSetting' {Maybe Text
defaultValue :: Maybe Text
$sel:defaultValue:OptionSetting' :: OptionSetting -> Maybe Text
defaultValue} -> Maybe Text
defaultValue) (\s :: OptionSetting
s@OptionSetting' {} Maybe Text
a -> OptionSetting
s {$sel:defaultValue:OptionSetting' :: Maybe Text
defaultValue = Maybe Text
a} :: OptionSetting)

-- | The description of the option setting.
optionSetting_description :: Lens.Lens' OptionSetting (Prelude.Maybe Prelude.Text)
optionSetting_description :: Lens' OptionSetting (Maybe Text)
optionSetting_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionSetting' {Maybe Text
description :: Maybe Text
$sel:description:OptionSetting' :: OptionSetting -> Maybe Text
description} -> Maybe Text
description) (\s :: OptionSetting
s@OptionSetting' {} Maybe Text
a -> OptionSetting
s {$sel:description:OptionSetting' :: Maybe Text
description = Maybe Text
a} :: OptionSetting)

-- | Indicates if the option setting is part of a collection.
optionSetting_isCollection :: Lens.Lens' OptionSetting (Prelude.Maybe Prelude.Bool)
optionSetting_isCollection :: Lens' OptionSetting (Maybe Bool)
optionSetting_isCollection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionSetting' {Maybe Bool
isCollection :: Maybe Bool
$sel:isCollection:OptionSetting' :: OptionSetting -> Maybe Bool
isCollection} -> Maybe Bool
isCollection) (\s :: OptionSetting
s@OptionSetting' {} Maybe Bool
a -> OptionSetting
s {$sel:isCollection:OptionSetting' :: Maybe Bool
isCollection = Maybe Bool
a} :: OptionSetting)

-- | A Boolean value that, when true, indicates the option setting can be
-- modified from the default.
optionSetting_isModifiable :: Lens.Lens' OptionSetting (Prelude.Maybe Prelude.Bool)
optionSetting_isModifiable :: Lens' OptionSetting (Maybe Bool)
optionSetting_isModifiable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionSetting' {Maybe Bool
isModifiable :: Maybe Bool
$sel:isModifiable:OptionSetting' :: OptionSetting -> Maybe Bool
isModifiable} -> Maybe Bool
isModifiable) (\s :: OptionSetting
s@OptionSetting' {} Maybe Bool
a -> OptionSetting
s {$sel:isModifiable:OptionSetting' :: Maybe Bool
isModifiable = Maybe Bool
a} :: OptionSetting)

-- | The name of the option that has settings that you can set.
optionSetting_name :: Lens.Lens' OptionSetting (Prelude.Maybe Prelude.Text)
optionSetting_name :: Lens' OptionSetting (Maybe Text)
optionSetting_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionSetting' {Maybe Text
name :: Maybe Text
$sel:name:OptionSetting' :: OptionSetting -> Maybe Text
name} -> Maybe Text
name) (\s :: OptionSetting
s@OptionSetting' {} Maybe Text
a -> OptionSetting
s {$sel:name:OptionSetting' :: Maybe Text
name = Maybe Text
a} :: OptionSetting)

-- | The current value of the option setting.
optionSetting_value :: Lens.Lens' OptionSetting (Prelude.Maybe Prelude.Text)
optionSetting_value :: Lens' OptionSetting (Maybe Text)
optionSetting_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionSetting' {Maybe Text
value :: Maybe Text
$sel:value:OptionSetting' :: OptionSetting -> Maybe Text
value} -> Maybe Text
value) (\s :: OptionSetting
s@OptionSetting' {} Maybe Text
a -> OptionSetting
s {$sel:value:OptionSetting' :: Maybe Text
value = Maybe Text
a} :: OptionSetting)

instance Data.FromXML OptionSetting where
  parseXML :: [Node] -> Either String OptionSetting
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> OptionSetting
OptionSetting'
      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
"AllowedValues")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ApplyType")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DataType")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DefaultValue")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Description")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"IsCollection")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"IsModifiable")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Name")
      forall (f :: * -> *) a b. Applicative f => 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 OptionSetting where
  hashWithSalt :: Int -> OptionSetting -> Int
hashWithSalt Int
_salt OptionSetting' {Maybe Bool
Maybe Text
value :: Maybe Text
name :: Maybe Text
isModifiable :: Maybe Bool
isCollection :: Maybe Bool
description :: Maybe Text
defaultValue :: Maybe Text
dataType :: Maybe Text
applyType :: Maybe Text
allowedValues :: Maybe Text
$sel:value:OptionSetting' :: OptionSetting -> Maybe Text
$sel:name:OptionSetting' :: OptionSetting -> Maybe Text
$sel:isModifiable:OptionSetting' :: OptionSetting -> Maybe Bool
$sel:isCollection:OptionSetting' :: OptionSetting -> Maybe Bool
$sel:description:OptionSetting' :: OptionSetting -> Maybe Text
$sel:defaultValue:OptionSetting' :: OptionSetting -> Maybe Text
$sel:dataType:OptionSetting' :: OptionSetting -> Maybe Text
$sel:applyType:OptionSetting' :: OptionSetting -> Maybe Text
$sel:allowedValues:OptionSetting' :: OptionSetting -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
allowedValues
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
applyType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dataType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isCollection
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isModifiable
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData OptionSetting where
  rnf :: OptionSetting -> ()
rnf OptionSetting' {Maybe Bool
Maybe Text
value :: Maybe Text
name :: Maybe Text
isModifiable :: Maybe Bool
isCollection :: Maybe Bool
description :: Maybe Text
defaultValue :: Maybe Text
dataType :: Maybe Text
applyType :: Maybe Text
allowedValues :: Maybe Text
$sel:value:OptionSetting' :: OptionSetting -> Maybe Text
$sel:name:OptionSetting' :: OptionSetting -> Maybe Text
$sel:isModifiable:OptionSetting' :: OptionSetting -> Maybe Bool
$sel:isCollection:OptionSetting' :: OptionSetting -> Maybe Bool
$sel:description:OptionSetting' :: OptionSetting -> Maybe Text
$sel:defaultValue:OptionSetting' :: OptionSetting -> Maybe Text
$sel:dataType:OptionSetting' :: OptionSetting -> Maybe Text
$sel:applyType:OptionSetting' :: OptionSetting -> Maybe Text
$sel:allowedValues:OptionSetting' :: OptionSetting -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
allowedValues
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
applyType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dataType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isCollection
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isModifiable
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value

instance Data.ToQuery OptionSetting where
  toQuery :: OptionSetting -> QueryString
toQuery OptionSetting' {Maybe Bool
Maybe Text
value :: Maybe Text
name :: Maybe Text
isModifiable :: Maybe Bool
isCollection :: Maybe Bool
description :: Maybe Text
defaultValue :: Maybe Text
dataType :: Maybe Text
applyType :: Maybe Text
allowedValues :: Maybe Text
$sel:value:OptionSetting' :: OptionSetting -> Maybe Text
$sel:name:OptionSetting' :: OptionSetting -> Maybe Text
$sel:isModifiable:OptionSetting' :: OptionSetting -> Maybe Bool
$sel:isCollection:OptionSetting' :: OptionSetting -> Maybe Bool
$sel:description:OptionSetting' :: OptionSetting -> Maybe Text
$sel:defaultValue:OptionSetting' :: OptionSetting -> Maybe Text
$sel:dataType:OptionSetting' :: OptionSetting -> Maybe Text
$sel:applyType:OptionSetting' :: OptionSetting -> Maybe Text
$sel:allowedValues:OptionSetting' :: OptionSetting -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"AllowedValues" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
allowedValues,
        ByteString
"ApplyType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
applyType,
        ByteString
"DataType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
dataType,
        ByteString
"DefaultValue" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
defaultValue,
        ByteString
"Description" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
description,
        ByteString
"IsCollection" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
isCollection,
        ByteString
"IsModifiable" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
isModifiable,
        ByteString
"Name" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
name,
        ByteString
"Value" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
value
      ]