{-# 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.Glue.Types.UpdateGrokClassifierRequest
-- 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.Glue.Types.UpdateGrokClassifierRequest where

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

-- | Specifies a grok classifier to update when passed to @UpdateClassifier@.
--
-- /See:/ 'newUpdateGrokClassifierRequest' smart constructor.
data UpdateGrokClassifierRequest = UpdateGrokClassifierRequest'
  { -- | An identifier of the data format that the classifier matches, such as
    -- Twitter, JSON, Omniture logs, Amazon CloudWatch Logs, and so on.
    UpdateGrokClassifierRequest -> Maybe Text
classification :: Prelude.Maybe Prelude.Text,
    -- | Optional custom grok patterns used by this classifier.
    UpdateGrokClassifierRequest -> Maybe Text
customPatterns :: Prelude.Maybe Prelude.Text,
    -- | The grok pattern used by this classifier.
    UpdateGrokClassifierRequest -> Maybe Text
grokPattern :: Prelude.Maybe Prelude.Text,
    -- | The name of the @GrokClassifier@.
    UpdateGrokClassifierRequest -> Text
name :: Prelude.Text
  }
  deriving (UpdateGrokClassifierRequest -> UpdateGrokClassifierRequest -> Bool
(UpdateGrokClassifierRequest
 -> UpdateGrokClassifierRequest -> Bool)
-> (UpdateGrokClassifierRequest
    -> UpdateGrokClassifierRequest -> Bool)
-> Eq UpdateGrokClassifierRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGrokClassifierRequest -> UpdateGrokClassifierRequest -> Bool
$c/= :: UpdateGrokClassifierRequest -> UpdateGrokClassifierRequest -> Bool
== :: UpdateGrokClassifierRequest -> UpdateGrokClassifierRequest -> Bool
$c== :: UpdateGrokClassifierRequest -> UpdateGrokClassifierRequest -> Bool
Prelude.Eq, ReadPrec [UpdateGrokClassifierRequest]
ReadPrec UpdateGrokClassifierRequest
Int -> ReadS UpdateGrokClassifierRequest
ReadS [UpdateGrokClassifierRequest]
(Int -> ReadS UpdateGrokClassifierRequest)
-> ReadS [UpdateGrokClassifierRequest]
-> ReadPrec UpdateGrokClassifierRequest
-> ReadPrec [UpdateGrokClassifierRequest]
-> Read UpdateGrokClassifierRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGrokClassifierRequest]
$creadListPrec :: ReadPrec [UpdateGrokClassifierRequest]
readPrec :: ReadPrec UpdateGrokClassifierRequest
$creadPrec :: ReadPrec UpdateGrokClassifierRequest
readList :: ReadS [UpdateGrokClassifierRequest]
$creadList :: ReadS [UpdateGrokClassifierRequest]
readsPrec :: Int -> ReadS UpdateGrokClassifierRequest
$creadsPrec :: Int -> ReadS UpdateGrokClassifierRequest
Prelude.Read, Int -> UpdateGrokClassifierRequest -> ShowS
[UpdateGrokClassifierRequest] -> ShowS
UpdateGrokClassifierRequest -> String
(Int -> UpdateGrokClassifierRequest -> ShowS)
-> (UpdateGrokClassifierRequest -> String)
-> ([UpdateGrokClassifierRequest] -> ShowS)
-> Show UpdateGrokClassifierRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGrokClassifierRequest] -> ShowS
$cshowList :: [UpdateGrokClassifierRequest] -> ShowS
show :: UpdateGrokClassifierRequest -> String
$cshow :: UpdateGrokClassifierRequest -> String
showsPrec :: Int -> UpdateGrokClassifierRequest -> ShowS
$cshowsPrec :: Int -> UpdateGrokClassifierRequest -> ShowS
Prelude.Show, (forall x.
 UpdateGrokClassifierRequest -> Rep UpdateGrokClassifierRequest x)
-> (forall x.
    Rep UpdateGrokClassifierRequest x -> UpdateGrokClassifierRequest)
-> Generic UpdateGrokClassifierRequest
forall x.
Rep UpdateGrokClassifierRequest x -> UpdateGrokClassifierRequest
forall x.
UpdateGrokClassifierRequest -> Rep UpdateGrokClassifierRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateGrokClassifierRequest x -> UpdateGrokClassifierRequest
$cfrom :: forall x.
UpdateGrokClassifierRequest -> Rep UpdateGrokClassifierRequest x
Prelude.Generic)

-- |
-- Create a value of 'UpdateGrokClassifierRequest' 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:
--
-- 'classification', 'updateGrokClassifierRequest_classification' - An identifier of the data format that the classifier matches, such as
-- Twitter, JSON, Omniture logs, Amazon CloudWatch Logs, and so on.
--
-- 'customPatterns', 'updateGrokClassifierRequest_customPatterns' - Optional custom grok patterns used by this classifier.
--
-- 'grokPattern', 'updateGrokClassifierRequest_grokPattern' - The grok pattern used by this classifier.
--
-- 'name', 'updateGrokClassifierRequest_name' - The name of the @GrokClassifier@.
newUpdateGrokClassifierRequest ::
  -- | 'name'
  Prelude.Text ->
  UpdateGrokClassifierRequest
newUpdateGrokClassifierRequest :: Text -> UpdateGrokClassifierRequest
newUpdateGrokClassifierRequest Text
pName_ =
  UpdateGrokClassifierRequest' :: Maybe Text
