{-# 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.RejectedLogEventsInfo
-- 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.RejectedLogEventsInfo where

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

-- | Represents the rejected events.
--
-- /See:/ 'newRejectedLogEventsInfo' smart constructor.
data RejectedLogEventsInfo = RejectedLogEventsInfo'
  { -- | The log events that are too old.
    RejectedLogEventsInfo -> Maybe Int
tooOldLogEventEndIndex :: Prelude.Maybe Prelude.Int,
    -- | The log events that are too new.
    RejectedLogEventsInfo -> Maybe Int
tooNewLogEventStartIndex :: Prelude.Maybe Prelude.Int,
    -- | The expired log events.
    RejectedLogEventsInfo -> Maybe Int
expiredLogEventEndIndex :: Prelude.Maybe Prelude.Int
  }
  deriving (RejectedLogEventsInfo -> RejectedLogEventsInfo -> Bool
(RejectedLogEventsInfo -> RejectedLogEventsInfo -> Bool)
-> (RejectedLogEventsInfo -> RejectedLogEventsInfo -> Bool)
-> Eq RejectedLogEventsInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RejectedLogEventsInfo -> RejectedLogEventsInfo -> Bool
$c/= :: RejectedLogEventsInfo -> RejectedLogEventsInfo -> Bool
== :: RejectedLogEventsInfo -> RejectedLogEventsInfo -> Bool
$c== :: RejectedLogEventsInfo -> RejectedLogEventsInfo -> Bool
Prelude.Eq, ReadPrec [RejectedLogEventsInfo]
ReadPrec RejectedLogEventsInfo
Int -> ReadS RejectedLogEventsInfo
ReadS [RejectedLogEventsInfo]
(Int -> ReadS RejectedLogEventsInfo)
-> ReadS [RejectedLogEventsInfo]
-> ReadPrec RejectedLogEventsInfo
-> ReadPrec [RejectedLogEventsInfo]
-> Read RejectedLogEventsInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RejectedLogEventsInfo]
$creadListPrec :: ReadPrec [RejectedLogEventsInfo]
readPrec :: ReadPrec RejectedLogEventsInfo
$creadPrec :: ReadPrec RejectedLogEventsInfo
readList :: ReadS [RejectedLogEventsInfo]
$creadList :: ReadS [RejectedLogEventsInfo]
readsPrec :: Int -> ReadS RejectedLogEventsInfo
$creadsPrec :: Int -> ReadS RejectedLogEventsInfo
Prelude.Read, Int -> RejectedLogEventsInfo -> ShowS
[RejectedLogEventsInfo] -> ShowS
RejectedLogEventsInfo -> String
(Int -> RejectedLogEventsInfo -> ShowS)
-> (RejectedLogEventsInfo -> String)
-> ([RejectedLogEventsInfo] -> ShowS)
-> Show RejectedLogEventsInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RejectedLogEventsInfo] -> ShowS
$cshowList :: [RejectedLogEventsInfo] -> ShowS
show :: RejectedLogEventsInfo -> String
$cshow :: RejectedLogEventsInfo -> String
showsPrec :: Int -> RejectedLogEventsInfo -> ShowS
$cshowsPrec :: Int -> RejectedLogEventsInfo -> ShowS
Prelude.Show, (forall x. RejectedLogEventsInfo -> Rep RejectedLogEventsInfo x)
-> (forall x. Rep RejectedLogEventsInfo x -> RejectedLogEventsInfo)
-> Generic RejectedLogEventsInfo
forall x. Rep RejectedLogEventsInfo x -> RejectedLogEventsInfo
forall x. RejectedLogEventsInfo -> Rep RejectedLogEventsInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RejectedLogEventsInfo x -> RejectedLogEventsInfo
$cfrom :: forall x. RejectedLogEventsInfo -> Rep RejectedLogEventsInfo x
Prelude.Generic)

-- |
-- Create a value of 'RejectedLogEventsInfo' 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:
--
-- 'tooOldLogEventEndIndex', 'rejectedLogEventsInfo_tooOldLogEventEndIndex' - The log events that are too old.
--
-- 'tooNewLogEventStartIndex', 'rejectedLogEventsInfo_tooNewLogEventStartIndex' - The log events that are too new.
--
-- 'expiredLogEventEndIndex', 'rejectedLogEventsInfo_expiredLogEventEndIndex' - The expired log events.
newRejectedLogEventsInfo ::
  RejectedLogEventsInfo
newRejectedLogEventsInfo :: RejectedLogEventsInfo
newRejectedLogEventsInfo =
  RejectedLogEventsInfo' :: Maybe Int -> Maybe Int -> Maybe Int -> RejectedLogEventsInfo
