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

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

-- | Specifies a JSON classifier for @CreateClassifier@ to create.
--
-- /See:/ 'newCreateJsonClassifierRequest' smart constructor.
data CreateJsonClassifierRequest = CreateJsonClassifierRequest'
  { -- | The name of the classifier.
    CreateJsonClassifierRequest -> 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>.
    CreateJsonClassifierRequest -> Text
jsonPath :: Prelude.Text
  }
  deriving (CreateJsonClassifierRequest -> CreateJsonClassifierRequest -> Bool
(CreateJsonClassifierRequest
 -> CreateJsonClassifierRequest -> Bool)
-> (CreateJsonClassifierRequest
    -> CreateJsonClassifierRequest -> Bool)
-> Eq CreateJsonClassifierRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateJsonClassifierRequest -> CreateJsonClassifierRequest -> Bool
$c/= :: CreateJsonClassifierRequest -> CreateJsonClassifierRequest -> Bool
== :: CreateJsonClassifierRequest -> CreateJsonClassifierRequest -> Bool
$c== :: CreateJsonClassifierRequest -> CreateJsonClassifierRequest -> Bool
Prelude.Eq, ReadPrec [CreateJsonClassifierRequest]
ReadPrec CreateJsonClassifierRequest
Int -> ReadS CreateJsonClassifierRequest
ReadS [CreateJsonClassifierRequest]
(Int -> ReadS CreateJsonClassifierRequest)
-> ReadS [CreateJsonClassifierRequest]
-> ReadPrec CreateJsonClassifierRequest
-> ReadPrec [CreateJsonClassifierRequest]
-> Read CreateJsonClassifierRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateJsonClassifierRequest]
$creadListPrec :: ReadPrec [CreateJsonClassifierRequest]
readPrec :: ReadPrec CreateJsonClassifierRequest
$creadPrec :: ReadPrec CreateJsonClassifierRequest
readList :: ReadS [CreateJsonClassifierRequest]
$creadList :: ReadS [CreateJsonClassifierRequest]
readsPrec :: Int -> ReadS CreateJsonClassifierRequest
$creadsPrec :: Int -> ReadS CreateJsonClassifierRequest
Prelude.Read, Int -> CreateJsonClassifierRequest -> ShowS
[CreateJsonClassifierRequest] -> ShowS
CreateJsonClassifierRequest -> String
(Int -> CreateJsonClassifierRequest -> ShowS)
-> (CreateJsonClassifierRequest -> String)
-> ([CreateJsonClassifierRequest] -> ShowS)
-> Show CreateJsonClassifierRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateJsonClassifierRequest] -> ShowS
$cshowList :: [CreateJsonClassifierRequest] -> ShowS
show :: CreateJsonClassifierRequest -> String
$cshow :: CreateJsonClassifierRequest -> String
showsPrec :: Int -> CreateJsonClassifierRequest -> ShowS
$cshowsPrec :: Int -> CreateJsonClassifierRequest -> ShowS
Prelude.Show, (forall x.
 CreateJsonClassifierRequest -> Rep CreateJsonClassifierRequest x)
-> (forall x.
    Rep CreateJsonClassifierRequest x -> CreateJsonClassifierRequest)
-> Generic CreateJsonClassifierRequest
forall x.
Rep CreateJsonClassifierRequest x -> CreateJsonClassifierRequest
forall x.
CreateJsonClassifierRequest -> Rep CreateJsonClassifierRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateJsonClassifierRequest x -> CreateJsonClassifierRequest
$cfrom :: forall x.
CreateJsonClassifierRequest -> Rep CreateJsonClassifierRequest x
Prelude.Generic)

-- |
-- Create a value of 'CreateJsonClassifierRequest' 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:
--
-- 'name', 'createJsonClassifierRequest_name' - The name of the classifier.
--
-- 'jsonPath', 'createJsonClassifierRequest_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>.
newCreateJsonClassifierRequest ::
  -- | 'name'
  Prelude.Text ->
  -- | 'jsonPath'
  Prelude.Text ->
  CreateJsonClassifierRequest
newCreateJsonClassifierRequest :: Text -> Text -> CreateJsonClassifierRequest
newCreateJsonClassifierRequest Text
pName_ Text
pJsonPath_ =
  CreateJsonClassifierRequest' :: Text -> Text -> CreateJsonClassifierRequest
CreateJsonClassifierRequest'
    { $sel:name:CreateJsonClassifierRequest' :: Text
name = Text
pName_,
      $sel:jsonPath:CreateJsonClassifierRequest' :: Text
jsonPath = Text
pJsonPath_
    }

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

-- | 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>.
createJsonClassifierRequest_jsonPath :: Lens.Lens' CreateJsonClassifierRequest Prelude.Text
createJsonClassifierRequest_jsonPath :: (Text -> f Text)
-> CreateJsonClassifierRequest -> f CreateJsonClassifierRequest
createJsonClassifierRequest_jsonPath = (CreateJsonClassifierRequest -> Text)
-> (CreateJsonClassifierRequest
    -> Text -> CreateJsonClassifierRequest)
-> Lens
     CreateJsonClassifierRequest CreateJsonClassifierRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJsonClassifierRequest' {Text
jsonPath :: Text
$sel:jsonPath:CreateJsonClassifierRequest' :: CreateJsonClassifierRequest -> Text
jsonPath} -> Text
jsonPath) (\s :: CreateJsonClassifierRequest
s@CreateJsonClassifierRequest' {} Text
a -> CreateJsonClassifierRequest
s {$sel:jsonPath:CreateJsonClassifierRequest' :: Text
jsonPath = Text
a} :: CreateJsonClassifierRequest)

instance Prelude.Hashable CreateJsonClassifierRequest

instance Prelude.NFData CreateJsonClassifierRequest

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