{-# 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.Glue.Types.LastCrawlInfo
-- 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.Glue.Types.LastCrawlInfo where

import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.LastCrawlStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Status and error information about the most recent crawl.
--
-- /See:/ 'newLastCrawlInfo' smart constructor.
data LastCrawlInfo = LastCrawlInfo'
  { -- | Status of the last crawl.
    LastCrawlInfo -> Maybe LastCrawlStatus
status :: Prelude.Maybe LastCrawlStatus,
    -- | The time at which the crawl started.
    LastCrawlInfo -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | The log stream for the last crawl.
    LastCrawlInfo -> Maybe Text
logStream :: Prelude.Maybe Prelude.Text,
    -- | The log group for the last crawl.
    LastCrawlInfo -> Maybe Text
logGroup :: Prelude.Maybe Prelude.Text,
    -- | The prefix for a message about this crawl.
    LastCrawlInfo -> Maybe Text
messagePrefix :: Prelude.Maybe Prelude.Text,
    -- | If an error occurred, the error information about the last crawl.
    LastCrawlInfo -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (LastCrawlInfo -> LastCrawlInfo -> Bool
(LastCrawlInfo -> LastCrawlInfo -> Bool)
-> (LastCrawlInfo -> LastCrawlInfo -> Bool) -> Eq LastCrawlInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LastCrawlInfo -> LastCrawlInfo -> Bool
$c/= :: LastCrawlInfo -> LastCrawlInfo -> Bool
== :: LastCrawlInfo -> LastCrawlInfo -> Bool
$c== :: LastCrawlInfo -> LastCrawlInfo -> Bool
Prelude.Eq, ReadPrec [LastCrawlInfo]
ReadPrec LastCrawlInfo
Int -> ReadS LastCrawlInfo
ReadS [LastCrawlInfo]
(Int -> ReadS LastCrawlInfo)
-> ReadS [LastCrawlInfo]
-> ReadPrec LastCrawlInfo
-> ReadPrec [LastCrawlInfo]
-> Read LastCrawlInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LastCrawlInfo]
$creadListPrec :: ReadPrec [LastCrawlInfo]
readPrec :: ReadPrec LastCrawlInfo
$creadPrec :: ReadPrec LastCrawlInfo
readList :: ReadS [LastCrawlInfo]
$creadList :: ReadS [LastCrawlInfo]
readsPrec :: Int -> ReadS LastCrawlInfo
$creadsPrec :: Int -> ReadS LastCrawlInfo
Prelude.Read, Int -> LastCrawlInfo -> ShowS
[LastCrawlInfo] -> ShowS
LastCrawlInfo -> String
(Int -> LastCrawlInfo -> ShowS)
-> (LastCrawlInfo -> String)
-> ([LastCrawlInfo] -> ShowS)
-> Show LastCrawlInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LastCrawlInfo] -> ShowS
$cshowList :: [LastCrawlInfo] -> ShowS
show :: LastCrawlInfo -> String
$cshow :: LastCrawlInfo -> String
showsPrec :: Int -> LastCrawlInfo -> ShowS
$cshowsPrec :: Int -> LastCrawlInfo -> ShowS
Prelude.Show, (forall x. LastCrawlInfo -> Rep LastCrawlInfo x)
-> (forall x. Rep LastCrawlInfo x -> LastCrawlInfo)
-> Generic LastCrawlInfo
forall x. Rep LastCrawlInfo x -> LastCrawlInfo
forall x. LastCrawlInfo -> Rep LastCrawlInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LastCrawlInfo x -> LastCrawlInfo
$cfrom :: forall x. LastCrawlInfo -> Rep LastCrawlInfo x
Prelude.Generic)

-- |
-- Create a value of 'LastCrawlInfo' 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:
--
-- 'status', 'lastCrawlInfo_status' - Status of the last crawl.
--
-- 'startTime', 'lastCrawlInfo_startTime' - The time at which the crawl started.
--
-- 'logStream', 'lastCrawlInfo_logStream' - The log stream for the last crawl.
--
-- 'logGroup', 'lastCrawlInfo_logGroup' - The log group for the last crawl.
--
-- 'messagePrefix', 'lastCrawlInfo_messagePrefix' - The prefix for a message about this crawl.
--
-- 'errorMessage', 'lastCrawlInfo_errorMessage' - If an error occurred, the error information about the last crawl.
newLastCrawlInfo ::
  LastCrawlInfo
