{-# 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.ExperimentTemplateS3LogConfigurationInput
-- 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.ExperimentTemplateS3LogConfigurationInput 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

-- | Specifies the configuration for experiment logging to Amazon S3.
--
-- /See:/ 'newExperimentTemplateS3LogConfigurationInput' smart constructor.
data ExperimentTemplateS3LogConfigurationInput = ExperimentTemplateS3LogConfigurationInput'
  { -- | The bucket prefix.
    ExperimentTemplateS3LogConfigurationInput -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text,
    -- | The name of the destination bucket.
    ExperimentTemplateS3LogConfigurationInput -> Text
bucketName :: Prelude.Text
  }
  deriving (ExperimentTemplateS3LogConfigurationInput
-> ExperimentTemplateS3LogConfigurationInput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExperimentTemplateS3LogConfigurationInput
-> ExperimentTemplateS3LogConfigurationInput -> Bool
$c/= :: ExperimentTemplateS3LogConfigurationInput
-> ExperimentTemplateS3LogConfigurationInput -> Bool
== :: ExperimentTemplateS3LogConfigurationInput
-> ExperimentTemplateS3LogConfigurationInput -> Bool
$c== :: ExperimentTemplateS3LogConfigurationInput
-> ExperimentTemplateS3LogConfigurationInput -> Bool
Prelude.Eq, ReadPrec [ExperimentTemplateS3LogConfigurationInput]
ReadPrec ExperimentTemplateS3LogConfigurationInput
Int -> ReadS ExperimentTemplateS3LogConfigurationInput
ReadS [ExperimentTemplateS3LogConfigurationInput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExperimentTemplateS3LogConfigurationInput]
$creadListPrec :: ReadPrec [ExperimentTemplateS3LogConfigurationInput]
readPrec :: ReadPrec ExperimentTemplateS3LogConfigurationInput
$creadPrec :: ReadPrec ExperimentTemplateS3LogConfigurationInput
readList :: ReadS [ExperimentTemplateS3LogConfigurationInput]
$creadList :: ReadS [ExperimentTemplateS3LogConfigurationInput]
readsPrec :: Int -> ReadS ExperimentTemplateS3LogConfigurationInput
$creadsPrec :: Int -> ReadS ExperimentTemplateS3LogConfigurationInput
Prelude.Read, Int -> ExperimentTemplateS3LogConfigurationInput -> ShowS
[ExperimentTemplateS3LogConfigurationInput] -> ShowS
ExperimentTemplateS3LogConfigurationInput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExperimentTemplateS3LogConfigurationInput] -> ShowS
$cshowList :: [ExperimentTemplateS3LogConfigurationInput] -> ShowS
show :: ExperimentTemplateS3LogConfigurationInput -> String
$cshow :: ExperimentTemplateS3LogConfigurationInput -> String
showsPrec :: Int -> ExperimentTemplateS3LogConfigurationInput -> ShowS
$cshowsPrec :: Int -> ExperimentTemplateS3LogConfigurationInput -> ShowS
Prelude.Show, forall x.
Rep ExperimentTemplateS3LogConfigurationInput x
-> ExperimentTemplateS3LogConfigurationInput
forall x.
ExperimentTemplateS3LogConfigurationInput
-> Rep ExperimentTemplateS3LogConfigurationInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExperimentTemplateS3LogConfigurationInput x
-> ExperimentTemplateS3LogConfigurationInput
$cfrom :: forall x.
ExperimentTemplateS3LogConfigurationInput
-> Rep ExperimentTemplateS3LogConfigurationInput x
Prelude.Generic)

-- |
-- Create a value of 'ExperimentTemplateS3LogConfigurationInput' 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:
--
-- 'prefix', 'experimentTemplateS3LogConfigurationInput_prefix' - The bucket prefix.
--
-- 'bucketName', 'experimentTemplateS3LogConfigurationInput_bucketName' - The name of the destination bucket.
newExperimentTemplateS3LogConfigurationInput ::
  -- | 'bucketName'
  Prelude.Text ->
  ExperimentTemplateS3LogConfigurationInput
