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

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

-- | Specifies an XML classifier for @CreateClassifier@ to create.
--
-- /See:/ 'newCreateXMLClassifierRequest' smart constructor.
data CreateXMLClassifierRequest = CreateXMLClassifierRequest'
  { -- | The XML tag designating the element that contains each record in an XML
    -- document being parsed. This can\'t identify a self-closing element
    -- (closed by @\/>@). An empty row element that contains only attributes
    -- can be parsed as long as it ends with a closing tag (for example,
    -- @\<row item_a=\"A\" item_b=\"B\">\<\/row>@ is okay, but
    -- @\<row item_a=\"A\" item_b=\"B\" \/>@ is not).
    CreateXMLClassifierRequest -> Maybe Text
rowTag :: Prelude.Maybe Prelude.Text,
    -- | An identifier of the data format that the classifier matches.
    CreateXMLClassifierRequest -> Text
classification :: Prelude.Text,
    -- | The name of the classifier.
    CreateXMLClassifierRequest -> Text
name :: Prelude.Text
  }
  deriving (CreateXMLClassifierRequest -> CreateXMLClassifierRequest -> Bool
(CreateXMLClassifierRequest -> CreateXMLClassifierRequest -> Bool)
-> (CreateXMLClassifierRequest
    -> CreateXMLClassifierRequest -> Bool)
-> Eq CreateXMLClassifierRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateXMLClassifierRequest -> CreateXMLClassifierRequest -> Bool
$c/= :: CreateXMLClassifierRequest -> CreateXMLClassifierRequest -> Bool
== :: CreateXMLClassifierRequest -> CreateXMLClassifierRequest -> Bool
$c== :: CreateXMLClassifierRequest -> CreateXMLClassifierRequest -> Bool
Prelude.Eq, ReadPrec [CreateXMLClassifierRequest]
ReadPrec CreateXMLClassifierRequest
Int -> ReadS CreateXMLClassifierRequest
ReadS [CreateXMLClassifierRequest]
(Int -> ReadS CreateXMLClassifierRequest)
-> ReadS [CreateXMLClassifierRequest]
-> ReadPrec CreateXMLClassifierRequest
-> ReadPrec [CreateXMLClassifierRequest]
-> Read CreateXMLClassifierRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateXMLClassifierRequest]
$creadListPrec :: ReadPrec [CreateXMLClassifierRequest]
readPrec :: ReadPrec CreateXMLClassifierRequest
$creadPrec :: ReadPrec CreateXMLClassifierRequest
readList :: ReadS [CreateXMLClassifierRequest]
$creadList :: ReadS [CreateXMLClassifierRequest]
readsPrec :: Int -> ReadS CreateXMLClassifierRequest
$creadsPrec :: Int -> ReadS CreateXMLClassifierRequest
Prelude.Read, Int -> CreateXMLClassifierRequest -> ShowS
[CreateXMLClassifierRequest] -> ShowS
CreateXMLClassifierRequest -> String
(Int -> CreateXMLClassifierRequest -> ShowS)
-> (CreateXMLClassifierRequest -> String)
-> ([CreateXMLClassifierRequest] -> ShowS)
-> Show CreateXMLClassifierRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateXMLClassifierRequest] -> ShowS
$cshowList :: [CreateXMLClassifierRequest] -> ShowS
show :: CreateXMLClassifierRequest -> String
$cshow :: CreateXMLClassifierRequest -> String
showsPrec :: Int -> CreateXMLClassifierRequest -> ShowS
$cshowsPrec :: Int -> CreateXMLClassifierRequest -> ShowS
Prelude.Show, (forall x.
 CreateXMLClassifierRequest -> Rep CreateXMLClassifierRequest x)
-> (forall x.
    Rep CreateXMLClassifierRequest x -> CreateXMLClassifierRequest)
-> Generic CreateXMLClassifierRequest
forall x.
Rep CreateXMLClassifierRequest x -> CreateXMLClassifierRequest
forall x.
CreateXMLClassifierRequest -> Rep CreateXMLClassifierRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateXMLClassifierRequest x -> CreateXMLClassifierRequest
$cfrom :: forall x.
CreateXMLClassifierRequest -> Rep CreateXMLClassifierRequest x
Prelude.Generic)

