{-# 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.ResponseTimeRootCauseEntity
-- 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.ResponseTimeRootCauseEntity 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

-- | A collection of segments and corresponding subsegments associated to a
-- response time warning.
--
-- /See:/ 'newResponseTimeRootCauseEntity' smart constructor.
data ResponseTimeRootCauseEntity = ResponseTimeRootCauseEntity'
  { -- | The type and messages of the exceptions.
    ResponseTimeRootCauseEntity -> Maybe Double
coverage :: Prelude.Maybe Prelude.Double,
    -- | The name of the entity.
    ResponseTimeRootCauseEntity -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A flag that denotes a remote subsegment.
    ResponseTimeRootCauseEntity -> Maybe Bool
remote :: Prelude.Maybe Prelude.Bool
  }
  deriving (ResponseTimeRootCauseEntity -> ResponseTimeRootCauseEntity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResponseTimeRootCauseEntity -> ResponseTimeRootCauseEntity -> Bool
$c/= :: ResponseTimeRootCauseEntity -> ResponseTimeRootCauseEntity -> Bool
== :: ResponseTimeRootCauseEntity -> ResponseTimeRootCauseEntity -> Bool
$c== :: ResponseTimeRootCauseEntity -> ResponseTimeRootCauseEntity -> Bool
Prelude.Eq, ReadPrec [ResponseTimeRootCauseEntity]
ReadPrec ResponseTimeRootCauseEntity
Int -> ReadS ResponseTimeRootCauseEntity
ReadS [ResponseTimeRootCauseEntity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResponseTimeRootCauseEntity]
$creadListPrec :: ReadPrec [ResponseTimeRootCauseEntity]
readPrec :: ReadPrec ResponseTimeRootCauseEntity
$creadPrec :: ReadPrec ResponseTimeRootCauseEntity
readList :: ReadS [ResponseTimeRootCauseEntity]
$creadList :: ReadS [ResponseTimeRootCauseEntity]
readsPrec :: Int -> ReadS ResponseTimeRootCauseEntity
$creadsPrec :: Int -> ReadS ResponseTimeRootCauseEntity
Prelude.Read, Int -> ResponseTimeRootCauseEntity -> ShowS
[ResponseTimeRootCauseEntity] -> ShowS
ResponseTimeRootCauseEntity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResponseTimeRootCauseEntity] -> ShowS
$cshowList :: [ResponseTimeRootCauseEntity] -> ShowS
show :: ResponseTimeRootCauseEntity -> String
$cshow :: ResponseTimeRootCauseEntity -> String
showsPrec :: Int -> ResponseTimeRootCauseEntity -> ShowS
$cshowsPrec :: Int -> ResponseTimeRootCauseEntity -> ShowS
Prelude.Show, forall x.
Rep ResponseTimeRootCauseEntity x -> ResponseTimeRootCauseEntity
forall x.
ResponseTimeRootCauseEntity -> Rep ResponseTimeRootCauseEntity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResponseTimeRootCauseEntity x -> ResponseTimeRootCauseEntity
$cfrom :: forall x.
ResponseTimeRootCauseEntity -> Rep ResponseTimeRootCauseEntity x
Prelude.Generic)

-- |
-- Create a value of 'ResponseTimeRootCauseEntity' 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:
--
-- 'coverage', 'responseTimeRootCauseEntity_coverage' - The type and messages of the exceptions.
--
-- 'name', 'responseTimeRootCauseEntity_name' - The name of the entity.
--
-- 'remote', 'responseTimeRootCauseEntity_remote' - A flag that denotes a remote subsegment.
newResponseTimeRootCauseEntity ::
  ResponseTimeRootCauseEntity
newResponseTimeRootCauseEntity :: ResponseTimeRootCauseEntity
newResponseTimeRootCauseEntity =
  ResponseTimeRootCauseEntity'
    { $sel:coverage:ResponseTimeRootCauseEntity' :: Maybe Double
coverage =
        forall a. Maybe a
Prelude.Nothing,
      $sel:name:ResponseTimeRootCauseEntity' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:remote:ResponseTimeRootCauseEntity' :: Maybe Bool
remote = forall a. Maybe a
Prelude.Nothing
    }

