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

import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.CsvHeaderOption
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies a custom CSV classifier for @CreateClassifier@ to create.
--
-- /See:/ 'newCreateCsvClassifierRequest' smart constructor.
data CreateCsvClassifierRequest = CreateCsvClassifierRequest'
  { -- | A custom symbol to denote what combines content into a single column
    -- value. Must be different from the column delimiter.
    CreateCsvClassifierRequest -> Maybe Text
quoteSymbol :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the CSV file contains a header.
    CreateCsvClassifierRequest -> Maybe CsvHeaderOption
containsHeader :: Prelude.Maybe CsvHeaderOption,
    -- | Specifies not to trim values before identifying the type of column
    -- values. The default value is true.
    CreateCsvClassifierRequest -> Maybe Bool
disableValueTrimming :: Prelude.Maybe Prelude.Bool,
    -- | A list of strings representing column names.
    CreateCsvClassifierRequest -> Maybe [Text]
header :: Prelude.Maybe [Prelude.Text],
    -- | Enables the processing of files that contain only one column.
    CreateCsvClassifierRequest -> Maybe Bool
allowSingleColumn :: Prelude.Maybe Prelude.Bool,
    -- | A custom symbol to denote what separates each column entry in the row.
    CreateCsvClassifierRequest -> Maybe Text
delimiter :: Prelude.Maybe Prelude.Text,
    -- | The name of the classifier.
    CreateCsvClassifierRequest -> Text
name :: Prelude.Text
  }
  deriving (CreateCsvClassifierRequest -> CreateCsvClassifierRequest -> Bool
(CreateCsvClassifierRequest -> CreateCsvClassifierRequest -> Bool)
-> (CreateCsvClassifierRequest
    -> CreateCsvClassifierRequest -> Bool)
-> Eq CreateCsvClassifierRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCsvClassifierRequest -> CreateCsvClassifierRequest -> Bool
$c/= :: CreateCsvClassifierRequest -> CreateCsvClassifierRequest -> Bool
== :: CreateCsvClassifierRequest -> CreateCsvClassifierRequest -> Bool
$c== :: CreateCsvClassifierRequest -> CreateCsvClassifierRequest -> Bool
Prelude.Eq, ReadPrec [CreateCsvClassifierRequest]
ReadPrec CreateCsvClassifierRequest
Int -> ReadS CreateCsvClassifierRequest
ReadS [CreateCsvClassifierRequest]
(Int -> ReadS CreateCsvClassifierRequest)
-> ReadS [CreateCsvClassifierRequest]
-> ReadPrec CreateCsvClassifierRequest
-> ReadPrec [CreateCsvClassifierRequest]
-> Read CreateCsvClassifierRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCsvClassifierRequest]
$creadListPrec :: ReadPrec [CreateCsvClassifierRequest]
readPrec :: ReadPrec CreateCsvClassifierRequest
$creadPrec :: ReadPrec CreateCsvClassifierRequest
readList :: ReadS [CreateCsvClassifierRequest]
$creadList :: ReadS [CreateCsvClassifierRequest]
readsPrec :: Int -> ReadS CreateCsvClassifierRequest
$creadsPrec :: Int -> ReadS CreateCsvClassifierRequest
Prelude.Read, Int -> CreateCsvClassifierRequest -> ShowS
[CreateCsvClassifierRequest] -> ShowS
CreateCsvClassifierRequest -> String
(Int -> CreateCsvClassifierRequest -> ShowS)
-> (CreateCsvClassifierRequest -> String)
-> ([CreateCsvClassifierRequest] -> ShowS)
-> Show CreateCsvClassifierRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCsvClassifierRequest] -> ShowS
$cshowList :: [CreateCsvClassifierRequest] -> ShowS
show :: CreateCsvClassifierRequest -> String
$cshow :: CreateCsvClassifierRequest -> String
showsPrec :: Int -> CreateCsvClassifierRequest -> ShowS
$cshowsPrec :: Int -> CreateCsvClassifierRequest -> ShowS
Prelude.Show, (forall x.
 CreateCsvClassifierRequest -> Rep CreateCsvClassifierRequest x)
-> (forall x.
    Rep CreateCsvClassifierRequest x -> CreateCsvClassifierRequest)
