{-# 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.Evidently.Types.ProjectDataDeliveryConfig
-- 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.Evidently.Types.ProjectDataDeliveryConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Evidently.Types.CloudWatchLogsDestinationConfig
import Amazonka.Evidently.Types.S3DestinationConfig
import qualified Amazonka.Prelude as Prelude

-- | A structure that contains information about where Evidently is to store
-- evaluation events for longer term storage.
--
-- /See:/ 'newProjectDataDeliveryConfig' smart constructor.
data ProjectDataDeliveryConfig = ProjectDataDeliveryConfig'
  { -- | If the project stores evaluation events in CloudWatch Logs, this
    -- structure stores the log group name.
    ProjectDataDeliveryConfig -> Maybe CloudWatchLogsDestinationConfig
cloudWatchLogs :: Prelude.Maybe CloudWatchLogsDestinationConfig,
    -- | If the project stores evaluation events in an Amazon S3 bucket, this
    -- structure stores the bucket name and bucket prefix.
    ProjectDataDeliveryConfig -> Maybe S3DestinationConfig
s3Destination :: Prelude.Maybe S3DestinationConfig
  }
  deriving (ProjectDataDeliveryConfig -> ProjectDataDeliveryConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProjectDataDeliveryConfig -> ProjectDataDeliveryConfig -> Bool
$c/= :: ProjectDataDeliveryConfig -> ProjectDataDeliveryConfig -> Bool
== :: ProjectDataDeliveryConfig -> ProjectDataDeliveryConfig -> Bool
$c== :: ProjectDataDeliveryConfig -> ProjectDataDeliveryConfig -> Bool
Prelude.Eq, ReadPrec [ProjectDataDeliveryConfig]
ReadPrec ProjectDataDeliveryConfig
Int -> ReadS ProjectDataDeliveryConfig
ReadS [ProjectDataDeliveryConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProjectDataDeliveryConfig]
$creadListPrec :: ReadPrec [ProjectDataDeliveryConfig]
readPrec :: ReadPrec ProjectDataDeliveryConfig
$creadPrec :: ReadPrec ProjectDataDeliveryConfig
readList :: ReadS [ProjectDataDeliveryConfig]
$creadList :: ReadS [ProjectDataDeliveryConfig]
readsPrec :: Int -> ReadS ProjectDataDeliveryConfig
$creadsPrec :: Int -> ReadS ProjectDataDeliveryConfig
Prelude.Read, Int -> ProjectDataDeliveryConfig -> ShowS
[ProjectDataDeliveryConfig] -> ShowS
ProjectDataDeliveryConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProjectDataDeliveryConfig] -> ShowS
$cshowList :: [ProjectDataDeliveryConfig] -> ShowS
show :: ProjectDataDeliveryConfig -> String
$cshow :: ProjectDataDeliveryConfig -> String
showsPrec :: Int -> ProjectDataDeliveryConfig -> ShowS
$cshowsPrec :: Int -> ProjectDataDeliveryConfig -> ShowS
Prelude.Show, forall x.
Rep ProjectDataDeliveryConfig x -> ProjectDataDeliveryConfig
forall x.
ProjectDataDeliveryConfig -> Rep ProjectDataDeliveryConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProjectDataDeliveryConfig x -> ProjectDataDeliveryConfig
$cfrom :: forall x.
ProjectDataDeliveryConfig -> Rep ProjectDataDeliveryConfig x
Prelude.Generic)

-- |
-- Create a value of 'ProjectDataDeliveryConfig' 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:
--
-- 'cloudWatchLogs', 'projectDataDeliveryConfig_cloudWatchLogs' - If the project stores evaluation events in CloudWatch Logs, this
-- structure stores the log group name.
--
-- 's3Destination', 'projectDataDeliveryConfig_s3Destination' - If the project stores evaluation events in an Amazon S3 bucket, this
-- structure stores the bucket name and bucket prefix.
newProjectDataDeliveryConfig ::
  ProjectDataDeliveryConfig
newProjectDataDeliveryConfig :: ProjectDataDeliveryConfig
newProjectDataDeliveryConfig =
  ProjectDataDeliveryConfig'
    { $sel:cloudWatchLogs:ProjectDataDeliveryConfig' :: Maybe CloudWatchLogsDestinationConfig
cloudWatchLogs =
        forall a. Maybe a
Prelude.Nothing,
      $sel:s3Destination:ProjectDataDeliveryConfig' :: Maybe S3DestinationConfig
s3Destination = forall a. Maybe a
Prelude.Nothing
    }

