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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types.CompressionType
import Amazonka.Glue.Types.GlueSchema
import Amazonka.Glue.Types.S3DirectSourceAdditionalOptions
import qualified Amazonka.Prelude as Prelude

-- | Specifies a JSON data store stored in Amazon S3.
--
-- /See:/ 'newS3JsonSource' smart constructor.
data S3JsonSource = S3JsonSource'
  { -- | Specifies additional connection options.
    S3JsonSource -> Maybe S3DirectSourceAdditionalOptions
additionalOptions :: Prelude.Maybe S3DirectSourceAdditionalOptions,
    -- | Specifies how the data is compressed. This is generally not necessary if
    -- the data has a standard file extension. Possible values are @\"gzip\"@
    -- and @\"bzip\"@).
    S3JsonSource -> Maybe CompressionType
compressionType :: Prelude.Maybe CompressionType,
    -- | A string containing a JSON list of Unix-style glob patterns to exclude.
    -- For example, \"[\\\"**.pdf\\\"]\" excludes all PDF files.
    S3JsonSource -> Maybe [Text]
exclusions :: Prelude.Maybe [Prelude.Text],
    -- | Grouping files is turned on by default when the input contains more than
    -- 50,000 files. To turn on grouping with fewer than 50,000 files, set this
    -- parameter to \"inPartition\". To disable grouping when there are more
    -- than 50,000 files, set this parameter to @\"none\"@.
    S3JsonSource -> Maybe Text
groupFiles :: Prelude.Maybe Prelude.Text,
    -- | The target group size in bytes. The default is computed based on the
    -- input data size and the size of your cluster. When there are fewer than
    -- 50,000 input files, @\"groupFiles\"@ must be set to @\"inPartition\"@
    -- for this to take effect.
    S3JsonSource -> Maybe Text
groupSize :: Prelude.Maybe Prelude.Text,
    -- | A JsonPath string defining the JSON data.
    S3JsonSource -> Maybe Text
jsonPath :: Prelude.Maybe Prelude.Text,
    -- | This option controls the duration in milliseconds after which the s3
    -- listing is likely to be consistent. Files with modification timestamps
    -- falling within the last maxBand milliseconds are tracked specially when
    -- using JobBookmarks to account for Amazon S3 eventual consistency. Most
    -- users don\'t need to set this option. The default is 900000
    -- milliseconds, or 15 minutes.
    S3JsonSource -> Maybe Natural
maxBand :: Prelude.Maybe Prelude.Natural,
    -- | This option specifies the maximum number of files to save from the last
    -- maxBand seconds. If this number is exceeded, extra files are skipped and
    -- only processed in the next job run.
    S3JsonSource -> Maybe Natural
maxFilesInBand :: Prelude.Maybe Prelude.Natural,
    -- | A Boolean value that specifies whether a single record can span multiple
    -- lines. This can occur when a field contains a quoted new-line character.
    -- You must set this option to True if any record spans multiple lines. The
    -- default value is @False@, which allows for more aggressive
    -- file-splitting during parsing.
    S3JsonSource -> Maybe Bool
multiline :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the data schema for the S3 JSON source.
    S3JsonSource -> Maybe [GlueSchema]
outputSchemas :: Prelude.Maybe [GlueSchema],
    -- | If set to true, recursively reads files in all subdirectories under the
    -- specified paths.
    S3JsonSource -> Maybe Bool
recurse :: Prelude.Maybe Prelude.Bool,
    -- | The name of the data store.
    S3JsonSource -> Text
name :: Prelude.Text,
    -- | A list of the Amazon S3 paths to read from.
    S3JsonSource -> [Text]
paths :: [Prelude.Text]
  }
  deriving (S3JsonSource -> S3JsonSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3JsonSource -> S3JsonSource -> Bool
$c/= :: S3JsonSource -> S3JsonSource -> Bool
== :: S3JsonSource -> S3JsonSource -> Bool
$c== :: S3JsonSource -> S3JsonSource -> Bool
Prelude.Eq, ReadPrec [S3JsonSource]
ReadPrec S3JsonSource
Int -> ReadS S3JsonSource
ReadS [S3JsonSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3JsonSource]
$creadListPrec :: ReadPrec [S3JsonSource]
readPrec :: ReadPrec S3JsonSource
$creadPrec :: ReadPrec S3JsonSource
readList :: ReadS [S3JsonSource]
$creadList :: ReadS [S3JsonSource]
readsPrec :: Int -> ReadS S3JsonSource
$creadsPrec :: Int -> ReadS S3JsonSource
Prelude.Read, Int -> S3JsonSource -> ShowS
[S3JsonSource] -> ShowS
S3JsonSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3JsonSource] -> ShowS
$cshowList :: [S3JsonSource] -> ShowS
show :: S3JsonSource -> String
$cshow :: S3JsonSource -> String
showsPrec :: Int -> S3JsonSource -> ShowS
$cshowsPrec :: Int -> S3JsonSource -> ShowS
Prelude.Show, forall x. Rep S3JsonSource x -> S3JsonSource
forall x. S3JsonSource -> Rep S3JsonSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3JsonSource x -> S3JsonSource
$cfrom :: forall x. S3JsonSource -> Rep S3JsonSource x
Prelude.Generic)

