{-# 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.SecurityHub.Types.AwsCodeBuildProjectLogsConfigDetails
-- 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.SecurityHub.Types.AwsCodeBuildProjectLogsConfigDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
import Amazonka.SecurityHub.Types.AwsCodeBuildProjectLogsConfigS3LogsDetails

-- | Information about logs for the build project.
--
-- /See:/ 'newAwsCodeBuildProjectLogsConfigDetails' smart constructor.
data AwsCodeBuildProjectLogsConfigDetails = AwsCodeBuildProjectLogsConfigDetails'
  { -- | Information about logs built to an S3 bucket for a build project.
    AwsCodeBuildProjectLogsConfigDetails
-> Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
s3Logs :: Prelude.Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails,
    -- | Information about CloudWatch Logs for the build project.
    AwsCodeBuildProjectLogsConfigDetails
-> Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
cloudWatchLogs :: Prelude.Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
  }
  deriving (AwsCodeBuildProjectLogsConfigDetails
-> AwsCodeBuildProjectLogsConfigDetails -> Bool
(AwsCodeBuildProjectLogsConfigDetails
 -> AwsCodeBuildProjectLogsConfigDetails -> Bool)
-> (AwsCodeBuildProjectLogsConfigDetails
    -> AwsCodeBuildProjectLogsConfigDetails -> Bool)
-> Eq AwsCodeBuildProjectLogsConfigDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsCodeBuildProjectLogsConfigDetails
-> AwsCodeBuildProjectLogsConfigDetails -> Bool
$c/= :: AwsCodeBuildProjectLogsConfigDetails
-> AwsCodeBuildProjectLogsConfigDetails -> Bool
== :: AwsCodeBuildProjectLogsConfigDetails
-> AwsCodeBuildProjectLogsConfigDetails -> Bool
$c== :: AwsCodeBuildProjectLogsConfigDetails
-> AwsCodeBuildProjectLogsConfigDetails -> Bool
Prelude.Eq, ReadPrec [AwsCodeBuildProjectLogsConfigDetails]
ReadPrec AwsCodeBuildProjectLogsConfigDetails
Int -> ReadS AwsCodeBuildProjectLogsConfigDetails
ReadS [AwsCodeBuildProjectLogsConfigDetails]
(Int -> ReadS AwsCodeBuildProjectLogsConfigDetails)
-> ReadS [AwsCodeBuildProjectLogsConfigDetails]
-> ReadPrec AwsCodeBuildProjectLogsConfigDetails
-> ReadPrec [AwsCodeBuildProjectLogsConfigDetails]
-> Read AwsCodeBuildProjectLogsConfigDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsCodeBuildProjectLogsConfigDetails]
$creadListPrec :: ReadPrec [AwsCodeBuildProjectLogsConfigDetails]
readPrec :: ReadPrec AwsCodeBuildProjectLogsConfigDetails
$creadPrec :: ReadPrec AwsCodeBuildProjectLogsConfigDetails
readList :: ReadS [AwsCodeBuildProjectLogsConfigDetails]
$creadList :: ReadS [AwsCodeBuildProjectLogsConfigDetails]
readsPrec :: Int -> ReadS AwsCodeBuildProjectLogsConfigDetails
$creadsPrec :: Int -> ReadS AwsCodeBuildProjectLogsConfigDetails
Prelude.Read, Int -> AwsCodeBuildProjectLogsConfigDetails -> ShowS
[AwsCodeBuildProjectLogsConfigDetails] -> ShowS
AwsCodeBuildProjectLogsConfigDetails -> String
(Int -> AwsCodeBuildProjectLogsConfigDetails -> ShowS)
-> (AwsCodeBuildProjectLogsConfigDetails -> String)
-> ([AwsCodeBuildProjectLogsConfigDetails] -> ShowS)
-> Show AwsCodeBuildProjectLogsConfigDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsCodeBuildProjectLogsConfigDetails] -> ShowS
$cshowList :: [AwsCodeBuildProjectLogsConfigDetails] -> ShowS
show :: AwsCodeBuildProjectLogsConfigDetails -> String
$cshow :: AwsCodeBuildProjectLogsConfigDetails -> String
showsPrec :: Int -> AwsCodeBuildProjectLogsConfigDetails -> ShowS
$cshowsPrec :: Int -> AwsCodeBuildProjectLogsConfigDetails -> ShowS
Prelude.Show, (forall x.
 AwsCodeBuildProjectLogsConfigDetails
 -> Rep AwsCodeBuildProjectLogsConfigDetails x)
