{-# 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.XMLClassifier
-- 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.Glue.Types.XMLClassifier 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 classifier for @XML@ content.
--
-- /See:/ 'newXMLClassifier' smart constructor.
data XMLClassifier = XMLClassifier'
  { -- | The time that this classifier was registered.
    XMLClassifier -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | The time that this classifier was last updated.
    XMLClassifier -> Maybe POSIX
lastUpdated :: Prelude.Maybe Data.POSIX,
    -- | 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).
    XMLClassifier -> Maybe Text
rowTag :: Prelude.Maybe Prelude.Text,
    -- | The version of this classifier.
    XMLClassifier -> Maybe Integer
version :: Prelude.Maybe Prelude.Integer,
    -- | The name of the classifier.
    XMLClassifier -> Text
name :: Prelude.Text,
    -- | An identifier of the data format that the classifier matches.
    XMLClassifier -> Text
classification :: Prelude.Text
  }
  deriving (XMLClassifier -> XMLClassifier -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: XMLClassifier -> XMLClassifier -> Bool
$c/= :: XMLClassifier -> XMLClassifier -> Bool
== :: XMLClassifier -> XMLClassifier -> Bool
$c== :: XMLClassifier -> XMLClassifier -> Bool
Prelude.Eq, ReadPrec [XMLClassifier]
ReadPrec XMLClassifier
Int -> ReadS XMLClassifier
ReadS [XMLClassifier]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [XMLClassifier]
$creadListPrec :: ReadPrec [XMLClassifier]
readPrec :: ReadPrec XMLClassifier
$creadPrec :: ReadPrec XMLClassifier
readList :: ReadS [XMLClassifier]
$creadList :: ReadS [XMLClassifier]
readsPrec :: Int -> ReadS XMLClassifier
$creadsPrec :: Int -> ReadS XMLClassifier
Prelude.Read, Int -> XMLClassifier -> ShowS
[XMLClassifier] -> ShowS
XMLClassifier -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [XMLClassifier] -> ShowS
$cshowList :: [XMLClassifier] -> ShowS
show :: XMLClassifier -> String
$cshow :: XMLClassifier -> String
showsPrec :: Int -> XMLClassifier -> ShowS
$cshowsPrec :: Int -> XMLClassifier -> ShowS
Prelude.Show, forall x. Rep XMLClassifier x -> XMLClassifier
forall x. XMLClassifier -> Rep XMLClassifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep XMLClassifier x -> XMLClassifier
$cfrom :: forall x. XMLClassifier -> Rep XMLClassifier x
Prelude.Generic)

-- |
-- Create a value of 'XMLClassifier' 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:
--
-- 'creationTime', 'xMLClassifier_creationTime' - The time that this classifier was registered.
--
-- 'lastUpdated', 'xMLClassifier_lastUpdated' - The time that this classifier was last updated.
--
-- 'rowTag', 'xMLClassifier_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).
--
-- 'version', 'xMLClassifier_version' - The version of this classifier.
--
-- 'name', 'xMLClassifier_name' - The name of the classifier.
--
-- 'classification', 'xMLClassifier_classification' - An identifier of the data format that the classifier matches.
newXMLClassifier ::
  -- | 'name'
  Prelude.Text ->
  -- | 'classification'
  Prelude.Text ->
  XMLClassifier
newXMLClassifier :: Text -> Text -> XMLClassifier
newXMLClassifier Text
pName_ Text
pClassification_ =
  XMLClassifier'
    { $sel:creationTime:XMLClassifier' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdated:XMLClassifier' :: Maybe POSIX
lastUpdated = forall a. Maybe a
Prelude.Nothing,
      $sel:rowTag:XMLClassifier' :: Maybe Text
rowTag = forall a. Maybe a
Prelude.Nothing,
      $sel:version:XMLClassifier' :: Maybe Integer
version = forall a. Maybe a
Prelude.Nothing,
      $sel:name:XMLClassifier' :: Text
name = Text
pName_,
      $sel:classification:XMLClassifier' :: Text
classification = Text
pClassification_
    }