-- |
-- Create a value of 'S3JsonSource' 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:
--
-- 'additionalOptions', 's3JsonSource_additionalOptions' - Specifies additional connection options.
--
-- 'compressionType', 's3JsonSource_compressionType' - Specifies how the data is compressed. This is generally not necessary if
-- the data has a standard file extension. Possible values are @\"gzip\"@
-- and @\"bzip\"@).
--
-- 'exclusions', 's3JsonSource_exclusions' - A string containing a JSON list of Unix-style glob patterns to exclude.
-- For example, \"[\\\"**.pdf\\\"]\" excludes all PDF files.
--
-- 'groupFiles', 's3JsonSource_groupFiles' - Grouping files is turned on by default when the input contains more than
-- 50,000 files. To turn on grouping with fewer than 50,000 files, set this
-- parameter to \"inPartition\". To disable grouping when there are more
-- than 50,000 files, set this parameter to @\"none\"@.
--
-- 'groupSize', 's3JsonSource_groupSize' - The target group size in bytes. The default is computed based on the
-- input data size and the size of your cluster. When there are fewer than
-- 50,000 input files, @\"groupFiles\"@ must be set to @\"inPartition\"@
-- for this to take effect.
--
-- 'jsonPath', 's3JsonSource_jsonPath' - A JsonPath string defining the JSON data.
--
-- 'maxBand', 's3JsonSource_maxBand' - This option controls the duration in milliseconds after which the s3
-- listing is likely to be consistent. Files with modification timestamps
-- falling within the last maxBand milliseconds are tracked specially when
-- using JobBookmarks to account for Amazon S3 eventual consistency. Most
-- users don\'t need to set this option. The default is 900000
-- milliseconds, or 15 minutes.
--
-- 'maxFilesInBand', 's3JsonSource_maxFilesInBand' - This option specifies the maximum number of files to save from the last
-- maxBand seconds. If this number is exceeded, extra files are skipped and
-- only processed in the next job run.
--
-- 'multiline', 's3JsonSource_multiline' - A Boolean value that specifies whether a single record can span multiple
-- lines. This can occur when a field contains a quoted new-line character.
-- You must set this option to True if any record spans multiple lines. The
-- default value is @False@, which allows for more aggressive
-- file-splitting during parsing.
--
-- 'outputSchemas', 's3JsonSource_outputSchemas' - Specifies the data schema for the S3 JSON source.
--
-- 'recurse', 's3JsonSource_recurse' - If set to true, recursively reads files in all subdirectories under the
-- specified paths.
--
-- 'name', 's3JsonSource_name' - The name of the data store.
--
-- 'paths', 's3JsonSource_paths' - A list of the Amazon S3 paths to read from.
newS3JsonSource ::
  -- | 'name'
  Prelude.Text ->
  S3JsonSource
