{-# 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.XRay.Types.RequestImpactStatistics
-- 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.XRay.Types.RequestImpactStatistics where

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

-- | Statistics that describe how the incident has impacted a service.
--
-- /See:/ 'newRequestImpactStatistics' smart constructor.
data RequestImpactStatistics = RequestImpactStatistics'
  { -- | The number of successful requests.
    RequestImpactStatistics -> Maybe Integer
okCount :: Prelude.Maybe Prelude.Integer,
    -- | The number of requests that have resulted in a fault,
    RequestImpactStatistics -> Maybe Integer
faultCount :: Prelude.Maybe Prelude.Integer,
    -- | The total number of requests to the service.
    RequestImpactStatistics -> Maybe Integer
totalCount :: Prelude.Maybe Prelude.Integer
  }
  deriving (RequestImpactStatistics -> RequestImpactStatistics -> Bool
(RequestImpactStatistics -> RequestImpactStatistics -> Bool)
-> (RequestImpactStatistics -> RequestImpactStatistics -> Bool)
-> Eq RequestImpactStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RequestImpactStatistics -> RequestImpactStatistics -> Bool
$c/= :: RequestImpactStatistics -> RequestImpactStatistics -> Bool
== :: RequestImpactStatistics -> RequestImpactStatistics -> Bool
$c== :: RequestImpactStatistics -> RequestImpactStatistics -> Bool
Prelude.Eq, ReadPrec [RequestImpactStatistics]
ReadPrec RequestImpactStatistics
Int -> ReadS RequestImpactStatistics
ReadS [RequestImpactStatistics]
(Int -> ReadS RequestImpactStatistics)
-> ReadS [RequestImpactStatistics]
-> ReadPrec RequestImpactStatistics
-> ReadPrec [RequestImpactStatistics]
-> Read RequestImpactStatistics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RequestImpactStatistics]
$creadListPrec :: ReadPrec [RequestImpactStatistics]
readPrec :: ReadPrec RequestImpactStatistics
$creadPrec :: ReadPrec RequestImpactStatistics
readList :: ReadS [RequestImpactStatistics]
$creadList :: ReadS [RequestImpactStatistics]
readsPrec :: Int -> ReadS RequestImpactStatistics
$creadsPrec :: Int -> ReadS RequestImpactStatistics
Prelude.Read, Int -> RequestImpactStatistics -> ShowS
[RequestImpactStatistics] -> ShowS
RequestImpactStatistics -> String
(Int -> RequestImpactStatistics -> ShowS)
-> (RequestImpactStatistics -> String)
-> ([RequestImpactStatistics] -> ShowS)
-> Show RequestImpactStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RequestImpactStatistics] -> ShowS
$cshowList :: [RequestImpactStatistics] -> ShowS
show :: RequestImpactStatistics -> String
$cshow :: RequestImpactStatistics -> String
showsPrec :: Int -> RequestImpactStatistics -> ShowS
$cshowsPrec :: Int -> RequestImpactStatistics -> ShowS
Prelude.Show, (forall x.
 RequestImpactStatistics -> Rep RequestImpactStatistics x)
-> (forall x.
    Rep RequestImpactStatistics x -> RequestImpactStatistics)
-> Generic RequestImpactStatistics
forall x. Rep RequestImpactStatistics x -> RequestImpactStatistics
forall x. RequestImpactStatistics -> Rep RequestImpactStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RequestImpactStatistics x -> RequestImpactStatistics
$cfrom :: forall x. RequestImpactStatistics -> Rep RequestImpactStatistics x
Prelude.Generic)

-- |
-- Create a value of 'RequestImpactStatistics' 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:
--
-- 'okCount', 'requestImpactStatistics_okCount' - The number of successful requests.
--
-- 'faultCount', 'requestImpactStatistics_faultCount' - The number of requests that have resulted in a fault,
--
-- 'totalCount', 'requestImpactStatistics_totalCount' - The total number of requests to the service.
newRequestImpactStatistics ::
  RequestImpactStatistics
newRequestImpactStatistics :: RequestImpactStatistics
newRequestImpactStatistics =
  RequestImpactStatistics' :: Maybe Integer
