{-# 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.Translate.Types.ParallelDataConfig
-- 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.Translate.Types.ParallelDataConfig 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
import Amazonka.Translate.Types.ParallelDataFormat

-- | Specifies the format and S3 location of the parallel data input file.
--
-- /See:/ 'newParallelDataConfig' smart constructor.
data ParallelDataConfig = ParallelDataConfig'
  { -- | The URI of the Amazon S3 folder that contains the parallel data input
    -- file. The folder must be in the same Region as the API endpoint you are
    -- calling.
    ParallelDataConfig -> Text
s3Uri :: Prelude.Text,
    -- | The format of the parallel data input file.
    ParallelDataConfig -> ParallelDataFormat
format :: ParallelDataFormat
  }
  deriving (ParallelDataConfig -> ParallelDataConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParallelDataConfig -> ParallelDataConfig -> Bool
$c/= :: ParallelDataConfig -> ParallelDataConfig -> Bool
== :: ParallelDataConfig -> ParallelDataConfig -> Bool
$c== :: ParallelDataConfig -> ParallelDataConfig -> Bool
Prelude.Eq, ReadPrec [ParallelDataConfig]
ReadPrec ParallelDataConfig
Int -> ReadS ParallelDataConfig
ReadS [ParallelDataConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParallelDataConfig]
$creadListPrec :: ReadPrec [ParallelDataConfig]
readPrec :: ReadPrec ParallelDataConfig
$creadPrec :: ReadPrec ParallelDataConfig
readList :: ReadS [ParallelDataConfig]
$creadList :: ReadS [ParallelDataConfig]
readsPrec :: Int -> ReadS ParallelDataConfig
$creadsPrec :: Int -> ReadS ParallelDataConfig
Prelude.Read, Int -> ParallelDataConfig -> ShowS
[ParallelDataConfig] -> ShowS
ParallelDataConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParallelDataConfig] -> ShowS
$cshowList :: [ParallelDataConfig] -> ShowS
show :: ParallelDataConfig -> String
$cshow :: ParallelDataConfig -> String
showsPrec :: Int -> ParallelDataConfig -> ShowS
$cshowsPrec :: Int -> ParallelDataConfig -> ShowS
Prelude.Show, forall x. Rep ParallelDataConfig x -> ParallelDataConfig
forall x. ParallelDataConfig -> Rep ParallelDataConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ParallelDataConfig x -> ParallelDataConfig
$cfrom :: forall x. ParallelDataConfig -> Rep ParallelDataConfig x
Prelude.Generic)

-- |
-- Create a value of 'ParallelDataConfig' 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:
--
-- 's3Uri', 'parallelDataConfig_s3Uri' - The URI of the Amazon S3 folder that contains the parallel data input
-- file. The folder must be in the same Region as the API endpoint you are
-- calling.
--
-- 'format', 'parallelDataConfig_format' - The format of the parallel data input file.
newParallelDataConfig ::
  -- | 's3Uri'
  Prelude.Text ->
  -- | 'format'
  ParallelDataFormat ->
  ParallelDataConfig
newParallelDataConfig :: Text -> ParallelDataFormat -> ParallelDataConfig
newParallelDataConfig Text
pS3Uri_ ParallelDataFormat
pFormat_ =
  ParallelDataConfig'
    { $sel:s3Uri:ParallelDataConfig' :: Text
s3Uri = Text
pS3Uri_,
      $sel:format:ParallelDataConfig' :: ParallelDataFormat
format = ParallelDataFormat
pFormat_
    }

-- | The URI of the Amazon S3 folder that contains the parallel data input
-- file. The folder must be in the same Region as the API endpoint you are
-- calling.
parallelDataConfig_s3Uri :: Lens.Lens' ParallelDataConfig Prelude.Text
parallelDataConfig_s3Uri :: Lens' ParallelDataConfig Text
parallelDataConfig_s3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParallelDataConfig' {Text
s3Uri :: Text
$sel:s3Uri:ParallelDataConfig' :: ParallelDataConfig -> Text
s3Uri} -> Text
s3Uri) (\s :: ParallelDataConfig
s@ParallelDataConfig' {} Text
a -> ParallelDataConfig
s {$sel:s3Uri:ParallelDataConfig' :: Text
s3Uri = Text
a} :: ParallelDataConfig)

-- | The format of the parallel data input file.
parallelDataConfig_format :: Lens.Lens' ParallelDataConfig ParallelDataFormat
parallelDataConfig_format :: Lens' ParallelDataConfig ParallelDataFormat
parallelDataConfig_format = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParallelDataConfig' {ParallelDataFormat
format :: ParallelDataFormat
$sel:format:ParallelDataConfig' :: ParallelDataConfig -> ParallelDataFormat
format} -> ParallelDataFormat
format) (\s :: ParallelDataConfig
s@ParallelDataConfig' {} ParallelDataFormat
a -> ParallelDataConfig
s {$sel:format:ParallelDataConfig' :: ParallelDataFormat
format = ParallelDataFormat
a} :: ParallelDataConfig)

instance Data.FromJSON ParallelDataConfig where
  parseJSON :: Value -> Parser ParallelDataConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ParallelDataConfig"
      ( \Object
x ->
          Text -> ParallelDataFormat -> ParallelDataConfig
ParallelDataConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"S3Uri")
            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
"Format")
      )

instance Prelude.Hashable ParallelDataConfig where
  hashWithSalt :: Int -> ParallelDataConfig -> Int
hashWithSalt Int
_salt ParallelDataConfig' {Text
ParallelDataFormat
format :: ParallelDataFormat
s3Uri :: Text
$sel:format:ParallelDataConfig' :: ParallelDataConfig -> ParallelDataFormat
$sel:s3Uri:ParallelDataConfig' :: ParallelDataConfig -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3Uri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ParallelDataFormat
format

instance Prelude.NFData ParallelDataConfig where
  rnf :: ParallelDataConfig -> ()
rnf ParallelDataConfig' {Text
ParallelDataFormat
format :: ParallelDataFormat
s3Uri :: Text
$sel:format:ParallelDataConfig' :: ParallelDataConfig -> ParallelDataFormat
$sel:s3Uri:ParallelDataConfig' :: ParallelDataConfig -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
s3Uri seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ParallelDataFormat
format

instance Data.ToJSON ParallelDataConfig where
  toJSON :: ParallelDataConfig -> Value
toJSON ParallelDataConfig' {Text
ParallelDataFormat
format :: ParallelDataFormat
s3Uri :: Text
$sel:format:ParallelDataConfig' :: ParallelDataConfig -> ParallelDataFormat
$sel:s3Uri:ParallelDataConfig' :: ParallelDataConfig -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"S3Uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3Uri),
            forall a. a -> Maybe a
Prelude.Just (Key
"Format" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ParallelDataFormat
format)
          ]
      )