newS3JsonSource :: Text -> S3JsonSource
newS3JsonSource Text
pName_ =
  S3JsonSource'
    { $sel:additionalOptions:S3JsonSource' :: Maybe S3DirectSourceAdditionalOptions
additionalOptions = forall a. Maybe a
Prelude.Nothing,
      $sel:compressionType:S3JsonSource' :: Maybe CompressionType
compressionType = forall a. Maybe a
Prelude.Nothing,
      $sel:exclusions:S3JsonSource' :: Maybe [Text]
exclusions = forall a. Maybe a
Prelude.Nothing,
      $sel:groupFiles:S3JsonSource' :: Maybe Text
groupFiles = forall a. Maybe a
Prelude.Nothing,
      $sel:groupSize:S3JsonSource' :: Maybe Text
groupSize = forall a. Maybe a
Prelude.Nothing,
      $sel:jsonPath:S3JsonSource' :: Maybe Text
jsonPath = forall a. Maybe a
Prelude.Nothing,
      $sel:maxBand:S3JsonSource' :: Maybe Natural
maxBand = forall a. Maybe a
Prelude.Nothing,
      $sel:maxFilesInBand:S3JsonSource' :: Maybe Natural
maxFilesInBand = forall a. Maybe a
Prelude.Nothing,
      $sel:multiline:S3JsonSource' :: Maybe Bool
multiline = forall a. Maybe a
Prelude.Nothing,
      $sel:outputSchemas:S3JsonSource' :: Maybe [GlueSchema]
outputSchemas = forall a. Maybe a
Prelude.Nothing,
      $sel:recurse:S3JsonSource' :: Maybe Bool
recurse = forall a. Maybe a
Prelude.Nothing,
      $sel:name:S3JsonSource' :: Text
name = Text
pName_,
      $sel:paths:S3JsonSource' :: [Text]
paths = forall a. Monoid a => a
Prelude.mempty
    }

-- | Specifies additional connection options.
s3JsonSource_additionalOptions :: Lens.Lens' S3JsonSource (Prelude.Maybe S3DirectSourceAdditionalOptions)
s3JsonSource_additionalOptions :: Lens' S3JsonSource (Maybe S3DirectSourceAdditionalOptions)
s3JsonSource_additionalOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3JsonSource' {Maybe S3DirectSourceAdditionalOptions
additionalOptions :: Maybe S3DirectSourceAdditionalOptions
$sel:additionalOptions:S3JsonSource' :: S3JsonSource -> Maybe S3DirectSourceAdditionalOptions
additionalOptions} -> Maybe S3DirectSourceAdditionalOptions
additionalOptions) (\s :: S3JsonSource
s@S3JsonSource' {} Maybe S3DirectSourceAdditionalOptions
a -> S3JsonSource
s {$sel:additionalOptions:S3JsonSource' :: Maybe S3DirectSourceAdditionalOptions
additionalOptions = Maybe S3DirectSourceAdditionalOptions
a} :: S3JsonSource)

-- | Specifies how the data is compressed. This is generally not necessary if
-- the data has a standard file extension. Possible values are @\"gzip\"@
-- and @\"bzip\"@).
s3JsonSource_compressionType :: Lens.Lens' S3JsonSource (Prelude.Maybe CompressionType)
s3JsonSource_compressionType :: Lens' S3JsonSource (Maybe CompressionType)
s3JsonSource_compressionType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3JsonSource' {Maybe CompressionType
compressionType :: Maybe CompressionType
$sel:compressionType:S3JsonSource' :: S3JsonSource -> Maybe CompressionType
compressionType} -> Maybe CompressionType
compressionType) (\s :: S3JsonSource
s@S3JsonSource' {} Maybe CompressionType
a -> S3JsonSource
s {$sel:compressionType:S3JsonSource' :: Maybe CompressionType
compressionType = Maybe CompressionType
a} :: S3JsonSource)

