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

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

-- | Metrics for a specified crawler.
--
-- /See:/ 'newCrawlerMetrics' smart constructor.
data CrawlerMetrics = CrawlerMetrics'
  { -- | The name of the crawler.
    CrawlerMetrics -> Maybe Text
crawlerName :: Prelude.Maybe Prelude.Text,
    -- | The duration of the crawler\'s most recent run, in seconds.
    CrawlerMetrics -> Maybe Double
lastRuntimeSeconds :: Prelude.Maybe Prelude.Double,
    -- | The median duration of this crawler\'s runs, in seconds.
    CrawlerMetrics -> Maybe Double
medianRuntimeSeconds :: Prelude.Maybe Prelude.Double,
    -- | True if the crawler is still estimating how long it will take to
    -- complete this run.
    CrawlerMetrics -> Maybe Bool
stillEstimating :: Prelude.Maybe Prelude.Bool,
    -- | The number of tables created by this crawler.
    CrawlerMetrics -> Maybe Natural
tablesCreated :: Prelude.Maybe Prelude.Natural,
    -- | The number of tables deleted by this crawler.
    CrawlerMetrics -> Maybe Natural
tablesDeleted :: Prelude.Maybe Prelude.Natural,
    -- | The number of tables updated by this crawler.
    CrawlerMetrics -> Maybe Natural
tablesUpdated :: Prelude.Maybe Prelude.Natural,
    -- | The estimated time left to complete a running crawl.
    CrawlerMetrics -> Maybe Double
timeLeftSeconds :: Prelude.Maybe Prelude.Double
  }
  deriving (CrawlerMetrics -> CrawlerMetrics -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CrawlerMetrics -> CrawlerMetrics -> Bool
$c/= :: CrawlerMetrics -> CrawlerMetrics -> Bool
== :: CrawlerMetrics -> CrawlerMetrics -> Bool
$c== :: CrawlerMetrics -> CrawlerMetrics -> Bool
Prelude.Eq, ReadPrec [CrawlerMetrics]
ReadPrec CrawlerMetrics
Int -> ReadS CrawlerMetrics
ReadS [CrawlerMetrics]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CrawlerMetrics]
$creadListPrec :: ReadPrec [CrawlerMetrics]
readPrec :: ReadPrec CrawlerMetrics
$creadPrec :: ReadPrec CrawlerMetrics
readList :: ReadS [CrawlerMetrics]
$creadList :: ReadS [CrawlerMetrics]
readsPrec :: Int -> ReadS CrawlerMetrics
$creadsPrec :: Int -> ReadS CrawlerMetrics
Prelude.Read, Int -> CrawlerMetrics -> ShowS
[CrawlerMetrics] -> ShowS
CrawlerMetrics -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CrawlerMetrics] -> ShowS
$cshowList :: [CrawlerMetrics] -> ShowS
show :: CrawlerMetrics -> String
$cshow :: CrawlerMetrics -> String
showsPrec :: Int -> CrawlerMetrics -> ShowS
$cshowsPrec :: Int -> CrawlerMetrics -> ShowS
Prelude.Show, forall x. Rep CrawlerMetrics x -> CrawlerMetrics
forall x. CrawlerMetrics -> Rep CrawlerMetrics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CrawlerMetrics x -> CrawlerMetrics
$cfrom :: forall x. CrawlerMetrics -> Rep CrawlerMetrics x
Prelude.Generic)

-- |
-- Create a value of 'CrawlerMetrics' 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:
--
-- 'crawlerName', 'crawlerMetrics_crawlerName' - The name of the crawler.
--
-- 'lastRuntimeSeconds', 'crawlerMetrics_lastRuntimeSeconds' - The duration of the crawler\'s most recent run, in seconds.
--
-- 'medianRuntimeSeconds', 'crawlerMetrics_medianRuntimeSeconds' - The median duration of this crawler\'s runs, in seconds.
--
-- 'stillEstimating', 'crawlerMetrics_stillEstimating' - True if the crawler is still estimating how long it will take to
-- complete this run.
--
-- 'tablesCreated', 'crawlerMetrics_tablesCreated' - The number of tables created by this crawler.
--
-- 'tablesDeleted', 'crawlerMetrics_tablesDeleted' - The number of tables deleted by this crawler.
--
-- 'tablesUpdated', 'crawlerMetrics_tablesUpdated' - The number of tables updated by this crawler.
--
-- 'timeLeftSeconds', 'crawlerMetrics_timeLeftSeconds' - The estimated time left to complete a running crawl.
newCrawlerMetrics ::
  CrawlerMetrics
