{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Information about build logs in CloudWatch Logs.
--
-- /See:/ 'newLogsLocation' smart constructor.
data LogsLocation = LogsLocation'
  { -- | Information about CloudWatch Logs for a build project.
    LogsLocation -> Maybe CloudWatchLogsConfig
cloudWatchLogs :: Prelude.Maybe CloudWatchLogsConfig,
    -- | 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 URL to an individual build log in CloudWatch Logs.
    LogsLocation -> Maybe Text
deepLink :: Prelude.Maybe Prelude.Text,
    -- | The name of the CloudWatch Logs group for the build logs.
    LogsLocation -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text,
    -- | The URL to a build log in an S3 bucket.
    LogsLocation -> Maybe Text
s3DeepLink :: Prelude.Maybe Prelude.Text,
    -- | Information about S3 logs for a build project.
    LogsLocation -> Maybe S3LogsConfig
s3Logs :: Prelude.Maybe S3LogsConfig,
    -- | 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 name of the CloudWatch Logs stream for the build logs.
    LogsLocation -> Maybe Text
streamName :: Prelude.Maybe Prelude.Text
  }
  deriving (LogsLocation -> LogsLocation -> Bool
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]
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
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. 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:
--
-- 'cloudWatchLogs', 'logsLocation_cloudWatchLogs' - Information about CloudWatch Logs for a build project.
--
-- '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>.
--
-- 'deepLink', 'logsLocation_deepLink' - The URL to an individual build log in CloudWatch Logs.
--
-- 'groupName', 'logsLocation_groupName' - The name of the CloudWatch Logs group for the build logs.
--
-- 's3DeepLink', 'logsLocation_s3DeepLink' - The URL to a build log in an S3 bucket.
--
-- 's3Logs', 'logsLocation_s3Logs' - Information about S3 logs for a build project.
--
-- '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>.
--
-- 'streamName', 'logsLocation_streamName' - The name of the CloudWatch Logs stream for the build logs.
newLogsLocation ::
  LogsLocation
newLogsLocation :: LogsLocation
newLogsLocation =
  LogsLocation'
    { $sel:cloudWatchLogs:LogsLocation' :: Maybe CloudWatchLogsConfig
cloudWatchLogs = forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogsArn:LogsLocation' :: Maybe Text
cloudWatchLogsArn = forall a. Maybe a
Prelude.Nothing,
      $sel:deepLink:LogsLocation' :: Maybe Text
deepLink = forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:LogsLocation' :: Maybe Text
groupName = forall a. Maybe a
Prelude.Nothing,
      $sel:s3DeepLink:LogsLocation' :: Maybe Text
s3DeepLink = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Logs:LogsLocation' :: Maybe S3LogsConfig
s3Logs = forall a. Maybe a
Prelude.Nothing,
      $sel:s3LogsArn:LogsLocation' :: Maybe Text
s3LogsArn = forall a. Maybe a
Prelude.Nothing,
      $sel:streamName:LogsLocation' :: Maybe Text
streamName = forall a. Maybe a
Prelude.Nothing
    }

-- | Information about CloudWatch Logs for a build project.
logsLocation_cloudWatchLogs :: Lens.Lens' LogsLocation (Prelude.Maybe CloudWatchLogsConfig)
logsLocation_cloudWatchLogs :: Lens' LogsLocation (Maybe CloudWatchLogsConfig)
logsLocation_cloudWatchLogs = 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 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 :: Lens' LogsLocation (Maybe Text)
logsLocation_cloudWatchLogsArn = 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 URL to an individual build log in CloudWatch Logs.
logsLocation_deepLink :: Lens.Lens' LogsLocation (Prelude.Maybe Prelude.Text)
logsLocation_deepLink :: Lens' LogsLocation (Maybe Text)
logsLocation_deepLink = 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)

-- | The name of the CloudWatch Logs group for the build logs.
logsLocation_groupName :: Lens.Lens' LogsLocation (Prelude.Maybe Prelude.Text)
logsLocation_groupName :: Lens' LogsLocation (Maybe Text)
logsLocation_groupName = 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 URL to a build log in an S3 bucket.
logsLocation_s3DeepLink :: Lens.Lens' LogsLocation (Prelude.Maybe Prelude.Text)
logsLocation_s3DeepLink :: Lens' LogsLocation (Maybe Text)
logsLocation_s3DeepLink = 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)