newExperimentTemplateS3LogConfigurationInput :: Text -> ExperimentTemplateS3LogConfigurationInput
newExperimentTemplateS3LogConfigurationInput
  Text
pBucketName_ =
    ExperimentTemplateS3LogConfigurationInput'
      { $sel:prefix:ExperimentTemplateS3LogConfigurationInput' :: Maybe Text
prefix =
          forall a. Maybe a
Prelude.Nothing,
        $sel:bucketName:ExperimentTemplateS3LogConfigurationInput' :: Text
bucketName = Text
pBucketName_
      }

-- | The bucket prefix.
experimentTemplateS3LogConfigurationInput_prefix :: Lens.Lens' ExperimentTemplateS3LogConfigurationInput (Prelude.Maybe Prelude.Text)
experimentTemplateS3LogConfigurationInput_prefix :: Lens' ExperimentTemplateS3LogConfigurationInput (Maybe Text)
experimentTemplateS3LogConfigurationInput_prefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentTemplateS3LogConfigurationInput' {Maybe Text
prefix :: Maybe Text
$sel:prefix:ExperimentTemplateS3LogConfigurationInput' :: ExperimentTemplateS3LogConfigurationInput -> Maybe Text
prefix} -> Maybe Text
prefix) (\s :: ExperimentTemplateS3LogConfigurationInput
s@ExperimentTemplateS3LogConfigurationInput' {} Maybe Text
a -> ExperimentTemplateS3LogConfigurationInput
s {$sel:prefix:ExperimentTemplateS3LogConfigurationInput' :: Maybe Text
prefix = Maybe Text
a} :: ExperimentTemplateS3LogConfigurationInput)

-- | The name of the destination bucket.
experimentTemplateS3LogConfigurationInput_bucketName :: Lens.Lens' ExperimentTemplateS3LogConfigurationInput Prelude.Text
experimentTemplateS3LogConfigurationInput_bucketName :: Lens' ExperimentTemplateS3LogConfigurationInput Text
experimentTemplateS3LogConfigurationInput_bucketName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentTemplateS3LogConfigurationInput' {Text
bucketName :: Text
$sel:bucketName:ExperimentTemplateS3LogConfigurationInput' :: ExperimentTemplateS3LogConfigurationInput -> Text
bucketName} -> Text
bucketName) (\s :: ExperimentTemplateS3LogConfigurationInput
s@ExperimentTemplateS3LogConfigurationInput' {} Text
a -> ExperimentTemplateS3LogConfigurationInput
s {$sel:bucketName:ExperimentTemplateS3LogConfigurationInput' :: Text
bucketName = Text
a} :: ExperimentTemplateS3LogConfigurationInput)

instance
  Prelude.Hashable
    ExperimentTemplateS3LogConfigurationInput
  where
  hashWithSalt :: Int -> ExperimentTemplateS3LogConfigurationInput -> Int
hashWithSalt
    Int
_salt
    ExperimentTemplateS3LogConfigurationInput' {Maybe Text
Text
bucketName :: Text
prefix :: Maybe Text
$sel:bucketName:ExperimentTemplateS3LogConfigurationInput' :: ExperimentTemplateS3LogConfigurationInput -> Text
$sel:prefix:ExperimentTemplateS3LogConfigurationInput' :: ExperimentTemplateS3LogConfigurationInput -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
prefix
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bucketName

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

instance
  Data.ToJSON
    ExperimentTemplateS3LogConfigurationInput
  where
  toJSON :: ExperimentTemplateS3LogConfigurationInput -> Value
toJSON ExperimentTemplateS3LogConfigurationInput' {Maybe Text
Text
bucketName :: Text
prefix :: Maybe Text
$sel:bucketName:ExperimentTemplateS3LogConfigurationInput' :: ExperimentTemplateS3LogConfigurationInput -> Text
$sel:prefix:ExperimentTemplateS3LogConfigurationInput' :: ExperimentTemplateS3LogConfigurationInput -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"prefix" 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
prefix,
            forall a. a -> Maybe a
Prelude.Just (Key
"bucketName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
bucketName)
          ]
      )