newCrawlerMetrics :: CrawlerMetrics
newCrawlerMetrics =
  CrawlerMetrics'
    { $sel:crawlerName:CrawlerMetrics' :: Maybe Text
crawlerName = forall a. Maybe a
Prelude.Nothing,
      $sel:lastRuntimeSeconds:CrawlerMetrics' :: Maybe Double
lastRuntimeSeconds = forall a. Maybe a
Prelude.Nothing,
      $sel:medianRuntimeSeconds:CrawlerMetrics' :: Maybe Double
medianRuntimeSeconds = forall a. Maybe a
Prelude.Nothing,
      $sel:stillEstimating:CrawlerMetrics' :: Maybe Bool
stillEstimating = forall a. Maybe a
Prelude.Nothing,
      $sel:tablesCreated:CrawlerMetrics' :: Maybe Natural
tablesCreated = forall a. Maybe a
Prelude.Nothing,
      $sel:tablesDeleted:CrawlerMetrics' :: Maybe Natural
tablesDeleted = forall a. Maybe a
Prelude.Nothing,
      $sel:tablesUpdated:CrawlerMetrics' :: Maybe Natural
tablesUpdated = forall a. Maybe a
Prelude.Nothing,
      $sel:timeLeftSeconds:CrawlerMetrics' :: Maybe Double
timeLeftSeconds = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the crawler.
crawlerMetrics_crawlerName :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Text)
crawlerMetrics_crawlerName :: Lens' CrawlerMetrics (Maybe Text)
crawlerMetrics_crawlerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrawlerMetrics' {Maybe Text
crawlerName :: Maybe Text
$sel:crawlerName:CrawlerMetrics' :: CrawlerMetrics -> Maybe Text
crawlerName} -> Maybe Text
crawlerName) (\s :: CrawlerMetrics
s@CrawlerMetrics' {} Maybe Text
a -> CrawlerMetrics
s {$sel:crawlerName:CrawlerMetrics' :: Maybe Text
crawlerName = Maybe Text
a} :: CrawlerMetrics)

-- | The duration of the crawler\'s most recent run, in seconds.
crawlerMetrics_lastRuntimeSeconds :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Double)
crawlerMetrics_lastRuntimeSeconds :: Lens' CrawlerMetrics (Maybe Double)
crawlerMetrics_lastRuntimeSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrawlerMetrics' {Maybe Double
lastRuntimeSeconds :: Maybe Double
$sel:lastRuntimeSeconds:CrawlerMetrics' :: CrawlerMetrics -> Maybe Double
lastRuntimeSeconds} -> Maybe Double
lastRuntimeSeconds) (\s :: CrawlerMetrics
s@CrawlerMetrics' {} Maybe Double
a -> CrawlerMetrics
s {$sel:lastRuntimeSeconds:CrawlerMetrics' :: Maybe Double
lastRuntimeSeconds = Maybe Double
a} :: CrawlerMetrics)

-- | The median duration of this crawler\'s runs, in seconds.
crawlerMetrics_medianRuntimeSeconds :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Double)
crawlerMetrics_medianRuntimeSeconds :: Lens' CrawlerMetrics (Maybe Double)
crawlerMetrics_medianRuntimeSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrawlerMetrics' {Maybe Double
medianRuntimeSeconds :: Maybe Double
$sel:medianRuntimeSeconds:CrawlerMetrics' :: CrawlerMetrics -> Maybe Double
medianRuntimeSeconds} -> Maybe Double
medianRuntimeSeconds) (\s :: CrawlerMetrics
s@CrawlerMetrics' {} Maybe Double
a -> CrawlerMetrics
s {$sel:medianRuntimeSeconds:CrawlerMetrics' :: Maybe Double
medianRuntimeSeconds = Maybe Double
a} :: CrawlerMetrics)

