{-# 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.CloudWatchLogs.Types.LogGroup
-- 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.CloudWatchLogs.Types.LogGroup where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a log group.
--
-- /See:/ 'newLogGroup' smart constructor.
data LogGroup = LogGroup'
  { -- | The creation time of the log group, expressed as the number of
    -- milliseconds after Jan 1, 1970 00:00:00 UTC.
    LogGroup -> Maybe Natural
creationTime :: Prelude.Maybe Prelude.Natural,
    -- | The number of metric filters.
    LogGroup -> Maybe Int
metricFilterCount :: Prelude.Maybe Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the log group.
    LogGroup -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the log group.
    LogGroup -> Maybe Text
logGroupName :: Prelude.Maybe Prelude.Text,
    LogGroup -> Maybe Int
retentionInDays :: Prelude.Maybe Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the CMK to use when encrypting log
    -- data.
    LogGroup -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The number of bytes stored.
    LogGroup -> Maybe Natural
storedBytes :: Prelude.Maybe Prelude.Natural
  }
  deriving (LogGroup -> LogGroup -> Bool
(LogGroup -> LogGroup -> Bool)
-> (LogGroup -> LogGroup -> Bool) -> Eq LogGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogGroup -> LogGroup -> Bool
$c/= :: LogGroup -> LogGroup -> Bool
== :: LogGroup -> LogGroup -> Bool
$c== :: LogGroup -> LogGroup -> Bool
Prelude.Eq, ReadPrec [LogGroup]
ReadPrec LogGroup
Int -> ReadS LogGroup
ReadS [LogGroup]
(Int -> ReadS LogGroup)
-> ReadS [LogGroup]
-> ReadPrec LogGroup
-> ReadPrec [LogGroup]
-> Read LogGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogGroup]
$creadListPrec :: ReadPrec [LogGroup]
readPrec :: ReadPrec LogGroup
$creadPrec :: ReadPrec LogGroup
readList :: ReadS [LogGroup]
$creadList :: ReadS [LogGroup]
readsPrec :: Int -> ReadS LogGroup
$creadsPrec :: Int -> ReadS LogGroup
Prelude.Read, Int -> LogGroup -> ShowS
[LogGroup] -> ShowS
LogGroup -> String
(Int -> LogGroup -> ShowS)
-> (LogGroup -> String) -> ([LogGroup] -> ShowS) -> Show LogGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogGroup] -> ShowS
$cshowList :: [LogGroup] -> ShowS
show :: LogGroup -> String
$cshow :: LogGroup -> String
showsPrec :: Int -> LogGroup -> ShowS
$cshowsPrec :: Int -> LogGroup -> ShowS
Prelude.Show, (forall x. LogGroup -> Rep LogGroup x)
-> (forall x. Rep LogGroup x -> LogGroup) -> Generic LogGroup
forall x. Rep LogGroup x -> LogGroup
forall x. LogGroup -> Rep LogGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LogGroup x -> LogGroup
$cfrom :: forall x. LogGroup -> Rep LogGroup x
Prelude.Generic)

-- |
-- Create a value of 'LogGroup' 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:
--
-- 'creationTime', 'logGroup_creationTime' - The creation time of the log group, expressed as the number of
-- milliseconds after Jan 1, 1970 00:00:00 UTC.
--
-- 'metricFilterCount', 'logGroup_metricFilterCount' - The number of metric filters.
--
-- 'arn', 'logGroup_arn' - The Amazon Resource Name (ARN) of the log group.
--
-- 'logGroupName', 'logGroup_logGroupName' - The name of the log group.
--
-- 'retentionInDays', 'logGroup_retentionInDays' - Undocumented member.
--
-- 'kmsKeyId', 'logGroup_kmsKeyId' - The Amazon Resource Name (ARN) of the CMK to use when encrypting log
-- data.
--
-- 'storedBytes', 'logGroup_storedBytes' - The number of bytes stored.
newLogGroup ::
  LogGroup
