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

-- | Statistics that describe how the incident has impacted a service.
--
-- /See:/ 'newRequestImpactStatistics' smart constructor.
data RequestImpactStatistics = RequestImpactStatistics'
  { -- | The number of requests that have resulted in a fault,
    RequestImpactStatistics -> Maybe Integer
faultCount :: Prelude.Maybe Prelude.Integer,
    -- | The number of successful requests.
    RequestImpactStatistics -> Maybe Integer
okCount :: Prelude.Maybe Prelude.Integer,
    -- | The total number of requests to the service.
    RequestImpactStatistics -> Maybe Integer
totalCount :: Prelude.Maybe Prelude.Integer
  }
  deriving (RequestImpactStatistics -> RequestImpactStatistics -> Bool
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]
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
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. 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:
--
-- 'faultCount', 'requestImpactStatistics_faultCount' - The number of requests that have resulted in a fault,
--
-- 'okCount', 'requestImpactStatistics_okCount' - The number of successful requests.
--
-- 'totalCount', 'requestImpactStatistics_totalCount' - The total number of requests to the service.
newRequestImpactStatistics ::
  RequestImpactStatistics
newRequestImpactStatistics :: RequestImpactStatistics
newRequestImpactStatistics =
  RequestImpactStatistics'
    { $sel:faultCount:RequestImpactStatistics' :: Maybe Integer
faultCount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:okCount:RequestImpactStatistics' :: Maybe Integer
okCount = forall a. Maybe a
Prelude.Nothing,
      $sel:totalCount:RequestImpactStatistics' :: Maybe Integer
totalCount = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of requests that have resulted in a fault,
requestImpactStatistics_faultCount :: Lens.Lens' RequestImpactStatistics (Prelude.Maybe Prelude.Integer)
requestImpactStatistics_faultCount :: Lens' RequestImpactStatistics (Maybe Integer)
requestImpactStatistics_faultCount = 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 number of successful requests.
requestImpactStatistics_okCount :: Lens.Lens' RequestImpactStatistics (Prelude.Maybe Prelude.Integer)
requestImpactStatistics_okCount :: Lens' RequestImpactStatistics (Maybe Integer)
requestImpactStatistics_okCount = 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 total number of requests to the service.
requestImpactStatistics_totalCount :: Lens.Lens' RequestImpactStatistics (Prelude.Maybe Prelude.Integer)
requestImpactStatistics_totalCount :: Lens' RequestImpactStatistics (Maybe Integer)
requestImpactStatistics_totalCount = 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 Data.FromJSON RequestImpactStatistics where
  parseJSON :: Value -> Parser RequestImpactStatistics
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RequestImpactStatistics"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer -> Maybe Integer -> RequestImpactStatistics
RequestImpactStatistics'
            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
"FaultCount")
            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
"OkCount")
            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
"TotalCount")
      )

instance Prelude.Hashable RequestImpactStatistics where
  hashWithSalt :: Int -> RequestImpactStatistics -> Int
hashWithSalt Int
_salt RequestImpactStatistics' {Maybe Integer
totalCount :: Maybe Integer
okCount :: Maybe Integer
faultCount :: Maybe Integer
$sel:totalCount:RequestImpactStatistics' :: RequestImpactStatistics -> Maybe Integer
$sel:okCount:RequestImpactStatistics' :: RequestImpactStatistics -> Maybe Integer
$sel:faultCount:RequestImpactStatistics' :: RequestImpactStatistics -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
faultCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
okCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
totalCount

instance Prelude.NFData RequestImpactStatistics where
  rnf :: RequestImpactStatistics -> ()
rnf RequestImpactStatistics' {Maybe Integer
totalCount :: Maybe Integer
okCount :: Maybe Integer
faultCount :: Maybe Integer
$sel:totalCount:RequestImpactStatistics' :: RequestImpactStatistics -> Maybe Integer
$sel:okCount:RequestImpactStatistics' :: RequestImpactStatistics -> Maybe Integer
$sel:faultCount:RequestImpactStatistics' :: RequestImpactStatistics -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
faultCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
okCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
totalCount