-- | The type and messages of the exceptions.
responseTimeRootCauseEntity_coverage :: Lens.Lens' ResponseTimeRootCauseEntity (Prelude.Maybe Prelude.Double)
responseTimeRootCauseEntity_coverage :: Lens' ResponseTimeRootCauseEntity (Maybe Double)
responseTimeRootCauseEntity_coverage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseTimeRootCauseEntity' {Maybe Double
coverage :: Maybe Double
$sel:coverage:ResponseTimeRootCauseEntity' :: ResponseTimeRootCauseEntity -> Maybe Double
coverage} -> Maybe Double
coverage) (\s :: ResponseTimeRootCauseEntity
s@ResponseTimeRootCauseEntity' {} Maybe Double
a -> ResponseTimeRootCauseEntity
s {$sel:coverage:ResponseTimeRootCauseEntity' :: Maybe Double
coverage = Maybe Double
a} :: ResponseTimeRootCauseEntity)

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

-- | A flag that denotes a remote subsegment.
responseTimeRootCauseEntity_remote :: Lens.Lens' ResponseTimeRootCauseEntity (Prelude.Maybe Prelude.Bool)
responseTimeRootCauseEntity_remote :: Lens' ResponseTimeRootCauseEntity (Maybe Bool)
responseTimeRootCauseEntity_remote = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseTimeRootCauseEntity' {Maybe Bool
remote :: Maybe Bool
$sel:remote:ResponseTimeRootCauseEntity' :: ResponseTimeRootCauseEntity -> Maybe Bool
remote} -> Maybe Bool
remote) (\s :: ResponseTimeRootCauseEntity
s@ResponseTimeRootCauseEntity' {} Maybe Bool
a -> ResponseTimeRootCauseEntity
s {$sel:remote:ResponseTimeRootCauseEntity' :: Maybe Bool
remote = Maybe Bool
a} :: ResponseTimeRootCauseEntity)

instance Data.FromJSON ResponseTimeRootCauseEntity where
  parseJSON :: Value -> Parser ResponseTimeRootCauseEntity
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResponseTimeRootCauseEntity"
      ( \Object
x ->
          Maybe Double
-> Maybe Text -> Maybe Bool -> ResponseTimeRootCauseEntity
ResponseTimeRootCauseEntity'
            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
"Coverage")
            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
"Name")
            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
"Remote")
      )

instance Prelude.Hashable ResponseTimeRootCauseEntity where
  hashWithSalt :: Int -> ResponseTimeRootCauseEntity -> Int
hashWithSalt Int
_salt ResponseTimeRootCauseEntity' {Maybe Bool
Maybe Double
Maybe Text
remote :: Maybe Bool
name :: Maybe Text
coverage :: Maybe Double
$sel:remote:ResponseTimeRootCauseEntity' :: ResponseTimeRootCauseEntity -> Maybe Bool
$sel:name:ResponseTimeRootCauseEntity' :: ResponseTimeRootCauseEntity -> Maybe Text
$sel:coverage:ResponseTimeRootCauseEntity' :: ResponseTimeRootCauseEntity -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
coverage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
remote

instance Prelude.NFData ResponseTimeRootCauseEntity where
  rnf :: ResponseTimeRootCauseEntity -> ()
rnf ResponseTimeRootCauseEntity' {Maybe Bool
Maybe Double
Maybe Text
remote :: Maybe Bool
name :: Maybe Text
coverage :: Maybe Double
$sel:remote:ResponseTimeRootCauseEntity' :: ResponseTimeRootCauseEntity -> Maybe Bool
$sel:name:ResponseTimeRootCauseEntity' :: ResponseTimeRootCauseEntity -> Maybe Text
$sel:coverage:ResponseTimeRootCauseEntity' :: ResponseTimeRootCauseEntity -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
coverage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
remote