{-# 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.CodeBuild.Types.LogsLocation
-- 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.CodeBuild.Types.LogsLocation where

import Amazonka.CodeBuild.Types.CloudWatchLogsConfig
import Amazonka.CodeBuild.Types.S3LogsConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about build logs in CloudWatch Logs.
--
-- /See:/ 'newLogsLocation' smart constructor.
data LogsLocation = LogsLocation'
  { -- | The URL to an individual build log in CloudWatch Logs.
    LogsLocation -> Maybe Text
deepLink :: Prelude.Maybe Prelude.Text,
    -- | Information about S3 logs for a build project.
    LogsLocation -> Maybe S3LogsConfig
s3Logs :: Prelude.Maybe S3LogsConfig,
    -- | Information about CloudWatch Logs for a build project.
    LogsLocation -> Maybe CloudWatchLogsConfig
cloudWatchLogs :: Prelude.Maybe CloudWatchLogsConfig,
    -- | The URL to a build log in an S3 bucket.
    LogsLocation -> Maybe Text
s3DeepLink :: Prelude.Maybe Prelude.Text,
    -- | The ARN of S3 logs for a build project. Its format is
    -- @arn:${Partition}:s3:::${BucketName}\/${ObjectName}@. For more
    -- information, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazons3.html#amazons3-resources-for-iam-policies Resources Defined by Amazon S3>.
    LogsLocation -> Maybe Text
s3LogsArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of CloudWatch Logs for a build project. Its format is
    -- @arn:${Partition}:logs:${Region}:${Account}:log-group:${LogGroupName}:log-stream:${LogStreamName}@.
    -- For more information, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazoncloudwatchlogs.html#amazoncloudwatchlogs-resources-for-iam-policies Resources Defined by CloudWatch Logs>.
    LogsLocation -> Maybe Text
cloudWatchLogsArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the CloudWatch Logs group for the build logs.
    LogsLocation -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text,
    -- | The name of the CloudWatch Logs stream for the build logs.
    LogsLocation -> Maybe Text
streamName :: Prelude.Maybe Prelude.Text
  }
  deriving (LogsLocation -> LogsLocation -> Bool
(LogsLocation -> LogsLocation -> Bool)
-> (LogsLocation -> LogsLocation -> Bool) -> Eq LogsLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogsLocation -> LogsLocation -> Bool
$c/= :: LogsLocation -> LogsLocation -> Bool
== :: LogsLocation -> LogsLocation -> Bool
$c== :: LogsLocation -> LogsLocation -> Bool
Prelude.Eq, ReadPrec [LogsLocation]
ReadPrec LogsLocation
Int -> ReadS LogsLocation
ReadS [LogsLocation]
(Int -> ReadS LogsLocation)
-> ReadS [LogsLocation]
-> ReadPrec LogsLocation
-> ReadPrec [LogsLocation]
-> Read LogsLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogsLocation]
$creadListPrec :: ReadPrec [LogsLocation]
readPrec :: ReadPrec LogsLocation
$creadPrec :: ReadPrec LogsLocation
readList :: ReadS [LogsLocation]
$creadList :: ReadS [LogsLocation]
readsPrec :: Int -> ReadS LogsLocation
$creadsPrec :: Int -> ReadS LogsLocation
Prelude.Read, Int -> LogsLocation -> ShowS
[LogsLocation] -> ShowS
LogsLocation -> String
(Int -> LogsLocation -> ShowS)
-> (LogsLocation -> String)
-> ([LogsLocation] -> ShowS)
-> Show LogsLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogsLocation] -> ShowS
$cshowList :: [LogsLocation] -> ShowS
show :: LogsLocation -> String
$cshow :: LogsLocation -> String
showsPrec :: Int -> LogsLocation -> ShowS
$cshowsPrec :: Int -> LogsLocation -> ShowS
Prelude.Show, (forall x. LogsLocation -> Rep LogsLocation x)
-> (forall x. Rep LogsLocation x -> LogsLocation)
-> Generic LogsLocation
forall x. Rep LogsLocation x -> LogsLocation
forall x. LogsLocation -> Rep LogsLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LogsLocation x -> LogsLocation
$cfrom :: forall x. LogsLocation -> Rep LogsLocation x
Prelude.Generic)

