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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 Core.POSIX,
    -- | The time that this classifier was last updated.
    XMLClassifier -> Maybe POSIX
lastUpdated :: Prelude.Maybe Core.POSIX,
    -- | The version of this classifier.
    XMLClassifier -> Maybe Integer
version :: Prelude.Maybe Prelude.Integer,
    -- | 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 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
(XMLClassifier -> XMLClassifier -> Bool)
-> (XMLClassifier -> XMLClassifier -> Bool) -> Eq XMLClassifier
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]
(Int -> ReadS XMLClassifier)
-> ReadS [XMLClassifier]
-> ReadPrec XMLClassifier
-> ReadPrec [XMLClassifier]
-> Read 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
(Int -> XMLClassifier -> ShowS)
-> (XMLClassifier -> String)
-> ([XMLClassifier] -> ShowS)
-> Show XMLClassifier
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. XMLClassifier -> Rep XMLClassifier x)
-> (forall x. Rep XMLClassifier x -> XMLClassifier)
-> Generic XMLClassifier
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.
--
-- 'version', 'xMLClassifier_version' - The version of this classifier.
--
-- '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).
--
-- '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' :: Maybe POSIX
-> Maybe POSIX
-> Maybe Integer
-> Maybe Text
-> Text
-> Text
-> XMLClassifier
XMLClassifier'
    { $sel:creationTime:XMLClassifier' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdated:XMLClassifier' :: Maybe POSIX
lastUpdated = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:version:XMLClassifier' :: Maybe Integer
version = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:rowTag:XMLClassifier' :: Maybe Text
rowTag = Maybe Text
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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> XMLClassifier -> f XMLClassifier
xMLClassifier_creationTime = (XMLClassifier -> Maybe POSIX)
-> (XMLClassifier -> Maybe POSIX -> XMLClassifier)
-> Lens XMLClassifier XMLClassifier (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> XMLClassifier -> f XMLClassifier)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> XMLClassifier
-> f XMLClassifier
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The time that this classifier was last updated.
xMLClassifier_lastUpdated :: Lens.Lens' XMLClassifier (Prelude.Maybe Prelude.UTCTime)
xMLClassifier_lastUpdated :: (Maybe UTCTime -> f (Maybe UTCTime))
-> XMLClassifier -> f XMLClassifier
xMLClassifier_lastUpdated = (XMLClassifier -> Maybe POSIX)
-> (XMLClassifier -> Maybe POSIX -> XMLClassifier)
-> Lens XMLClassifier XMLClassifier (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> XMLClassifier -> f XMLClassifier)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> XMLClassifier
-> f XMLClassifier
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The version of this classifier.
xMLClassifier_version :: Lens.Lens' XMLClassifier (Prelude.Maybe Prelude.Integer)
xMLClassifier_version :: (Maybe Integer -> f (Maybe Integer))
-> XMLClassifier -> f XMLClassifier
xMLClassifier_version = (XMLClassifier -> Maybe Integer)
-> (XMLClassifier -> Maybe Integer -> XMLClassifier)
-> Lens XMLClassifier XMLClassifier (Maybe Integer) (Maybe Integer)
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 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 :: (Maybe Text -> f (Maybe Text)) -> XMLClassifier -> f XMLClassifier
xMLClassifier_rowTag = (XMLClassifier -> Maybe Text)
-> (XMLClassifier -> Maybe Text -> XMLClassifier)
-> Lens XMLClassifier XMLClassifier (Maybe Text) (Maybe Text)
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 name of the classifier.
xMLClassifier_name :: Lens.Lens' XMLClassifier Prelude.Text
xMLClassifier_name :: (Text -> f Text) -> XMLClassifier -> f XMLClassifier
xMLClassifier_name = (XMLClassifier -> Text)
-> (XMLClassifier -> Text -> XMLClassifier)
-> Lens XMLClassifier XMLClassifier Text Text
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 :: (Text -> f Text) -> XMLClassifier -> f XMLClassifier
xMLClassifier_classification = (XMLClassifier -> Text)
-> (XMLClassifier -> Text -> XMLClassifier)
-> Lens XMLClassifier XMLClassifier Text Text
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 Core.FromJSON XMLClassifier where
  parseJSON :: Value -> Parser XMLClassifier
parseJSON =
    String
-> (Object -> Parser XMLClassifier)
-> Value
-> Parser XMLClassifier
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"XMLClassifier"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe Integer
-> Maybe Text
-> Text
-> Text
-> XMLClassifier
XMLClassifier'
            (Maybe POSIX
 -> Maybe POSIX
 -> Maybe Integer
 -> Maybe Text
 -> Text
 -> Text
 -> XMLClassifier)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe Integer -> Maybe Text -> Text -> Text -> XMLClassifier)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationTime")
            Parser
  (Maybe POSIX
   -> Maybe Integer -> Maybe Text -> Text -> Text -> XMLClassifier)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Integer -> Maybe Text -> Text -> Text -> XMLClassifier)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastUpdated")
            Parser
  (Maybe Integer -> Maybe Text -> Text -> Text -> XMLClassifier)
-> Parser (Maybe Integer)
-> Parser (Maybe Text -> Text -> Text -> XMLClassifier)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Version")
            Parser (Maybe Text -> Text -> Text -> XMLClassifier)
-> Parser (Maybe Text) -> Parser (Text -> Text -> XMLClassifier)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RowTag")
            Parser (Text -> Text -> XMLClassifier)
-> Parser Text -> Parser (Text -> XMLClassifier)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Name")
            Parser (Text -> XMLClassifier)
-> Parser Text -> Parser XMLClassifier
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Classification")
      )

instance Prelude.Hashable XMLClassifier

instance Prelude.NFData XMLClassifier