{-# 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.ElastiCache.Types.Parameter
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ElastiCache.Types.Parameter where

import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.Types.ChangeType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes an individual setting that controls some aspect of ElastiCache
-- behavior.
--
-- /See:/ 'newParameter' smart constructor.
data Parameter = Parameter'
  { -- | The value of the parameter.
    Parameter -> Maybe Text
parameterValue :: Prelude.Maybe Prelude.Text,
    -- | The earliest cache engine version to which the parameter can apply.
    Parameter -> Maybe Text
minimumEngineVersion :: Prelude.Maybe Prelude.Text,
    -- | The source of the parameter.
    Parameter -> Maybe Text
source :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether (@true@) or not (@false@) the parameter can be
    -- modified. Some parameters have security or operational implications that
    -- prevent them from being changed.
    Parameter -> Maybe Bool
isModifiable :: Prelude.Maybe Prelude.Bool,
    -- | The valid data type for the parameter.
    Parameter -> Maybe Text
dataType :: Prelude.Maybe Prelude.Text,
    -- | The valid range of values for the parameter.
    Parameter -> Maybe Text
allowedValues :: Prelude.Maybe Prelude.Text,
    -- | The name of the parameter.
    Parameter -> Maybe Text
parameterName :: Prelude.Maybe Prelude.Text,
    -- | A description of the parameter.
    Parameter -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether a change to the parameter is applied immediately or
    -- requires a reboot for the change to be applied. You can force a reboot
    -- or wait until the next maintenance window\'s reboot. For more
    -- information, see
    -- <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Clusters.Rebooting.html Rebooting a Cluster>.
    Parameter -> Maybe ChangeType
changeType :: Prelude.Maybe ChangeType
  }
  deriving (Parameter -> Parameter -> Bool
(Parameter -> Parameter -> Bool)
-> (Parameter -> Parameter -> Bool) -> Eq Parameter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Parameter -> Parameter -> Bool
$c/= :: Parameter -> Parameter -> Bool
== :: Parameter -> Parameter -> Bool
$c== :: Parameter -> Parameter -> Bool
Prelude.Eq, ReadPrec [Parameter]
ReadPrec Parameter
Int -> ReadS Parameter
ReadS [Parameter]
(Int -> ReadS Parameter)
-> ReadS [Parameter]
-> ReadPrec Parameter
-> ReadPrec [Parameter]
-> Read Parameter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Parameter]
$creadListPrec :: ReadPrec [Parameter]
readPrec :: ReadPrec Parameter
$creadPrec :: ReadPrec Parameter
readList :: ReadS [Parameter]
$creadList :: ReadS [Parameter]
readsPrec :: Int -> ReadS Parameter
$creadsPrec :: Int -> ReadS Parameter
Prelude.Read, Int -> Parameter -> ShowS
[Parameter] -> ShowS
Parameter -> String
(Int -> Parameter -> ShowS)
-> (Parameter -> String)
-> ([Parameter] -> ShowS)
-> Show Parameter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Parameter] -> ShowS
$cshowList :: [Parameter] -> ShowS
show :: Parameter -> String
$cshow :: Parameter -> String
showsPrec :: Int -> Parameter -> ShowS
$cshowsPrec :: Int -> Parameter -> ShowS
Prelude.Show, (forall x. Parameter -> Rep Parameter x)
-> (forall x. Rep Parameter x -> Parameter) -> Generic Parameter
forall x. Rep Parameter x -> Parameter
forall x. Parameter -> Rep Parameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Parameter x -> Parameter
$cfrom :: forall x. Parameter -> Rep Parameter x
Prelude.Generic)

-- |
-- Create a value of 'Parameter' 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:
--
-- 'parameterValue', 'parameter_parameterValue' - The value of the parameter.
--
-- 'minimumEngineVersion', 'parameter_minimumEngineVersion' - The earliest cache engine version to which the parameter can apply.
--
-- 'source', 'parameter_source' - The source of the parameter.
--
-- 'isModifiable', 'parameter_isModifiable' - Indicates whether (@true@) or not (@false@) the parameter can be
-- modified. Some parameters have security or operational implications that
-- prevent them from being changed.
--
-- 'dataType', 'parameter_dataType' - The valid data type for the parameter.
--
-- 'allowedValues', 'parameter_allowedValues' - The valid range of values for the parameter.
--
-- 'parameterName', 'parameter_parameterName' - The name of the parameter.
--
-- 'description', 'parameter_description' - A description of the parameter.
--
-- 'changeType', 'parameter_changeType' - Indicates whether a change to the parameter is applied immediately or
-- requires a reboot for the change to be applied. You can force a reboot
-- or wait until the next maintenance window\'s reboot. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Clusters.Rebooting.html Rebooting a Cluster>.
newParameter ::
  Parameter
