{-# 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.ElasticBeanstalk.Types.ConfigurationOptionSetting
-- 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.ElasticBeanstalk.Types.ConfigurationOptionSetting where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A specification identifying an individual configuration option along
-- with its current value. For a list of possible namespaces and option
-- values, see
-- <https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html Option Values>
-- in the /AWS Elastic Beanstalk Developer Guide/.
--
-- /See:/ 'newConfigurationOptionSetting' smart constructor.
data ConfigurationOptionSetting = ConfigurationOptionSetting'
  { -- | The name of the configuration option.
    ConfigurationOptionSetting -> Maybe Text
optionName :: Prelude.Maybe Prelude.Text,
    -- | A unique resource name for the option setting. Use it for a time–based
    -- scaling configuration option.
    ConfigurationOptionSetting -> Maybe Text
resourceName :: Prelude.Maybe Prelude.Text,
    -- | A unique namespace that identifies the option\'s associated AWS
    -- resource.
    ConfigurationOptionSetting -> Maybe Text
namespace :: Prelude.Maybe Prelude.Text,
    -- | The current value for the configuration option.
    ConfigurationOptionSetting -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (ConfigurationOptionSetting -> ConfigurationOptionSetting -> Bool
(ConfigurationOptionSetting -> ConfigurationOptionSetting -> Bool)
-> (ConfigurationOptionSetting
    -> ConfigurationOptionSetting -> Bool)
-> Eq ConfigurationOptionSetting
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigurationOptionSetting -> ConfigurationOptionSetting -> Bool
$c/= :: ConfigurationOptionSetting -> ConfigurationOptionSetting -> Bool
== :: ConfigurationOptionSetting -> ConfigurationOptionSetting -> Bool
$c== :: ConfigurationOptionSetting -> ConfigurationOptionSetting -> Bool
Prelude.Eq, ReadPrec [ConfigurationOptionSetting]
ReadPrec ConfigurationOptionSetting
Int -> ReadS ConfigurationOptionSetting
ReadS [ConfigurationOptionSetting]
(Int -> ReadS ConfigurationOptionSetting)
-> ReadS [ConfigurationOptionSetting]
-> ReadPrec ConfigurationOptionSetting
-> ReadPrec [ConfigurationOptionSetting]
-> Read ConfigurationOptionSetting
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfigurationOptionSetting]
$creadListPrec :: ReadPrec [ConfigurationOptionSetting]
readPrec :: ReadPrec ConfigurationOptionSetting
$creadPrec :: ReadPrec ConfigurationOptionSetting
readList :: ReadS [ConfigurationOptionSetting]
$creadList :: ReadS [ConfigurationOptionSetting]
readsPrec :: Int -> ReadS ConfigurationOptionSetting
$creadsPrec :: Int -> ReadS ConfigurationOptionSetting
Prelude.Read, Int -> ConfigurationOptionSetting -> ShowS
[ConfigurationOptionSetting] -> ShowS
ConfigurationOptionSetting -> String
(Int -> ConfigurationOptionSetting -> ShowS)
-> (ConfigurationOptionSetting -> String)
-> ([ConfigurationOptionSetting] -> ShowS)
-> Show ConfigurationOptionSetting
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigurationOptionSetting] -> ShowS
$cshowList :: [ConfigurationOptionSetting] -> ShowS
show :: ConfigurationOptionSetting -> String
$cshow :: ConfigurationOptionSetting -> String
showsPrec :: Int -> ConfigurationOptionSetting -> ShowS
$cshowsPrec :: Int -> ConfigurationOptionSetting -> ShowS
Prelude.Show, (forall x.
 ConfigurationOptionSetting -> Rep ConfigurationOptionSetting x)
-> (forall x.
    Rep ConfigurationOptionSetting x -> ConfigurationOptionSetting)
-> Generic ConfigurationOptionSetting
forall x.
Rep ConfigurationOptionSetting x -> ConfigurationOptionSetting
forall x.
ConfigurationOptionSetting -> Rep ConfigurationOptionSetting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConfigurationOptionSetting x -> ConfigurationOptionSetting
$cfrom :: forall x.
ConfigurationOptionSetting -> Rep ConfigurationOptionSetting x
Prelude.Generic)

