{-# 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.JsonClassifier
-- 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.JsonClassifier 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 @JSON@ content.
--
-- /See:/ 'newJsonClassifier' smart constructor.
data JsonClassifier = JsonClassifier'
  { -- | The time that this classifier was registered.
    JsonClassifier -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | The time that this classifier was last updated.
    JsonClassifier -> Maybe POSIX
lastUpdated :: Prelude.Maybe Data.POSIX,
    -- | The version of this classifier.
    JsonClassifier -> Maybe Integer
version :: Prelude.Maybe Prelude.Integer,
    -- | The name of the classifier.
    JsonClassifier -> Text
name :: Prelude.Text,
    -- | A @JsonPath@ string defining the JSON data for the classifier to
    -- classify. Glue supports a subset of JsonPath, as described in
    -- <https://docs.aws.amazon.com/glue/latest/dg/custom-classifier.html#custom-classifier-json Writing JsonPath Custom Classifiers>.
    JsonClassifier -> Text
jsonPath :: Prelude.Text
  }
  deriving (JsonClassifier -> JsonClassifier -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JsonClassifier -> JsonClassifier -> Bool
$c/= :: JsonClassifier -> JsonClassifier -> Bool
== :: JsonClassifier -> JsonClassifier -> Bool
$c== :: JsonClassifier -> JsonClassifier -> Bool
Prelude.Eq, ReadPrec [JsonClassifier]
ReadPrec JsonClassifier
Int -> ReadS JsonClassifier
ReadS [JsonClassifier]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JsonClassifier]
$creadListPrec :: ReadPrec [JsonClassifier]
readPrec :: ReadPrec JsonClassifier
$creadPrec :: ReadPrec JsonClassifier
readList :: ReadS [JsonClassifier]
$creadList :: ReadS [JsonClassifier]
readsPrec :: Int -> ReadS JsonClassifier
$creadsPrec :: Int -> ReadS JsonClassifier
Prelude.Read, Int -> JsonClassifier -> ShowS
[JsonClassifier] -> ShowS
JsonClassifier -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JsonClassifier] -> ShowS
$cshowList :: [JsonClassifier] -> ShowS
show :: JsonClassifier -> String
$cshow :: JsonClassifier -> String
showsPrec :: Int -> JsonClassifier -> ShowS
$cshowsPrec :: Int -> JsonClassifier -> ShowS
Prelude.Show, forall x. Rep JsonClassifier x -> JsonClassifier
forall x. JsonClassifier -> Rep JsonClassifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JsonClassifier x -> JsonClassifier
$cfrom :: forall x. JsonClassifier -> Rep JsonClassifier x
Prelude.Generic)

-- |
-- Create a value of 'JsonClassifier' 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', 'jsonClassifier_creationTime' - The time that this classifier was registered.
--
-- 'lastUpdated', 'jsonClassifier_lastUpdated' - The time that this classifier was last updated.
--
-- 'version', 'jsonClassifier_version' - The version of this classifier.
--
-- 'name', 'jsonClassifier_name' - The name of the classifier.
--
-- 'jsonPath', 'jsonClassifier_jsonPath' - A @JsonPath@ string defining the JSON data for the classifier to
-- classify. Glue supports a subset of JsonPath, as described in
-- <https://docs.aws.amazon.com/glue/latest/dg/custom-classifier.html#custom-classifier-json Writing JsonPath Custom Classifiers>.
newJsonClassifier ::
  -- | 'name'
  Prelude.Text ->
  -- | 'jsonPath'
  Prelude.Text ->
  JsonClassifier
newJsonClassifier :: Text -> Text -> JsonClassifier
newJsonClassifier Text
pName_ Text
pJsonPath_ =
  JsonClassifier'
    { $sel:creationTime:JsonClassifier' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdated:JsonClassifier' :: Maybe POSIX
lastUpdated = forall a. Maybe a
Prelude.Nothing,
      $sel:version:JsonClassifier' :: Maybe Integer
version = forall a. Maybe a
Prelude.Nothing,
      $sel:name:JsonClassifier' :: Text
name = Text
pName_,
      $sel:jsonPath:JsonClassifier' :: Text
jsonPath = Text
pJsonPath_
    }