newParameter :: Parameter
newParameter =
  Parameter' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ChangeType
-> Parameter
Parameter'
    { $sel:parameterValue:Parameter' :: Maybe Text
parameterValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:minimumEngineVersion:Parameter' :: Maybe Text
minimumEngineVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:source:Parameter' :: Maybe Text
source = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isModifiable:Parameter' :: Maybe Bool
isModifiable = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:dataType:Parameter' :: Maybe Text
dataType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:allowedValues:Parameter' :: Maybe Text
allowedValues = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parameterName:Parameter' :: Maybe Text
parameterName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Parameter' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:changeType:Parameter' :: Maybe ChangeType
changeType = Maybe ChangeType
forall a. Maybe a
Prelude.Nothing
    }

-- | The value of the parameter.
parameter_parameterValue :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Text)
parameter_parameterValue :: (Maybe Text -> f (Maybe Text)) -> Parameter -> f Parameter
parameter_parameterValue = (Parameter -> Maybe Text)
-> (Parameter -> Maybe Text -> Parameter)
-> Lens Parameter Parameter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe Text
parameterValue :: Maybe Text
$sel:parameterValue:Parameter' :: Parameter -> Maybe Text
parameterValue} -> Maybe Text
parameterValue) (\s :: Parameter
s@Parameter' {} Maybe Text
a -> Parameter
s {$sel:parameterValue:Parameter' :: Maybe Text
parameterValue = Maybe Text
a} :: Parameter)

-- | The earliest cache engine version to which the parameter can apply.
parameter_minimumEngineVersion :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Text)
parameter_minimumEngineVersion :: (Maybe Text -> f (Maybe Text)) -> Parameter -> f Parameter
parameter_minimumEngineVersion = (Parameter -> Maybe Text)
-> (Parameter -> Maybe Text -> Parameter)
-> Lens Parameter Parameter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe Text
minimumEngineVersion :: Maybe Text
$sel:minimumEngineVersion:Parameter' :: Parameter -> Maybe Text
minimumEngineVersion} -> Maybe Text
minimumEngineVersion) (\s :: Parameter
s@Parameter' {} Maybe Text
a -> Parameter
s {$sel:minimumEngineVersion:Parameter' :: Maybe Text
minimumEngineVersion = Maybe Text
a} :: Parameter)

-- | The source of the parameter.
parameter_source :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Text)
parameter_source :: (Maybe Text -> f (Maybe Text)) -> Parameter -> f Parameter
parameter_source = (Parameter -> Maybe Text)
-> (Parameter -> Maybe Text -> Parameter)
-> Lens Parameter Parameter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe Text
source :: Maybe Text
$sel:source:Parameter' :: Parameter -> Maybe Text
source} -> Maybe Text
source) (\s :: Parameter
s@Parameter' {} Maybe Text
a -> Parameter
s {$sel:source:Parameter' :: Maybe Text
source = Maybe Text
a} :: Parameter)

-- | Indicates whether (@true@) or not (@false@) the parameter can be
-- modified. Some parameters have security or operational implications that
-- prevent them from being changed.
parameter_isModifiable :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Bool)
parameter_isModifiable :: (Maybe Bool -> f (Maybe Bool)) -> Parameter -> f Parameter
parameter_isModifiable = (Parameter -> Maybe Bool)
-> (Parameter -> Maybe Bool -> Parameter)
-> Lens Parameter Parameter (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe Bool
isModifiable :: Maybe Bool
$sel:isModifiable:Parameter' :: Parameter -> Maybe Bool
isModifiable} -> Maybe Bool
isModifiable) (\s :: Parameter
s@Parameter' {} Maybe Bool
a -> Parameter
s {$sel:isModifiable:Parameter' :: Maybe Bool
isModifiable = Maybe Bool
a} :: Parameter)

-- | The valid data type for the parameter.
parameter_dataType :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Text)
parameter_dataType :: (Maybe Text -> f (Maybe Text)) -> Parameter -> f Parameter
parameter_dataType = (Parameter -> Maybe Text)
-> (Parameter -> Maybe Text -> Parameter)
-> Lens Parameter Parameter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe Text
dataType :: Maybe Text
$sel:dataType:Parameter' :: Parameter -> Maybe Text
dataType} -> Maybe Text
dataType) (\s :: Parameter
s@Parameter' {} Maybe Text
a -> Parameter
s {$sel:dataType:Parameter' :: Maybe Text
dataType = Maybe Text
a} :: Parameter)

