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

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

-- | Metrics for a specified crawler.
--
-- /See:/ 'newCrawlerMetrics' smart constructor.
data CrawlerMetrics = CrawlerMetrics'
  { -- | The duration of the crawler\'s most recent run, in seconds.
    CrawlerMetrics -> Maybe Double
lastRuntimeSeconds :: Prelude.Maybe Prelude.Double,
    -- | The number of tables created by this crawler.
    CrawlerMetrics -> Maybe Natural
tablesCreated :: Prelude.Maybe Prelude.Natural,
    -- | 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 median duration of this crawler\'s runs, in seconds.
    CrawlerMetrics -> Maybe Double
medianRuntimeSeconds :: Prelude.Maybe Prelude.Double,
    -- | The estimated time left to complete a running crawl.
    CrawlerMetrics -> Maybe Double
timeLeftSeconds :: Prelude.Maybe Prelude.Double,
    -- | 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 name of the crawler.
    CrawlerMetrics -> Maybe Text
crawlerName :: Prelude.Maybe Prelude.Text
  }
  deriving (CrawlerMetrics -> CrawlerMetrics -> Bool
(CrawlerMetrics -> CrawlerMetrics -> Bool)
-> (CrawlerMetrics -> CrawlerMetrics -> Bool) -> Eq CrawlerMetrics
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]
(Int -> ReadS CrawlerMetrics)
-> ReadS [CrawlerMetrics]
-> ReadPrec CrawlerMetrics
-> ReadPrec [CrawlerMetrics]
-> Read 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
(Int -> CrawlerMetrics -> ShowS)
-> (CrawlerMetrics -> String)
-> ([CrawlerMetrics] -> ShowS)
-> Show CrawlerMetrics
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. CrawlerMetrics -> Rep CrawlerMetrics x)
-> (forall x. Rep CrawlerMetrics x -> CrawlerMetrics)
-> Generic CrawlerMetrics
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:
--
-- 'lastRuntimeSeconds', 'crawlerMetrics_lastRuntimeSeconds' - The duration of the crawler\'s most recent run, in seconds.
--
-- 'tablesCreated', 'crawlerMetrics_tablesCreated' - The number of tables created by this crawler.
--
-- 'stillEstimating', 'crawlerMetrics_stillEstimating' - True if the crawler is still estimating how long it will take to
-- complete this run.
--
-- 'medianRuntimeSeconds', 'crawlerMetrics_medianRuntimeSeconds' - The median duration of this crawler\'s runs, in seconds.
--
-- 'timeLeftSeconds', 'crawlerMetrics_timeLeftSeconds' - The estimated time left to complete a running crawl.
--
-- 'tablesDeleted', 'crawlerMetrics_tablesDeleted' - The number of tables deleted by this crawler.
--
-- 'tablesUpdated', 'crawlerMetrics_tablesUpdated' - The number of tables updated by this crawler.
--
-- 'crawlerName', 'crawlerMetrics_crawlerName' - The name of the crawler.
newCrawlerMetrics ::
  CrawlerMetrics
newCrawlerMetrics :: CrawlerMetrics
newCrawlerMetrics =
  CrawlerMetrics' :: Maybe Double
