{-# 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.ProjectDataDelivery
-- 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.ProjectDataDelivery 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.CloudWatchLogsDestination
import Amazonka.Evidently.Types.S3Destination
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'ProjectDataDelivery' 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', 'projectDataDelivery_cloudWatchLogs' - If the project stores evaluation events in CloudWatch Logs, this
-- structure stores the log group name.
--
-- 's3Destination', 'projectDataDelivery_s3Destination' - If the project stores evaluation events in an Amazon S3 bucket, this
-- structure stores the bucket name and bucket prefix.
newProjectDataDelivery ::
  ProjectDataDelivery
newProjectDataDelivery :: ProjectDataDelivery
newProjectDataDelivery =
  ProjectDataDelivery'
    { $sel:cloudWatchLogs:ProjectDataDelivery' :: Maybe CloudWatchLogsDestination
cloudWatchLogs =
        forall a. Maybe a
Prelude.Nothing,
      $sel:s3Destination:ProjectDataDelivery' :: Maybe S3Destination
s3Destination = forall a. Maybe a
Prelude.Nothing
    }

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

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

instance Data.FromJSON ProjectDataDelivery where
  parseJSON :: Value -> Parser ProjectDataDelivery
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProjectDataDelivery"
      ( \Object
x ->
          Maybe CloudWatchLogsDestination
-> Maybe S3Destination -> ProjectDataDelivery
ProjectDataDelivery'
            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
"cloudWatchLogs")
            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
"s3Destination")
      )

instance Prelude.Hashable ProjectDataDelivery where
  hashWithSalt :: Int -> ProjectDataDelivery -> Int
hashWithSalt Int
_salt ProjectDataDelivery' {Maybe CloudWatchLogsDestination
Maybe S3Destination
s3Destination :: Maybe S3Destination
cloudWatchLogs :: Maybe CloudWatchLogsDestination
$sel:s3Destination:ProjectDataDelivery' :: ProjectDataDelivery -> Maybe S3Destination
$sel:cloudWatchLogs:ProjectDataDelivery' :: ProjectDataDelivery -> Maybe CloudWatchLogsDestination
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CloudWatchLogsDestination
cloudWatchLogs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3Destination
s3Destination

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