-- | A string containing a JSON list of Unix-style glob patterns to exclude.
-- For example, \"[\\\"**.pdf\\\"]\" excludes all PDF files.
s3JsonSource_exclusions :: Lens.Lens' S3JsonSource (Prelude.Maybe [Prelude.Text])
s3JsonSource_exclusions :: Lens' S3JsonSource (Maybe [Text])
s3JsonSource_exclusions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3JsonSource' {Maybe [Text]
exclusions :: Maybe [Text]
$sel:exclusions:S3JsonSource' :: S3JsonSource -> Maybe [Text]
exclusions} -> Maybe [Text]
exclusions) (\s :: S3JsonSource
s@S3JsonSource' {} Maybe [Text]
a -> S3JsonSource
s {$sel:exclusions:S3JsonSource' :: Maybe [Text]
exclusions = Maybe [Text]
a} :: S3JsonSource) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Grouping files is turned on by default when the input contains more than
-- 50,000 files. To turn on grouping with fewer than 50,000 files, set this
-- parameter to \"inPartition\". To disable grouping when there are more
-- than 50,000 files, set this parameter to @\"none\"@.
s3JsonSource_groupFiles :: Lens.Lens' S3JsonSource (Prelude.Maybe Prelude.Text)
s3JsonSource_groupFiles :: Lens' S3JsonSource (Maybe Text)
s3JsonSource_groupFiles = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3JsonSource' {Maybe Text
groupFiles :: Maybe Text
$sel:groupFiles:S3JsonSource' :: S3JsonSource -> Maybe Text
groupFiles} -> Maybe Text
groupFiles) (\s :: S3JsonSource
s@S3JsonSource' {} Maybe Text
a -> S3JsonSource
s {$sel:groupFiles:S3JsonSource' :: Maybe Text
groupFiles = Maybe Text
a} :: S3JsonSource)

-- | The target group size in bytes. The default is computed based on the
-- input data size and the size of your cluster. When there are fewer than
-- 50,000 input files, @\"groupFiles\"@ must be set to @\"inPartition\"@
-- for this to take effect.
s3JsonSource_groupSize :: Lens.Lens' S3JsonSource (Prelude.Maybe Prelude.Text)
s3JsonSource_groupSize :: Lens' S3JsonSource (Maybe Text)
s3JsonSource_groupSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3JsonSource' {Maybe Text
groupSize :: Maybe Text
$sel:groupSize:S3JsonSource' :: S3JsonSource -> Maybe Text
groupSize} -> Maybe Text
groupSize) (\s :: S3JsonSource
s@S3JsonSource' {} Maybe Text
a -> S3JsonSource
s {$sel:groupSize:S3JsonSource' :: Maybe Text
groupSize = Maybe Text
a} :: S3JsonSource)

-- | A JsonPath string defining the JSON data.
s3JsonSource_jsonPath :: Lens.Lens' S3JsonSource (Prelude.Maybe Prelude.Text)
s3JsonSource_jsonPath :: Lens' S3JsonSource (Maybe Text)
s3JsonSource_jsonPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3JsonSource' {Maybe Text
jsonPath :: Maybe Text
$sel:jsonPath:S3JsonSource' :: S3JsonSource -> Maybe Text
jsonPath} -> Maybe Text
jsonPath) (\s :: S3JsonSource
s@S3JsonSource' {} Maybe Text
a -> S3JsonSource
s {$sel:jsonPath:S3JsonSource' :: Maybe Text
jsonPath = Maybe Text
a} :: S3JsonSource)

-- | This option controls the duration in milliseconds after which the s3
-- listing is likely to be consistent. Files with modification timestamps
-- falling within the last maxBand milliseconds are tracked specially when
-- using JobBookmarks to account for Amazon S3 eventual consistency. Most
-- users don\'t need to set this option. The default is 900000
-- milliseconds, or 15 minutes.
s3JsonSource_maxBand :: Lens.Lens' S3JsonSource (Prelude.Maybe Prelude.Natural)
s3JsonSource_maxBand :: Lens' S3JsonSource (Maybe Natural)
s3JsonSource_maxBand = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3JsonSource' {Maybe Natural
maxBand :: Maybe Natural
$sel:maxBand:S3JsonSource' :: S3JsonSource -> Maybe Natural
maxBand} -> Maybe Natural
maxBand) (\s :: S3JsonSource
s@S3JsonSource' {} Maybe Natural
a -> S3JsonSource
s {$sel:maxBand:S3JsonSource' :: Maybe Natural
maxBand = Maybe Natural
a} :: S3JsonSource)

-- | This option specifies the maximum number of files to save from the last
-- maxBand seconds. If this number is exceeded, extra files are skipped and
-- only processed in the next job run.
s3JsonSource_maxFilesInBand :: Lens.Lens' S3JsonSource (Prelude.Maybe Prelude.Natural)
s3JsonSource_maxFilesInBand :: Lens' S3JsonSource (Maybe Natural)
s3JsonSource_maxFilesInBand = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3JsonSource' {Maybe Natural
maxFilesInBand :: Maybe Natural
$sel:maxFilesInBand:S3JsonSource' :: S3JsonSource -> Maybe Natural
maxFilesInBand} -> Maybe Natural
maxFilesInBand) (\s :: S3JsonSource
s@S3JsonSource' {} Maybe Natural
a -> S3JsonSource
s {$sel:maxFilesInBand:S3JsonSource' :: Maybe Natural
maxFilesInBand = Maybe Natural
a} :: S3JsonSource)

-- | A Boolean value that specifies whether a single record can span multiple
-- lines. This can occur when a field contains a quoted new-line character.
-- You must set this option to True if any record spans multiple lines. The
-- default value is @False@, which allows for more aggressive
-- file-splitting during parsing.
s3JsonSource_multiline :: Lens.Lens' S3JsonSource (Prelude.Maybe Prelude.Bool)
s3JsonSource_multiline :: Lens' S3JsonSource (Maybe Bool)
s3JsonSource_multiline = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3JsonSource' {Maybe Bool
multiline :: Maybe Bool
$sel:multiline:S3JsonSource' :: S3JsonSource -> Maybe Bool
multiline} -> Maybe Bool
multiline) (\s :: S3JsonSource
s@S3JsonSource' {} Maybe Bool
a -> S3JsonSource
s {$sel:multiline:S3JsonSource' :: Maybe Bool
multiline = Maybe Bool
a} :: S3JsonSource)

-- | Specifies the data schema for the S3 JSON source.
s3JsonSource_outputSchemas :: Lens.Lens' S3JsonSource (Prelude.Maybe [GlueSchema])
s3JsonSource_outputSchemas :: Lens' S3JsonSource (Maybe [GlueSchema])
s3JsonSource_outputSchemas = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3JsonSource' {Maybe [GlueSchema]
outputSchemas :: Maybe [GlueSchema]
$sel:outputSchemas:S3JsonSource' :: S3JsonSource -> Maybe [GlueSchema]
outputSchemas} -> Maybe [GlueSchema]
outputSchemas) (\s :: S3JsonSource
s@S3JsonSource' {} Maybe [GlueSchema]
a -> S3JsonSource
s {$sel:outputSchemas:S3JsonSource' :: Maybe [GlueSchema]
outputSchemas = Maybe [GlueSchema]
a} :: S3JsonSource) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If set to true, recursively reads files in all subdirectories under the
-- specified paths.
s3JsonSource_recurse :: Lens.Lens' S3JsonSource (Prelude.Maybe Prelude.Bool)
s3JsonSource_recurse :: Lens' S3JsonSource (Maybe Bool)
s3JsonSource_recurse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3JsonSource' {Maybe Bool
recurse :: Maybe Bool
$sel:recurse:S3JsonSource' :: S3JsonSource -> Maybe Bool
recurse} -> Maybe Bool
recurse) (\s :: S3JsonSource
s@S3JsonSource' {} Maybe Bool
a -> S3JsonSource
s {$sel:recurse:S3JsonSource' :: Maybe Bool
recurse = Maybe Bool
a} :: S3JsonSource)

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

-- | A list of the Amazon S3 paths to read from.
s3JsonSource_paths :: Lens.Lens' S3JsonSource [Prelude.Text]
s3JsonSource_paths :: Lens' S3JsonSource [Text]
s3JsonSource_paths = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3JsonSource' {[Text]
paths :: [Text]
$sel:paths:S3JsonSource' :: S3JsonSource -> [Text]
paths} -> [Text]
paths) (\s :: S3JsonSource
s@S3JsonSource' {} [Text]
a -> S3JsonSource
s {$sel:paths:S3JsonSource' :: [Text]
paths = [Text]
a} :: S3JsonSource) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON S3JsonSource where
  parseJSON :: Value -> Parser S3JsonSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"S3JsonSource"
      ( \Object
x ->
          Maybe S3DirectSourceAdditionalOptions
-> Maybe CompressionType
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Natural
-> Maybe Bool
-> Maybe [GlueSchema]
-> Maybe Bool
-> Text
-> [Text]
-> S3JsonSource
S3JsonSource'
            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
"AdditionalOptions")
            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
"CompressionType")
            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
"Exclusions" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"GroupFiles")
            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
"GroupSize")
            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
"JsonPath")
            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
"MaxBand")
            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
"MaxFilesInBand")
            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
"Multiline")
            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
"OutputSchemas" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"Recurse")
            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 (Maybe a)
Data..:? Key
"Paths" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable S3JsonSource where
  hashWithSalt :: Int -> S3JsonSource -> Int
hashWithSalt Int
_salt S3JsonSource' {[Text]
Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [GlueSchema]
Maybe Text
Maybe CompressionType
Maybe S3DirectSourceAdditionalOptions
Text
paths :: [Text]
name :: Text
recurse :: Maybe Bool
outputSchemas :: Maybe [GlueSchema]
multiline :: Maybe Bool
maxFilesInBand :: Maybe Natural
maxBand :: Maybe Natural
jsonPath :: Maybe Text
groupSize :: Maybe Text
groupFiles :: Maybe Text
exclusions :: Maybe [Text]
compressionType :: Maybe CompressionType
additionalOptions :: Maybe S3DirectSourceAdditionalOptions
$sel:paths:S3JsonSource' :: S3JsonSource -> [Text]
$sel:name:S3JsonSource' :: S3JsonSource -> Text
$sel:recurse:S3JsonSource' :: S3JsonSource -> Maybe Bool
$sel:outputSchemas:S3JsonSource' :: S3JsonSource -> Maybe [GlueSchema]
$sel:multiline:S3JsonSource' :: S3JsonSource -> Maybe Bool
$sel:maxFilesInBand:S3JsonSource' :: S3JsonSource -> Maybe Natural
$sel:maxBand:S3JsonSource' :: S3JsonSource -> Maybe Natural
$sel:jsonPath:S3JsonSource' :: S3JsonSource -> Maybe Text
$sel:groupSize:S3JsonSource' :: S3JsonSource -> Maybe Text
$sel:groupFiles:S3JsonSource' :: S3JsonSource -> Maybe Text
$sel:exclusions:S3JsonSource' :: S3JsonSource -> Maybe [Text]
$sel:compressionType:S3JsonSource' :: S3JsonSource -> Maybe CompressionType
$sel:additionalOptions:S3JsonSource' :: S3JsonSource -> Maybe S3DirectSourceAdditionalOptions
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3DirectSourceAdditionalOptions
additionalOptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CompressionType
compressionType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
exclusions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
groupFiles
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
groupSize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jsonPath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxBand
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxFilesInBand
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
multiline
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [GlueSchema]
outputSchemas
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
recurse
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
paths

instance Prelude.NFData S3JsonSource where
  rnf :: S3JsonSource -> ()