-- |
-- Create a value of 'LogsLocation' 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:
--
-- 'deepLink', 'logsLocation_deepLink' - The URL to an individual build log in CloudWatch Logs.
--
-- 's3Logs', 'logsLocation_s3Logs' - Information about S3 logs for a build project.
--
-- 'cloudWatchLogs', 'logsLocation_cloudWatchLogs' - Information about CloudWatch Logs for a build project.
--
-- 's3DeepLink', 'logsLocation_s3DeepLink' - The URL to a build log in an S3 bucket.
--
-- 's3LogsArn', 'logsLocation_s3LogsArn' - The ARN of S3 logs for a build project. Its format is
-- @arn:${Partition}:s3:::${BucketName}\/${ObjectName}@. For more
-- information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazons3.html#amazons3-resources-for-iam-policies Resources Defined by Amazon S3>.
--
-- 'cloudWatchLogsArn', 'logsLocation_cloudWatchLogsArn' - The ARN of CloudWatch Logs for a build project. Its format is
-- @arn:${Partition}:logs:${Region}:${Account}:log-group:${LogGroupName}:log-stream:${LogStreamName}@.
-- For more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazoncloudwatchlogs.html#amazoncloudwatchlogs-resources-for-iam-policies Resources Defined by CloudWatch Logs>.
--
-- 'groupName', 'logsLocation_groupName' - The name of the CloudWatch Logs group for the build logs.
--
-- 'streamName', 'logsLocation_streamName' - The name of the CloudWatch Logs stream for the build logs.
newLogsLocation ::
  LogsLocation
newLogsLocation :: LogsLocation
newLogsLocation =
  LogsLocation' :: Maybe Text
-> Maybe S3LogsConfig
-> Maybe CloudWatchLogsConfig
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> LogsLocation
LogsLocation'
    { $sel:deepLink:LogsLocation' :: Maybe Text
deepLink = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Logs:LogsLocation' :: Maybe S3LogsConfig
s3Logs = Maybe S3LogsConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogs:LogsLocation' :: Maybe CloudWatchLogsConfig
cloudWatchLogs = Maybe CloudWatchLogsConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:s3DeepLink:LogsLocation' :: Maybe Text
s3DeepLink = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3LogsArn:LogsLocation' :: Maybe Text
s3LogsArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogsArn:LogsLocation' :: Maybe Text
cloudWatchLogsArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:LogsLocation' :: Maybe Text
groupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:streamName:LogsLocation' :: Maybe Text
streamName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The URL to an individual build log in CloudWatch Logs.
logsLocation_deepLink :: Lens.Lens' LogsLocation (Prelude.Maybe Prelude.Text)
logsLocation_deepLink :: (Maybe Text -> f (Maybe Text)) -> LogsLocation -> f LogsLocation
logsLocation_deepLink = (LogsLocation -> Maybe Text)
-> (LogsLocation -> Maybe Text -> LogsLocation)
-> Lens LogsLocation LogsLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogsLocation' {Maybe Text
deepLink :: Maybe Text
$sel:deepLink:LogsLocation' :: LogsLocation -> Maybe Text
deepLink} -> Maybe Text
deepLink) (\s :: LogsLocation
s@LogsLocation' {} Maybe Text
a -> LogsLocation
s {$sel:deepLink:LogsLocation' :: Maybe Text
deepLink = Maybe Text
a} :: LogsLocation)

