{-# 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.FIS.Types.ExperimentLogConfiguration
-- 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.FIS.Types.ExperimentLogConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FIS.Types.ExperimentCloudWatchLogsLogConfiguration
import Amazonka.FIS.Types.ExperimentS3LogConfiguration
import qualified Amazonka.Prelude as Prelude

-- | Describes the configuration for experiment logging.
--
-- /See:/ 'newExperimentLogConfiguration' smart constructor.
data ExperimentLogConfiguration = ExperimentLogConfiguration'
  { -- | The configuration for experiment logging to Amazon CloudWatch Logs.
    ExperimentLogConfiguration
-> Maybe ExperimentCloudWatchLogsLogConfiguration
cloudWatchLogsConfiguration :: Prelude.Maybe ExperimentCloudWatchLogsLogConfiguration,
    -- | The schema version.
    ExperimentLogConfiguration -> Maybe Int
logSchemaVersion :: Prelude.Maybe Prelude.Int,
    -- | The configuration for experiment logging to Amazon S3.
    ExperimentLogConfiguration -> Maybe ExperimentS3LogConfiguration
s3Configuration :: Prelude.Maybe ExperimentS3LogConfiguration
  }
  deriving (ExperimentLogConfiguration -> ExperimentLogConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExperimentLogConfiguration -> ExperimentLogConfiguration -> Bool
$c/= :: ExperimentLogConfiguration -> ExperimentLogConfiguration -> Bool
== :: ExperimentLogConfiguration -> ExperimentLogConfiguration -> Bool
$c== :: ExperimentLogConfiguration -> ExperimentLogConfiguration -> Bool
Prelude.Eq, ReadPrec [ExperimentLogConfiguration]
ReadPrec ExperimentLogConfiguration
Int -> ReadS ExperimentLogConfiguration
ReadS [ExperimentLogConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExperimentLogConfiguration]
$creadListPrec :: ReadPrec [ExperimentLogConfiguration]
readPrec :: ReadPrec ExperimentLogConfiguration
$creadPrec :: ReadPrec ExperimentLogConfiguration
readList :: ReadS [ExperimentLogConfiguration]
$creadList :: ReadS [ExperimentLogConfiguration]
readsPrec :: Int -> ReadS ExperimentLogConfiguration
$creadsPrec :: Int -> ReadS ExperimentLogConfiguration
Prelude.Read, Int -> ExperimentLogConfiguration -> ShowS
[ExperimentLogConfiguration] -> ShowS
ExperimentLogConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExperimentLogConfiguration] -> ShowS
$cshowList :: [ExperimentLogConfiguration] -> ShowS
show :: ExperimentLogConfiguration -> String
$cshow :: ExperimentLogConfiguration -> String
showsPrec :: Int -> ExperimentLogConfiguration -> ShowS
$cshowsPrec :: Int -> ExperimentLogConfiguration -> ShowS
Prelude.Show, forall x.
Rep ExperimentLogConfiguration x -> ExperimentLogConfiguration
forall x.
ExperimentLogConfiguration -> Rep ExperimentLogConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExperimentLogConfiguration x -> ExperimentLogConfiguration
$cfrom :: forall x.
ExperimentLogConfiguration -> Rep ExperimentLogConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ExperimentLogConfiguration' 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:
--
-- 'cloudWatchLogsConfiguration', 'experimentLogConfiguration_cloudWatchLogsConfiguration' - The configuration for experiment logging to Amazon CloudWatch Logs.
--
-- 'logSchemaVersion', 'experimentLogConfiguration_logSchemaVersion' - The schema version.
--
-- 's3Configuration', 'experimentLogConfiguration_s3Configuration' - The configuration for experiment logging to Amazon S3.
newExperimentLogConfiguration ::
  ExperimentLogConfiguration
newExperimentLogConfiguration :: ExperimentLogConfiguration
newExperimentLogConfiguration =
  ExperimentLogConfiguration'
    { $sel:cloudWatchLogsConfiguration:ExperimentLogConfiguration' :: Maybe ExperimentCloudWatchLogsLogConfiguration
cloudWatchLogsConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:logSchemaVersion:ExperimentLogConfiguration' :: Maybe Int
logSchemaVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Configuration:ExperimentLogConfiguration' :: Maybe ExperimentS3LogConfiguration
s3Configuration = forall a. Maybe a
Prelude.Nothing
    }

-- | The configuration for experiment logging to Amazon CloudWatch Logs.
experimentLogConfiguration_cloudWatchLogsConfiguration :: Lens.Lens' ExperimentLogConfiguration (Prelude.Maybe ExperimentCloudWatchLogsLogConfiguration)
experimentLogConfiguration_cloudWatchLogsConfiguration :: Lens'
  ExperimentLogConfiguration
  (Maybe ExperimentCloudWatchLogsLogConfiguration)
experimentLogConfiguration_cloudWatchLogsConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentLogConfiguration' {Maybe ExperimentCloudWatchLogsLogConfiguration
cloudWatchLogsConfiguration :: Maybe ExperimentCloudWatchLogsLogConfiguration
$sel:cloudWatchLogsConfiguration:ExperimentLogConfiguration' :: ExperimentLogConfiguration
-> Maybe ExperimentCloudWatchLogsLogConfiguration
cloudWatchLogsConfiguration} -> Maybe ExperimentCloudWatchLogsLogConfiguration
cloudWatchLogsConfiguration) (\s :: ExperimentLogConfiguration
s@ExperimentLogConfiguration' {} Maybe ExperimentCloudWatchLogsLogConfiguration
a -> ExperimentLogConfiguration
s {$sel:cloudWatchLogsConfiguration:ExperimentLogConfiguration' :: Maybe ExperimentCloudWatchLogsLogConfiguration
cloudWatchLogsConfiguration = Maybe ExperimentCloudWatchLogsLogConfiguration
a} :: ExperimentLogConfiguration)