-- | The valid range of values for the parameter.
parameter_allowedValues :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Text)
parameter_allowedValues :: (Maybe Text -> f (Maybe Text)) -> Parameter -> f Parameter
parameter_allowedValues = (Parameter -> Maybe Text)
-> (Parameter -> Maybe Text -> Parameter)
-> Lens Parameter Parameter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe Text
allowedValues :: Maybe Text
$sel:allowedValues:Parameter' :: Parameter -> Maybe Text
allowedValues} -> Maybe Text
allowedValues) (\s :: Parameter
s@Parameter' {} Maybe Text
a -> Parameter
s {$sel:allowedValues:Parameter' :: Maybe Text
allowedValues = Maybe Text
a} :: Parameter)

-- | The name of the parameter.
parameter_parameterName :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Text)
parameter_parameterName :: (Maybe Text -> f (Maybe Text)) -> Parameter -> f Parameter
parameter_parameterName = (Parameter -> Maybe Text)
-> (Parameter -> Maybe Text -> Parameter)
-> Lens Parameter Parameter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe Text
parameterName :: Maybe Text
$sel:parameterName:Parameter' :: Parameter -> Maybe Text
parameterName} -> Maybe Text
parameterName) (\s :: Parameter
s@Parameter' {} Maybe Text
a -> Parameter
s {$sel:parameterName:Parameter' :: Maybe Text
parameterName = Maybe Text
a} :: Parameter)

-- | A description of the parameter.
parameter_description :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Text)
parameter_description :: (Maybe Text -> f (Maybe Text)) -> Parameter -> f Parameter
parameter_description = (Parameter -> Maybe Text)
-> (Parameter -> Maybe Text -> Parameter)
-> Lens Parameter Parameter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe Text
description :: Maybe Text
$sel:description:Parameter' :: Parameter -> Maybe Text
description} -> Maybe Text
description) (\s :: Parameter
s@Parameter' {} Maybe Text
a -> Parameter
s {$sel:description:Parameter' :: Maybe Text
description = Maybe Text
a} :: Parameter)

-- | Indicates whether a change to the parameter is applied immediately or
-- requires a reboot for the change to be applied. You can force a reboot
-- or wait until the next maintenance window\'s reboot. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Clusters.Rebooting.html Rebooting a Cluster>.
parameter_changeType :: Lens.Lens' Parameter (Prelude.Maybe ChangeType)
parameter_changeType :: (Maybe ChangeType -> f (Maybe ChangeType))
-> Parameter -> f Parameter
parameter_changeType = (Parameter -> Maybe ChangeType)
-> (Parameter -> Maybe ChangeType -> Parameter)
-> Lens Parameter Parameter (Maybe ChangeType) (Maybe ChangeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe ChangeType
changeType :: Maybe ChangeType
$sel:changeType:Parameter' :: Parameter -> Maybe ChangeType
changeType} -> Maybe ChangeType
changeType) (\s :: Parameter
s@Parameter' {} Maybe ChangeType
a -> Parameter
s {$sel:changeType:Parameter' :: Maybe ChangeType
changeType = Maybe ChangeType
a} :: Parameter)

instance Core.FromXML Parameter where
  parseXML :: [Node] -> Either String Parameter
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ChangeType
-> Parameter
Parameter'
      (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe ChangeType
 -> Parameter)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe ChangeType
      -> Parameter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ParameterValue")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe ChangeType
   -> Parameter)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe ChangeType
      -> Parameter)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MinimumEngineVersion")
      Either
  String
  (Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe ChangeType
   -> Parameter)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe ChangeType
      -> Parameter)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Source")
      Either
  String
  (Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe ChangeType
   -> Parameter)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe ChangeType
      -> Parameter)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IsModifiable")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe ChangeType
   -> Parameter)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe ChangeType -> Parameter)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DataType")
      Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe ChangeType -> Parameter)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Maybe ChangeType -> Parameter)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AllowedValues")
      Either
  String (Maybe Text -> Maybe Text -> Maybe ChangeType -> Parameter)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe ChangeType -> Parameter)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ParameterName")
      Either String (Maybe Text -> Maybe ChangeType -> Parameter)
-> Either String (Maybe Text)
-> Either String (Maybe ChangeType -> Parameter)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Description")
      Either String (Maybe ChangeType -> Parameter)
-> Either String (Maybe ChangeType) -> Either String Parameter
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ChangeType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ChangeType")

instance Prelude.Hashable Parameter

instance Prelude.NFData Parameter