-> (forall x.
    Rep AwsCodeBuildProjectLogsConfigDetails x
    -> AwsCodeBuildProjectLogsConfigDetails)
-> Generic AwsCodeBuildProjectLogsConfigDetails
forall x.
Rep AwsCodeBuildProjectLogsConfigDetails x
-> AwsCodeBuildProjectLogsConfigDetails
forall x.
AwsCodeBuildProjectLogsConfigDetails
-> Rep AwsCodeBuildProjectLogsConfigDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsCodeBuildProjectLogsConfigDetails x
-> AwsCodeBuildProjectLogsConfigDetails
$cfrom :: forall x.
AwsCodeBuildProjectLogsConfigDetails
-> Rep AwsCodeBuildProjectLogsConfigDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsCodeBuildProjectLogsConfigDetails' 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:
--
-- 's3Logs', 'awsCodeBuildProjectLogsConfigDetails_s3Logs' - Information about logs built to an S3 bucket for a build project.
--
-- 'cloudWatchLogs', 'awsCodeBuildProjectLogsConfigDetails_cloudWatchLogs' - Information about CloudWatch Logs for the build project.
newAwsCodeBuildProjectLogsConfigDetails ::
  AwsCodeBuildProjectLogsConfigDetails
newAwsCodeBuildProjectLogsConfigDetails :: AwsCodeBuildProjectLogsConfigDetails
newAwsCodeBuildProjectLogsConfigDetails =
  AwsCodeBuildProjectLogsConfigDetails' :: Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
-> Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
-> AwsCodeBuildProjectLogsConfigDetails
AwsCodeBuildProjectLogsConfigDetails'
    { $sel:s3Logs:AwsCodeBuildProjectLogsConfigDetails' :: Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
s3Logs =
        Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogs:AwsCodeBuildProjectLogsConfigDetails' :: Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
cloudWatchLogs = Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about logs built to an S3 bucket for a build project.
awsCodeBuildProjectLogsConfigDetails_s3Logs :: Lens.Lens' AwsCodeBuildProjectLogsConfigDetails (Prelude.Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails)
awsCodeBuildProjectLogsConfigDetails_s3Logs :: (Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
 -> f (Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails))
-> AwsCodeBuildProjectLogsConfigDetails
-> f AwsCodeBuildProjectLogsConfigDetails
awsCodeBuildProjectLogsConfigDetails_s3Logs = (AwsCodeBuildProjectLogsConfigDetails
 -> Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails)
-> (AwsCodeBuildProjectLogsConfigDetails
    -> Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
    -> AwsCodeBuildProjectLogsConfigDetails)
-> Lens
     AwsCodeBuildProjectLogsConfigDetails
     AwsCodeBuildProjectLogsConfigDetails
     (Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails)
     (Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCodeBuildProjectLogsConfigDetails' {Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
s3Logs :: Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
$sel:s3Logs:AwsCodeBuildProjectLogsConfigDetails' :: AwsCodeBuildProjectLogsConfigDetails
-> Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
s3Logs} -> Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
s3Logs) (\s :: AwsCodeBuildProjectLogsConfigDetails
s@AwsCodeBuildProjectLogsConfigDetails' {} Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
a -> AwsCodeBuildProjectLogsConfigDetails
s {$sel:s3Logs:AwsCodeBuildProjectLogsConfigDetails' :: Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
s3Logs = Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
a} :: AwsCodeBuildProjectLogsConfigDetails)

