{-# 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.Comprehend.Types.DocumentClassifierOutputDataConfig
-- 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.Comprehend.Types.DocumentClassifierOutputDataConfig 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

-- | Provides output results configuration parameters for custom classifier
-- jobs.
--
-- /See:/ 'newDocumentClassifierOutputDataConfig' smart constructor.
data DocumentClassifierOutputDataConfig = DocumentClassifierOutputDataConfig'
  { -- | ID for the AWS Key Management Service (KMS) key that Amazon Comprehend
    -- uses to encrypt the output results from an analysis job. The KmsKeyId
    -- can be one of the following formats:
    --
    -- -   KMS Key ID: @\"1234abcd-12ab-34cd-56ef-1234567890ab\"@
    --
    -- -   Amazon Resource Name (ARN) of a KMS Key:
    --     @\"arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab\"@
    --
    -- -   KMS Key Alias: @\"alias\/ExampleAlias\"@
    --
    -- -   ARN of a KMS Key Alias:
    --     @\"arn:aws:kms:us-west-2:111122223333:alias\/ExampleAlias\"@
    DocumentClassifierOutputDataConfig -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | When you use the @OutputDataConfig@ object while creating a custom
    -- classifier, you specify the Amazon S3 location where you want to write
    -- the confusion matrix. The URI must be in the same region as the API
    -- endpoint that you are calling. The location is used as the prefix for
    -- the actual location of this output file.
    --
    -- When the custom classifier job is finished, the service creates the
    -- output file in a directory specific to the job. The @S3Uri@ field
    -- contains the location of the output file, called @output.tar.gz@. It is
    -- a compressed archive that contains the confusion matrix.
    DocumentClassifierOutputDataConfig -> Maybe Text
s3Uri :: Prelude.Maybe Prelude.Text
  }
  deriving (DocumentClassifierOutputDataConfig
-> DocumentClassifierOutputDataConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentClassifierOutputDataConfig
-> DocumentClassifierOutputDataConfig -> Bool
$c/= :: DocumentClassifierOutputDataConfig
-> DocumentClassifierOutputDataConfig -> Bool
== :: DocumentClassifierOutputDataConfig
-> DocumentClassifierOutputDataConfig -> Bool
$c== :: DocumentClassifierOutputDataConfig
-> DocumentClassifierOutputDataConfig -> Bool
Prelude.Eq, ReadPrec [DocumentClassifierOutputDataConfig]
ReadPrec DocumentClassifierOutputDataConfig
Int -> ReadS DocumentClassifierOutputDataConfig
ReadS [DocumentClassifierOutputDataConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DocumentClassifierOutputDataConfig]
$creadListPrec :: ReadPrec [DocumentClassifierOutputDataConfig]
readPrec :: ReadPrec DocumentClassifierOutputDataConfig
$creadPrec :: ReadPrec DocumentClassifierOutputDataConfig
readList :: ReadS [DocumentClassifierOutputDataConfig]
$creadList :: ReadS [DocumentClassifierOutputDataConfig]
readsPrec :: Int -> ReadS DocumentClassifierOutputDataConfig
$creadsPrec :: Int -> ReadS DocumentClassifierOutputDataConfig
Prelude.Read, Int -> DocumentClassifierOutputDataConfig -> ShowS
[DocumentClassifierOutputDataConfig] -> ShowS
DocumentClassifierOutputDataConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentClassifierOutputDataConfig] -> ShowS
$cshowList :: [DocumentClassifierOutputDataConfig] -> ShowS
show :: DocumentClassifierOutputDataConfig -> String
$cshow :: DocumentClassifierOutputDataConfig -> String
showsPrec :: Int -> DocumentClassifierOutputDataConfig -> ShowS
$cshowsPrec :: Int -> DocumentClassifierOutputDataConfig -> ShowS
Prelude.Show, forall x.
Rep DocumentClassifierOutputDataConfig x
-> DocumentClassifierOutputDataConfig
forall x.
DocumentClassifierOutputDataConfig
-> Rep DocumentClassifierOutputDataConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DocumentClassifierOutputDataConfig x
-> DocumentClassifierOutputDataConfig
$cfrom :: forall x.
DocumentClassifierOutputDataConfig
-> Rep DocumentClassifierOutputDataConfig x
Prelude.Generic)

