{-# 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.OptionRestrictionRegex
-- 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.OptionRestrictionRegex where

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

-- | A regular expression representing a restriction on a string
-- configuration option value.
--
-- /See:/ 'newOptionRestrictionRegex' smart constructor.
data OptionRestrictionRegex = OptionRestrictionRegex'
  { -- | The regular expression pattern that a string configuration option value
    -- with this restriction must match.
    OptionRestrictionRegex -> Maybe Text
pattern' :: Prelude.Maybe Prelude.Text,
    -- | A unique name representing this regular expression.
    OptionRestrictionRegex -> Maybe Text
label :: Prelude.Maybe Prelude.Text
  }
  deriving (OptionRestrictionRegex -> OptionRestrictionRegex -> Bool
(OptionRestrictionRegex -> OptionRestrictionRegex -> Bool)
-> (OptionRestrictionRegex -> OptionRestrictionRegex -> Bool)
-> Eq OptionRestrictionRegex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OptionRestrictionRegex -> OptionRestrictionRegex -> Bool
$c/= :: OptionRestrictionRegex -> OptionRestrictionRegex -> Bool
== :: OptionRestrictionRegex -> OptionRestrictionRegex -> Bool
$c== :: OptionRestrictionRegex -> OptionRestrictionRegex -> Bool
Prelude.Eq, ReadPrec [OptionRestrictionRegex]
ReadPrec OptionRestrictionRegex
Int -> ReadS OptionRestrictionRegex
ReadS [OptionRestrictionRegex]
(Int -> ReadS OptionRestrictionRegex)
-> ReadS [OptionRestrictionRegex]
-> ReadPrec OptionRestrictionRegex
-> ReadPrec [OptionRestrictionRegex]
-> Read OptionRestrictionRegex
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OptionRestrictionRegex]
$creadListPrec :: ReadPrec [OptionRestrictionRegex]
readPrec :: ReadPrec OptionRestrictionRegex
$creadPrec :: ReadPrec OptionRestrictionRegex
readList :: ReadS [OptionRestrictionRegex]
$creadList :: ReadS [OptionRestrictionRegex]
readsPrec :: Int -> ReadS OptionRestrictionRegex
$creadsPrec :: Int -> ReadS OptionRestrictionRegex
Prelude.Read, Int -> OptionRestrictionRegex -> ShowS
[OptionRestrictionRegex] -> ShowS
OptionRestrictionRegex -> String
(Int -> OptionRestrictionRegex -> ShowS)
-> (OptionRestrictionRegex -> String)
-> ([OptionRestrictionRegex] -> ShowS)
-> Show OptionRestrictionRegex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OptionRestrictionRegex] -> ShowS
$cshowList :: [OptionRestrictionRegex] -> ShowS
show :: OptionRestrictionRegex -> String
$cshow :: OptionRestrictionRegex -> String
showsPrec :: Int -> OptionRestrictionRegex -> ShowS
$cshowsPrec :: Int -> OptionRestrictionRegex -> ShowS
Prelude.Show, (forall x. OptionRestrictionRegex -> Rep OptionRestrictionRegex x)
-> (forall x.
    Rep OptionRestrictionRegex x -> OptionRestrictionRegex)
-> Generic OptionRestrictionRegex
forall x. Rep OptionRestrictionRegex x -> OptionRestrictionRegex
forall x. OptionRestrictionRegex -> Rep OptionRestrictionRegex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OptionRestrictionRegex x -> OptionRestrictionRegex
$cfrom :: forall x. OptionRestrictionRegex -> Rep OptionRestrictionRegex x
Prelude.Generic)

-- |
-- Create a value of 'OptionRestrictionRegex' 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:
--
-- 'pattern'', 'optionRestrictionRegex_pattern' - The regular expression pattern that a string configuration option value
-- with this restriction must match.
--
-- 'label', 'optionRestrictionRegex_label' - A unique name representing this regular expression.
newOptionRestrictionRegex ::
  OptionRestrictionRegex
newOptionRestrictionRegex :: OptionRestrictionRegex
newOptionRestrictionRegex =
  OptionRestrictionRegex' :: Maybe Text -> Maybe Text -> OptionRestrictionRegex
OptionRestrictionRegex'
    { $sel:pattern':OptionRestrictionRegex' :: Maybe Text
pattern' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:label:OptionRestrictionRegex' :: Maybe Text
label = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The regular expression pattern that a string configuration option value
-- with this restriction must match.
optionRestrictionRegex_pattern :: Lens.Lens' OptionRestrictionRegex (Prelude.Maybe Prelude.Text)
optionRestrictionRegex_pattern :: (Maybe Text -> f (Maybe Text))
-> OptionRestrictionRegex -> f OptionRestrictionRegex
optionRestrictionRegex_pattern = (OptionRestrictionRegex -> Maybe Text)
-> (OptionRestrictionRegex -> Maybe Text -> OptionRestrictionRegex)
-> Lens
     OptionRestrictionRegex
     OptionRestrictionRegex
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionRestrictionRegex' {Maybe Text
pattern' :: Maybe Text
$sel:pattern':OptionRestrictionRegex' :: OptionRestrictionRegex -> Maybe Text
pattern'} -> Maybe Text
pattern') (\s :: OptionRestrictionRegex
s@OptionRestrictionRegex' {} Maybe Text
a -> OptionRestrictionRegex
s {$sel:pattern':OptionRestrictionRegex' :: Maybe Text
pattern' = Maybe Text
a} :: OptionRestrictionRegex)

-- | A unique name representing this regular expression.
optionRestrictionRegex_label :: Lens.Lens' OptionRestrictionRegex (Prelude.Maybe Prelude.Text)
optionRestrictionRegex_label :: (Maybe Text -> f (Maybe Text))
-> OptionRestrictionRegex -> f OptionRestrictionRegex
optionRestrictionRegex_label = (OptionRestrictionRegex -> Maybe Text)
-> (OptionRestrictionRegex -> Maybe Text -> OptionRestrictionRegex)
-> Lens
     OptionRestrictionRegex
     OptionRestrictionRegex
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionRestrictionRegex' {Maybe Text
label :: Maybe Text
$sel:label:OptionRestrictionRegex' :: OptionRestrictionRegex -> Maybe Text
label} -> Maybe Text
label) (\s :: OptionRestrictionRegex
s@OptionRestrictionRegex' {} Maybe Text
a -> OptionRestrictionRegex
s {$sel:label:OptionRestrictionRegex' :: Maybe Text
label = Maybe Text
a} :: OptionRestrictionRegex)

instance Core.FromXML OptionRestrictionRegex where
  parseXML :: [Node] -> Either String OptionRestrictionRegex
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> OptionRestrictionRegex
OptionRestrictionRegex'
      (Maybe Text -> Maybe Text -> OptionRestrictionRegex)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> OptionRestrictionRegex)
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
"Pattern")
      Either String (Maybe Text -> OptionRestrictionRegex)
-> Either String (Maybe Text)
-> Either String OptionRestrictionRegex
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
"Label")

instance Prelude.Hashable OptionRestrictionRegex

instance Prelude.NFData OptionRestrictionRegex