-- | If the project stores evaluation events in CloudWatch Logs, this
-- structure stores the log group name.
projectDataDeliveryConfig_cloudWatchLogs :: Lens.Lens' ProjectDataDeliveryConfig (Prelude.Maybe CloudWatchLogsDestinationConfig)
projectDataDeliveryConfig_cloudWatchLogs :: Lens'
  ProjectDataDeliveryConfig (Maybe CloudWatchLogsDestinationConfig)
projectDataDeliveryConfig_cloudWatchLogs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectDataDeliveryConfig' {Maybe CloudWatchLogsDestinationConfig
cloudWatchLogs :: Maybe CloudWatchLogsDestinationConfig
$sel:cloudWatchLogs:ProjectDataDeliveryConfig' :: ProjectDataDeliveryConfig -> Maybe CloudWatchLogsDestinationConfig
cloudWatchLogs} -> Maybe CloudWatchLogsDestinationConfig
cloudWatchLogs) (\s :: ProjectDataDeliveryConfig
s@ProjectDataDeliveryConfig' {} Maybe CloudWatchLogsDestinationConfig
a -> ProjectDataDeliveryConfig
s {$sel:cloudWatchLogs:ProjectDataDeliveryConfig' :: Maybe CloudWatchLogsDestinationConfig
cloudWatchLogs = Maybe CloudWatchLogsDestinationConfig
a} :: ProjectDataDeliveryConfig)

-- | If the project stores evaluation events in an Amazon S3 bucket, this
-- structure stores the bucket name and bucket prefix.
projectDataDeliveryConfig_s3Destination :: Lens.Lens' ProjectDataDeliveryConfig (Prelude.Maybe S3DestinationConfig)
projectDataDeliveryConfig_s3Destination :: Lens' ProjectDataDeliveryConfig (Maybe S3DestinationConfig)
projectDataDeliveryConfig_s3Destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectDataDeliveryConfig' {Maybe S3DestinationConfig
s3Destination :: Maybe S3DestinationConfig
$sel:s3Destination:ProjectDataDeliveryConfig' :: ProjectDataDeliveryConfig -> Maybe S3DestinationConfig
s3Destination} -> Maybe S3DestinationConfig
s3Destination) (\s :: ProjectDataDeliveryConfig
s@ProjectDataDeliveryConfig' {} Maybe S3DestinationConfig
a -> ProjectDataDeliveryConfig
s {$sel:s3Destination:ProjectDataDeliveryConfig' :: Maybe S3DestinationConfig
s3Destination = Maybe S3DestinationConfig
a} :: ProjectDataDeliveryConfig)

instance Prelude.Hashable ProjectDataDeliveryConfig where
  hashWithSalt :: Int -> ProjectDataDeliveryConfig -> Int
hashWithSalt Int
_salt ProjectDataDeliveryConfig' {Maybe CloudWatchLogsDestinationConfig
Maybe S3DestinationConfig
s3Destination :: Maybe S3DestinationConfig
cloudWatchLogs :: Maybe CloudWatchLogsDestinationConfig
$sel:s3Destination:ProjectDataDeliveryConfig' :: ProjectDataDeliveryConfig -> Maybe S3DestinationConfig
$sel:cloudWatchLogs:ProjectDataDeliveryConfig' :: ProjectDataDeliveryConfig -> Maybe CloudWatchLogsDestinationConfig
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CloudWatchLogsDestinationConfig
cloudWatchLogs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3DestinationConfig
s3Destination

instance Prelude.NFData ProjectDataDeliveryConfig where
  rnf :: ProjectDataDeliveryConfig -> ()
rnf ProjectDataDeliveryConfig' {Maybe CloudWatchLogsDestinationConfig
Maybe S3DestinationConfig
s3Destination :: Maybe S3DestinationConfig
cloudWatchLogs :: Maybe CloudWatchLogsDestinationConfig
$sel:s3Destination:ProjectDataDeliveryConfig' :: ProjectDataDeliveryConfig -> Maybe S3DestinationConfig
$sel:cloudWatchLogs:ProjectDataDeliveryConfig' :: ProjectDataDeliveryConfig -> Maybe CloudWatchLogsDestinationConfig
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CloudWatchLogsDestinationConfig
cloudWatchLogs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3DestinationConfig
s3Destination

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