-- |
-- Create a value of 'DocumentClassifierOutputDataConfig' 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:
--
-- 'kmsKeyId', 'documentClassifierOutputDataConfig_kmsKeyId' - ID for the AWS Key Management Service (KMS) key that Amazon Comprehend
-- uses to encrypt the output results from an analysis job. The KmsKeyId
-- can be one of the following formats:
--
-- -   KMS Key ID: @\"1234abcd-12ab-34cd-56ef-1234567890ab\"@
--
-- -   Amazon Resource Name (ARN) of a KMS Key:
--     @\"arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab\"@
--
-- -   KMS Key Alias: @\"alias\/ExampleAlias\"@
--
-- -   ARN of a KMS Key Alias:
--     @\"arn:aws:kms:us-west-2:111122223333:alias\/ExampleAlias\"@
--
-- 's3Uri', 'documentClassifierOutputDataConfig_s3Uri' - When you use the @OutputDataConfig@ object while creating a custom
-- classifier, you specify the Amazon S3 location where you want to write
-- the confusion matrix. The URI must be in the same region as the API
-- endpoint that you are calling. The location is used as the prefix for
-- the actual location of this output file.
--
-- When the custom classifier job is finished, the service creates the
-- output file in a directory specific to the job. The @S3Uri@ field
-- contains the location of the output file, called @output.tar.gz@. It is
-- a compressed archive that contains the confusion matrix.
newDocumentClassifierOutputDataConfig ::
  DocumentClassifierOutputDataConfig
newDocumentClassifierOutputDataConfig :: DocumentClassifierOutputDataConfig
newDocumentClassifierOutputDataConfig =
  DocumentClassifierOutputDataConfig'
    { $sel:kmsKeyId:DocumentClassifierOutputDataConfig' :: Maybe Text
kmsKeyId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:s3Uri:DocumentClassifierOutputDataConfig' :: Maybe Text
s3Uri = forall a. Maybe a
Prelude.Nothing
    }

-- | ID for the AWS Key Management Service (KMS) key that Amazon Comprehend
-- uses to encrypt the output results from an analysis job. The KmsKeyId
-- can be one of the following formats:
--
-- -   KMS Key ID: @\"1234abcd-12ab-34cd-56ef-1234567890ab\"@
--
-- -   Amazon Resource Name (ARN) of a KMS Key:
--     @\"arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab\"@
--
-- -   KMS Key Alias: @\"alias\/ExampleAlias\"@
--
-- -   ARN of a KMS Key Alias:
--     @\"arn:aws:kms:us-west-2:111122223333:alias\/ExampleAlias\"@
documentClassifierOutputDataConfig_kmsKeyId :: Lens.Lens' DocumentClassifierOutputDataConfig (Prelude.Maybe Prelude.Text)
documentClassifierOutputDataConfig_kmsKeyId :: Lens' DocumentClassifierOutputDataConfig (Maybe Text)
documentClassifierOutputDataConfig_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentClassifierOutputDataConfig' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:DocumentClassifierOutputDataConfig' :: DocumentClassifierOutputDataConfig -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: DocumentClassifierOutputDataConfig
s@DocumentClassifierOutputDataConfig' {} Maybe Text
a -> DocumentClassifierOutputDataConfig
s {$sel:kmsKeyId:DocumentClassifierOutputDataConfig' :: Maybe Text
kmsKeyId = Maybe Text
a} :: DocumentClassifierOutputDataConfig)

-- | When you use the @OutputDataConfig@ object while creating a custom
-- classifier, you specify the Amazon S3 location where you want to write
-- the confusion matrix. The URI must be in the same region as the API
-- endpoint that you are calling. The location is used as the prefix for
-- the actual location of this output file.
--
-- When the custom classifier job is finished, the service creates the
-- output file in a directory specific to the job. The @S3Uri@ field
-- contains the location of the output file, called @output.tar.gz@. It is
-- a compressed archive that contains the confusion matrix.
documentClassifierOutputDataConfig_s3Uri :: Lens.Lens' DocumentClassifierOutputDataConfig (Prelude.Maybe Prelude.Text)
documentClassifierOutputDataConfig_s3Uri :: Lens' DocumentClassifierOutputDataConfig (Maybe Text)
documentClassifierOutputDataConfig_s3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentClassifierOutputDataConfig' {Maybe Text
s3Uri :: Maybe Text
$sel:s3Uri:DocumentClassifierOutputDataConfig' :: DocumentClassifierOutputDataConfig -> Maybe Text
s3Uri} -> Maybe Text
s3Uri) (\s :: DocumentClassifierOutputDataConfig
s@DocumentClassifierOutputDataConfig' {} Maybe Text
a -> DocumentClassifierOutputDataConfig
s {$sel:s3Uri:DocumentClassifierOutputDataConfig' :: Maybe Text
s3Uri = Maybe Text
a} :: DocumentClassifierOutputDataConfig)

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

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

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

instance
  Data.ToJSON
    DocumentClassifierOutputDataConfig
  where
  toJSON :: DocumentClassifierOutputDataConfig -> Value
toJSON DocumentClassifierOutputDataConfig' {Maybe Text
s3Uri :: Maybe Text
kmsKeyId :: Maybe Text
$sel:s3Uri:DocumentClassifierOutputDataConfig' :: DocumentClassifierOutputDataConfig -> Maybe Text
$sel:kmsKeyId:DocumentClassifierOutputDataConfig' :: DocumentClassifierOutputDataConfig -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"KmsKeyId" 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
kmsKeyId,
            (Key
"S3Uri" 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
s3Uri
          ]
      )