-> Generic CreateCsvClassifierRequest
forall x.
Rep CreateCsvClassifierRequest x -> CreateCsvClassifierRequest
forall x.
CreateCsvClassifierRequest -> Rep CreateCsvClassifierRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCsvClassifierRequest x -> CreateCsvClassifierRequest
$cfrom :: forall x.
CreateCsvClassifierRequest -> Rep CreateCsvClassifierRequest x
Prelude.Generic)

-- |
-- Create a value of 'CreateCsvClassifierRequest' 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:
--
-- 'quoteSymbol', 'createCsvClassifierRequest_quoteSymbol' - A custom symbol to denote what combines content into a single column
-- value. Must be different from the column delimiter.
--
-- 'containsHeader', 'createCsvClassifierRequest_containsHeader' - Indicates whether the CSV file contains a header.
--
-- 'disableValueTrimming', 'createCsvClassifierRequest_disableValueTrimming' - Specifies not to trim values before identifying the type of column
-- values. The default value is true.
--
-- 'header', 'createCsvClassifierRequest_header' - A list of strings representing column names.
--
-- 'allowSingleColumn', 'createCsvClassifierRequest_allowSingleColumn' - Enables the processing of files that contain only one column.
--
-- 'delimiter', 'createCsvClassifierRequest_delimiter' - A custom symbol to denote what separates each column entry in the row.
--
-- 'name', 'createCsvClassifierRequest_name' - The name of the classifier.
newCreateCsvClassifierRequest ::
  -- | 'name'
  Prelude.Text ->
  CreateCsvClassifierRequest
newCreateCsvClassifierRequest :: Text -> CreateCsvClassifierRequest
newCreateCsvClassifierRequest Text
pName_ =
  CreateCsvClassifierRequest' :: Maybe Text
-> Maybe CsvHeaderOption
-> Maybe Bool
-> Maybe [Text]
-> Maybe Bool
-> Maybe Text
-> Text
-> CreateCsvClassifierRequest
CreateCsvClassifierRequest'
    { $sel:quoteSymbol:CreateCsvClassifierRequest' :: Maybe Text
quoteSymbol =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:containsHeader:CreateCsvClassifierRequest' :: Maybe CsvHeaderOption
containsHeader = Maybe CsvHeaderOption
forall a. Maybe a
Prelude.Nothing,
      $sel:disableValueTrimming:CreateCsvClassifierRequest' :: Maybe Bool
disableValueTrimming = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:header:CreateCsvClassifierRequest' :: Maybe [Text]
header = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:allowSingleColumn:CreateCsvClassifierRequest' :: Maybe Bool
allowSingleColumn = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:delimiter:CreateCsvClassifierRequest' :: Maybe Text
delimiter = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateCsvClassifierRequest' :: Text
name = Text
pName_
    }

-- | A custom symbol to denote what combines content into a single column
-- value. Must be different from the column delimiter.
createCsvClassifierRequest_quoteSymbol :: Lens.Lens' CreateCsvClassifierRequest (Prelude.Maybe Prelude.Text)
createCsvClassifierRequest_quoteSymbol :: (Maybe Text -> f (Maybe Text))
-> CreateCsvClassifierRequest -> f CreateCsvClassifierRequest
createCsvClassifierRequest_quoteSymbol = (CreateCsvClassifierRequest -> Maybe Text)
-> (CreateCsvClassifierRequest
    -> Maybe Text -> CreateCsvClassifierRequest)
-> Lens
     CreateCsvClassifierRequest
     CreateCsvClassifierRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCsvClassifierRequest' {Maybe Text
quoteSymbol :: Maybe Text
$sel:quoteSymbol:CreateCsvClassifierRequest' :: CreateCsvClassifierRequest -> Maybe Text
quoteSymbol} -> Maybe Text
quoteSymbol) (\s :: CreateCsvClassifierRequest
s@CreateCsvClassifierRequest' {} Maybe Text
a -> CreateCsvClassifierRequest
s {$sel:quoteSymbol:CreateCsvClassifierRequest' :: Maybe Text
quoteSymbol = Maybe Text
a} :: CreateCsvClassifierRequest)