newLastCrawlInfo :: LastCrawlInfo
newLastCrawlInfo =
  LastCrawlInfo' :: Maybe LastCrawlStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> LastCrawlInfo
LastCrawlInfo'
    { $sel:status:LastCrawlInfo' :: Maybe LastCrawlStatus
status = Maybe LastCrawlStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:LastCrawlInfo' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:logStream:LastCrawlInfo' :: Maybe Text
logStream = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:logGroup:LastCrawlInfo' :: Maybe Text
logGroup = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:messagePrefix:LastCrawlInfo' :: Maybe Text
messagePrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:LastCrawlInfo' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Status of the last crawl.
lastCrawlInfo_status :: Lens.Lens' LastCrawlInfo (Prelude.Maybe LastCrawlStatus)
lastCrawlInfo_status :: (Maybe LastCrawlStatus -> f (Maybe LastCrawlStatus))
-> LastCrawlInfo -> f LastCrawlInfo
lastCrawlInfo_status = (LastCrawlInfo -> Maybe LastCrawlStatus)
-> (LastCrawlInfo -> Maybe LastCrawlStatus -> LastCrawlInfo)
-> Lens
     LastCrawlInfo
     LastCrawlInfo
     (Maybe LastCrawlStatus)
     (Maybe LastCrawlStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastCrawlInfo' {Maybe LastCrawlStatus
status :: Maybe LastCrawlStatus
$sel:status:LastCrawlInfo' :: LastCrawlInfo -> Maybe LastCrawlStatus
status} -> Maybe LastCrawlStatus
status) (\s :: LastCrawlInfo
s@LastCrawlInfo' {} Maybe LastCrawlStatus
a -> LastCrawlInfo
s {$sel:status:LastCrawlInfo' :: Maybe LastCrawlStatus
status = Maybe LastCrawlStatus
a} :: LastCrawlInfo)

-- | The time at which the crawl started.
lastCrawlInfo_startTime :: Lens.Lens' LastCrawlInfo (Prelude.Maybe Prelude.UTCTime)
lastCrawlInfo_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> LastCrawlInfo -> f LastCrawlInfo
lastCrawlInfo_startTime = (LastCrawlInfo -> Maybe POSIX)
-> (LastCrawlInfo -> Maybe POSIX -> LastCrawlInfo)
-> Lens LastCrawlInfo LastCrawlInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastCrawlInfo' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:LastCrawlInfo' :: LastCrawlInfo -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: LastCrawlInfo
s@LastCrawlInfo' {} Maybe POSIX
a -> LastCrawlInfo
s {$sel:startTime:LastCrawlInfo' :: Maybe POSIX
startTime = Maybe POSIX
a} :: LastCrawlInfo) ((Maybe POSIX -> f (Maybe POSIX))
 -> LastCrawlInfo -> f LastCrawlInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> LastCrawlInfo
-> f LastCrawlInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The log stream for the last crawl.
lastCrawlInfo_logStream :: Lens.Lens' LastCrawlInfo (Prelude.Maybe Prelude.Text)
lastCrawlInfo_logStream :: (Maybe Text -> f (Maybe Text)) -> LastCrawlInfo -> f LastCrawlInfo
lastCrawlInfo_logStream = (LastCrawlInfo -> Maybe Text)
-> (LastCrawlInfo -> Maybe Text -> LastCrawlInfo)
-> Lens LastCrawlInfo LastCrawlInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastCrawlInfo' {Maybe Text
logStream :: Maybe Text
$sel:logStream:LastCrawlInfo' :: LastCrawlInfo -> Maybe Text
logStream} -> Maybe Text
logStream) (\s :: LastCrawlInfo
s@LastCrawlInfo' {} Maybe Text
a -> LastCrawlInfo
s {$sel:logStream:LastCrawlInfo' :: Maybe Text
logStream = Maybe Text
a} :: LastCrawlInfo)