-- | Information about S3 logs for a build project.
logsLocation_s3Logs :: Lens.Lens' LogsLocation (Prelude.Maybe S3LogsConfig)
logsLocation_s3Logs :: (Maybe S3LogsConfig -> f (Maybe S3LogsConfig))
-> LogsLocation -> f LogsLocation
logsLocation_s3Logs = (LogsLocation -> Maybe S3LogsConfig)
-> (LogsLocation -> Maybe S3LogsConfig -> LogsLocation)
-> Lens
     LogsLocation LogsLocation (Maybe S3LogsConfig) (Maybe S3LogsConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogsLocation' {Maybe S3LogsConfig
s3Logs :: Maybe S3LogsConfig
$sel:s3Logs:LogsLocation' :: LogsLocation -> Maybe S3LogsConfig
s3Logs} -> Maybe S3LogsConfig
s3Logs) (\s :: LogsLocation
s@LogsLocation' {} Maybe S3LogsConfig
a -> LogsLocation
s {$sel:s3Logs:LogsLocation' :: Maybe S3LogsConfig
s3Logs = Maybe S3LogsConfig
a} :: LogsLocation)

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

-- | The URL to a build log in an S3 bucket.
logsLocation_s3DeepLink :: Lens.Lens' LogsLocation (Prelude.Maybe Prelude.Text)
logsLocation_s3DeepLink :: (Maybe Text -> f (Maybe Text)) -> LogsLocation -> f LogsLocation
logsLocation_s3DeepLink = (LogsLocation -> Maybe Text)
-> (LogsLocation -> Maybe Text -> LogsLocation)
-> Lens LogsLocation LogsLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogsLocation' {Maybe Text
s3DeepLink :: Maybe Text
$sel:s3DeepLink:LogsLocation' :: LogsLocation -> Maybe Text
s3DeepLink} -> Maybe Text
s3DeepLink) (\s :: LogsLocation
s@LogsLocation' {} Maybe Text
a -> LogsLocation
s {$sel:s3DeepLink:LogsLocation' :: Maybe Text
s3DeepLink = Maybe Text
a} :: LogsLocation)

-- | The ARN of S3 logs for a build project. Its format is
-- @arn:${Partition}:s3:::${BucketName}\/${ObjectName}@. For more
-- information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazons3.html#amazons3-resources-for-iam-policies Resources Defined by Amazon S3>.
logsLocation_s3LogsArn :: Lens.Lens' LogsLocation (Prelude.Maybe Prelude.Text)
logsLocation_s3LogsArn :: (Maybe Text -> f (Maybe Text)) -> LogsLocation -> f LogsLocation
logsLocation_s3LogsArn = (LogsLocation -> Maybe Text)
-> (LogsLocation -> Maybe Text -> LogsLocation)
-> Lens LogsLocation LogsLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogsLocation' {Maybe Text
s3LogsArn :: Maybe Text
$sel:s3LogsArn:LogsLocation' :: LogsLocation -> Maybe Text
s3LogsArn} -> Maybe Text
s3LogsArn) (\s :: LogsLocation
s@LogsLocation' {} Maybe Text
a -> LogsLocation
s {$sel:s3LogsArn:LogsLocation' :: Maybe Text
s3LogsArn = Maybe Text
a} :: LogsLocation)

-- | The ARN of CloudWatch Logs for a build project. Its format is
-- @arn:${Partition}:logs:${Region}:${Account}:log-group:${LogGroupName}:log-stream:${LogStreamName}@.
-- For more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazoncloudwatchlogs.html#amazoncloudwatchlogs-resources-for-iam-policies Resources Defined by CloudWatch Logs>.
logsLocation_cloudWatchLogsArn :: Lens.Lens' LogsLocation (Prelude.Maybe Prelude.Text)
logsLocation_cloudWatchLogsArn :: (Maybe Text -> f (Maybe Text)) -> LogsLocation -> f LogsLocation
logsLocation_cloudWatchLogsArn = (LogsLocation -> Maybe Text)
-> (LogsLocation -> Maybe Text -> LogsLocation)
-> Lens LogsLocation LogsLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogsLocation' {Maybe Text
cloudWatchLogsArn :: Maybe Text
$sel:cloudWatchLogsArn:LogsLocation' :: LogsLocation -> Maybe Text
cloudWatchLogsArn} -> Maybe Text
cloudWatchLogsArn) (\s :: LogsLocation
s@LogsLocation' {} Maybe Text
a -> LogsLocation
s {$sel:cloudWatchLogsArn:LogsLocation' :: Maybe Text
cloudWatchLogsArn = Maybe Text
a} :: LogsLocation)