RejectedLogEventsInfo'
    { $sel:tooOldLogEventEndIndex:RejectedLogEventsInfo' :: Maybe Int
tooOldLogEventEndIndex =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:tooNewLogEventStartIndex:RejectedLogEventsInfo' :: Maybe Int
tooNewLogEventStartIndex = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:expiredLogEventEndIndex:RejectedLogEventsInfo' :: Maybe Int
expiredLogEventEndIndex = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The log events that are too old.
rejectedLogEventsInfo_tooOldLogEventEndIndex :: Lens.Lens' RejectedLogEventsInfo (Prelude.Maybe Prelude.Int)
rejectedLogEventsInfo_tooOldLogEventEndIndex :: (Maybe Int -> f (Maybe Int))
-> RejectedLogEventsInfo -> f RejectedLogEventsInfo
rejectedLogEventsInfo_tooOldLogEventEndIndex = (RejectedLogEventsInfo -> Maybe Int)
-> (RejectedLogEventsInfo -> Maybe Int -> RejectedLogEventsInfo)
-> Lens
     RejectedLogEventsInfo RejectedLogEventsInfo (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectedLogEventsInfo' {Maybe Int
tooOldLogEventEndIndex :: Maybe Int
$sel:tooOldLogEventEndIndex:RejectedLogEventsInfo' :: RejectedLogEventsInfo -> Maybe Int
tooOldLogEventEndIndex} -> Maybe Int
tooOldLogEventEndIndex) (\s :: RejectedLogEventsInfo
s@RejectedLogEventsInfo' {} Maybe Int
a -> RejectedLogEventsInfo
s {$sel:tooOldLogEventEndIndex:RejectedLogEventsInfo' :: Maybe Int
tooOldLogEventEndIndex = Maybe Int
a} :: RejectedLogEventsInfo)

-- | The log events that are too new.
rejectedLogEventsInfo_tooNewLogEventStartIndex :: Lens.Lens' RejectedLogEventsInfo (Prelude.Maybe Prelude.Int)
rejectedLogEventsInfo_tooNewLogEventStartIndex :: (Maybe Int -> f (Maybe Int))
-> RejectedLogEventsInfo -> f RejectedLogEventsInfo
rejectedLogEventsInfo_tooNewLogEventStartIndex = (RejectedLogEventsInfo -> Maybe Int)
-> (RejectedLogEventsInfo -> Maybe Int -> RejectedLogEventsInfo)
-> Lens
     RejectedLogEventsInfo RejectedLogEventsInfo (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectedLogEventsInfo' {Maybe Int
tooNewLogEventStartIndex :: Maybe Int
$sel:tooNewLogEventStartIndex:RejectedLogEventsInfo' :: RejectedLogEventsInfo -> Maybe Int
tooNewLogEventStartIndex} -> Maybe Int
tooNewLogEventStartIndex) (\s :: RejectedLogEventsInfo
s@RejectedLogEventsInfo' {} Maybe Int
a -> RejectedLogEventsInfo
s {$sel:tooNewLogEventStartIndex:RejectedLogEventsInfo' :: Maybe Int
tooNewLogEventStartIndex = Maybe Int
a} :: RejectedLogEventsInfo)

-- | The expired log events.
rejectedLogEventsInfo_expiredLogEventEndIndex :: Lens.Lens' RejectedLogEventsInfo (Prelude.Maybe Prelude.Int)
rejectedLogEventsInfo_expiredLogEventEndIndex :: (Maybe Int -> f (Maybe Int))
-> RejectedLogEventsInfo -> f RejectedLogEventsInfo
rejectedLogEventsInfo_expiredLogEventEndIndex = (RejectedLogEventsInfo -> Maybe Int)
-> (RejectedLogEventsInfo -> Maybe Int -> RejectedLogEventsInfo)
-> Lens
     RejectedLogEventsInfo RejectedLogEventsInfo (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectedLogEventsInfo' {Maybe Int
expiredLogEventEndIndex :: Maybe Int
$sel:expiredLogEventEndIndex:RejectedLogEventsInfo' :: RejectedLogEventsInfo -> Maybe Int
expiredLogEventEndIndex} -> Maybe Int
expiredLogEventEndIndex) (\s :: RejectedLogEventsInfo
s@RejectedLogEventsInfo' {} Maybe Int
a -> RejectedLogEventsInfo
s {$sel:expiredLogEventEndIndex:RejectedLogEventsInfo' :: Maybe Int
expiredLogEventEndIndex = Maybe Int
a} :: RejectedLogEventsInfo)

instance Core.FromJSON RejectedLogEventsInfo where
  parseJSON :: Value -> Parser RejectedLogEventsInfo
parseJSON =
    String
-> (Object -> Parser RejectedLogEventsInfo)
-> Value
-> Parser RejectedLogEventsInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RejectedLogEventsInfo"
      ( \Object
x ->
          Maybe Int -> Maybe Int -> Maybe Int -> RejectedLogEventsInfo
RejectedLogEventsInfo'
            (Maybe Int -> Maybe Int -> Maybe Int -> RejectedLogEventsInfo)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Int -> RejectedLogEventsInfo)
forall (f :: * -> *) a b. Functor 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
"tooOldLogEventEndIndex")
            Parser (Maybe Int -> Maybe Int -> RejectedLogEventsInfo)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> RejectedLogEventsInfo)
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
"tooNewLogEventStartIndex")
            Parser (Maybe Int -> RejectedLogEventsInfo)
-> Parser (Maybe Int) -> Parser RejectedLogEventsInfo
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
"expiredLogEventEndIndex")
      )

instance Prelude.Hashable RejectedLogEventsInfo

instance Prelude.NFData RejectedLogEventsInfo