newLogGroup :: LogGroup
newLogGroup =
  LogGroup' :: Maybe Natural
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Natural
-> LogGroup
LogGroup'
    { $sel:creationTime:LogGroup' :: Maybe Natural
creationTime = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:metricFilterCount:LogGroup' :: Maybe Int
metricFilterCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:LogGroup' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:logGroupName:LogGroup' :: Maybe Text
logGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:retentionInDays:LogGroup' :: Maybe Int
retentionInDays = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:LogGroup' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:storedBytes:LogGroup' :: Maybe Natural
storedBytes = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The creation time of the log group, expressed as the number of
-- milliseconds after Jan 1, 1970 00:00:00 UTC.
logGroup_creationTime :: Lens.Lens' LogGroup (Prelude.Maybe Prelude.Natural)
logGroup_creationTime :: (Maybe Natural -> f (Maybe Natural)) -> LogGroup -> f LogGroup
logGroup_creationTime = (LogGroup -> Maybe Natural)
-> (LogGroup -> Maybe Natural -> LogGroup)
-> Lens LogGroup LogGroup (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogGroup' {Maybe Natural
creationTime :: Maybe Natural
$sel:creationTime:LogGroup' :: LogGroup -> Maybe Natural
creationTime} -> Maybe Natural
creationTime) (\s :: LogGroup
s@LogGroup' {} Maybe Natural
a -> LogGroup
s {$sel:creationTime:LogGroup' :: Maybe Natural
creationTime = Maybe Natural
a} :: LogGroup)

-- | The number of metric filters.
logGroup_metricFilterCount :: Lens.Lens' LogGroup (Prelude.Maybe Prelude.Int)
logGroup_metricFilterCount :: (Maybe Int -> f (Maybe Int)) -> LogGroup -> f LogGroup
logGroup_metricFilterCount = (LogGroup -> Maybe Int)
-> (LogGroup -> Maybe Int -> LogGroup)
-> Lens LogGroup LogGroup (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogGroup' {Maybe Int
metricFilterCount :: Maybe Int
$sel:metricFilterCount:LogGroup' :: LogGroup -> Maybe Int
metricFilterCount} -> Maybe Int
metricFilterCount) (\s :: LogGroup
s@LogGroup' {} Maybe Int
a -> LogGroup
s {$sel:metricFilterCount:LogGroup' :: Maybe Int
metricFilterCount = Maybe Int
a} :: LogGroup)

-- | The Amazon Resource Name (ARN) of the log group.
logGroup_arn :: Lens.Lens' LogGroup (Prelude.Maybe Prelude.Text)
logGroup_arn :: (Maybe Text -> f (Maybe Text)) -> LogGroup -> f LogGroup
logGroup_arn = (LogGroup -> Maybe Text)
-> (LogGroup -> Maybe Text -> LogGroup)
-> Lens LogGroup LogGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogGroup' {Maybe Text
arn :: Maybe Text
$sel:arn:LogGroup' :: LogGroup -> Maybe Text
arn} -> Maybe Text
arn) (\s :: LogGroup
s@LogGroup' {} Maybe Text
a -> LogGroup
s {$sel:arn:LogGroup' :: Maybe Text
arn = Maybe Text
a} :: LogGroup)

-- | The name of the log group.
logGroup_logGroupName :: Lens.Lens' LogGroup (Prelude.Maybe Prelude.Text)
logGroup_logGroupName :: (Maybe Text -> f (Maybe Text)) -> LogGroup -> f LogGroup
logGroup_logGroupName = (LogGroup -> Maybe Text)
-> (LogGroup -> Maybe Text -> LogGroup)
-> Lens LogGroup LogGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogGroup' {Maybe Text
logGroupName :: Maybe Text
$sel:logGroupName:LogGroup' :: LogGroup -> Maybe Text
logGroupName} -> Maybe Text
logGroupName) (\s :: LogGroup
s@LogGroup' {} Maybe Text
a -> LogGroup
s {$sel:logGroupName:LogGroup' :: Maybe Text
logGroupName = Maybe Text
a} :: LogGroup)