-- | Information about S3 logs for a build project.
logsLocation_s3Logs :: Lens.Lens' LogsLocation (Prelude.Maybe S3LogsConfig)
logsLocation_s3Logs :: Lens' LogsLocation (Maybe S3LogsConfig)
logsLocation_s3Logs = 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)

-- | 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 :: Lens' LogsLocation (Maybe Text)
logsLocation_s3LogsArn = 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 name of the CloudWatch Logs stream for the build logs.
logsLocation_streamName :: Lens.Lens' LogsLocation (Prelude.Maybe Prelude.Text)
logsLocation_streamName :: Lens' LogsLocation (Maybe Text)
logsLocation_streamName = 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 Data.FromJSON LogsLocation where
  parseJSON :: Value -> Parser LogsLocation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LogsLocation"
      ( \Object
x ->
          Maybe CloudWatchLogsConfig
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe S3LogsConfig
-> Maybe Text
-> Maybe Text
-> LogsLocation
LogsLocation'
            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
"cloudWatchLogsArn")
            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
"deepLink")
            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
"groupName")
            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
"s3DeepLink")
            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
"s3Logs")
            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
"s3LogsArn")
            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
"streamName")
      )

instance Prelude.Hashable LogsLocation where
  hashWithSalt :: Int -> LogsLocation -> Int
hashWithSalt Int
_salt LogsLocation' {Maybe Text
Maybe CloudWatchLogsConfig
Maybe S3LogsConfig
streamName :: Maybe Text
s3LogsArn :: Maybe Text
s3Logs :: Maybe S3LogsConfig
s3DeepLink :: Maybe Text
groupName :: Maybe Text
deepLink :: Maybe Text
cloudWatchLogsArn :: Maybe Text
cloudWatchLogs :: Maybe CloudWatchLogsConfig
$sel:streamName:LogsLocation' :: LogsLocation -> Maybe Text
$sel:s3LogsArn:LogsLocation' :: LogsLocation -> Maybe Text
$sel:s3Logs:LogsLocation' :: LogsLocation -> Maybe S3LogsConfig
$sel:s3DeepLink:LogsLocation' :: LogsLocation -> Maybe Text
$sel:groupName:LogsLocation' :: LogsLocation -> Maybe Text
$sel:deepLink:LogsLocation' :: LogsLocation -> Maybe Text
$sel:cloudWatchLogsArn:LogsLocation' :: LogsLocation -> Maybe Text
$sel:cloudWatchLogs:LogsLocation' :: LogsLocation -> Maybe CloudWatchLogsConfig
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CloudWatchLogsConfig
cloudWatchLogs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cloudWatchLogsArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deepLink
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
groupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3DeepLink
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3LogsConfig
s3Logs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3LogsArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamName

instance Prelude.NFData LogsLocation where
  rnf :: LogsLocation -> ()
rnf LogsLocation' {Maybe Text
Maybe CloudWatchLogsConfig
Maybe S3LogsConfig
streamName :: Maybe Text
s3LogsArn :: Maybe Text
s3Logs :: Maybe S3LogsConfig
s3DeepLink :: Maybe Text
groupName :: Maybe Text
deepLink :: Maybe Text
cloudWatchLogsArn :: Maybe Text
cloudWatchLogs :: Maybe CloudWatchLogsConfig
$sel:streamName:LogsLocation' :: LogsLocation -> Maybe Text
$sel:s3LogsArn:LogsLocation' :: LogsLocation -> Maybe Text
$sel:s3Logs:LogsLocation' :: LogsLocation -> Maybe S3LogsConfig
$sel:s3DeepLink:LogsLocation' :: LogsLocation -> Maybe Text
$sel:groupName:LogsLocation' :: LogsLocation -> Maybe Text
$sel:deepLink:LogsLocation' :: LogsLocation -> Maybe Text
$sel:cloudWatchLogsArn:LogsLocation' :: LogsLocation -> Maybe Text
$sel:cloudWatchLogs:LogsLocation' :: LogsLocation -> Maybe CloudWatchLogsConfig
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CloudWatchLogsConfig
cloudWatchLogs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cloudWatchLogsArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deepLink
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
groupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3DeepLink
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3LogsConfig
s3Logs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3LogsArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamName