{-# 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.S3SourceAdditionalOptions
-- 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.S3SourceAdditionalOptions 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

-- | Specifies additional connection options for the Amazon S3 data store.
--
-- /See:/ 'newS3SourceAdditionalOptions' smart constructor.
data S3SourceAdditionalOptions = S3SourceAdditionalOptions'
  { -- | Sets the upper limit for the target number of files that will be
    -- processed.
    S3SourceAdditionalOptions -> Maybe Integer
boundedFiles :: Prelude.Maybe Prelude.Integer,
    -- | Sets the upper limit for the target size of the dataset in bytes that
    -- will be processed.
    S3SourceAdditionalOptions -> Maybe Integer
boundedSize :: Prelude.Maybe Prelude.Integer
  }
  deriving (S3SourceAdditionalOptions -> S3SourceAdditionalOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3SourceAdditionalOptions -> S3SourceAdditionalOptions -> Bool
$c/= :: S3SourceAdditionalOptions -> S3SourceAdditionalOptions -> Bool
== :: S3SourceAdditionalOptions -> S3SourceAdditionalOptions -> Bool
$c== :: S3SourceAdditionalOptions -> S3SourceAdditionalOptions -> Bool
Prelude.Eq, ReadPrec [S3SourceAdditionalOptions]
ReadPrec S3SourceAdditionalOptions
Int -> ReadS S3SourceAdditionalOptions
ReadS [S3SourceAdditionalOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3SourceAdditionalOptions]
$creadListPrec :: ReadPrec [S3SourceAdditionalOptions]
readPrec :: ReadPrec S3SourceAdditionalOptions
$creadPrec :: ReadPrec S3SourceAdditionalOptions
readList :: ReadS [S3SourceAdditionalOptions]
$creadList :: ReadS [S3SourceAdditionalOptions]
readsPrec :: Int -> ReadS S3SourceAdditionalOptions
$creadsPrec :: Int -> ReadS S3SourceAdditionalOptions
Prelude.Read, Int -> S3SourceAdditionalOptions -> ShowS
[S3SourceAdditionalOptions] -> ShowS
S3SourceAdditionalOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3SourceAdditionalOptions] -> ShowS
$cshowList :: [S3SourceAdditionalOptions] -> ShowS
show :: S3SourceAdditionalOptions -> String
$cshow :: S3SourceAdditionalOptions -> String
showsPrec :: Int -> S3SourceAdditionalOptions -> ShowS
$cshowsPrec :: Int -> S3SourceAdditionalOptions -> ShowS
Prelude.Show, forall x.
Rep S3SourceAdditionalOptions x -> S3SourceAdditionalOptions
forall x.
S3SourceAdditionalOptions -> Rep S3SourceAdditionalOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep S3SourceAdditionalOptions x -> S3SourceAdditionalOptions
$cfrom :: forall x.
S3SourceAdditionalOptions -> Rep S3SourceAdditionalOptions x
Prelude.Generic)

-- |
-- Create a value of 'S3SourceAdditionalOptions' 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:
--
-- 'boundedFiles', 's3SourceAdditionalOptions_boundedFiles' - Sets the upper limit for the target number of files that will be
-- processed.
--
-- 'boundedSize', 's3SourceAdditionalOptions_boundedSize' - Sets the upper limit for the target size of the dataset in bytes that
-- will be processed.
newS3SourceAdditionalOptions ::
  S3SourceAdditionalOptions
newS3SourceAdditionalOptions :: S3SourceAdditionalOptions
newS3SourceAdditionalOptions =
  S3SourceAdditionalOptions'
    { $sel:boundedFiles:S3SourceAdditionalOptions' :: Maybe Integer
boundedFiles =
        forall a. Maybe a
Prelude.Nothing,
      $sel:boundedSize:S3SourceAdditionalOptions' :: Maybe Integer
boundedSize = forall a. Maybe a
Prelude.Nothing
    }

-- | Sets the upper limit for the target number of files that will be
-- processed.
s3SourceAdditionalOptions_boundedFiles :: Lens.Lens' S3SourceAdditionalOptions (Prelude.Maybe Prelude.Integer)
s3SourceAdditionalOptions_boundedFiles :: Lens' S3SourceAdditionalOptions (Maybe Integer)
s3SourceAdditionalOptions_boundedFiles = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3SourceAdditionalOptions' {Maybe Integer
boundedFiles :: Maybe Integer
$sel:boundedFiles:S3SourceAdditionalOptions' :: S3SourceAdditionalOptions -> Maybe Integer
boundedFiles} -> Maybe Integer
boundedFiles) (\s :: S3SourceAdditionalOptions
s@S3SourceAdditionalOptions' {} Maybe Integer
a -> S3SourceAdditionalOptions
s {$sel:boundedFiles:S3SourceAdditionalOptions' :: Maybe Integer
boundedFiles = Maybe Integer
a} :: S3SourceAdditionalOptions)

-- | Sets the upper limit for the target size of the dataset in bytes that
-- will be processed.
s3SourceAdditionalOptions_boundedSize :: Lens.Lens' S3SourceAdditionalOptions (Prelude.Maybe Prelude.Integer)
s3SourceAdditionalOptions_boundedSize :: Lens' S3SourceAdditionalOptions (Maybe Integer)
s3SourceAdditionalOptions_boundedSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3SourceAdditionalOptions' {Maybe Integer
boundedSize :: Maybe Integer
$sel:boundedSize:S3SourceAdditionalOptions' :: S3SourceAdditionalOptions -> Maybe Integer
boundedSize} -> Maybe Integer
boundedSize) (\s :: S3SourceAdditionalOptions
s@S3SourceAdditionalOptions' {} Maybe Integer
a -> S3SourceAdditionalOptions
s {$sel:boundedSize:S3SourceAdditionalOptions' :: Maybe Integer
boundedSize = Maybe Integer
a} :: S3SourceAdditionalOptions)

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

instance Prelude.Hashable S3SourceAdditionalOptions where
  hashWithSalt :: Int -> S3SourceAdditionalOptions -> Int
hashWithSalt Int
_salt S3SourceAdditionalOptions' {Maybe Integer
boundedSize :: Maybe Integer
boundedFiles :: Maybe Integer
$sel:boundedSize:S3SourceAdditionalOptions' :: S3SourceAdditionalOptions -> Maybe Integer
$sel:boundedFiles:S3SourceAdditionalOptions' :: S3SourceAdditionalOptions -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
boundedFiles
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
boundedSize

instance Prelude.NFData S3SourceAdditionalOptions where
  rnf :: S3SourceAdditionalOptions -> ()
rnf S3SourceAdditionalOptions' {Maybe Integer
boundedSize :: Maybe Integer
boundedFiles :: Maybe Integer
$sel:boundedSize:S3SourceAdditionalOptions' :: S3SourceAdditionalOptions -> Maybe Integer
$sel:boundedFiles:S3SourceAdditionalOptions' :: S3SourceAdditionalOptions -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
boundedFiles
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
boundedSize

instance Data.ToJSON S3SourceAdditionalOptions where
  toJSON :: S3SourceAdditionalOptions -> Value
toJSON S3SourceAdditionalOptions' {Maybe Integer
boundedSize :: Maybe Integer
boundedFiles :: Maybe Integer
$sel:boundedSize:S3SourceAdditionalOptions' :: S3SourceAdditionalOptions -> Maybe Integer
$sel:boundedFiles:S3SourceAdditionalOptions' :: S3SourceAdditionalOptions -> Maybe Integer
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"BoundedFiles" 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 Integer
boundedFiles,
            (Key
"BoundedSize" 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 Integer
boundedSize
          ]
      )