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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(DocumentClassifierOutputDataConfig
 -> DocumentClassifierOutputDataConfig -> Bool)
-> (DocumentClassifierOutputDataConfig
    -> DocumentClassifierOutputDataConfig -> Bool)
-> Eq DocumentClassifierOutputDataConfig
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]
(Int -> ReadS DocumentClassifierOutputDataConfig)
-> ReadS [DocumentClassifierOutputDataConfig]
-> ReadPrec DocumentClassifierOutputDataConfig
-> ReadPrec [DocumentClassifierOutputDataConfig]
-> Read 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
(Int -> DocumentClassifierOutputDataConfig -> ShowS)
-> (DocumentClassifierOutputDataConfig -> String)
-> ([DocumentClassifierOutputDataConfig] -> ShowS)
-> Show DocumentClassifierOutputDataConfig
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.
 DocumentClassifierOutputDataConfig
 -> Rep DocumentClassifierOutputDataConfig x)
-> (forall x.
    Rep DocumentClassifierOutputDataConfig x
    -> DocumentClassifierOutputDataConfig)
-> Generic DocumentClassifierOutputDataConfig
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' :: Maybe Text -> Maybe Text -> DocumentClassifierOutputDataConfig
DocumentClassifierOutputDataConfig'
    { $sel:kmsKeyId:DocumentClassifierOutputDataConfig' :: Maybe Text
kmsKeyId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Uri:DocumentClassifierOutputDataConfig' :: Maybe Text
s3Uri = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> DocumentClassifierOutputDataConfig
-> f DocumentClassifierOutputDataConfig
documentClassifierOutputDataConfig_kmsKeyId = (DocumentClassifierOutputDataConfig -> Maybe Text)
-> (DocumentClassifierOutputDataConfig
    -> Maybe Text -> DocumentClassifierOutputDataConfig)
-> Lens
     DocumentClassifierOutputDataConfig
     DocumentClassifierOutputDataConfig
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> DocumentClassifierOutputDataConfig
-> f DocumentClassifierOutputDataConfig
documentClassifierOutputDataConfig_s3Uri = (DocumentClassifierOutputDataConfig -> Maybe Text)
-> (DocumentClassifierOutputDataConfig
    -> Maybe Text -> DocumentClassifierOutputDataConfig)
-> Lens
     DocumentClassifierOutputDataConfig
     DocumentClassifierOutputDataConfig
     (Maybe Text)
     (Maybe Text)
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
  Core.FromJSON
    DocumentClassifierOutputDataConfig
  where
  parseJSON :: Value -> Parser DocumentClassifierOutputDataConfig
parseJSON =
    String
-> (Object -> Parser DocumentClassifierOutputDataConfig)
-> Value
-> Parser DocumentClassifierOutputDataConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DocumentClassifierOutputDataConfig"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> DocumentClassifierOutputDataConfig
DocumentClassifierOutputDataConfig'
            (Maybe Text -> Maybe Text -> DocumentClassifierOutputDataConfig)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> DocumentClassifierOutputDataConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KmsKeyId")
            Parser (Maybe Text -> DocumentClassifierOutputDataConfig)
-> Parser (Maybe Text) -> Parser DocumentClassifierOutputDataConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3Uri")
      )

instance
  Prelude.Hashable
    DocumentClassifierOutputDataConfig

instance
  Prelude.NFData
    DocumentClassifierOutputDataConfig

instance
  Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"KmsKeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
            (Text
"S3Uri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
s3Uri
          ]
      )