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

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

-- | Represents the search status of a log stream.
--
-- /See:/ 'newSearchedLogStream' smart constructor.
data SearchedLogStream = SearchedLogStream'
  { -- | The name of the log stream.
    SearchedLogStream -> Maybe Text
logStreamName :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether all the events in this log stream were searched.
    SearchedLogStream -> Maybe Bool
searchedCompletely :: Prelude.Maybe Prelude.Bool
  }
  deriving (SearchedLogStream -> SearchedLogStream -> Bool
(SearchedLogStream -> SearchedLogStream -> Bool)
-> (SearchedLogStream -> SearchedLogStream -> Bool)
-> Eq SearchedLogStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchedLogStream -> SearchedLogStream -> Bool
$c/= :: SearchedLogStream -> SearchedLogStream -> Bool
== :: SearchedLogStream -> SearchedLogStream -> Bool
$c== :: SearchedLogStream -> SearchedLogStream -> Bool
Prelude.Eq, ReadPrec [SearchedLogStream]
ReadPrec SearchedLogStream
Int -> ReadS SearchedLogStream
ReadS [SearchedLogStream]
(Int -> ReadS SearchedLogStream)
-> ReadS [SearchedLogStream]
-> ReadPrec SearchedLogStream
-> ReadPrec [SearchedLogStream]
-> Read SearchedLogStream
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchedLogStream]
$creadListPrec :: ReadPrec [SearchedLogStream]
readPrec :: ReadPrec SearchedLogStream
$creadPrec :: ReadPrec SearchedLogStream
readList :: ReadS [SearchedLogStream]
$creadList :: ReadS [SearchedLogStream]
readsPrec :: Int -> ReadS SearchedLogStream
$creadsPrec :: Int -> ReadS SearchedLogStream
Prelude.Read, Int -> SearchedLogStream -> ShowS
[SearchedLogStream] -> ShowS
SearchedLogStream -> String
(Int -> SearchedLogStream -> ShowS)
-> (SearchedLogStream -> String)
-> ([SearchedLogStream] -> ShowS)
-> Show SearchedLogStream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchedLogStream] -> ShowS
$cshowList :: [SearchedLogStream] -> ShowS
show :: SearchedLogStream -> String
$cshow :: SearchedLogStream -> String
showsPrec :: Int -> SearchedLogStream -> ShowS
$cshowsPrec :: Int -> SearchedLogStream -> ShowS
Prelude.Show, (forall x. SearchedLogStream -> Rep SearchedLogStream x)
-> (forall x. Rep SearchedLogStream x -> SearchedLogStream)
-> Generic SearchedLogStream
forall x. Rep SearchedLogStream x -> SearchedLogStream
forall x. SearchedLogStream -> Rep SearchedLogStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchedLogStream x -> SearchedLogStream
$cfrom :: forall x. SearchedLogStream -> Rep SearchedLogStream x
Prelude.Generic)

-- |
-- Create a value of 'SearchedLogStream' 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:
--
-- 'logStreamName', 'searchedLogStream_logStreamName' - The name of the log stream.
--
-- 'searchedCompletely', 'searchedLogStream_searchedCompletely' - Indicates whether all the events in this log stream were searched.
newSearchedLogStream ::
  SearchedLogStream
newSearchedLogStream :: SearchedLogStream
newSearchedLogStream =
  SearchedLogStream' :: Maybe Text -> Maybe Bool -> SearchedLogStream
SearchedLogStream'
    { $sel:logStreamName:SearchedLogStream' :: Maybe Text
logStreamName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:searchedCompletely:SearchedLogStream' :: Maybe Bool
searchedCompletely = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the log stream.
searchedLogStream_logStreamName :: Lens.Lens' SearchedLogStream (Prelude.Maybe Prelude.Text)
searchedLogStream_logStreamName :: (Maybe Text -> f (Maybe Text))
-> SearchedLogStream -> f SearchedLogStream
searchedLogStream_logStreamName = (SearchedLogStream -> Maybe Text)
-> (SearchedLogStream -> Maybe Text -> SearchedLogStream)
-> Lens
     SearchedLogStream SearchedLogStream (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchedLogStream' {Maybe Text
logStreamName :: Maybe Text
$sel:logStreamName:SearchedLogStream' :: SearchedLogStream -> Maybe Text
logStreamName} -> Maybe Text
logStreamName) (\s :: SearchedLogStream
s@SearchedLogStream' {} Maybe Text
a -> SearchedLogStream
s {$sel:logStreamName:SearchedLogStream' :: Maybe Text
logStreamName = Maybe Text
a} :: SearchedLogStream)

-- | Indicates whether all the events in this log stream were searched.
searchedLogStream_searchedCompletely :: Lens.Lens' SearchedLogStream (Prelude.Maybe Prelude.Bool)
searchedLogStream_searchedCompletely :: (Maybe Bool -> f (Maybe Bool))
-> SearchedLogStream -> f SearchedLogStream
searchedLogStream_searchedCompletely = (SearchedLogStream -> Maybe Bool)
-> (SearchedLogStream -> Maybe Bool -> SearchedLogStream)
-> Lens
     SearchedLogStream SearchedLogStream (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchedLogStream' {Maybe Bool
searchedCompletely :: Maybe Bool
$sel:searchedCompletely:SearchedLogStream' :: SearchedLogStream -> Maybe Bool
searchedCompletely} -> Maybe Bool
searchedCompletely) (\s :: SearchedLogStream
s@SearchedLogStream' {} Maybe Bool
a -> SearchedLogStream
s {$sel:searchedCompletely:SearchedLogStream' :: Maybe Bool
searchedCompletely = Maybe Bool
a} :: SearchedLogStream)

instance Core.FromJSON SearchedLogStream where
  parseJSON :: Value -> Parser SearchedLogStream
parseJSON =
    String
-> (Object -> Parser SearchedLogStream)
-> Value
-> Parser SearchedLogStream
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SearchedLogStream"
      ( \Object
x ->
          Maybe Text -> Maybe Bool -> SearchedLogStream
SearchedLogStream'
            (Maybe Text -> Maybe Bool -> SearchedLogStream)
-> Parser (Maybe Text) -> Parser (Maybe Bool -> SearchedLogStream)
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
"logStreamName")
            Parser (Maybe Bool -> SearchedLogStream)
-> Parser (Maybe Bool) -> Parser SearchedLogStream
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"searchedCompletely")
      )

instance Prelude.Hashable SearchedLogStream

instance Prelude.NFData SearchedLogStream