-- | The name of the CloudWatch Logs group for the build logs.
logsLocation_groupName :: Lens.Lens' LogsLocation (Prelude.Maybe Prelude.Text)
logsLocation_groupName :: (Maybe Text -> f (Maybe Text)) -> LogsLocation -> f LogsLocation
logsLocation_groupName = (LogsLocation -> Maybe Text)
-> (LogsLocation -> Maybe Text -> LogsLocation)
-> Lens LogsLocation LogsLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogsLocation' {Maybe Text
groupName :: Maybe Text
$sel:groupName:LogsLocation' :: LogsLocation -> Maybe Text
groupName} -> Maybe Text
groupName) (\s :: LogsLocation
s@LogsLocation' {} Maybe Text
a -> LogsLocation
s {$sel:groupName:LogsLocation' :: Maybe Text
groupName = Maybe Text
a} :: LogsLocation)

-- | The name of the CloudWatch Logs stream for the build logs.
logsLocation_streamName :: Lens.Lens' LogsLocation (Prelude.Maybe Prelude.Text)
logsLocation_streamName :: (Maybe Text -> f (Maybe Text)) -> LogsLocation -> f LogsLocation
logsLocation_streamName = (LogsLocation -> Maybe Text)
-> (LogsLocation -> Maybe Text -> LogsLocation)
-> Lens LogsLocation LogsLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogsLocation' {Maybe Text
streamName :: Maybe Text
$sel:streamName:LogsLocation' :: LogsLocation -> Maybe Text
streamName} -> Maybe Text
streamName) (\s :: LogsLocation
s@LogsLocation' {} Maybe Text
a -> LogsLocation
s {$sel:streamName:LogsLocation' :: Maybe Text
streamName = Maybe Text
a} :: LogsLocation)

instance Core.FromJSON LogsLocation where
  parseJSON :: Value -> Parser LogsLocation
parseJSON =
    String
-> (Object -> Parser LogsLocation) -> Value -> Parser LogsLocation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LogsLocation"
      ( \Object
x ->
          Maybe Text
-> Maybe S3LogsConfig
-> Maybe CloudWatchLogsConfig
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> LogsLocation
LogsLocation'
            (Maybe Text
 -> Maybe S3LogsConfig
 -> Maybe CloudWatchLogsConfig
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> LogsLocation)
-> Parser (Maybe Text)
-> Parser
     (Maybe S3LogsConfig
      -> Maybe CloudWatchLogsConfig
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> LogsLocation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"deepLink")
            Parser
  (Maybe S3LogsConfig
   -> Maybe CloudWatchLogsConfig
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> LogsLocation)
-> Parser (Maybe S3LogsConfig)
-> Parser
     (Maybe CloudWatchLogsConfig
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> LogsLocation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe S3LogsConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3Logs")
            Parser
  (Maybe CloudWatchLogsConfig
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> LogsLocation)
-> Parser (Maybe CloudWatchLogsConfig)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> LogsLocation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CloudWatchLogsConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cloudWatchLogs")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> LogsLocation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> LogsLocation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3DeepLink")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> LogsLocation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> LogsLocation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3LogsArn")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> LogsLocation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> LogsLocation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cloudWatchLogsArn")
            Parser (Maybe Text -> Maybe Text -> LogsLocation)
-> Parser (Maybe Text) -> Parser (Maybe Text -> LogsLocation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"groupName")
            Parser (Maybe Text -> LogsLocation)
-> Parser (Maybe Text) -> Parser LogsLocation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"streamName")
      )

instance Prelude.Hashable LogsLocation

instance Prelude.NFData LogsLocation