{-# 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.ResponseTimeRootCauseService
-- 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.ResponseTimeRootCauseService 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
import Amazonka.XRay.Types.ResponseTimeRootCauseEntity

-- | A collection of fields identifying the service in a response time
-- warning.
--
-- /See:/ 'newResponseTimeRootCauseService' smart constructor.
data ResponseTimeRootCauseService = ResponseTimeRootCauseService'
  { -- | The account ID associated to the service.
    ResponseTimeRootCauseService -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The path of root cause entities found on the service.
    ResponseTimeRootCauseService -> Maybe [ResponseTimeRootCauseEntity]
entityPath :: Prelude.Maybe [ResponseTimeRootCauseEntity],
    -- | A Boolean value indicating if the service is inferred from the trace.
    ResponseTimeRootCauseService -> Maybe Bool
inferred :: Prelude.Maybe Prelude.Bool,
    -- | The service name.
    ResponseTimeRootCauseService -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A collection of associated service names.
    ResponseTimeRootCauseService -> Maybe [Text]
names :: Prelude.Maybe [Prelude.Text],
    -- | The type associated to the service.
    ResponseTimeRootCauseService -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (ResponseTimeRootCauseService
-> ResponseTimeRootCauseService -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResponseTimeRootCauseService
-> ResponseTimeRootCauseService -> Bool
$c/= :: ResponseTimeRootCauseService
-> ResponseTimeRootCauseService -> Bool
== :: ResponseTimeRootCauseService
-> ResponseTimeRootCauseService -> Bool
$c== :: ResponseTimeRootCauseService
-> ResponseTimeRootCauseService -> Bool
Prelude.Eq, ReadPrec [ResponseTimeRootCauseService]
ReadPrec ResponseTimeRootCauseService
Int -> ReadS ResponseTimeRootCauseService
ReadS [ResponseTimeRootCauseService]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResponseTimeRootCauseService]
$creadListPrec :: ReadPrec [ResponseTimeRootCauseService]
readPrec :: ReadPrec ResponseTimeRootCauseService
$creadPrec :: ReadPrec ResponseTimeRootCauseService
readList :: ReadS [ResponseTimeRootCauseService]
$creadList :: ReadS [ResponseTimeRootCauseService]
readsPrec :: Int -> ReadS ResponseTimeRootCauseService
$creadsPrec :: Int -> ReadS ResponseTimeRootCauseService
Prelude.Read, Int -> ResponseTimeRootCauseService -> ShowS
[ResponseTimeRootCauseService] -> ShowS
ResponseTimeRootCauseService -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResponseTimeRootCauseService] -> ShowS
$cshowList :: [ResponseTimeRootCauseService] -> ShowS
show :: ResponseTimeRootCauseService -> String
$cshow :: ResponseTimeRootCauseService -> String
showsPrec :: Int -> ResponseTimeRootCauseService -> ShowS
$cshowsPrec :: Int -> ResponseTimeRootCauseService -> ShowS
Prelude.Show, forall x.
Rep ResponseTimeRootCauseService x -> ResponseTimeRootCauseService
forall x.
ResponseTimeRootCauseService -> Rep ResponseTimeRootCauseService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResponseTimeRootCauseService x -> ResponseTimeRootCauseService
$cfrom :: forall x.
ResponseTimeRootCauseService -> Rep ResponseTimeRootCauseService x
Prelude.Generic)

-- |
-- Create a value of 'ResponseTimeRootCauseService' 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:
--
-- 'accountId', 'responseTimeRootCauseService_accountId' - The account ID associated to the service.
--
-- 'entityPath', 'responseTimeRootCauseService_entityPath' - The path of root cause entities found on the service.
--
-- 'inferred', 'responseTimeRootCauseService_inferred' - A Boolean value indicating if the service is inferred from the trace.
--
-- 'name', 'responseTimeRootCauseService_name' - The service name.
--
-- 'names', 'responseTimeRootCauseService_names' - A collection of associated service names.
--
-- 'type'', 'responseTimeRootCauseService_type' - The type associated to the service.
newResponseTimeRootCauseService ::
  ResponseTimeRootCauseService
newResponseTimeRootCauseService :: ResponseTimeRootCauseService
newResponseTimeRootCauseService =
  ResponseTimeRootCauseService'
    { $sel:accountId:ResponseTimeRootCauseService' :: Maybe Text
accountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:entityPath:ResponseTimeRootCauseService' :: Maybe [ResponseTimeRootCauseEntity]
entityPath = forall a. Maybe a
Prelude.Nothing,
      $sel:inferred:ResponseTimeRootCauseService' :: Maybe Bool
inferred = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ResponseTimeRootCauseService' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:names:ResponseTimeRootCauseService' :: Maybe [Text]
names = forall a. Maybe a
Prelude.Nothing,
      $sel:type':ResponseTimeRootCauseService' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The account ID associated to the service.
responseTimeRootCauseService_accountId :: Lens.Lens' ResponseTimeRootCauseService (Prelude.Maybe Prelude.Text)
responseTimeRootCauseService_accountId :: Lens' ResponseTimeRootCauseService (Maybe Text)
responseTimeRootCauseService_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseTimeRootCauseService' {Maybe Text
accountId :: Maybe Text
$sel:accountId:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: ResponseTimeRootCauseService
s@ResponseTimeRootCauseService' {} Maybe Text
a -> ResponseTimeRootCauseService
s {$sel:accountId:ResponseTimeRootCauseService' :: Maybe Text
accountId = Maybe Text
a} :: ResponseTimeRootCauseService)

-- | The path of root cause entities found on the service.
responseTimeRootCauseService_entityPath :: Lens.Lens' ResponseTimeRootCauseService (Prelude.Maybe [ResponseTimeRootCauseEntity])
responseTimeRootCauseService_entityPath :: Lens'
  ResponseTimeRootCauseService (Maybe [ResponseTimeRootCauseEntity])
responseTimeRootCauseService_entityPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseTimeRootCauseService' {Maybe [ResponseTimeRootCauseEntity]
entityPath :: Maybe [ResponseTimeRootCauseEntity]
$sel:entityPath:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe [ResponseTimeRootCauseEntity]
entityPath} -> Maybe [ResponseTimeRootCauseEntity]
entityPath) (\s :: ResponseTimeRootCauseService
s@ResponseTimeRootCauseService' {} Maybe [ResponseTimeRootCauseEntity]
a -> ResponseTimeRootCauseService
s {$sel:entityPath:ResponseTimeRootCauseService' :: Maybe [ResponseTimeRootCauseEntity]
entityPath = Maybe [ResponseTimeRootCauseEntity]
a} :: ResponseTimeRootCauseService) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A Boolean value indicating if the service is inferred from the trace.
responseTimeRootCauseService_inferred :: Lens.Lens' ResponseTimeRootCauseService (Prelude.Maybe Prelude.Bool)
responseTimeRootCauseService_inferred :: Lens' ResponseTimeRootCauseService (Maybe Bool)
responseTimeRootCauseService_inferred = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseTimeRootCauseService' {Maybe Bool
inferred :: Maybe Bool
$sel:inferred:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe Bool
inferred} -> Maybe Bool
inferred) (\s :: ResponseTimeRootCauseService
s@ResponseTimeRootCauseService' {} Maybe Bool
a -> ResponseTimeRootCauseService
s {$sel:inferred:ResponseTimeRootCauseService' :: Maybe Bool
inferred = Maybe Bool
a} :: ResponseTimeRootCauseService)

-- | The service name.
responseTimeRootCauseService_name :: Lens.Lens' ResponseTimeRootCauseService (Prelude.Maybe Prelude.Text)
responseTimeRootCauseService_name :: Lens' ResponseTimeRootCauseService (Maybe Text)
responseTimeRootCauseService_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseTimeRootCauseService' {Maybe Text
name :: Maybe Text
$sel:name:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe Text
name} -> Maybe Text
name) (\s :: ResponseTimeRootCauseService
s@ResponseTimeRootCauseService' {} Maybe Text
a -> ResponseTimeRootCauseService
s {$sel:name:ResponseTimeRootCauseService' :: Maybe Text
name = Maybe Text
a} :: ResponseTimeRootCauseService)

-- | A collection of associated service names.
responseTimeRootCauseService_names :: Lens.Lens' ResponseTimeRootCauseService (Prelude.Maybe [Prelude.Text])
responseTimeRootCauseService_names :: Lens' ResponseTimeRootCauseService (Maybe [Text])
responseTimeRootCauseService_names = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseTimeRootCauseService' {Maybe [Text]
names :: Maybe [Text]
$sel:names:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe [Text]
names} -> Maybe [Text]
names) (\s :: ResponseTimeRootCauseService
s@ResponseTimeRootCauseService' {} Maybe [Text]
a -> ResponseTimeRootCauseService
s {$sel:names:ResponseTimeRootCauseService' :: Maybe [Text]
names = Maybe [Text]
a} :: ResponseTimeRootCauseService) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The type associated to the service.
responseTimeRootCauseService_type :: Lens.Lens' ResponseTimeRootCauseService (Prelude.Maybe Prelude.Text)
responseTimeRootCauseService_type :: Lens' ResponseTimeRootCauseService (Maybe Text)
responseTimeRootCauseService_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseTimeRootCauseService' {Maybe Text
type' :: Maybe Text
$sel:type':ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe Text
type'} -> Maybe Text
type') (\s :: ResponseTimeRootCauseService
s@ResponseTimeRootCauseService' {} Maybe Text
a -> ResponseTimeRootCauseService
s {$sel:type':ResponseTimeRootCauseService' :: Maybe Text
type' = Maybe Text
a} :: ResponseTimeRootCauseService)

instance Data.FromJSON ResponseTimeRootCauseService where
  parseJSON :: Value -> Parser ResponseTimeRootCauseService
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResponseTimeRootCauseService"
      ( \Object
x ->
          Maybe Text
-> Maybe [ResponseTimeRootCauseEntity]
-> Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> ResponseTimeRootCauseService
ResponseTimeRootCauseService'
            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
"AccountId")
            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
"EntityPath" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"Inferred")
            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
"Names" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"Type")
      )

instance
  Prelude.Hashable
    ResponseTimeRootCauseService
  where
  hashWithSalt :: Int -> ResponseTimeRootCauseService -> Int
hashWithSalt Int
_salt ResponseTimeRootCauseService' {Maybe Bool
Maybe [Text]
Maybe [ResponseTimeRootCauseEntity]
Maybe Text
type' :: Maybe Text
names :: Maybe [Text]
name :: Maybe Text
inferred :: Maybe Bool
entityPath :: Maybe [ResponseTimeRootCauseEntity]
accountId :: Maybe Text
$sel:type':ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe Text
$sel:names:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe [Text]
$sel:name:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe Text
$sel:inferred:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe Bool
$sel:entityPath:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe [ResponseTimeRootCauseEntity]
$sel:accountId:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ResponseTimeRootCauseEntity]
entityPath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
inferred
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
names
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
type'

instance Prelude.NFData ResponseTimeRootCauseService where
  rnf :: ResponseTimeRootCauseService -> ()
rnf ResponseTimeRootCauseService' {Maybe Bool
Maybe [Text]
Maybe [ResponseTimeRootCauseEntity]
Maybe Text
type' :: Maybe Text
names :: Maybe [Text]
name :: Maybe Text
inferred :: Maybe Bool
entityPath :: Maybe [ResponseTimeRootCauseEntity]
accountId :: Maybe Text
$sel:type':ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe Text
$sel:names:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe [Text]
$sel:name:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe Text
$sel:inferred:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe Bool
$sel:entityPath:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe [ResponseTimeRootCauseEntity]
$sel:accountId:ResponseTimeRootCauseService' :: ResponseTimeRootCauseService -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ResponseTimeRootCauseEntity]
entityPath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
inferred
      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 [Text]
names
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
type'