-- | True if the crawler is still estimating how long it will take to
-- complete this run.
crawlerMetrics_stillEstimating :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Bool)
crawlerMetrics_stillEstimating :: Lens' CrawlerMetrics (Maybe Bool)
crawlerMetrics_stillEstimating = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrawlerMetrics' {Maybe Bool
stillEstimating :: Maybe Bool
$sel:stillEstimating:CrawlerMetrics' :: CrawlerMetrics -> Maybe Bool
stillEstimating} -> Maybe Bool
stillEstimating) (\s :: CrawlerMetrics
s@CrawlerMetrics' {} Maybe Bool
a -> CrawlerMetrics
s {$sel:stillEstimating:CrawlerMetrics' :: Maybe Bool
stillEstimating = Maybe Bool
a} :: CrawlerMetrics)

-- | The number of tables created by this crawler.
crawlerMetrics_tablesCreated :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Natural)
crawlerMetrics_tablesCreated :: Lens' CrawlerMetrics (Maybe Natural)
crawlerMetrics_tablesCreated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrawlerMetrics' {Maybe Natural
tablesCreated :: Maybe Natural
$sel:tablesCreated:CrawlerMetrics' :: CrawlerMetrics -> Maybe Natural
tablesCreated} -> Maybe Natural
tablesCreated) (\s :: CrawlerMetrics
s@CrawlerMetrics' {} Maybe Natural
a -> CrawlerMetrics
s {$sel:tablesCreated:CrawlerMetrics' :: Maybe Natural
tablesCreated = Maybe Natural
a} :: CrawlerMetrics)

-- | The number of tables deleted by this crawler.
crawlerMetrics_tablesDeleted :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Natural)
crawlerMetrics_tablesDeleted :: Lens' CrawlerMetrics (Maybe Natural)
crawlerMetrics_tablesDeleted = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrawlerMetrics' {Maybe Natural
tablesDeleted :: Maybe Natural
$sel:tablesDeleted:CrawlerMetrics' :: CrawlerMetrics -> Maybe Natural
tablesDeleted} -> Maybe Natural
tablesDeleted) (\s :: CrawlerMetrics
s@CrawlerMetrics' {} Maybe Natural
a -> CrawlerMetrics
s {$sel:tablesDeleted:CrawlerMetrics' :: Maybe Natural
tablesDeleted = Maybe Natural
a} :: CrawlerMetrics)

-- | The number of tables updated by this crawler.
crawlerMetrics_tablesUpdated :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Natural)
crawlerMetrics_tablesUpdated :: Lens' CrawlerMetrics (Maybe Natural)
crawlerMetrics_tablesUpdated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrawlerMetrics' {Maybe Natural
tablesUpdated :: Maybe Natural
$sel:tablesUpdated:CrawlerMetrics' :: CrawlerMetrics -> Maybe Natural
tablesUpdated} -> Maybe Natural
tablesUpdated) (\s :: CrawlerMetrics
s@CrawlerMetrics' {} Maybe Natural
a -> CrawlerMetrics
s {$sel:tablesUpdated:CrawlerMetrics' :: Maybe Natural
tablesUpdated = Maybe Natural
a} :: CrawlerMetrics)

-- | The estimated time left to complete a running crawl.
crawlerMetrics_timeLeftSeconds :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Double)
crawlerMetrics_timeLeftSeconds :: Lens' CrawlerMetrics (Maybe Double)
crawlerMetrics_timeLeftSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrawlerMetrics' {Maybe Double
timeLeftSeconds :: Maybe Double
$sel:timeLeftSeconds:CrawlerMetrics' :: CrawlerMetrics -> Maybe Double
timeLeftSeconds} -> Maybe Double
timeLeftSeconds) (\s :: CrawlerMetrics
s@CrawlerMetrics' {} Maybe Double
a -> CrawlerMetrics
s {$sel:timeLeftSeconds:CrawlerMetrics' :: Maybe Double
timeLeftSeconds = Maybe Double
a} :: CrawlerMetrics)

