{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ElasticBeanstalk.Types.OptionRestrictionRegex 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

-- | A regular expression representing a restriction on a string
-- configuration option value.
--
-- /See:/ 'newOptionRestrictionRegex' smart constructor.
data OptionRestrictionRegex = OptionRestrictionRegex'
  { -- | A unique name representing this regular expression.
    OptionRestrictionRegex -> Maybe Text
label :: Prelude.Maybe Prelude.Text,
    -- | The regular expression pattern that a string configuration option value
    -- with this restriction must match.
    OptionRestrictionRegex -> Maybe Text
pattern' :: Prelude.Maybe Prelude.Text
  }
  deriving (OptionRestrictionRegex -> OptionRestrictionRegex -> Bool
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]
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
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. 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:
--
-- 'label', 'optionRestrictionRegex_label' - A unique name representing this regular expression.
--
-- 'pattern'', 'optionRestrictionRegex_pattern' - The regular expression pattern that a string configuration option value
-- with this restriction must match.
newOptionRestrictionRegex ::
  OptionRestrictionRegex
newOptionRestrictionRegex :: OptionRestrictionRegex
newOptionRestrictionRegex =
  OptionRestrictionRegex'
    { $sel:label:OptionRestrictionRegex' :: Maybe Text
label = forall a. Maybe a
Prelude.Nothing,
      $sel:pattern':OptionRestrictionRegex' :: Maybe Text
pattern' = forall a. Maybe a
Prelude.Nothing
    }

-- | A unique name representing this regular expression.
optionRestrictionRegex_label :: Lens.Lens' OptionRestrictionRegex (Prelude.Maybe Prelude.Text)
optionRestrictionRegex_label :: Lens' OptionRestrictionRegex (Maybe Text)
optionRestrictionRegex_label = 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)

-- | 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 :: Lens' OptionRestrictionRegex (Maybe Text)
optionRestrictionRegex_pattern = 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)

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

instance Prelude.Hashable OptionRestrictionRegex where
  hashWithSalt :: Int -> OptionRestrictionRegex -> Int
hashWithSalt Int
_salt OptionRestrictionRegex' {Maybe Text
pattern' :: Maybe Text
label :: Maybe Text
$sel:pattern':OptionRestrictionRegex' :: OptionRestrictionRegex -> Maybe Text
$sel:label:OptionRestrictionRegex' :: OptionRestrictionRegex -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
label
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pattern'

instance Prelude.NFData OptionRestrictionRegex where
  rnf :: OptionRestrictionRegex -> ()
rnf OptionRestrictionRegex' {Maybe Text
pattern' :: Maybe Text
label :: Maybe Text
$sel:pattern':OptionRestrictionRegex' :: OptionRestrictionRegex -> Maybe Text
$sel:label:OptionRestrictionRegex' :: OptionRestrictionRegex -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
label
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pattern'