-- | Undocumented member.
logGroup_retentionInDays :: Lens.Lens' LogGroup (Prelude.Maybe Prelude.Int)
logGroup_retentionInDays :: (Maybe Int -> f (Maybe Int)) -> LogGroup -> f LogGroup
logGroup_retentionInDays = (LogGroup -> Maybe Int)
-> (LogGroup -> Maybe Int -> LogGroup)
-> Lens LogGroup LogGroup (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogGroup' {Maybe Int
retentionInDays :: Maybe Int
$sel:retentionInDays:LogGroup' :: LogGroup -> Maybe Int
retentionInDays} -> Maybe Int
retentionInDays) (\s :: LogGroup
s@LogGroup' {} Maybe Int
a -> LogGroup
s {$sel:retentionInDays:LogGroup' :: Maybe Int
retentionInDays = Maybe Int
a} :: LogGroup)

-- | The Amazon Resource Name (ARN) of the CMK to use when encrypting log
-- data.
logGroup_kmsKeyId :: Lens.Lens' LogGroup (Prelude.Maybe Prelude.Text)
logGroup_kmsKeyId :: (Maybe Text -> f (Maybe Text)) -> LogGroup -> f LogGroup
logGroup_kmsKeyId = (LogGroup -> Maybe Text)
-> (LogGroup -> Maybe Text -> LogGroup)
-> Lens LogGroup LogGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogGroup' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:LogGroup' :: LogGroup -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: LogGroup
s@LogGroup' {} Maybe Text
a -> LogGroup
s {$sel:kmsKeyId:LogGroup' :: Maybe Text
kmsKeyId = Maybe Text
a} :: LogGroup)

-- | The number of bytes stored.
logGroup_storedBytes :: Lens.Lens' LogGroup (Prelude.Maybe Prelude.Natural)
logGroup_storedBytes :: (Maybe Natural -> f (Maybe Natural)) -> LogGroup -> f LogGroup
logGroup_storedBytes = (LogGroup -> Maybe Natural)
-> (LogGroup -> Maybe Natural -> LogGroup)
-> Lens LogGroup LogGroup (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogGroup' {Maybe Natural
storedBytes :: Maybe Natural
$sel:storedBytes:LogGroup' :: LogGroup -> Maybe Natural
storedBytes} -> Maybe Natural
storedBytes) (\s :: LogGroup
s@LogGroup' {} Maybe Natural
a -> LogGroup
s {$sel:storedBytes:LogGroup' :: Maybe Natural
storedBytes = Maybe Natural
a} :: LogGroup)

instance Core.FromJSON LogGroup where
  parseJSON :: Value -> Parser LogGroup
parseJSON =
    String -> (Object -> Parser LogGroup) -> Value -> Parser LogGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LogGroup"
      ( \Object
x ->
          Maybe Natural
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Natural
-> LogGroup
LogGroup'
            (Maybe Natural
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Maybe Natural
 -> LogGroup)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Natural
      -> LogGroup)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"creationTime")
            Parser
  (Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Natural
   -> LogGroup)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Natural
      -> LogGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"metricFilterCount")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Natural
   -> LogGroup)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Int -> Maybe Text -> Maybe Natural -> LogGroup)
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
"arn")
            Parser
  (Maybe Text
   -> Maybe Int -> Maybe Text -> Maybe Natural -> LogGroup)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe Text -> Maybe Natural -> LogGroup)
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
"logGroupName")
            Parser (Maybe Int -> Maybe Text -> Maybe Natural -> LogGroup)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe Natural -> LogGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"retentionInDays")
            Parser (Maybe Text -> Maybe Natural -> LogGroup)
-> Parser (Maybe Text) -> Parser (Maybe Natural -> LogGroup)
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
"kmsKeyId")
            Parser (Maybe Natural -> LogGroup)
-> Parser (Maybe Natural) -> Parser LogGroup
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"storedBytes")
      )

instance Prelude.Hashable LogGroup

instance Prelude.NFData LogGroup