{-# 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.EMRServerless.Types.S3MonitoringConfiguration
-- 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.EMRServerless.Types.S3MonitoringConfiguration 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

-- | The Amazon S3 configuration for monitoring log publishing. You can
-- configure your jobs to send log information to Amazon S3.
--
-- /See:/ 'newS3MonitoringConfiguration' smart constructor.
data S3MonitoringConfiguration = S3MonitoringConfiguration'
  { -- | The KMS key ARN to encrypt the logs published to the given Amazon S3
    -- destination.
    S3MonitoringConfiguration -> Maybe Text
encryptionKeyArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 destination URI for log publishing.
    S3MonitoringConfiguration -> Maybe Text
logUri :: Prelude.Maybe Prelude.Text
  }
  deriving (S3MonitoringConfiguration -> S3MonitoringConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3MonitoringConfiguration -> S3MonitoringConfiguration -> Bool
$c/= :: S3MonitoringConfiguration -> S3MonitoringConfiguration -> Bool
== :: S3MonitoringConfiguration -> S3MonitoringConfiguration -> Bool
$c== :: S3MonitoringConfiguration -> S3MonitoringConfiguration -> Bool
Prelude.Eq, ReadPrec [S3MonitoringConfiguration]
ReadPrec S3MonitoringConfiguration
Int -> ReadS S3MonitoringConfiguration
ReadS [S3MonitoringConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3MonitoringConfiguration]
$creadListPrec :: ReadPrec [S3MonitoringConfiguration]
readPrec :: ReadPrec S3MonitoringConfiguration
$creadPrec :: ReadPrec S3MonitoringConfiguration
readList :: ReadS [S3MonitoringConfiguration]
$creadList :: ReadS [S3MonitoringConfiguration]
readsPrec :: Int -> ReadS S3MonitoringConfiguration
$creadsPrec :: Int -> ReadS S3MonitoringConfiguration
Prelude.Read, Int -> S3MonitoringConfiguration -> ShowS
[S3MonitoringConfiguration] -> ShowS
S3MonitoringConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3MonitoringConfiguration] -> ShowS
$cshowList :: [S3MonitoringConfiguration] -> ShowS
show :: S3MonitoringConfiguration -> String
$cshow :: S3MonitoringConfiguration -> String
showsPrec :: Int -> S3MonitoringConfiguration -> ShowS
$cshowsPrec :: Int -> S3MonitoringConfiguration -> ShowS
Prelude.Show, forall x.
Rep S3MonitoringConfiguration x -> S3MonitoringConfiguration
forall x.
S3MonitoringConfiguration -> Rep S3MonitoringConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep S3MonitoringConfiguration x -> S3MonitoringConfiguration
$cfrom :: forall x.
S3MonitoringConfiguration -> Rep S3MonitoringConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'S3MonitoringConfiguration' 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:
--
-- 'encryptionKeyArn', 's3MonitoringConfiguration_encryptionKeyArn' - The KMS key ARN to encrypt the logs published to the given Amazon S3
-- destination.
--
-- 'logUri', 's3MonitoringConfiguration_logUri' - The Amazon S3 destination URI for log publishing.
newS3MonitoringConfiguration ::
  S3MonitoringConfiguration
newS3MonitoringConfiguration :: S3MonitoringConfiguration
newS3MonitoringConfiguration =
  S3MonitoringConfiguration'
    { $sel:encryptionKeyArn:S3MonitoringConfiguration' :: Maybe Text
encryptionKeyArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:logUri:S3MonitoringConfiguration' :: Maybe Text
logUri = forall a. Maybe a
Prelude.Nothing
    }

-- | The KMS key ARN to encrypt the logs published to the given Amazon S3
-- destination.
s3MonitoringConfiguration_encryptionKeyArn :: Lens.Lens' S3MonitoringConfiguration (Prelude.Maybe Prelude.Text)
s3MonitoringConfiguration_encryptionKeyArn :: Lens' S3MonitoringConfiguration (Maybe Text)
s3MonitoringConfiguration_encryptionKeyArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3MonitoringConfiguration' {Maybe Text
encryptionKeyArn :: Maybe Text
$sel:encryptionKeyArn:S3MonitoringConfiguration' :: S3MonitoringConfiguration -> Maybe Text
encryptionKeyArn} -> Maybe Text
encryptionKeyArn) (\s :: S3MonitoringConfiguration
s@S3MonitoringConfiguration' {} Maybe Text
a -> S3MonitoringConfiguration
s {$sel:encryptionKeyArn:S3MonitoringConfiguration' :: Maybe Text
encryptionKeyArn = Maybe Text
a} :: S3MonitoringConfiguration)

-- | The Amazon S3 destination URI for log publishing.
s3MonitoringConfiguration_logUri :: Lens.Lens' S3MonitoringConfiguration (Prelude.Maybe Prelude.Text)
s3MonitoringConfiguration_logUri :: Lens' S3MonitoringConfiguration (Maybe Text)
s3MonitoringConfiguration_logUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3MonitoringConfiguration' {Maybe Text
logUri :: Maybe Text
$sel:logUri:S3MonitoringConfiguration' :: S3MonitoringConfiguration -> Maybe Text
logUri} -> Maybe Text
logUri) (\s :: S3MonitoringConfiguration
s@S3MonitoringConfiguration' {} Maybe Text
a -> S3MonitoringConfiguration
s {$sel:logUri:S3MonitoringConfiguration' :: Maybe Text
logUri = Maybe Text
a} :: S3MonitoringConfiguration)

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

instance Prelude.Hashable S3MonitoringConfiguration where
  hashWithSalt :: Int -> S3MonitoringConfiguration -> Int
hashWithSalt Int
_salt S3MonitoringConfiguration' {Maybe Text
logUri :: Maybe Text
encryptionKeyArn :: Maybe Text
$sel:logUri:S3MonitoringConfiguration' :: S3MonitoringConfiguration -> Maybe Text
$sel:encryptionKeyArn:S3MonitoringConfiguration' :: S3MonitoringConfiguration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
encryptionKeyArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
logUri

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

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