-- | Indicates whether the CSV file contains a header.
createCsvClassifierRequest_containsHeader :: Lens.Lens' CreateCsvClassifierRequest (Prelude.Maybe CsvHeaderOption)
createCsvClassifierRequest_containsHeader :: (Maybe CsvHeaderOption -> f (Maybe CsvHeaderOption))
-> CreateCsvClassifierRequest -> f CreateCsvClassifierRequest
createCsvClassifierRequest_containsHeader = (CreateCsvClassifierRequest -> Maybe CsvHeaderOption)
-> (CreateCsvClassifierRequest
    -> Maybe CsvHeaderOption -> CreateCsvClassifierRequest)
-> Lens
     CreateCsvClassifierRequest
     CreateCsvClassifierRequest
     (Maybe CsvHeaderOption)
     (Maybe CsvHeaderOption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCsvClassifierRequest' {Maybe CsvHeaderOption
containsHeader :: Maybe CsvHeaderOption
$sel:containsHeader:CreateCsvClassifierRequest' :: CreateCsvClassifierRequest -> Maybe CsvHeaderOption
containsHeader} -> Maybe CsvHeaderOption
containsHeader) (\s :: CreateCsvClassifierRequest
s@CreateCsvClassifierRequest' {} Maybe CsvHeaderOption
a -> CreateCsvClassifierRequest
s {$sel:containsHeader:CreateCsvClassifierRequest' :: Maybe CsvHeaderOption
containsHeader = Maybe CsvHeaderOption
a} :: CreateCsvClassifierRequest)

-- | Specifies not to trim values before identifying the type of column
-- values. The default value is true.
createCsvClassifierRequest_disableValueTrimming :: Lens.Lens' CreateCsvClassifierRequest (Prelude.Maybe Prelude.Bool)
createCsvClassifierRequest_disableValueTrimming :: (Maybe Bool -> f (Maybe Bool))
-> CreateCsvClassifierRequest -> f CreateCsvClassifierRequest
createCsvClassifierRequest_disableValueTrimming = (CreateCsvClassifierRequest -> Maybe Bool)
-> (CreateCsvClassifierRequest
    -> Maybe Bool -> CreateCsvClassifierRequest)
-> Lens
     CreateCsvClassifierRequest
     CreateCsvClassifierRequest
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCsvClassifierRequest' {Maybe Bool
disableValueTrimming :: Maybe Bool
$sel:disableValueTrimming:CreateCsvClassifierRequest' :: CreateCsvClassifierRequest -> Maybe Bool
disableValueTrimming} -> Maybe Bool
disableValueTrimming) (\s :: CreateCsvClassifierRequest
s@CreateCsvClassifierRequest' {} Maybe Bool
a -> CreateCsvClassifierRequest
s {$sel:disableValueTrimming:CreateCsvClassifierRequest' :: Maybe Bool
disableValueTrimming = Maybe Bool
a} :: CreateCsvClassifierRequest)

-- | A list of strings representing column names.
createCsvClassifierRequest_header :: Lens.Lens' CreateCsvClassifierRequest (Prelude.Maybe [Prelude.Text])
createCsvClassifierRequest_header :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateCsvClassifierRequest -> f CreateCsvClassifierRequest
createCsvClassifierRequest_header = (CreateCsvClassifierRequest -> Maybe [Text])
-> (CreateCsvClassifierRequest
    -> Maybe [Text] -> CreateCsvClassifierRequest)
-> Lens
     CreateCsvClassifierRequest
     CreateCsvClassifierRequest
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCsvClassifierRequest' {Maybe [Text]
header :: Maybe [Text]
$sel:header:CreateCsvClassifierRequest' :: CreateCsvClassifierRequest -> Maybe [Text]
header} -> Maybe [Text]
header) (\s :: CreateCsvClassifierRequest
s@CreateCsvClassifierRequest' {} Maybe [Text]
a -> CreateCsvClassifierRequest
s {$sel:header:CreateCsvClassifierRequest' :: Maybe [Text]
header = Maybe [Text]
a} :: CreateCsvClassifierRequest) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateCsvClassifierRequest -> f CreateCsvClassifierRequest)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateCsvClassifierRequest
-> f CreateCsvClassifierRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Enables the processing of files that contain only one column.
createCsvClassifierRequest_allowSingleColumn :: Lens.Lens' CreateCsvClassifierRequest (Prelude.Maybe Prelude.Bool)
createCsvClassifierRequest_allowSingleColumn :: (Maybe Bool -> f (Maybe Bool))
-> CreateCsvClassifierRequest -> f CreateCsvClassifierRequest
createCsvClassifierRequest_allowSingleColumn = (CreateCsvClassifierRequest -> Maybe Bool)
-> (CreateCsvClassifierRequest
    -> Maybe Bool -> CreateCsvClassifierRequest)