-> Maybe Text -> Maybe Text -> Text -> UpdateGrokClassifierRequest
UpdateGrokClassifierRequest'
    { $sel:classification:UpdateGrokClassifierRequest' :: Maybe Text
classification =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:customPatterns:UpdateGrokClassifierRequest' :: Maybe Text
customPatterns = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:grokPattern:UpdateGrokClassifierRequest' :: Maybe Text
grokPattern = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateGrokClassifierRequest' :: Text
name = Text
pName_
    }

-- | An identifier of the data format that the classifier matches, such as
-- Twitter, JSON, Omniture logs, Amazon CloudWatch Logs, and so on.
updateGrokClassifierRequest_classification :: Lens.Lens' UpdateGrokClassifierRequest (Prelude.Maybe Prelude.Text)
updateGrokClassifierRequest_classification :: (Maybe Text -> f (Maybe Text))
-> UpdateGrokClassifierRequest -> f UpdateGrokClassifierRequest
updateGrokClassifierRequest_classification = (UpdateGrokClassifierRequest -> Maybe Text)
-> (UpdateGrokClassifierRequest
    -> Maybe Text -> UpdateGrokClassifierRequest)
-> Lens
     UpdateGrokClassifierRequest
     UpdateGrokClassifierRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGrokClassifierRequest' {Maybe Text
classification :: Maybe Text
$sel:classification:UpdateGrokClassifierRequest' :: UpdateGrokClassifierRequest -> Maybe Text
classification} -> Maybe Text
classification) (\s :: UpdateGrokClassifierRequest
s@UpdateGrokClassifierRequest' {} Maybe Text
a -> UpdateGrokClassifierRequest
s {$sel:classification:UpdateGrokClassifierRequest' :: Maybe Text
classification = Maybe Text
a} :: UpdateGrokClassifierRequest)

-- | Optional custom grok patterns used by this classifier.
updateGrokClassifierRequest_customPatterns :: Lens.Lens' UpdateGrokClassifierRequest (Prelude.Maybe Prelude.Text)
updateGrokClassifierRequest_customPatterns :: (Maybe Text -> f (Maybe Text))
-> UpdateGrokClassifierRequest -> f UpdateGrokClassifierRequest
updateGrokClassifierRequest_customPatterns = (UpdateGrokClassifierRequest -> Maybe Text)
-> (UpdateGrokClassifierRequest
    -> Maybe Text -> UpdateGrokClassifierRequest)
-> Lens
     UpdateGrokClassifierRequest
     UpdateGrokClassifierRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGrokClassifierRequest' {Maybe Text
customPatterns :: Maybe Text
$sel:customPatterns:UpdateGrokClassifierRequest' :: UpdateGrokClassifierRequest -> Maybe Text
customPatterns} -> Maybe Text
customPatterns) (\s :: UpdateGrokClassifierRequest
s@UpdateGrokClassifierRequest' {} Maybe Text
a -> UpdateGrokClassifierRequest
s {$sel:customPatterns:UpdateGrokClassifierRequest' :: Maybe Text
customPatterns = Maybe Text
a} :: UpdateGrokClassifierRequest)

-- | The grok pattern used by this classifier.
updateGrokClassifierRequest_grokPattern :: Lens.Lens' UpdateGrokClassifierRequest (Prelude.Maybe Prelude.Text)
updateGrokClassifierRequest_grokPattern :: (Maybe Text -> f (Maybe Text))
-> UpdateGrokClassifierRequest -> f UpdateGrokClassifierRequest
updateGrokClassifierRequest_grokPattern = (UpdateGrokClassifierRequest -> Maybe Text)
-> (UpdateGrokClassifierRequest
    -> Maybe Text -> UpdateGrokClassifierRequest)
-> Lens
     UpdateGrokClassifierRequest
     UpdateGrokClassifierRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGrokClassifierRequest' {Maybe Text
grokPattern :: Maybe Text
$sel:grokPattern:UpdateGrokClassifierRequest' :: UpdateGrokClassifierRequest -> Maybe Text
grokPattern} -> Maybe Text
grokPattern) (\s :: UpdateGrokClassifierRequest
s@UpdateGrokClassifierRequest' {} Maybe Text
a -> UpdateGrokClassifierRequest
s {$sel:grokPattern:UpdateGrokClassifierRequest' :: Maybe Text
grokPattern = Maybe Text
a} :: UpdateGrokClassifierRequest)

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

instance Prelude.Hashable UpdateGrokClassifierRequest

instance Prelude.NFData UpdateGrokClassifierRequest

instance Core.ToJSON UpdateGrokClassifierRequest where
  toJSON :: UpdateGrokClassifierRequest -> Value
toJSON UpdateGrokClassifierRequest' {Maybe Text
Text
name :: Text
grokPattern :: Maybe Text
customPatterns :: Maybe Text
classification :: Maybe Text
$sel:name:UpdateGrokClassifierRequest' :: UpdateGrokClassifierRequest -> Text
$sel:grokPattern:UpdateGrokClassifierRequest' :: UpdateGrokClassifierRequest -> Maybe Text
$sel:customPatterns:UpdateGrokClassifierRequest' :: UpdateGrokClassifierRequest -> Maybe Text
$sel:classification:UpdateGrokClassifierRequest' :: UpdateGrokClassifierRequest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Classification" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
classification,
            (Text
"CustomPatterns" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
customPatterns,
            (Text
"GrokPattern" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
grokPattern,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )