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

-- | Contains the Amazon S3 location of the training data you want to use to
-- create a new custom language model, and permissions to access this
-- location.
--
-- When using @InputDataConfig@, you must include these sub-parameters:
-- @S3Uri@ and @DataAccessRoleArn@. You can optionally include
-- @TuningDataS3Uri@.
--
-- /See:/ 'newInputDataConfig' smart constructor.
data InputDataConfig = InputDataConfig'
  { -- | The Amazon S3 location (URI) of the text files you want to use to tune
    -- your custom language model.
    --
    -- Here\'s an example URI path:
    -- @s3:\/\/DOC-EXAMPLE-BUCKET\/my-model-tuning-data\/@
    InputDataConfig -> Maybe Text
tuningDataS3Uri :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 location (URI) of the text files you want to use to train
    -- your custom language model.
    --
    -- Here\'s an example URI path:
    -- @s3:\/\/DOC-EXAMPLE-BUCKET\/my-model-training-data\/@
    InputDataConfig -> Text
s3Uri :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of an IAM role that has permissions to
    -- access the Amazon S3 bucket that contains your input files. If the role
    -- that you specify doesn’t have the appropriate permissions to access the
    -- specified Amazon S3 location, your request fails.
    --
    -- IAM role ARNs have the format
    -- @arn:partition:iam::account:role\/role-name-with-path@. For example:
    -- @arn:aws:iam::111122223333:role\/Admin@.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns IAM ARNs>.
    InputDataConfig -> Text
dataAccessRoleArn :: 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:
--
-- 'tuningDataS3Uri', 'inputDataConfig_tuningDataS3Uri' - The Amazon S3 location (URI) of the text files you want to use to tune
-- your custom language model.
--
-- Here\'s an example URI path:
-- @s3:\/\/DOC-EXAMPLE-BUCKET\/my-model-tuning-data\/@
--
-- 's3Uri', 'inputDataConfig_s3Uri' - The Amazon S3 location (URI) of the text files you want to use to train
-- your custom language model.
--
-- Here\'s an example URI path:
-- @s3:\/\/DOC-EXAMPLE-BUCKET\/my-model-training-data\/@
--
-- 'dataAccessRoleArn', 'inputDataConfig_dataAccessRoleArn' - The Amazon Resource Name (ARN) of an IAM role that has permissions to
-- access the Amazon S3 bucket that contains your input files. If the role
-- that you specify doesn’t have the appropriate permissions to access the
-- specified Amazon S3 location, your request fails.
--
-- IAM role ARNs have the format
-- @arn:partition:iam::account:role\/role-name-with-path@. For example:
-- @arn:aws:iam::111122223333:role\/Admin@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns IAM ARNs>.
newInputDataConfig ::
  -- | 's3Uri'
  Prelude.Text ->
  -- | 'dataAccessRoleArn'
  Prelude.Text ->
  InputDataConfig
newInputDataConfig :: Text -> Text -> InputDataConfig
newInputDataConfig Text
pS3Uri_ Text
pDataAccessRoleArn_ =
  InputDataConfig'
    { $sel:tuningDataS3Uri:InputDataConfig' :: Maybe Text
tuningDataS3Uri = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Uri:InputDataConfig' :: Text
s3Uri = Text
pS3Uri_,
      $sel:dataAccessRoleArn:InputDataConfig' :: Text
dataAccessRoleArn = Text
pDataAccessRoleArn_
    }

-- | The Amazon S3 location (URI) of the text files you want to use to tune
-- your custom language model.
--
-- Here\'s an example URI path:
-- @s3:\/\/DOC-EXAMPLE-BUCKET\/my-model-tuning-data\/@
inputDataConfig_tuningDataS3Uri :: Lens.Lens' InputDataConfig (Prelude.Maybe Prelude.Text)
inputDataConfig_tuningDataS3Uri :: Lens' InputDataConfig (Maybe Text)
inputDataConfig_tuningDataS3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDataConfig' {Maybe Text
tuningDataS3Uri :: Maybe Text
$sel:tuningDataS3Uri:InputDataConfig' :: InputDataConfig -> Maybe Text
tuningDataS3Uri} -> Maybe Text
tuningDataS3Uri) (\s :: InputDataConfig
s@InputDataConfig' {} Maybe Text
a -> InputDataConfig
s {$sel:tuningDataS3Uri:InputDataConfig' :: Maybe Text
tuningDataS3Uri = Maybe Text
a} :: InputDataConfig)

-- | The Amazon S3 location (URI) of the text files you want to use to train
-- your custom language model.
--
-- Here\'s an example URI path:
-- @s3:\/\/DOC-EXAMPLE-BUCKET\/my-model-training-data\/@
inputDataConfig_s3Uri :: Lens.Lens' InputDataConfig Prelude.Text
inputDataConfig_s3Uri :: Lens' InputDataConfig Text
inputDataConfig_s3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDataConfig' {Text
s3Uri :: Text
$sel:s3Uri:InputDataConfig' :: InputDataConfig -> Text
s3Uri} -> Text
s3Uri) (\s :: InputDataConfig
s@InputDataConfig' {} Text
a -> InputDataConfig
s {$sel:s3Uri:InputDataConfig' :: Text
s3Uri = Text
a} :: InputDataConfig)

-- | The Amazon Resource Name (ARN) of an IAM role that has permissions to
-- access the Amazon S3 bucket that contains your input files. If the role
-- that you specify doesn’t have the appropriate permissions to access the
-- specified Amazon S3 location, your request fails.
--
-- IAM role ARNs have the format
-- @arn:partition:iam::account:role\/role-name-with-path@. For example:
-- @arn:aws:iam::111122223333:role\/Admin@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns IAM ARNs>.
inputDataConfig_dataAccessRoleArn :: Lens.Lens' InputDataConfig Prelude.Text
inputDataConfig_dataAccessRoleArn :: Lens' InputDataConfig Text
inputDataConfig_dataAccessRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDataConfig' {Text
dataAccessRoleArn :: Text
$sel:dataAccessRoleArn:InputDataConfig' :: InputDataConfig -> Text
dataAccessRoleArn} -> Text
dataAccessRoleArn) (\s :: InputDataConfig
s@InputDataConfig' {} Text
a -> InputDataConfig
s {$sel:dataAccessRoleArn:InputDataConfig' :: Text
dataAccessRoleArn = 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 -> 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
"TuningDataS3Uri")
            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
"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
"DataAccessRoleArn")
      )

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

instance Prelude.NFData InputDataConfig where
  rnf :: InputDataConfig -> ()
rnf InputDataConfig' {Maybe Text
Text
dataAccessRoleArn :: Text
s3Uri :: Text
tuningDataS3Uri :: Maybe Text
$sel:dataAccessRoleArn:InputDataConfig' :: InputDataConfig -> Text
$sel:s3Uri:InputDataConfig' :: InputDataConfig -> Text
$sel:tuningDataS3Uri:InputDataConfig' :: InputDataConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
tuningDataS3Uri
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
dataAccessRoleArn

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