{-# 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.LookoutEquipment.Types.InferenceOutputConfiguration
-- 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.LookoutEquipment.Types.InferenceOutputConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LookoutEquipment.Types.InferenceS3OutputConfiguration
import qualified Amazonka.Prelude as Prelude

-- | Specifies configuration information for the output results from for the
-- inference, including KMS key ID and output S3 location.
--
-- /See:/ 'newInferenceOutputConfiguration' smart constructor.
data InferenceOutputConfiguration = InferenceOutputConfiguration'
  { -- | The ID number for the AWS KMS key used to encrypt the inference output.
    InferenceOutputConfiguration -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Specifies configuration information for the output results from for the
    -- inference, output S3 location.
    InferenceOutputConfiguration -> InferenceS3OutputConfiguration
s3OutputConfiguration :: InferenceS3OutputConfiguration
  }
  deriving (InferenceOutputConfiguration
-> InferenceOutputConfiguration -> Bool
(InferenceOutputConfiguration
 -> InferenceOutputConfiguration -> Bool)
-> (InferenceOutputConfiguration
    -> InferenceOutputConfiguration -> Bool)
-> Eq InferenceOutputConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InferenceOutputConfiguration
-> InferenceOutputConfiguration -> Bool
$c/= :: InferenceOutputConfiguration
-> InferenceOutputConfiguration -> Bool
== :: InferenceOutputConfiguration
-> InferenceOutputConfiguration -> Bool
$c== :: InferenceOutputConfiguration
-> InferenceOutputConfiguration -> Bool
Prelude.Eq, ReadPrec [InferenceOutputConfiguration]
ReadPrec InferenceOutputConfiguration
Int -> ReadS InferenceOutputConfiguration
ReadS [InferenceOutputConfiguration]
(Int -> ReadS InferenceOutputConfiguration)
-> ReadS [InferenceOutputConfiguration]
-> ReadPrec InferenceOutputConfiguration
-> ReadPrec [InferenceOutputConfiguration]
-> Read InferenceOutputConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InferenceOutputConfiguration]
$creadListPrec :: ReadPrec [InferenceOutputConfiguration]
readPrec :: ReadPrec InferenceOutputConfiguration
$creadPrec :: ReadPrec InferenceOutputConfiguration
readList :: ReadS [InferenceOutputConfiguration]
$creadList :: ReadS [InferenceOutputConfiguration]
readsPrec :: Int -> ReadS InferenceOutputConfiguration
$creadsPrec :: Int -> ReadS InferenceOutputConfiguration
Prelude.Read, Int -> InferenceOutputConfiguration -> ShowS
[InferenceOutputConfiguration] -> ShowS
InferenceOutputConfiguration -> String
(Int -> InferenceOutputConfiguration -> ShowS)
-> (InferenceOutputConfiguration -> String)
-> ([InferenceOutputConfiguration] -> ShowS)
-> Show InferenceOutputConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InferenceOutputConfiguration] -> ShowS
$cshowList :: [InferenceOutputConfiguration] -> ShowS
show :: InferenceOutputConfiguration -> String
$cshow :: InferenceOutputConfiguration -> String
showsPrec :: Int -> InferenceOutputConfiguration -> ShowS
$cshowsPrec :: Int -> InferenceOutputConfiguration -> ShowS
Prelude.Show, (forall x.
 InferenceOutputConfiguration -> Rep InferenceOutputConfiguration x)
-> (forall x.
    Rep InferenceOutputConfiguration x -> InferenceOutputConfiguration)
-> Generic InferenceOutputConfiguration
forall x.
Rep InferenceOutputConfiguration x -> InferenceOutputConfiguration
forall x.
InferenceOutputConfiguration -> Rep InferenceOutputConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InferenceOutputConfiguration x -> InferenceOutputConfiguration
$cfrom :: forall x.
InferenceOutputConfiguration -> Rep InferenceOutputConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'InferenceOutputConfiguration' 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', 'inferenceOutputConfiguration_kmsKeyId' - The ID number for the AWS KMS key used to encrypt the inference output.
--
-- 's3OutputConfiguration', 'inferenceOutputConfiguration_s3OutputConfiguration' - Specifies configuration information for the output results from for the
-- inference, output S3 location.
newInferenceOutputConfiguration ::
  -- | 's3OutputConfiguration'
  InferenceS3OutputConfiguration ->
  InferenceOutputConfiguration
newInferenceOutputConfiguration :: InferenceS3OutputConfiguration -> InferenceOutputConfiguration
newInferenceOutputConfiguration
  InferenceS3OutputConfiguration
pS3OutputConfiguration_ =
    InferenceOutputConfiguration' :: Maybe Text