-- | The time that this classifier was registered.
jsonClassifier_creationTime :: Lens.Lens' JsonClassifier (Prelude.Maybe Prelude.UTCTime)
jsonClassifier_creationTime :: Lens' JsonClassifier (Maybe UTCTime)
jsonClassifier_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JsonClassifier' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:JsonClassifier' :: JsonClassifier -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: JsonClassifier
s@JsonClassifier' {} Maybe POSIX
a -> JsonClassifier
s {$sel:creationTime:JsonClassifier' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: JsonClassifier) 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.
jsonClassifier_lastUpdated :: Lens.Lens' JsonClassifier (Prelude.Maybe Prelude.UTCTime)
jsonClassifier_lastUpdated :: Lens' JsonClassifier (Maybe UTCTime)
jsonClassifier_lastUpdated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JsonClassifier' {Maybe POSIX
lastUpdated :: Maybe POSIX
$sel:lastUpdated:JsonClassifier' :: JsonClassifier -> Maybe POSIX
lastUpdated} -> Maybe POSIX
lastUpdated) (\s :: JsonClassifier
s@JsonClassifier' {} Maybe POSIX
a -> JsonClassifier
s {$sel:lastUpdated:JsonClassifier' :: Maybe POSIX
lastUpdated = Maybe POSIX
a} :: JsonClassifier) 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 version of this classifier.
jsonClassifier_version :: Lens.Lens' JsonClassifier (Prelude.Maybe Prelude.Integer)
jsonClassifier_version :: Lens' JsonClassifier (Maybe Integer)
jsonClassifier_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JsonClassifier' {Maybe Integer
version :: Maybe Integer
$sel:version:JsonClassifier' :: JsonClassifier -> Maybe Integer
version} -> Maybe Integer
version) (\s :: JsonClassifier
s@JsonClassifier' {} Maybe Integer
a -> JsonClassifier
s {$sel:version:JsonClassifier' :: Maybe Integer
version = Maybe Integer
a} :: JsonClassifier)

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

-- | A @JsonPath@ string defining the JSON data for the classifier to
-- classify. Glue supports a subset of JsonPath, as described in
-- <https://docs.aws.amazon.com/glue/latest/dg/custom-classifier.html#custom-classifier-json Writing JsonPath Custom Classifiers>.
jsonClassifier_jsonPath :: Lens.Lens' JsonClassifier Prelude.Text
jsonClassifier_jsonPath :: Lens' JsonClassifier Text
jsonClassifier_jsonPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JsonClassifier' {Text
jsonPath :: Text
$sel:jsonPath:JsonClassifier' :: JsonClassifier -> Text
jsonPath} -> Text
jsonPath) (\s :: JsonClassifier
s@JsonClassifier' {} Text
a -> JsonClassifier
s {$sel:jsonPath:JsonClassifier' :: Text
jsonPath = Text
a} :: JsonClassifier)

instance Data.FromJSON JsonClassifier where
  parseJSON :: Value -> Parser JsonClassifier
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"JsonClassifier"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX -> Maybe Integer -> Text -> Text -> JsonClassifier
JsonClassifier'
            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
"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
"JsonPath")
      )

instance Prelude.Hashable JsonClassifier where
  hashWithSalt :: Int -> JsonClassifier -> Int
hashWithSalt Int
_salt JsonClassifier' {Maybe Integer
Maybe POSIX
Text
jsonPath :: Text
name :: Text
version :: Maybe Integer
lastUpdated :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:jsonPath:JsonClassifier' :: JsonClassifier -> Text
$sel:name:JsonClassifier' :: JsonClassifier -> Text
$sel:version:JsonClassifier' :: JsonClassifier -> Maybe Integer
$sel:lastUpdated:JsonClassifier' :: JsonClassifier -> Maybe POSIX
$sel:creationTime:JsonClassifier' :: JsonClassifier -> 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 Integer
version
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jsonPath

instance Prelude.NFData JsonClassifier where
  rnf :: JsonClassifier -> ()
rnf JsonClassifier' {Maybe Integer
Maybe POSIX
Text
jsonPath :: Text
name :: Text
version :: Maybe Integer
lastUpdated :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:jsonPath:JsonClassifier' :: JsonClassifier -> Text
$sel:name:JsonClassifier' :: JsonClassifier -> Text
$sel:version:JsonClassifier' :: JsonClassifier -> Maybe Integer
$sel:lastUpdated:JsonClassifier' :: JsonClassifier -> Maybe POSIX
$sel:creationTime:JsonClassifier' :: JsonClassifier -> 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 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
jsonPath