-> Maybe Integer -> Maybe Integer -> RequestImpactStatistics
RequestImpactStatistics'
    { $sel:okCount:RequestImpactStatistics' :: Maybe Integer
okCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:faultCount:RequestImpactStatistics' :: Maybe Integer
faultCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:totalCount:RequestImpactStatistics' :: Maybe Integer
totalCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of successful requests.
requestImpactStatistics_okCount :: Lens.Lens' RequestImpactStatistics (Prelude.Maybe Prelude.Integer)
requestImpactStatistics_okCount :: (Maybe Integer -> f (Maybe Integer))
-> RequestImpactStatistics -> f RequestImpactStatistics
requestImpactStatistics_okCount = (RequestImpactStatistics -> Maybe Integer)
-> (RequestImpactStatistics
    -> Maybe Integer -> RequestImpactStatistics)
-> Lens
     RequestImpactStatistics
     RequestImpactStatistics
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestImpactStatistics' {Maybe Integer
okCount :: Maybe Integer
$sel:okCount:RequestImpactStatistics' :: RequestImpactStatistics -> Maybe Integer
okCount} -> Maybe Integer
okCount) (\s :: RequestImpactStatistics
s@RequestImpactStatistics' {} Maybe Integer
a -> RequestImpactStatistics
s {$sel:okCount:RequestImpactStatistics' :: Maybe Integer
okCount = Maybe Integer
a} :: RequestImpactStatistics)

-- | The number of requests that have resulted in a fault,
requestImpactStatistics_faultCount :: Lens.Lens' RequestImpactStatistics (Prelude.Maybe Prelude.Integer)
requestImpactStatistics_faultCount :: (Maybe Integer -> f (Maybe Integer))
-> RequestImpactStatistics -> f RequestImpactStatistics
requestImpactStatistics_faultCount = (RequestImpactStatistics -> Maybe Integer)
-> (RequestImpactStatistics
    -> Maybe Integer -> RequestImpactStatistics)
-> Lens
     RequestImpactStatistics
     RequestImpactStatistics
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestImpactStatistics' {Maybe Integer
faultCount :: Maybe Integer
$sel:faultCount:RequestImpactStatistics' :: RequestImpactStatistics -> Maybe Integer
faultCount} -> Maybe Integer
faultCount) (\s :: RequestImpactStatistics
s@RequestImpactStatistics' {} Maybe Integer
a -> RequestImpactStatistics
s {$sel:faultCount:RequestImpactStatistics' :: Maybe Integer
faultCount = Maybe Integer
a} :: RequestImpactStatistics)

-- | The total number of requests to the service.
requestImpactStatistics_totalCount :: Lens.Lens' RequestImpactStatistics (Prelude.Maybe Prelude.Integer)
requestImpactStatistics_totalCount :: (Maybe Integer -> f (Maybe Integer))
-> RequestImpactStatistics -> f RequestImpactStatistics
requestImpactStatistics_totalCount = (RequestImpactStatistics -> Maybe Integer)
-> (RequestImpactStatistics
    -> Maybe Integer -> RequestImpactStatistics)
-> Lens
     RequestImpactStatistics
     RequestImpactStatistics
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestImpactStatistics' {Maybe Integer
totalCount :: Maybe Integer
$sel:totalCount:RequestImpactStatistics' :: RequestImpactStatistics -> Maybe Integer
totalCount} -> Maybe Integer
totalCount) (\s :: RequestImpactStatistics
s@RequestImpactStatistics' {} Maybe Integer
a -> RequestImpactStatistics
s {$sel:totalCount:RequestImpactStatistics' :: Maybe Integer
totalCount = Maybe Integer
a} :: RequestImpactStatistics)

instance Core.FromJSON RequestImpactStatistics where
  parseJSON :: Value -> Parser RequestImpactStatistics
parseJSON =
    String
-> (Object -> Parser RequestImpactStatistics)
-> Value
-> Parser RequestImpactStatistics
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RequestImpactStatistics"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer -> Maybe Integer -> RequestImpactStatistics
RequestImpactStatistics'
            (Maybe Integer
 -> Maybe Integer -> Maybe Integer -> RequestImpactStatistics)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer -> Maybe Integer -> RequestImpactStatistics)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OkCount")
            Parser (Maybe Integer -> Maybe Integer -> RequestImpactStatistics)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> RequestImpactStatistics)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FaultCount")
            Parser (Maybe Integer -> RequestImpactStatistics)
-> Parser (Maybe Integer) -> Parser RequestImpactStatistics
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TotalCount")
      )

instance Prelude.Hashable RequestImpactStatistics

instance Prelude.NFData RequestImpactStatistics