-> Lens
     CreateCsvClassifierRequest
     CreateCsvClassifierRequest
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCsvClassifierRequest' {Maybe Bool
allowSingleColumn :: Maybe Bool
$sel:allowSingleColumn:CreateCsvClassifierRequest' :: CreateCsvClassifierRequest -> Maybe Bool
allowSingleColumn} -> Maybe Bool
allowSingleColumn) (\s :: CreateCsvClassifierRequest
s@CreateCsvClassifierRequest' {} Maybe Bool
a -> CreateCsvClassifierRequest
s {$sel:allowSingleColumn:CreateCsvClassifierRequest' :: Maybe Bool
allowSingleColumn = Maybe Bool
a} :: CreateCsvClassifierRequest)

-- | A custom symbol to denote what separates each column entry in the row.
createCsvClassifierRequest_delimiter :: Lens.Lens' CreateCsvClassifierRequest (Prelude.Maybe Prelude.Text)
createCsvClassifierRequest_delimiter :: (Maybe Text -> f (Maybe Text))
-> CreateCsvClassifierRequest -> f CreateCsvClassifierRequest
createCsvClassifierRequest_delimiter = (CreateCsvClassifierRequest -> Maybe Text)
-> (CreateCsvClassifierRequest
    -> Maybe Text -> CreateCsvClassifierRequest)
-> Lens
     CreateCsvClassifierRequest
     CreateCsvClassifierRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCsvClassifierRequest' {Maybe Text
delimiter :: Maybe Text
$sel:delimiter:CreateCsvClassifierRequest' :: CreateCsvClassifierRequest -> Maybe Text
delimiter} -> Maybe Text
delimiter) (\s :: CreateCsvClassifierRequest
s@CreateCsvClassifierRequest' {} Maybe Text
a -> CreateCsvClassifierRequest
s {$sel:delimiter:CreateCsvClassifierRequest' :: Maybe Text
delimiter = Maybe Text
a} :: CreateCsvClassifierRequest)

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

instance Prelude.Hashable CreateCsvClassifierRequest

instance Prelude.NFData CreateCsvClassifierRequest

instance Core.ToJSON CreateCsvClassifierRequest where
  toJSON :: CreateCsvClassifierRequest -> Value
toJSON CreateCsvClassifierRequest' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe CsvHeaderOption
Text
name :: Text
delimiter :: Maybe Text
allowSingleColumn :: Maybe Bool
header :: Maybe [Text]
disableValueTrimming :: Maybe Bool
containsHeader :: Maybe CsvHeaderOption
quoteSymbol :: Maybe Text
$sel:name:CreateCsvClassifierRequest' :: CreateCsvClassifierRequest -> Text
$sel:delimiter:CreateCsvClassifierRequest' :: CreateCsvClassifierRequest -> Maybe Text
$sel:allowSingleColumn:CreateCsvClassifierRequest' :: CreateCsvClassifierRequest -> Maybe Bool
$sel:header:CreateCsvClassifierRequest' :: CreateCsvClassifierRequest -> Maybe [Text]
$sel:disableValueTrimming:CreateCsvClassifierRequest' :: CreateCsvClassifierRequest -> Maybe Bool
$sel:containsHeader:CreateCsvClassifierRequest' :: CreateCsvClassifierRequest -> Maybe CsvHeaderOption
$sel:quoteSymbol:CreateCsvClassifierRequest' :: CreateCsvClassifierRequest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"QuoteSymbol" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
quoteSymbol,
            (Text
"ContainsHeader" Text -> CsvHeaderOption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CsvHeaderOption -> Pair) -> Maybe CsvHeaderOption -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CsvHeaderOption
containsHeader,
            (Text
"DisableValueTrimming" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
disableValueTrimming,
            (Text
"Header" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
header,
            (Text
"AllowSingleColumn" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
allowSingleColumn,
            (Text
"Delimiter" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
delimiter,
            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)
          ]
      )