{-# 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.SDB.Types.ReplaceableAttribute
-- 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.SDB.Types.ReplaceableAttribute where

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

-- |
--
-- /See:/ 'newReplaceableAttribute' smart constructor.
data ReplaceableAttribute = ReplaceableAttribute'
  { -- | A flag specifying whether or not to replace the attribute\/value pair or
    -- to add a new attribute\/value pair. The default setting is @false@.
    ReplaceableAttribute -> Maybe Bool
replace :: Prelude.Maybe Prelude.Bool,
    -- | The name of the replaceable attribute.
    ReplaceableAttribute -> Text
name :: Prelude.Text,
    -- | The value of the replaceable attribute.
    ReplaceableAttribute -> Text
value :: Prelude.Text
  }
  deriving (ReplaceableAttribute -> ReplaceableAttribute -> Bool
(ReplaceableAttribute -> ReplaceableAttribute -> Bool)
-> (ReplaceableAttribute -> ReplaceableAttribute -> Bool)
-> Eq ReplaceableAttribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplaceableAttribute -> ReplaceableAttribute -> Bool
$c/= :: ReplaceableAttribute -> ReplaceableAttribute -> Bool
== :: ReplaceableAttribute -> ReplaceableAttribute -> Bool
$c== :: ReplaceableAttribute -> ReplaceableAttribute -> Bool
Prelude.Eq, ReadPrec [ReplaceableAttribute]
ReadPrec ReplaceableAttribute
Int -> ReadS ReplaceableAttribute
ReadS [ReplaceableAttribute]
(Int -> ReadS ReplaceableAttribute)
-> ReadS [ReplaceableAttribute]
-> ReadPrec ReplaceableAttribute
-> ReadPrec [ReplaceableAttribute]
-> Read ReplaceableAttribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplaceableAttribute]
$creadListPrec :: ReadPrec [ReplaceableAttribute]
readPrec :: ReadPrec ReplaceableAttribute
$creadPrec :: ReadPrec ReplaceableAttribute
readList :: ReadS [ReplaceableAttribute]
$creadList :: ReadS [ReplaceableAttribute]
readsPrec :: Int -> ReadS ReplaceableAttribute
$creadsPrec :: Int -> ReadS ReplaceableAttribute
Prelude.Read, Int -> ReplaceableAttribute -> ShowS
[ReplaceableAttribute] -> ShowS
ReplaceableAttribute -> String
(Int -> ReplaceableAttribute -> ShowS)
-> (ReplaceableAttribute -> String)
-> ([ReplaceableAttribute] -> ShowS)
-> Show ReplaceableAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplaceableAttribute] -> ShowS
$cshowList :: [ReplaceableAttribute] -> ShowS
show :: ReplaceableAttribute -> String
$cshow :: ReplaceableAttribute -> String
showsPrec :: Int -> ReplaceableAttribute -> ShowS
$cshowsPrec :: Int -> ReplaceableAttribute -> ShowS
Prelude.Show, (forall x. ReplaceableAttribute -> Rep ReplaceableAttribute x)
-> (forall x. Rep ReplaceableAttribute x -> ReplaceableAttribute)
-> Generic ReplaceableAttribute
forall x. Rep ReplaceableAttribute x -> ReplaceableAttribute
forall x. ReplaceableAttribute -> Rep ReplaceableAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReplaceableAttribute x -> ReplaceableAttribute
$cfrom :: forall x. ReplaceableAttribute -> Rep ReplaceableAttribute x
Prelude.Generic)

-- |
-- Create a value of 'ReplaceableAttribute' 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:
--
-- 'replace', 'replaceableAttribute_replace' - A flag specifying whether or not to replace the attribute\/value pair or
-- to add a new attribute\/value pair. The default setting is @false@.
--
-- 'name', 'replaceableAttribute_name' - The name of the replaceable attribute.
--
-- 'value', 'replaceableAttribute_value' - The value of the replaceable attribute.
newReplaceableAttribute ::
  -- | 'name'
  Prelude.Text ->
  -- | 'value'
  Prelude.Text ->
  ReplaceableAttribute
