{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Glue.Types.LastCrawlInfo where

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

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

-- | If an error occurred, the error information about the last crawl.
lastCrawlInfo_errorMessage :: Lens.Lens' LastCrawlInfo (Prelude.Maybe Prelude.Text)
lastCrawlInfo_errorMessage :: Lens' LastCrawlInfo (Maybe Text)
lastCrawlInfo_errorMessage = 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)

-- | The log group for the last crawl.
lastCrawlInfo_logGroup :: Lens.Lens' LastCrawlInfo (Prelude.Maybe Prelude.Text)
lastCrawlInfo_logGroup :: Lens' LastCrawlInfo (Maybe Text)
lastCrawlInfo_logGroup = 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 log stream for the last crawl.
lastCrawlInfo_logStream :: Lens.Lens' LastCrawlInfo (Prelude.Maybe Prelude.Text)
lastCrawlInfo_logStream :: Lens' LastCrawlInfo (Maybe Text)
lastCrawlInfo_logStream = 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 prefix for a message about this crawl.
lastCrawlInfo_messagePrefix :: Lens.Lens' LastCrawlInfo (Prelude.Maybe Prelude.Text)
lastCrawlInfo_messagePrefix :: Lens' LastCrawlInfo (Maybe Text)
lastCrawlInfo_messagePrefix = 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)

-- | The time at which the crawl started.
lastCrawlInfo_startTime :: Lens.Lens' LastCrawlInfo (Prelude.Maybe Prelude.UTCTime)
lastCrawlInfo_startTime :: Lens' LastCrawlInfo (Maybe UTCTime)
lastCrawlInfo_startTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Status of the last crawl.
lastCrawlInfo_status :: Lens.Lens' LastCrawlInfo (Prelude.Maybe LastCrawlStatus)
lastCrawlInfo_status :: Lens' LastCrawlInfo (Maybe LastCrawlStatus)
lastCrawlInfo_status = 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)

instance Data.FromJSON LastCrawlInfo where
  parseJSON :: Value -> Parser LastCrawlInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LastCrawlInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe LastCrawlStatus
-> LastCrawlInfo
LastCrawlInfo'
            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
"ErrorMessage")
            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
"LogGroup")
            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
"LogStream")
            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
"MessagePrefix")
            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
"StartTime")
            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
"Status")
      )

instance Prelude.Hashable LastCrawlInfo where
  hashWithSalt :: Int -> LastCrawlInfo -> Int
hashWithSalt Int
_salt LastCrawlInfo' {Maybe Text
Maybe POSIX
Maybe LastCrawlStatus
status :: Maybe LastCrawlStatus
startTime :: Maybe POSIX
messagePrefix :: Maybe Text
logStream :: Maybe Text
logGroup :: Maybe Text
errorMessage :: Maybe Text
$sel:status:LastCrawlInfo' :: LastCrawlInfo -> Maybe LastCrawlStatus
$sel:startTime:LastCrawlInfo' :: LastCrawlInfo -> Maybe POSIX
$sel:messagePrefix:LastCrawlInfo' :: LastCrawlInfo -> Maybe Text
$sel:logStream:LastCrawlInfo' :: LastCrawlInfo -> Maybe Text
$sel:logGroup:LastCrawlInfo' :: LastCrawlInfo -> Maybe Text
$sel:errorMessage:LastCrawlInfo' :: LastCrawlInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
logGroup
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
logStream
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
messagePrefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LastCrawlStatus
status

instance Prelude.NFData LastCrawlInfo where
  rnf :: LastCrawlInfo -> ()
rnf LastCrawlInfo' {Maybe Text
Maybe POSIX
Maybe LastCrawlStatus
status :: Maybe LastCrawlStatus
startTime :: Maybe POSIX
messagePrefix :: Maybe Text
logStream :: Maybe Text
logGroup :: Maybe Text
errorMessage :: Maybe Text
$sel:status:LastCrawlInfo' :: LastCrawlInfo -> Maybe LastCrawlStatus
$sel:startTime:LastCrawlInfo' :: LastCrawlInfo -> Maybe POSIX
$sel:messagePrefix:LastCrawlInfo' :: LastCrawlInfo -> Maybe Text
$sel:logStream:LastCrawlInfo' :: LastCrawlInfo -> Maybe Text
$sel:logGroup:LastCrawlInfo' :: LastCrawlInfo -> Maybe Text
$sel:errorMessage:LastCrawlInfo' :: LastCrawlInfo -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
logGroup
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
logStream
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
messagePrefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LastCrawlStatus
status