instance Data.FromJSON CrawlerMetrics where
  parseJSON :: Value -> Parser CrawlerMetrics
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CrawlerMetrics"
      ( \Object
x ->
          Maybe Text
-> Maybe Double
-> Maybe Double
-> Maybe Bool
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Double
-> CrawlerMetrics
CrawlerMetrics'
            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
"CrawlerName")
            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
"LastRuntimeSeconds")
            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
"MedianRuntimeSeconds")
            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
"StillEstimating")
            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
"TablesCreated")
            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
"TablesDeleted")
            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
"TablesUpdated")
            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
"TimeLeftSeconds")
      )

instance Prelude.Hashable CrawlerMetrics where
  hashWithSalt :: Int -> CrawlerMetrics -> Int
hashWithSalt Int
_salt CrawlerMetrics' {Maybe Bool
Maybe Double
Maybe Natural
Maybe Text
timeLeftSeconds :: Maybe Double
tablesUpdated :: Maybe Natural
tablesDeleted :: Maybe Natural
tablesCreated :: Maybe Natural
stillEstimating :: Maybe Bool
medianRuntimeSeconds :: Maybe Double
lastRuntimeSeconds :: Maybe Double
crawlerName :: Maybe Text
$sel:timeLeftSeconds:CrawlerMetrics' :: CrawlerMetrics -> Maybe Double
$sel:tablesUpdated:CrawlerMetrics' :: CrawlerMetrics -> Maybe Natural
$sel:tablesDeleted:CrawlerMetrics' :: CrawlerMetrics -> Maybe Natural
$sel:tablesCreated:CrawlerMetrics' :: CrawlerMetrics -> Maybe Natural
$sel:stillEstimating:CrawlerMetrics' :: CrawlerMetrics -> Maybe Bool
$sel:medianRuntimeSeconds:CrawlerMetrics' :: CrawlerMetrics -> Maybe Double
$sel:lastRuntimeSeconds:CrawlerMetrics' :: CrawlerMetrics -> Maybe Double
$sel:crawlerName:CrawlerMetrics' :: CrawlerMetrics -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
crawlerName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
lastRuntimeSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
medianRuntimeSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
stillEstimating
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
tablesCreated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
tablesDeleted
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
tablesUpdated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
timeLeftSeconds

instance Prelude.NFData CrawlerMetrics where
  rnf :: CrawlerMetrics -> ()
rnf CrawlerMetrics' {Maybe Bool
Maybe Double
Maybe Natural
Maybe Text
timeLeftSeconds :: Maybe Double
tablesUpdated :: Maybe Natural
tablesDeleted :: Maybe Natural
tablesCreated :: Maybe Natural
stillEstimating :: Maybe Bool
medianRuntimeSeconds :: Maybe Double
lastRuntimeSeconds :: Maybe Double
crawlerName :: Maybe Text
$sel:timeLeftSeconds:CrawlerMetrics' :: CrawlerMetrics -> Maybe Double
$sel:tablesUpdated:CrawlerMetrics' :: CrawlerMetrics -> Maybe Natural
$sel:tablesDeleted:CrawlerMetrics' :: CrawlerMetrics -> Maybe Natural
$sel:tablesCreated:CrawlerMetrics' :: CrawlerMetrics -> Maybe Natural
$sel:stillEstimating:CrawlerMetrics' :: CrawlerMetrics -> Maybe Bool
$sel:medianRuntimeSeconds:CrawlerMetrics' :: CrawlerMetrics -> Maybe Double
$sel:lastRuntimeSeconds:CrawlerMetrics' :: CrawlerMetrics -> Maybe Double
$sel:crawlerName:CrawlerMetrics' :: CrawlerMetrics -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
crawlerName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
lastRuntimeSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
medianRuntimeSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
stillEstimating
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
tablesCreated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
tablesDeleted
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
tablesUpdated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
timeLeftSeconds