newReplaceableAttribute :: Text -> Text -> ReplaceableAttribute
newReplaceableAttribute Text
pName_ Text
pValue_ =
  ReplaceableAttribute' :: Maybe Bool -> Text -> Text -> ReplaceableAttribute
ReplaceableAttribute'
    { $sel:replace:ReplaceableAttribute' :: Maybe Bool
replace = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ReplaceableAttribute' :: Text
name = Text
pName_,
      $sel:value:ReplaceableAttribute' :: Text
value = Text
pValue_
    }

-- | A flag specifying whether or not to replace the attribute\/value pair or
-- to add a new attribute\/value pair. The default setting is @false@.
replaceableAttribute_replace :: Lens.Lens' ReplaceableAttribute (Prelude.Maybe Prelude.Bool)
replaceableAttribute_replace :: (Maybe Bool -> f (Maybe Bool))
-> ReplaceableAttribute -> f ReplaceableAttribute
replaceableAttribute_replace = (ReplaceableAttribute -> Maybe Bool)
-> (ReplaceableAttribute -> Maybe Bool -> ReplaceableAttribute)
-> Lens
     ReplaceableAttribute ReplaceableAttribute (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplaceableAttribute' {Maybe Bool
replace :: Maybe Bool
$sel:replace:ReplaceableAttribute' :: ReplaceableAttribute -> Maybe Bool
replace} -> Maybe Bool
replace) (\s :: ReplaceableAttribute
s@ReplaceableAttribute' {} Maybe Bool
a -> ReplaceableAttribute
s {$sel:replace:ReplaceableAttribute' :: Maybe Bool
replace = Maybe Bool
a} :: ReplaceableAttribute)

-- | The name of the replaceable attribute.
replaceableAttribute_name :: Lens.Lens' ReplaceableAttribute Prelude.Text
replaceableAttribute_name :: (Text -> f Text) -> ReplaceableAttribute -> f ReplaceableAttribute
replaceableAttribute_name = (ReplaceableAttribute -> Text)
-> (ReplaceableAttribute -> Text -> ReplaceableAttribute)
-> Lens ReplaceableAttribute ReplaceableAttribute Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplaceableAttribute' {Text
name :: Text
$sel:name:ReplaceableAttribute' :: ReplaceableAttribute -> Text
name} -> Text
name) (\s :: ReplaceableAttribute
s@ReplaceableAttribute' {} Text
a -> ReplaceableAttribute
s {$sel:name:ReplaceableAttribute' :: Text
name = Text
a} :: ReplaceableAttribute)

-- | The value of the replaceable attribute.
replaceableAttribute_value :: Lens.Lens' ReplaceableAttribute Prelude.Text
replaceableAttribute_value :: (Text -> f Text) -> ReplaceableAttribute -> f ReplaceableAttribute
replaceableAttribute_value = (ReplaceableAttribute -> Text)
-> (ReplaceableAttribute -> Text -> ReplaceableAttribute)
-> Lens ReplaceableAttribute ReplaceableAttribute Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplaceableAttribute' {Text
value :: Text
$sel:value:ReplaceableAttribute' :: ReplaceableAttribute -> Text
value} -> Text
value) (\s :: ReplaceableAttribute
s@ReplaceableAttribute' {} Text
a -> ReplaceableAttribute
s {$sel:value:ReplaceableAttribute' :: Text
value = Text
a} :: ReplaceableAttribute)

instance Prelude.Hashable ReplaceableAttribute

instance Prelude.NFData ReplaceableAttribute

instance Core.ToQuery ReplaceableAttribute where
  toQuery :: ReplaceableAttribute -> QueryString
toQuery ReplaceableAttribute' {Maybe Bool
Text
value :: Text
name :: Text
replace :: Maybe Bool
$sel:value:ReplaceableAttribute' :: ReplaceableAttribute -> Text
$sel:name:ReplaceableAttribute' :: ReplaceableAttribute -> Text
$sel:replace:ReplaceableAttribute' :: ReplaceableAttribute -> Maybe Bool
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Replace" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
replace,
        ByteString
"Name" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
name,
        ByteString
"Value" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
value
      ]