-- |
-- Create a value of 'ConfigurationOptionSetting' 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:
--
-- 'optionName', 'configurationOptionSetting_optionName' - The name of the configuration option.
--
-- 'resourceName', 'configurationOptionSetting_resourceName' - A unique resource name for the option setting. Use it for a time–based
-- scaling configuration option.
--
-- 'namespace', 'configurationOptionSetting_namespace' - A unique namespace that identifies the option\'s associated AWS
-- resource.
--
-- 'value', 'configurationOptionSetting_value' - The current value for the configuration option.
newConfigurationOptionSetting ::
  ConfigurationOptionSetting
newConfigurationOptionSetting :: ConfigurationOptionSetting
newConfigurationOptionSetting =
  ConfigurationOptionSetting' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ConfigurationOptionSetting
ConfigurationOptionSetting'
    { $sel:optionName:ConfigurationOptionSetting' :: Maybe Text
optionName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceName:ConfigurationOptionSetting' :: Maybe Text
resourceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:namespace:ConfigurationOptionSetting' :: Maybe Text
namespace = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:value:ConfigurationOptionSetting' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the configuration option.
configurationOptionSetting_optionName :: Lens.Lens' ConfigurationOptionSetting (Prelude.Maybe Prelude.Text)
configurationOptionSetting_optionName :: (Maybe Text -> f (Maybe Text))
-> ConfigurationOptionSetting -> f ConfigurationOptionSetting
configurationOptionSetting_optionName = (ConfigurationOptionSetting -> Maybe Text)
-> (ConfigurationOptionSetting
    -> Maybe Text -> ConfigurationOptionSetting)
-> Lens
     ConfigurationOptionSetting
     ConfigurationOptionSetting
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationOptionSetting' {Maybe Text
optionName :: Maybe Text
$sel:optionName:ConfigurationOptionSetting' :: ConfigurationOptionSetting -> Maybe Text
optionName} -> Maybe Text
optionName) (\s :: ConfigurationOptionSetting
s@ConfigurationOptionSetting' {} Maybe Text
a -> ConfigurationOptionSetting
s {$sel:optionName:ConfigurationOptionSetting' :: Maybe Text
optionName = Maybe Text
a} :: ConfigurationOptionSetting)

-- | A unique resource name for the option setting. Use it for a time–based
-- scaling configuration option.
configurationOptionSetting_resourceName :: Lens.Lens' ConfigurationOptionSetting (Prelude.Maybe Prelude.Text)
configurationOptionSetting_resourceName :: (Maybe Text -> f (Maybe Text))
-> ConfigurationOptionSetting -> f ConfigurationOptionSetting
configurationOptionSetting_resourceName = (ConfigurationOptionSetting -> Maybe Text)
-> (ConfigurationOptionSetting
    -> Maybe Text -> ConfigurationOptionSetting)
-> Lens
     ConfigurationOptionSetting
     ConfigurationOptionSetting
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationOptionSetting' {Maybe Text
resourceName :: Maybe Text
$sel:resourceName:ConfigurationOptionSetting' :: ConfigurationOptionSetting -> Maybe Text
resourceName} -> Maybe Text
resourceName) (\s :: ConfigurationOptionSetting
s@ConfigurationOptionSetting' {} Maybe Text
a -> ConfigurationOptionSetting
s {$sel:resourceName:ConfigurationOptionSetting' :: Maybe Text
resourceName = Maybe Text
a} :: ConfigurationOptionSetting)