-- | The schema version.
experimentLogConfiguration_logSchemaVersion :: Lens.Lens' ExperimentLogConfiguration (Prelude.Maybe Prelude.Int)
experimentLogConfiguration_logSchemaVersion :: Lens' ExperimentLogConfiguration (Maybe Int)
experimentLogConfiguration_logSchemaVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentLogConfiguration' {Maybe Int
logSchemaVersion :: Maybe Int
$sel:logSchemaVersion:ExperimentLogConfiguration' :: ExperimentLogConfiguration -> Maybe Int
logSchemaVersion} -> Maybe Int
logSchemaVersion) (\s :: ExperimentLogConfiguration
s@ExperimentLogConfiguration' {} Maybe Int
a -> ExperimentLogConfiguration
s {$sel:logSchemaVersion:ExperimentLogConfiguration' :: Maybe Int
logSchemaVersion = Maybe Int
a} :: ExperimentLogConfiguration)

-- | The configuration for experiment logging to Amazon S3.
experimentLogConfiguration_s3Configuration :: Lens.Lens' ExperimentLogConfiguration (Prelude.Maybe ExperimentS3LogConfiguration)
experimentLogConfiguration_s3Configuration :: Lens'
  ExperimentLogConfiguration (Maybe ExperimentS3LogConfiguration)
experimentLogConfiguration_s3Configuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentLogConfiguration' {Maybe ExperimentS3LogConfiguration
s3Configuration :: Maybe ExperimentS3LogConfiguration
$sel:s3Configuration:ExperimentLogConfiguration' :: ExperimentLogConfiguration -> Maybe ExperimentS3LogConfiguration
s3Configuration} -> Maybe ExperimentS3LogConfiguration
s3Configuration) (\s :: ExperimentLogConfiguration
s@ExperimentLogConfiguration' {} Maybe ExperimentS3LogConfiguration
a -> ExperimentLogConfiguration
s {$sel:s3Configuration:ExperimentLogConfiguration' :: Maybe ExperimentS3LogConfiguration
s3Configuration = Maybe ExperimentS3LogConfiguration
a} :: ExperimentLogConfiguration)

instance Data.FromJSON ExperimentLogConfiguration where
  parseJSON :: Value -> Parser ExperimentLogConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ExperimentLogConfiguration"
      ( \Object
x ->
          Maybe ExperimentCloudWatchLogsLogConfiguration
-> Maybe Int
-> Maybe ExperimentS3LogConfiguration
-> ExperimentLogConfiguration
ExperimentLogConfiguration'
            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
"cloudWatchLogsConfiguration")
            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
"logSchemaVersion")
            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
"s3Configuration")
      )

instance Prelude.Hashable ExperimentLogConfiguration where
  hashWithSalt :: Int -> ExperimentLogConfiguration -> Int
hashWithSalt Int
_salt ExperimentLogConfiguration' {Maybe Int
Maybe ExperimentCloudWatchLogsLogConfiguration
Maybe ExperimentS3LogConfiguration
s3Configuration :: Maybe ExperimentS3LogConfiguration
logSchemaVersion :: Maybe Int
cloudWatchLogsConfiguration :: Maybe ExperimentCloudWatchLogsLogConfiguration
$sel:s3Configuration:ExperimentLogConfiguration' :: ExperimentLogConfiguration -> Maybe ExperimentS3LogConfiguration
$sel:logSchemaVersion:ExperimentLogConfiguration' :: ExperimentLogConfiguration -> Maybe Int
$sel:cloudWatchLogsConfiguration:ExperimentLogConfiguration' :: ExperimentLogConfiguration
-> Maybe ExperimentCloudWatchLogsLogConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExperimentCloudWatchLogsLogConfiguration
cloudWatchLogsConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
logSchemaVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExperimentS3LogConfiguration
s3Configuration

instance Prelude.NFData ExperimentLogConfiguration where
  rnf :: ExperimentLogConfiguration -> ()
rnf ExperimentLogConfiguration' {Maybe Int
Maybe ExperimentCloudWatchLogsLogConfiguration
Maybe ExperimentS3LogConfiguration
s3Configuration :: Maybe ExperimentS3LogConfiguration
logSchemaVersion :: Maybe Int
cloudWatchLogsConfiguration :: Maybe ExperimentCloudWatchLogsLogConfiguration
$sel:s3Configuration:ExperimentLogConfiguration' :: ExperimentLogConfiguration -> Maybe ExperimentS3LogConfiguration
$sel:logSchemaVersion:ExperimentLogConfiguration' :: ExperimentLogConfiguration -> Maybe Int
$sel:cloudWatchLogsConfiguration:ExperimentLogConfiguration' :: ExperimentLogConfiguration
-> Maybe ExperimentCloudWatchLogsLogConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ExperimentCloudWatchLogsLogConfiguration
cloudWatchLogsConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
logSchemaVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExperimentS3LogConfiguration
s3Configuration