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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 Core.POSIX,
    -- | The time that this classifier was last updated.
    JsonClassifier -> Maybe POSIX
lastUpdated :: Prelude.Maybe Core.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
(JsonClassifier -> JsonClassifier -> Bool)
-> (JsonClassifier -> JsonClassifier -> Bool) -> Eq JsonClassifier
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]
(Int -> ReadS JsonClassifier)
-> ReadS [JsonClassifier]
-> ReadPrec JsonClassifier
-> ReadPrec [JsonClassifier]
-> Read 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
(Int -> JsonClassifier -> ShowS)
-> (JsonClassifier -> String)
-> ([JsonClassifier] -> ShowS)
-> Show JsonClassifier
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. JsonClassifier -> Rep JsonClassifier x)
-> (forall x. Rep JsonClassifier x -> JsonClassifier)
-> Generic JsonClassifier
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' :: Maybe POSIX
-> Maybe POSIX -> Maybe Integer -> Text -> Text -> JsonClassifier
JsonClassifier'
    { $sel:creationTime:JsonClassifier' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdated:JsonClassifier' :: Maybe POSIX
lastUpdated = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:version:JsonClassifier' :: Maybe Integer
version = Maybe Integer
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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> JsonClassifier -> f JsonClassifier
jsonClassifier_creationTime = (JsonClassifier -> Maybe POSIX)
-> (JsonClassifier -> Maybe POSIX -> JsonClassifier)
-> Lens JsonClassifier JsonClassifier (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> JsonClassifier -> f JsonClassifier)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> JsonClassifier
-> f JsonClassifier
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.
jsonClassifier_lastUpdated :: Lens.Lens' JsonClassifier (Prelude.Maybe Prelude.UTCTime)
jsonClassifier_lastUpdated :: (Maybe UTCTime -> f (Maybe UTCTime))
-> JsonClassifier -> f JsonClassifier
jsonClassifier_lastUpdated = (JsonClassifier -> Maybe POSIX)
-> (JsonClassifier -> Maybe POSIX -> JsonClassifier)
-> Lens JsonClassifier JsonClassifier (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> JsonClassifier -> f JsonClassifier)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> JsonClassifier
-> f JsonClassifier
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.
jsonClassifier_version :: Lens.Lens' JsonClassifier (Prelude.Maybe Prelude.Integer)
jsonClassifier_version :: (Maybe Integer -> f (Maybe Integer))
-> JsonClassifier -> f JsonClassifier
jsonClassifier_version = (JsonClassifier -> Maybe Integer)
-> (JsonClassifier -> Maybe Integer -> JsonClassifier)
-> Lens
     JsonClassifier JsonClassifier (Maybe Integer) (Maybe Integer)
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 :: (Text -> f Text) -> JsonClassifier -> f JsonClassifier
jsonClassifier_name = (JsonClassifier -> Text)
-> (JsonClassifier -> Text -> JsonClassifier)
-> Lens JsonClassifier JsonClassifier Text Text
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 :: (Text -> f Text) -> JsonClassifier -> f JsonClassifier
jsonClassifier_jsonPath = (JsonClassifier -> Text)
-> (JsonClassifier -> Text -> JsonClassifier)
-> Lens JsonClassifier JsonClassifier Text Text
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 Core.FromJSON JsonClassifier where
  parseJSON :: Value -> Parser JsonClassifier
parseJSON =
    String
-> (Object -> Parser JsonClassifier)
-> Value
-> Parser JsonClassifier
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JsonClassifier"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX -> Maybe Integer -> Text -> Text -> JsonClassifier
JsonClassifier'
            (Maybe POSIX
 -> Maybe POSIX -> Maybe Integer -> Text -> Text -> JsonClassifier)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX -> Maybe Integer -> Text -> Text -> JsonClassifier)
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 -> Text -> Text -> JsonClassifier)
-> Parser (Maybe POSIX)
-> Parser (Maybe Integer -> Text -> Text -> JsonClassifier)
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 -> Text -> Text -> JsonClassifier)
-> Parser (Maybe Integer)
-> Parser (Text -> Text -> JsonClassifier)
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 (Text -> Text -> JsonClassifier)
-> Parser Text -> Parser (Text -> JsonClassifier)
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 -> JsonClassifier)
-> Parser Text -> Parser JsonClassifier
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
"JsonPath")
      )

instance Prelude.Hashable JsonClassifier

instance Prelude.NFData JsonClassifier