-> Maybe Natural
-> Maybe Bool
-> Maybe Double
-> Maybe Double
-> Maybe Natural
-> Maybe Natural
-> Maybe Text
-> CrawlerMetrics
CrawlerMetrics'
    { $sel:lastRuntimeSeconds:CrawlerMetrics' :: Maybe Double
lastRuntimeSeconds =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:tablesCreated:CrawlerMetrics' :: Maybe Natural
tablesCreated = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:stillEstimating:CrawlerMetrics' :: Maybe Bool
stillEstimating = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:medianRuntimeSeconds:CrawlerMetrics' :: Maybe Double
medianRuntimeSeconds = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:timeLeftSeconds:CrawlerMetrics' :: Maybe Double
timeLeftSeconds = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:tablesDeleted:CrawlerMetrics' :: Maybe Natural
tablesDeleted = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:tablesUpdated:CrawlerMetrics' :: Maybe Natural
tablesUpdated = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:crawlerName:CrawlerMetrics' :: Maybe Text
crawlerName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The duration of the crawler\'s most recent run, in seconds.
crawlerMetrics_lastRuntimeSeconds :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Double)
crawlerMetrics_lastRuntimeSeconds :: (Maybe Double -> f (Maybe Double))
-> CrawlerMetrics -> f CrawlerMetrics
crawlerMetrics_lastRuntimeSeconds = (CrawlerMetrics -> Maybe Double)
-> (CrawlerMetrics -> Maybe Double -> CrawlerMetrics)
-> Lens CrawlerMetrics CrawlerMetrics (Maybe Double) (Maybe Double)
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 number of tables created by this crawler.
crawlerMetrics_tablesCreated :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Natural)
crawlerMetrics_tablesCreated :: (Maybe Natural -> f (Maybe Natural))
-> CrawlerMetrics -> f CrawlerMetrics
crawlerMetrics_tablesCreated = (CrawlerMetrics -> Maybe Natural)
-> (CrawlerMetrics -> Maybe Natural -> CrawlerMetrics)
-> Lens
     CrawlerMetrics CrawlerMetrics (Maybe Natural) (Maybe Natural)
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)

-- | 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 :: (Maybe Bool -> f (Maybe Bool))
-> CrawlerMetrics -> f CrawlerMetrics
crawlerMetrics_stillEstimating = (CrawlerMetrics -> Maybe Bool)
-> (CrawlerMetrics -> Maybe Bool -> CrawlerMetrics)
-> Lens CrawlerMetrics CrawlerMetrics (Maybe Bool) (Maybe Bool)
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 median duration of this crawler\'s runs, in seconds.
crawlerMetrics_medianRuntimeSeconds :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Double)
crawlerMetrics_medianRuntimeSeconds :: (Maybe Double -> f (Maybe Double))
-> CrawlerMetrics -> f CrawlerMetrics
crawlerMetrics_medianRuntimeSeconds = (CrawlerMetrics -> Maybe Double)
-> (CrawlerMetrics -> Maybe Double -> CrawlerMetrics)
-> Lens CrawlerMetrics CrawlerMetrics (Maybe Double) (Maybe Double)
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)

-- | The estimated time left to complete a running crawl.
crawlerMetrics_timeLeftSeconds :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Double)
crawlerMetrics_timeLeftSeconds :: (Maybe Double -> f (Maybe Double))
-> CrawlerMetrics -> f CrawlerMetrics
crawlerMetrics_timeLeftSeconds = (CrawlerMetrics -> Maybe Double)
-> (CrawlerMetrics -> Maybe Double -> CrawlerMetrics)
-> Lens CrawlerMetrics CrawlerMetrics (Maybe Double) (Maybe Double)
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)

-- | The number of tables deleted by this crawler.
crawlerMetrics_tablesDeleted :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Natural)
crawlerMetrics_tablesDeleted :: (Maybe Natural -> f (Maybe Natural))
-> CrawlerMetrics -> f CrawlerMetrics
crawlerMetrics_tablesDeleted = (CrawlerMetrics -> Maybe Natural)
-> (CrawlerMetrics -> Maybe Natural -> CrawlerMetrics)
-> Lens
     CrawlerMetrics CrawlerMetrics (Maybe Natural) (Maybe Natural)
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 :: (Maybe Natural -> f (Maybe Natural))
-> CrawlerMetrics -> f CrawlerMetrics
crawlerMetrics_tablesUpdated = (CrawlerMetrics -> Maybe Natural)
-> (CrawlerMetrics -> Maybe Natural -> CrawlerMetrics)
-> Lens
     CrawlerMetrics CrawlerMetrics (Maybe Natural) (Maybe Natural)
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 name of the crawler.
crawlerMetrics_crawlerName :: Lens.Lens' CrawlerMetrics (Prelude.Maybe Prelude.Text)
crawlerMetrics_crawlerName :: (Maybe Text -> f (Maybe Text))
-> CrawlerMetrics -> f CrawlerMetrics
crawlerMetrics_crawlerName = (CrawlerMetrics -> Maybe Text)
-> (CrawlerMetrics -> Maybe Text -> CrawlerMetrics)
-> Lens CrawlerMetrics CrawlerMetrics (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable CrawlerMetrics

instance Prelude.NFData CrawlerMetrics