-> InferenceS3OutputConfiguration -> InferenceOutputConfiguration
InferenceOutputConfiguration'
      { $sel:kmsKeyId:InferenceOutputConfiguration' :: Maybe Text
kmsKeyId =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:s3OutputConfiguration:InferenceOutputConfiguration' :: InferenceS3OutputConfiguration
s3OutputConfiguration =
          InferenceS3OutputConfiguration
pS3OutputConfiguration_
      }

-- | The ID number for the AWS KMS key used to encrypt the inference output.
inferenceOutputConfiguration_kmsKeyId :: Lens.Lens' InferenceOutputConfiguration (Prelude.Maybe Prelude.Text)
inferenceOutputConfiguration_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> InferenceOutputConfiguration -> f InferenceOutputConfiguration
inferenceOutputConfiguration_kmsKeyId = (InferenceOutputConfiguration -> Maybe Text)
-> (InferenceOutputConfiguration
    -> Maybe Text -> InferenceOutputConfiguration)
-> Lens
     InferenceOutputConfiguration
     InferenceOutputConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InferenceOutputConfiguration' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:InferenceOutputConfiguration' :: InferenceOutputConfiguration -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: InferenceOutputConfiguration
s@InferenceOutputConfiguration' {} Maybe Text
a -> InferenceOutputConfiguration
s {$sel:kmsKeyId:InferenceOutputConfiguration' :: Maybe Text
kmsKeyId = Maybe Text
a} :: InferenceOutputConfiguration)

-- | Specifies configuration information for the output results from for the
-- inference, output S3 location.
inferenceOutputConfiguration_s3OutputConfiguration :: Lens.Lens' InferenceOutputConfiguration InferenceS3OutputConfiguration
inferenceOutputConfiguration_s3OutputConfiguration :: (InferenceS3OutputConfiguration
 -> f InferenceS3OutputConfiguration)
-> InferenceOutputConfiguration -> f InferenceOutputConfiguration
inferenceOutputConfiguration_s3OutputConfiguration = (InferenceOutputConfiguration -> InferenceS3OutputConfiguration)
-> (InferenceOutputConfiguration
    -> InferenceS3OutputConfiguration -> InferenceOutputConfiguration)
-> Lens
     InferenceOutputConfiguration
     InferenceOutputConfiguration
     InferenceS3OutputConfiguration
     InferenceS3OutputConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InferenceOutputConfiguration' {InferenceS3OutputConfiguration
s3OutputConfiguration :: InferenceS3OutputConfiguration
$sel:s3OutputConfiguration:InferenceOutputConfiguration' :: InferenceOutputConfiguration -> InferenceS3OutputConfiguration
s3OutputConfiguration} -> InferenceS3OutputConfiguration
s3OutputConfiguration) (\s :: InferenceOutputConfiguration
s@InferenceOutputConfiguration' {} InferenceS3OutputConfiguration
a -> InferenceOutputConfiguration
s {$sel:s3OutputConfiguration:InferenceOutputConfiguration' :: InferenceS3OutputConfiguration
s3OutputConfiguration = InferenceS3OutputConfiguration
a} :: InferenceOutputConfiguration)

instance Core.FromJSON InferenceOutputConfiguration where
  parseJSON :: Value -> Parser InferenceOutputConfiguration
parseJSON =
    String
-> (Object -> Parser InferenceOutputConfiguration)
-> Value
-> Parser InferenceOutputConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InferenceOutputConfiguration"
      ( \Object
x ->
          Maybe Text
-> InferenceS3OutputConfiguration -> InferenceOutputConfiguration
InferenceOutputConfiguration'
            (Maybe Text
 -> InferenceS3OutputConfiguration -> InferenceOutputConfiguration)
-> Parser (Maybe Text)
-> Parser
     (InferenceS3OutputConfiguration -> InferenceOutputConfiguration)
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
  (InferenceS3OutputConfiguration -> InferenceOutputConfiguration)
-> Parser InferenceS3OutputConfiguration
-> Parser InferenceOutputConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser InferenceS3OutputConfiguration
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3OutputConfiguration")
      )

instance
  Prelude.Hashable
    InferenceOutputConfiguration

instance Prelude.NFData InferenceOutputConfiguration

instance Core.ToJSON InferenceOutputConfiguration where
  toJSON :: InferenceOutputConfiguration -> Value
toJSON InferenceOutputConfiguration' {Maybe Text
InferenceS3OutputConfiguration
s3OutputConfiguration :: InferenceS3OutputConfiguration
kmsKeyId :: Maybe Text
$sel:s3OutputConfiguration:InferenceOutputConfiguration' :: InferenceOutputConfiguration -> InferenceS3OutputConfiguration
$sel:kmsKeyId:InferenceOutputConfiguration' :: InferenceOutputConfiguration -> 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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"S3OutputConfiguration"
                  Text -> InferenceS3OutputConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= InferenceS3OutputConfiguration
s3OutputConfiguration
              )
          ]
      )