{-# 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.ComprehendMedical.Types.InputDataConfig
-- 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.ComprehendMedical.Types.InputDataConfig 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

-- | The input properties for an entities detection job. This includes the
-- name of the S3 bucket and the path to the files to be analyzed.
--
-- /See:/ 'newInputDataConfig' smart constructor.
data InputDataConfig = InputDataConfig'
  { -- | The path to the input data files in the S3 bucket.
    InputDataConfig -> Maybe Text
s3Key :: Prelude.Maybe Prelude.Text,
    -- | The URI of the S3 bucket that contains the input data. The bucket must
    -- be in the same region as the API endpoint that you are calling.
    --
    -- Each file in the document collection must be less than 40 KB. You can
    -- store a maximum of 30 GB in the bucket.
    InputDataConfig -> Text
s3Bucket :: Prelude.Text
  }
  deriving (InputDataConfig -> InputDataConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputDataConfig -> InputDataConfig -> Bool
$c/= :: InputDataConfig -> InputDataConfig -> Bool
== :: InputDataConfig -> InputDataConfig -> Bool
$c== :: InputDataConfig -> InputDataConfig -> Bool
Prelude.Eq, ReadPrec [InputDataConfig]
ReadPrec InputDataConfig
Int -> ReadS InputDataConfig
ReadS [InputDataConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputDataConfig]
$creadListPrec :: ReadPrec [InputDataConfig]
readPrec :: ReadPrec InputDataConfig
$creadPrec :: ReadPrec InputDataConfig
readList :: ReadS [InputDataConfig]
$creadList :: ReadS [InputDataConfig]
readsPrec :: Int -> ReadS InputDataConfig
$creadsPrec :: Int -> ReadS InputDataConfig
Prelude.Read, Int -> InputDataConfig -> ShowS
[InputDataConfig] -> ShowS
InputDataConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputDataConfig] -> ShowS
$cshowList :: [InputDataConfig] -> ShowS
show :: InputDataConfig -> String
$cshow :: InputDataConfig -> String
showsPrec :: Int -> InputDataConfig -> ShowS
$cshowsPrec :: Int -> InputDataConfig -> ShowS
Prelude.Show, forall x. Rep InputDataConfig x -> InputDataConfig
forall x. InputDataConfig -> Rep InputDataConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputDataConfig x -> InputDataConfig
$cfrom :: forall x. InputDataConfig -> Rep InputDataConfig x
Prelude.Generic)

-- |
-- Create a value of 'InputDataConfig' 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:
--
-- 's3Key', 'inputDataConfig_s3Key' - The path to the input data files in the S3 bucket.
--
-- 's3Bucket', 'inputDataConfig_s3Bucket' - The URI of the S3 bucket that contains the input data. The bucket must
-- be in the same region as the API endpoint that you are calling.
--
-- Each file in the document collection must be less than 40 KB. You can
-- store a maximum of 30 GB in the bucket.
newInputDataConfig ::
  -- | 's3Bucket'
  Prelude.Text ->
  InputDataConfig
newInputDataConfig :: Text -> InputDataConfig
newInputDataConfig Text
pS3Bucket_ =
  InputDataConfig'
    { $sel:s3Key:InputDataConfig' :: Maybe Text
s3Key = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Bucket:InputDataConfig' :: Text
s3Bucket = Text
pS3Bucket_
    }

-- | The path to the input data files in the S3 bucket.
inputDataConfig_s3Key :: Lens.Lens' InputDataConfig (Prelude.Maybe Prelude.Text)
inputDataConfig_s3Key :: Lens' InputDataConfig (Maybe Text)
inputDataConfig_s3Key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDataConfig' {Maybe Text
s3Key :: Maybe Text
$sel:s3Key:InputDataConfig' :: InputDataConfig -> Maybe Text
s3Key} -> Maybe Text
s3Key) (\s :: InputDataConfig
s@InputDataConfig' {} Maybe Text
a -> InputDataConfig
s {$sel:s3Key:InputDataConfig' :: Maybe Text
s3Key = Maybe Text
a} :: InputDataConfig)

-- | The URI of the S3 bucket that contains the input data. The bucket must
-- be in the same region as the API endpoint that you are calling.
--
-- Each file in the document collection must be less than 40 KB. You can
-- store a maximum of 30 GB in the bucket.
inputDataConfig_s3Bucket :: Lens.Lens' InputDataConfig Prelude.Text
inputDataConfig_s3Bucket :: Lens' InputDataConfig Text
inputDataConfig_s3Bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDataConfig' {Text
s3Bucket :: Text
$sel:s3Bucket:InputDataConfig' :: InputDataConfig -> Text
s3Bucket} -> Text
s3Bucket) (\s :: InputDataConfig
s@InputDataConfig' {} Text
a -> InputDataConfig
s {$sel:s3Bucket:InputDataConfig' :: Text
s3Bucket = Text
a} :: InputDataConfig)

instance Data.FromJSON InputDataConfig where
  parseJSON :: Value -> Parser InputDataConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InputDataConfig"
      ( \Object
x ->
          Maybe Text -> Text -> InputDataConfig
InputDataConfig'
            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
"S3Key")
            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
"S3Bucket")
      )

instance Prelude.Hashable InputDataConfig where
  hashWithSalt :: Int -> InputDataConfig -> Int
hashWithSalt Int
_salt InputDataConfig' {Maybe Text
Text
s3Bucket :: Text
s3Key :: Maybe Text
$sel:s3Bucket:InputDataConfig' :: InputDataConfig -> Text
$sel:s3Key:InputDataConfig' :: InputDataConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3Key
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3Bucket

instance Prelude.NFData InputDataConfig where
  rnf :: InputDataConfig -> ()
rnf InputDataConfig' {Maybe Text
Text
s3Bucket :: Text
s3Key :: Maybe Text
$sel:s3Bucket:InputDataConfig' :: InputDataConfig -> Text
$sel:s3Key:InputDataConfig' :: InputDataConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3Key
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
s3Bucket

instance Data.ToJSON InputDataConfig where
  toJSON :: InputDataConfig -> Value
toJSON InputDataConfig' {Maybe Text
Text
s3Bucket :: Text
s3Key :: Maybe Text
$sel:s3Bucket:InputDataConfig' :: InputDataConfig -> Text
$sel:s3Key:InputDataConfig' :: InputDataConfig -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"S3Key" 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
s3Key,
            forall a. a -> Maybe a
Prelude.Just (Key
"S3Bucket" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3Bucket)
          ]
      )