-- |
-- Create a value of 'CreateXMLClassifierRequest' 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:
--
-- 'rowTag', 'createXMLClassifierRequest_rowTag' - The XML tag designating the element that contains each record in an XML
-- document being parsed. This can\'t identify a self-closing element
-- (closed by @\/>@). An empty row element that contains only attributes
-- can be parsed as long as it ends with a closing tag (for example,
-- @\<row item_a=\"A\" item_b=\"B\">\<\/row>@ is okay, but
-- @\<row item_a=\"A\" item_b=\"B\" \/>@ is not).
--
-- 'classification', 'createXMLClassifierRequest_classification' - An identifier of the data format that the classifier matches.
--
-- 'name', 'createXMLClassifierRequest_name' - The name of the classifier.
newCreateXMLClassifierRequest ::
  -- | 'classification'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  CreateXMLClassifierRequest
newCreateXMLClassifierRequest :: Text -> Text -> CreateXMLClassifierRequest
newCreateXMLClassifierRequest Text
pClassification_ Text
pName_ =
  CreateXMLClassifierRequest' :: Maybe Text -> Text -> Text -> CreateXMLClassifierRequest
CreateXMLClassifierRequest'
    { $sel:rowTag:CreateXMLClassifierRequest' :: Maybe Text
rowTag =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:classification:CreateXMLClassifierRequest' :: Text
classification = Text
pClassification_,
      $sel:name:CreateXMLClassifierRequest' :: Text
name = Text
pName_
    }

-- | The XML tag designating the element that contains each record in an XML
-- document being parsed. This can\'t identify a self-closing element
-- (closed by @\/>@). An empty row element that contains only attributes
-- can be parsed as long as it ends with a closing tag (for example,
-- @\<row item_a=\"A\" item_b=\"B\">\<\/row>@ is okay, but
-- @\<row item_a=\"A\" item_b=\"B\" \/>@ is not).
createXMLClassifierRequest_rowTag :: Lens.Lens' CreateXMLClassifierRequest (Prelude.Maybe Prelude.Text)
createXMLClassifierRequest_rowTag :: (Maybe Text -> f (Maybe Text))
-> CreateXMLClassifierRequest -> f CreateXMLClassifierRequest
createXMLClassifierRequest_rowTag = (CreateXMLClassifierRequest -> Maybe Text)
-> (CreateXMLClassifierRequest
    -> Maybe Text -> CreateXMLClassifierRequest)
-> Lens
     CreateXMLClassifierRequest
     CreateXMLClassifierRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateXMLClassifierRequest' {Maybe Text
rowTag :: Maybe Text
$sel:rowTag:CreateXMLClassifierRequest' :: CreateXMLClassifierRequest -> Maybe Text
rowTag} -> Maybe Text
rowTag) (\s :: CreateXMLClassifierRequest
s@CreateXMLClassifierRequest' {} Maybe Text
a -> CreateXMLClassifierRequest
s {$sel:rowTag:CreateXMLClassifierRequest' :: Maybe Text
rowTag = Maybe Text
a} :: CreateXMLClassifierRequest)

-- | An identifier of the data format that the classifier matches.
createXMLClassifierRequest_classification :: Lens.Lens' CreateXMLClassifierRequest Prelude.Text
createXMLClassifierRequest_classification :: (Text -> f Text)
-> CreateXMLClassifierRequest -> f CreateXMLClassifierRequest
createXMLClassifierRequest_classification = (CreateXMLClassifierRequest -> Text)
-> (CreateXMLClassifierRequest
    -> Text -> CreateXMLClassifierRequest)
-> Lens
     CreateXMLClassifierRequest CreateXMLClassifierRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateXMLClassifierRequest' {Text
classification :: Text
$sel:classification:CreateXMLClassifierRequest' :: CreateXMLClassifierRequest -> Text
classification} -> Text
classification) (\s :: CreateXMLClassifierRequest
s@CreateXMLClassifierRequest' {} Text
a -> CreateXMLClassifierRequest
s {$sel:classification:CreateXMLClassifierRequest' :: Text
classification = Text
a} :: CreateXMLClassifierRequest)

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

instance Prelude.Hashable CreateXMLClassifierRequest

instance Prelude.NFData CreateXMLClassifierRequest

instance Core.ToJSON CreateXMLClassifierRequest where
  toJSON :: CreateXMLClassifierRequest -> Value
toJSON CreateXMLClassifierRequest' {Maybe Text
Text
name :: Text
classification :: Text
rowTag :: Maybe Text
$sel:name:CreateXMLClassifierRequest' :: CreateXMLClassifierRequest -> Text
$sel:classification:CreateXMLClassifierRequest' :: CreateXMLClassifierRequest -> Text
$sel:rowTag:CreateXMLClassifierRequest' :: CreateXMLClassifierRequest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RowTag" 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
rowTag,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"Classification" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
classification),
            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)
          ]
      )