{-# 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-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.Translate.Types.ParallelDataConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ParallelDataConfig -> ParallelDataConfig -> Bool)
-> (ParallelDataConfig -> ParallelDataConfig -> Bool)
-> Eq ParallelDataConfig
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]
(Int -> ReadS ParallelDataConfig)
-> ReadS [ParallelDataConfig]
-> ReadPrec ParallelDataConfig
-> ReadPrec [ParallelDataConfig]
-> Read 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
(Int -> ParallelDataConfig -> ShowS)
-> (ParallelDataConfig -> String)
-> ([ParallelDataConfig] -> ShowS)
-> Show ParallelDataConfig
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. ParallelDataConfig -> Rep ParallelDataConfig x)
-> (forall x. Rep ParallelDataConfig x -> ParallelDataConfig)
-> Generic ParallelDataConfig
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' :: Text -> ParallelDataFormat -> ParallelDataConfig
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 :: (Text -> f Text) -> ParallelDataConfig -> f ParallelDataConfig
parallelDataConfig_s3Uri = (ParallelDataConfig -> Text)
-> (ParallelDataConfig -> Text -> ParallelDataConfig)
-> Lens ParallelDataConfig ParallelDataConfig Text Text
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 :: (ParallelDataFormat -> f ParallelDataFormat)
-> ParallelDataConfig -> f ParallelDataConfig
parallelDataConfig_format = (ParallelDataConfig -> ParallelDataFormat)
-> (ParallelDataConfig -> ParallelDataFormat -> ParallelDataConfig)
-> Lens
     ParallelDataConfig
     ParallelDataConfig
     ParallelDataFormat
     ParallelDataFormat
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 Core.FromJSON ParallelDataConfig where
  parseJSON :: Value -> Parser ParallelDataConfig
parseJSON =
    String
-> (Object -> Parser ParallelDataConfig)
-> Value
-> Parser ParallelDataConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ParallelDataConfig"
      ( \Object
x ->
          Text -> ParallelDataFormat -> ParallelDataConfig
ParallelDataConfig'
            (Text -> ParallelDataFormat -> ParallelDataConfig)
-> Parser Text -> Parser (ParallelDataFormat -> ParallelDataConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3Uri") Parser (ParallelDataFormat -> ParallelDataConfig)
-> Parser ParallelDataFormat -> Parser ParallelDataConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ParallelDataFormat
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Format")
      )

instance Prelude.Hashable ParallelDataConfig

instance Prelude.NFData ParallelDataConfig

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3Uri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Uri),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Format" Text -> ParallelDataFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ParallelDataFormat
format)
          ]
      )