-- | The time that this classifier was registered.
xMLClassifier_creationTime :: Lens.Lens' XMLClassifier (Prelude.Maybe Prelude.UTCTime)
xMLClassifier_creationTime :: Lens' XMLClassifier (Maybe UTCTime)
xMLClassifier_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\XMLClassifier' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:XMLClassifier' :: XMLClassifier -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: XMLClassifier
s@XMLClassifier' {} Maybe POSIX
a -> XMLClassifier
s {$sel:creationTime:XMLClassifier' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: XMLClassifier) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The time that this classifier was last updated.
xMLClassifier_lastUpdated :: Lens.Lens' XMLClassifier (Prelude.Maybe Prelude.UTCTime)
xMLClassifier_lastUpdated :: Lens' XMLClassifier (Maybe UTCTime)
xMLClassifier_lastUpdated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\XMLClassifier' {Maybe POSIX
lastUpdated :: Maybe POSIX
$sel:lastUpdated:XMLClassifier' :: XMLClassifier -> Maybe POSIX
lastUpdated} -> Maybe POSIX
lastUpdated) (\s :: XMLClassifier
s@XMLClassifier' {} Maybe POSIX
a -> XMLClassifier
s {$sel:lastUpdated:XMLClassifier' :: Maybe POSIX
lastUpdated = Maybe POSIX
a} :: XMLClassifier) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | 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).
xMLClassifier_rowTag :: Lens.Lens' XMLClassifier (Prelude.Maybe Prelude.Text)
xMLClassifier_rowTag :: Lens' XMLClassifier (Maybe Text)
xMLClassifier_rowTag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\XMLClassifier' {Maybe Text
rowTag :: Maybe Text
$sel:rowTag:XMLClassifier' :: XMLClassifier -> Maybe Text
rowTag} -> Maybe Text
rowTag) (\s :: XMLClassifier
s@XMLClassifier' {} Maybe Text
a -> XMLClassifier
s {$sel:rowTag:XMLClassifier' :: Maybe Text
rowTag = Maybe Text
a} :: XMLClassifier)

-- | The version of this classifier.
xMLClassifier_version :: Lens.Lens' XMLClassifier (Prelude.Maybe Prelude.Integer)
xMLClassifier_version :: Lens' XMLClassifier (Maybe Integer)
xMLClassifier_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\XMLClassifier' {Maybe Integer
version :: Maybe Integer
$sel:version:XMLClassifier' :: XMLClassifier -> Maybe Integer
version} -> Maybe Integer
version) (\s :: XMLClassifier
s@XMLClassifier' {} Maybe Integer
a -> XMLClassifier
s {$sel:version:XMLClassifier' :: Maybe Integer
version = Maybe Integer
a} :: XMLClassifier)

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

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

instance Data.FromJSON XMLClassifier where
  parseJSON :: Value -> Parser XMLClassifier
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"XMLClassifier"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Integer
-> Text
-> Text
-> XMLClassifier
XMLClassifier'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CreationTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LastUpdated")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RowTag")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Version")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Classification")
      )

instance Prelude.Hashable XMLClassifier where
  hashWithSalt :: Int -> XMLClassifier -> Int
hashWithSalt Int
_salt XMLClassifier' {Maybe Integer
Maybe Text
Maybe POSIX
Text
classification :: Text
name :: Text
version :: Maybe Integer
rowTag :: Maybe Text
lastUpdated :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:classification:XMLClassifier' :: XMLClassifier -> Text
$sel:name:XMLClassifier' :: XMLClassifier -> Text
$sel:version:XMLClassifier' :: XMLClassifier -> Maybe Integer
$sel:rowTag:XMLClassifier' :: XMLClassifier -> Maybe Text
$sel:lastUpdated:XMLClassifier' :: XMLClassifier -> Maybe POSIX
$sel:creationTime:XMLClassifier' :: XMLClassifier -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
rowTag
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
version
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
classification

instance Prelude.NFData XMLClassifier where
  rnf :: XMLClassifier -> ()
rnf XMLClassifier' {Maybe Integer
Maybe Text
Maybe POSIX
Text
classification :: Text
name :: Text
version :: Maybe Integer
rowTag :: Maybe Text
lastUpdated :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:classification:XMLClassifier' :: XMLClassifier -> Text
$sel:name:XMLClassifier' :: XMLClassifier -> Text
$sel:version:XMLClassifier' :: XMLClassifier -> Maybe Integer
$sel:rowTag:XMLClassifier' :: XMLClassifier -> Maybe Text
$sel:lastUpdated:XMLClassifier' :: XMLClassifier -> Maybe POSIX
$sel:creationTime:XMLClassifier' :: XMLClassifier -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
rowTag
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
version
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
classification