rnf S3JsonSource' {[Text]
Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [GlueSchema]
Maybe Text
Maybe CompressionType
Maybe S3DirectSourceAdditionalOptions
Text
paths :: [Text]
name :: Text
recurse :: Maybe Bool
outputSchemas :: Maybe [GlueSchema]
multiline :: Maybe Bool
maxFilesInBand :: Maybe Natural
maxBand :: Maybe Natural
jsonPath :: Maybe Text
groupSize :: Maybe Text
groupFiles :: Maybe Text
exclusions :: Maybe [Text]
compressionType :: Maybe CompressionType
additionalOptions :: Maybe S3DirectSourceAdditionalOptions
$sel:paths:S3JsonSource' :: S3JsonSource -> [Text]
$sel:name:S3JsonSource' :: S3JsonSource -> Text
$sel:recurse:S3JsonSource' :: S3JsonSource -> Maybe Bool
$sel:outputSchemas:S3JsonSource' :: S3JsonSource -> Maybe [GlueSchema]
$sel:multiline:S3JsonSource' :: S3JsonSource -> Maybe Bool
$sel:maxFilesInBand:S3JsonSource' :: S3JsonSource -> Maybe Natural
$sel:maxBand:S3JsonSource' :: S3JsonSource -> Maybe Natural
$sel:jsonPath:S3JsonSource' :: S3JsonSource -> Maybe Text
$sel:groupSize:S3JsonSource' :: S3JsonSource -> Maybe Text
$sel:groupFiles:S3JsonSource' :: S3JsonSource -> Maybe Text
$sel:exclusions:S3JsonSource' :: S3JsonSource -> Maybe [Text]
$sel:compressionType:S3JsonSource' :: S3JsonSource -> Maybe CompressionType
$sel:additionalOptions:S3JsonSource' :: S3JsonSource -> Maybe S3DirectSourceAdditionalOptions
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe S3DirectSourceAdditionalOptions
additionalOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CompressionType
compressionType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
exclusions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
groupFiles
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
groupSize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jsonPath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxBand
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxFilesInBand
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
multiline
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [GlueSchema]
outputSchemas
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
recurse
      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]
paths

instance Data.ToJSON S3JsonSource where
  toJSON :: S3JsonSource -> Value
toJSON S3JsonSource' {[Text]
Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [GlueSchema]
Maybe Text
Maybe CompressionType
Maybe S3DirectSourceAdditionalOptions
Text
paths :: [Text]
name :: Text
recurse :: Maybe Bool
outputSchemas :: Maybe [GlueSchema]
multiline :: Maybe Bool
maxFilesInBand :: Maybe Natural
maxBand :: Maybe Natural
jsonPath :: Maybe Text
groupSize :: Maybe Text
groupFiles :: Maybe Text
exclusions :: Maybe [Text]
compressionType :: Maybe CompressionType
additionalOptions :: Maybe S3DirectSourceAdditionalOptions
$sel:paths:S3JsonSource' :: S3JsonSource -> [Text]
$sel:name:S3JsonSource' :: S3JsonSource -> Text
$sel:recurse:S3JsonSource' :: S3JsonSource -> Maybe Bool
$sel:outputSchemas:S3JsonSource' :: S3JsonSource -> Maybe [GlueSchema]
$sel:multiline:S3JsonSource' :: S3JsonSource -> Maybe Bool
$sel:maxFilesInBand:S3JsonSource' :: S3JsonSource -> Maybe Natural
$sel:maxBand:S3JsonSource' :: S3JsonSource -> Maybe Natural
$sel:jsonPath:S3JsonSource' :: S3JsonSource -> Maybe Text
$sel:groupSize:S3JsonSource' :: S3JsonSource -> Maybe Text
$sel:groupFiles:S3JsonSource' :: S3JsonSource -> Maybe Text
$sel:exclusions:S3JsonSource' :: S3JsonSource -> Maybe [Text]
$sel:compressionType:S3JsonSource' :: S3JsonSource -> Maybe CompressionType
$sel:additionalOptions:S3JsonSource' :: S3JsonSource -> Maybe S3DirectSourceAdditionalOptions
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AdditionalOptions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3DirectSourceAdditionalOptions
additionalOptions,
            (Key
"CompressionType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CompressionType
compressionType,
            (Key
"Exclusions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
exclusions,
            (Key
"GroupFiles" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
groupFiles,
            (Key
"GroupSize" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
groupSize,
            (Key
"JsonPath" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
jsonPath,
            (Key
"MaxBand" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxBand,
            (Key
"MaxFilesInBand" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxFilesInBand,
            (Key
"Multiline" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
multiline,
            (Key
"OutputSchemas" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [GlueSchema]
outputSchemas,
            (Key
"Recurse" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
recurse,
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"Paths" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
paths)
          ]
      )