-- | A unique namespace that identifies the option\'s associated AWS
-- resource.
configurationOptionSetting_namespace :: Lens.Lens' ConfigurationOptionSetting (Prelude.Maybe Prelude.Text)
configurationOptionSetting_namespace :: (Maybe Text -> f (Maybe Text))
-> ConfigurationOptionSetting -> f ConfigurationOptionSetting
configurationOptionSetting_namespace = (ConfigurationOptionSetting -> Maybe Text)
-> (ConfigurationOptionSetting
    -> Maybe Text -> ConfigurationOptionSetting)
-> Lens
     ConfigurationOptionSetting
     ConfigurationOptionSetting
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationOptionSetting' {Maybe Text
namespace :: Maybe Text
$sel:namespace:ConfigurationOptionSetting' :: ConfigurationOptionSetting -> Maybe Text
namespace} -> Maybe Text
namespace) (\s :: ConfigurationOptionSetting
s@ConfigurationOptionSetting' {} Maybe Text
a -> ConfigurationOptionSetting
s {$sel:namespace:ConfigurationOptionSetting' :: Maybe Text
namespace = Maybe Text
a} :: ConfigurationOptionSetting)

-- | The current value for the configuration option.
configurationOptionSetting_value :: Lens.Lens' ConfigurationOptionSetting (Prelude.Maybe Prelude.Text)
configurationOptionSetting_value :: (Maybe Text -> f (Maybe Text))
-> ConfigurationOptionSetting -> f ConfigurationOptionSetting
configurationOptionSetting_value = (ConfigurationOptionSetting -> Maybe Text)
-> (ConfigurationOptionSetting
    -> Maybe Text -> ConfigurationOptionSetting)
-> Lens
     ConfigurationOptionSetting
     ConfigurationOptionSetting
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationOptionSetting' {Maybe Text
value :: Maybe Text
$sel:value:ConfigurationOptionSetting' :: ConfigurationOptionSetting -> Maybe Text
value} -> Maybe Text
value) (\s :: ConfigurationOptionSetting
s@ConfigurationOptionSetting' {} Maybe Text
a -> ConfigurationOptionSetting
s {$sel:value:ConfigurationOptionSetting' :: Maybe Text
value = Maybe Text
a} :: ConfigurationOptionSetting)

instance Core.FromXML ConfigurationOptionSetting where
  parseXML :: [Node] -> Either String ConfigurationOptionSetting
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ConfigurationOptionSetting
ConfigurationOptionSetting'
      (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ConfigurationOptionSetting)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> ConfigurationOptionSetting)
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
"OptionName")
      Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Text -> ConfigurationOptionSetting)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> ConfigurationOptionSetting)
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
"ResourceName")
      Either
  String (Maybe Text -> Maybe Text -> ConfigurationOptionSetting)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> ConfigurationOptionSetting)
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
"Namespace")
      Either String (Maybe Text -> ConfigurationOptionSetting)
-> Either String (Maybe Text)
-> Either String ConfigurationOptionSetting
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
"Value")

instance Prelude.Hashable ConfigurationOptionSetting

instance Prelude.NFData ConfigurationOptionSetting

instance Core.ToQuery ConfigurationOptionSetting where
  toQuery :: ConfigurationOptionSetting -> QueryString
toQuery ConfigurationOptionSetting' {Maybe Text
value :: Maybe Text
namespace :: Maybe Text
resourceName :: Maybe Text
optionName :: Maybe Text
$sel:value:ConfigurationOptionSetting' :: ConfigurationOptionSetting -> Maybe Text
$sel:namespace:ConfigurationOptionSetting' :: ConfigurationOptionSetting -> Maybe Text
$sel:resourceName:ConfigurationOptionSetting' :: ConfigurationOptionSetting -> Maybe Text
$sel:optionName:ConfigurationOptionSetting' :: ConfigurationOptionSetting -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"OptionName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
optionName,
        ByteString
"ResourceName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
resourceName,
        ByteString
"Namespace" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
namespace,
        ByteString
"Value" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
value
      ]