-- | The log group for the last crawl.
lastCrawlInfo_logGroup :: Lens.Lens' LastCrawlInfo (Prelude.Maybe Prelude.Text)
lastCrawlInfo_logGroup :: (Maybe Text -> f (Maybe Text)) -> LastCrawlInfo -> f LastCrawlInfo
lastCrawlInfo_logGroup = (LastCrawlInfo -> Maybe Text)
-> (LastCrawlInfo -> Maybe Text -> LastCrawlInfo)
-> Lens LastCrawlInfo LastCrawlInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastCrawlInfo' {Maybe Text
logGroup :: Maybe Text
$sel:logGroup:LastCrawlInfo' :: LastCrawlInfo -> Maybe Text
logGroup} -> Maybe Text
logGroup) (\s :: LastCrawlInfo
s@LastCrawlInfo' {} Maybe Text
a -> LastCrawlInfo
s {$sel:logGroup:LastCrawlInfo' :: Maybe Text
logGroup = Maybe Text
a} :: LastCrawlInfo)

-- | The prefix for a message about this crawl.
lastCrawlInfo_messagePrefix :: Lens.Lens' LastCrawlInfo (Prelude.Maybe Prelude.Text)
lastCrawlInfo_messagePrefix :: (Maybe Text -> f (Maybe Text)) -> LastCrawlInfo -> f LastCrawlInfo
lastCrawlInfo_messagePrefix = (LastCrawlInfo -> Maybe Text)
-> (LastCrawlInfo -> Maybe Text -> LastCrawlInfo)
-> Lens LastCrawlInfo LastCrawlInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastCrawlInfo' {Maybe Text
messagePrefix :: Maybe Text
$sel:messagePrefix:LastCrawlInfo' :: LastCrawlInfo -> Maybe Text
messagePrefix} -> Maybe Text
messagePrefix) (\s :: LastCrawlInfo
s@LastCrawlInfo' {} Maybe Text
a -> LastCrawlInfo
s {$sel:messagePrefix:LastCrawlInfo' :: Maybe Text
messagePrefix = Maybe Text
a} :: LastCrawlInfo)

-- | If an error occurred, the error information about the last crawl.
lastCrawlInfo_errorMessage :: Lens.Lens' LastCrawlInfo (Prelude.Maybe Prelude.Text)
lastCrawlInfo_errorMessage :: (Maybe Text -> f (Maybe Text)) -> LastCrawlInfo -> f LastCrawlInfo
lastCrawlInfo_errorMessage = (LastCrawlInfo -> Maybe Text)
-> (LastCrawlInfo -> Maybe Text -> LastCrawlInfo)
-> Lens LastCrawlInfo LastCrawlInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastCrawlInfo' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:LastCrawlInfo' :: LastCrawlInfo -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: LastCrawlInfo
s@LastCrawlInfo' {} Maybe Text
a -> LastCrawlInfo
s {$sel:errorMessage:LastCrawlInfo' :: Maybe Text
errorMessage = Maybe Text
a} :: LastCrawlInfo)

instance Core.FromJSON LastCrawlInfo where
  parseJSON :: Value -> Parser LastCrawlInfo
parseJSON =
    String
-> (Object -> Parser LastCrawlInfo)
-> Value
-> Parser LastCrawlInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LastCrawlInfo"
      ( \Object
x ->
          Maybe LastCrawlStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> LastCrawlInfo
LastCrawlInfo'
            (Maybe LastCrawlStatus
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> LastCrawlInfo)
-> Parser (Maybe LastCrawlStatus)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> LastCrawlInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LastCrawlStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> LastCrawlInfo)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> LastCrawlInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartTime")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> LastCrawlInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> LastCrawlInfo)
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
"LogStream")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> LastCrawlInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> LastCrawlInfo)
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
"LogGroup")
            Parser (Maybe Text -> Maybe Text -> LastCrawlInfo)
-> Parser (Maybe Text) -> Parser (Maybe Text -> LastCrawlInfo)
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
"MessagePrefix")
            Parser (Maybe Text -> LastCrawlInfo)
-> Parser (Maybe Text) -> Parser LastCrawlInfo
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
"ErrorMessage")
      )

instance Prelude.Hashable LastCrawlInfo

instance Prelude.NFData LastCrawlInfo