-- | Information about CloudWatch Logs for the build project.
awsCodeBuildProjectLogsConfigDetails_cloudWatchLogs :: Lens.Lens' AwsCodeBuildProjectLogsConfigDetails (Prelude.Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails)
awsCodeBuildProjectLogsConfigDetails_cloudWatchLogs :: (Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
 -> f (Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails))
-> AwsCodeBuildProjectLogsConfigDetails
-> f AwsCodeBuildProjectLogsConfigDetails
awsCodeBuildProjectLogsConfigDetails_cloudWatchLogs = (AwsCodeBuildProjectLogsConfigDetails
 -> Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails)
-> (AwsCodeBuildProjectLogsConfigDetails
    -> Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
    -> AwsCodeBuildProjectLogsConfigDetails)
-> Lens
     AwsCodeBuildProjectLogsConfigDetails
     AwsCodeBuildProjectLogsConfigDetails
     (Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails)
     (Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCodeBuildProjectLogsConfigDetails' {Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
cloudWatchLogs :: Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
$sel:cloudWatchLogs:AwsCodeBuildProjectLogsConfigDetails' :: AwsCodeBuildProjectLogsConfigDetails
-> Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
cloudWatchLogs} -> Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
cloudWatchLogs) (\s :: AwsCodeBuildProjectLogsConfigDetails
s@AwsCodeBuildProjectLogsConfigDetails' {} Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
a -> AwsCodeBuildProjectLogsConfigDetails
s {$sel:cloudWatchLogs:AwsCodeBuildProjectLogsConfigDetails' :: Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
cloudWatchLogs = Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
a} :: AwsCodeBuildProjectLogsConfigDetails)

instance
  Core.FromJSON
    AwsCodeBuildProjectLogsConfigDetails
  where
  parseJSON :: Value -> Parser AwsCodeBuildProjectLogsConfigDetails
parseJSON =
    String
-> (Object -> Parser AwsCodeBuildProjectLogsConfigDetails)
-> Value
-> Parser AwsCodeBuildProjectLogsConfigDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsCodeBuildProjectLogsConfigDetails"
      ( \Object
x ->
          Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
-> Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
-> AwsCodeBuildProjectLogsConfigDetails
AwsCodeBuildProjectLogsConfigDetails'
            (Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
 -> Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
 -> AwsCodeBuildProjectLogsConfigDetails)
-> Parser (Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails)
-> Parser
     (Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
      -> AwsCodeBuildProjectLogsConfigDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser (Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3Logs")
            Parser
  (Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
   -> AwsCodeBuildProjectLogsConfigDetails)
-> Parser
     (Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails)
-> Parser AwsCodeBuildProjectLogsConfigDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Parser
     (Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CloudWatchLogs")
      )

instance
  Prelude.Hashable
    AwsCodeBuildProjectLogsConfigDetails

instance
  Prelude.NFData
    AwsCodeBuildProjectLogsConfigDetails

instance
  Core.ToJSON
    AwsCodeBuildProjectLogsConfigDetails
  where
  toJSON :: AwsCodeBuildProjectLogsConfigDetails -> Value
toJSON AwsCodeBuildProjectLogsConfigDetails' {Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
cloudWatchLogs :: Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
s3Logs :: Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
$sel:cloudWatchLogs:AwsCodeBuildProjectLogsConfigDetails' :: AwsCodeBuildProjectLogsConfigDetails
-> Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
$sel:s3Logs:AwsCodeBuildProjectLogsConfigDetails' :: AwsCodeBuildProjectLogsConfigDetails
-> Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"S3Logs" Text -> AwsCodeBuildProjectLogsConfigS3LogsDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AwsCodeBuildProjectLogsConfigS3LogsDetails -> Pair)
-> Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsCodeBuildProjectLogsConfigS3LogsDetails
s3Logs,
            (Text
"CloudWatchLogs" Text -> AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails -> Pair)
-> Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsCodeBuildProjectLogsConfigCloudWatchLogsDetails
cloudWatchLogs
          ]
      )