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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | 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'
  { -- | Amazon S3 destination URI for log publishing.
    S3MonitoringConfiguration -> Text
logUri :: Prelude.Text
  }
  deriving (S3MonitoringConfiguration -> S3MonitoringConfiguration -> Bool
(S3MonitoringConfiguration -> S3MonitoringConfiguration -> Bool)
-> (S3MonitoringConfiguration -> S3MonitoringConfiguration -> Bool)
-> Eq S3MonitoringConfiguration
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]
(Int -> ReadS S3MonitoringConfiguration)
-> ReadS [S3MonitoringConfiguration]
-> ReadPrec S3MonitoringConfiguration
-> ReadPrec [S3MonitoringConfiguration]
-> Read 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
(Int -> S3MonitoringConfiguration -> ShowS)
-> (S3MonitoringConfiguration -> String)
-> ([S3MonitoringConfiguration] -> ShowS)
-> Show S3MonitoringConfiguration
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.
 S3MonitoringConfiguration -> Rep S3MonitoringConfiguration x)
-> (forall x.
    Rep S3MonitoringConfiguration x -> S3MonitoringConfiguration)
-> Generic S3MonitoringConfiguration
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:
--
-- 'logUri', 's3MonitoringConfiguration_logUri' - Amazon S3 destination URI for log publishing.
newS3MonitoringConfiguration ::
  -- | 'logUri'
  Prelude.Text ->
  S3MonitoringConfiguration
newS3MonitoringConfiguration :: Text -> S3MonitoringConfiguration
newS3MonitoringConfiguration Text
pLogUri_ =
  S3MonitoringConfiguration' :: Text -> S3MonitoringConfiguration
S3MonitoringConfiguration' {$sel:logUri:S3MonitoringConfiguration' :: Text
logUri = Text
pLogUri_}

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

instance Core.FromJSON S3MonitoringConfiguration where
  parseJSON :: Value -> Parser S3MonitoringConfiguration
parseJSON =
    String
-> (Object -> Parser S3MonitoringConfiguration)
-> Value
-> Parser S3MonitoringConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"S3MonitoringConfiguration"
      ( \Object
x ->
          Text -> S3MonitoringConfiguration
S3MonitoringConfiguration'
            (Text -> S3MonitoringConfiguration)
-> Parser Text -> Parser S3MonitoringConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"logUri")
      )

instance Prelude.Hashable S3MonitoringConfiguration

instance Prelude.NFData S3MonitoringConfiguration

instance Core.ToJSON S3MonitoringConfiguration where
  toJSON :: S3MonitoringConfiguration -> Value
toJSON S3MonitoringConfiguration' {Text
logUri :: Text
$sel:logUri:S3MonitoringConfiguration' :: S3MonitoringConfiguration -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"logUri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
logUri)]
      )