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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 path of root cause entities found on the service.
    ResponseTimeRootCauseService -> Maybe [ResponseTimeRootCauseEntity]
entityPath :: Prelude.Maybe [ResponseTimeRootCauseEntity],
    -- | The account ID associated to the service.
    ResponseTimeRootCauseService -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | A collection of associated service names.
    ResponseTimeRootCauseService -> Maybe [Text]
names :: Prelude.Maybe [Prelude.Text],
    -- | The service name.
    ResponseTimeRootCauseService -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A Boolean value indicating if the service is inferred from the trace.
    ResponseTimeRootCauseService -> Maybe Bool
inferred :: Prelude.Maybe Prelude.Bool,
    -- | The type associated to the service.
    ResponseTimeRootCauseService -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (ResponseTimeRootCauseService
-> ResponseTimeRootCauseService -> Bool
(ResponseTimeRootCauseService
 -> ResponseTimeRootCauseService -> Bool)
-> (ResponseTimeRootCauseService
    -> ResponseTimeRootCauseService -> Bool)
-> Eq ResponseTimeRootCauseService
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]
(Int -> ReadS ResponseTimeRootCauseService)
-> ReadS [ResponseTimeRootCauseService]
-> ReadPrec ResponseTimeRootCauseService
-> ReadPrec [ResponseTimeRootCauseService]
-> Read 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
(Int -> ResponseTimeRootCauseService -> ShowS)
-> (ResponseTimeRootCauseService -> String)
-> ([ResponseTimeRootCauseService] -> ShowS)
-> Show ResponseTimeRootCauseService
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.
 ResponseTimeRootCauseService -> Rep ResponseTimeRootCauseService x)
-> (forall x.
    Rep ResponseTimeRootCauseService x -> ResponseTimeRootCauseService)
-> Generic ResponseTimeRootCauseService
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:
--
-- 'entityPath', 'responseTimeRootCauseService_entityPath' - The path of root cause entities found on the service.
--
-- 'accountId', 'responseTimeRootCauseService_accountId' - The account ID associated to the service.
--
-- 'names', 'responseTimeRootCauseService_names' - A collection of associated service names.
--
-- 'name', 'responseTimeRootCauseService_name' - The service name.
--
-- 'inferred', 'responseTimeRootCauseService_inferred' - A Boolean value indicating if the service is inferred from the trace.
--
-- 'type'', 'responseTimeRootCauseService_type' - The type associated to the service.
newResponseTimeRootCauseService ::
  ResponseTimeRootCauseService
newResponseTimeRootCauseService :: ResponseTimeRootCauseService
newResponseTimeRootCauseService =
  ResponseTimeRootCauseService' :: Maybe [ResponseTimeRootCauseEntity]
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> ResponseTimeRootCauseService
ResponseTimeRootCauseService'
    { $sel:entityPath:ResponseTimeRootCauseService' :: Maybe [ResponseTimeRootCauseEntity]
entityPath =
        Maybe [ResponseTimeRootCauseEntity]
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:ResponseTimeRootCauseService' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:names:ResponseTimeRootCauseService' :: Maybe [Text]
names = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ResponseTimeRootCauseService' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:inferred:ResponseTimeRootCauseService' :: Maybe Bool
inferred = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:type':ResponseTimeRootCauseService' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The path of root cause entities found on the service.
responseTimeRootCauseService_entityPath :: Lens.Lens' ResponseTimeRootCauseService (Prelude.Maybe [ResponseTimeRootCauseEntity])
responseTimeRootCauseService_entityPath :: (Maybe [ResponseTimeRootCauseEntity]
 -> f (Maybe [ResponseTimeRootCauseEntity]))
-> ResponseTimeRootCauseService -> f ResponseTimeRootCauseService
responseTimeRootCauseService_entityPath = (ResponseTimeRootCauseService
 -> Maybe [ResponseTimeRootCauseEntity])
-> (ResponseTimeRootCauseService
    -> Maybe [ResponseTimeRootCauseEntity]
    -> ResponseTimeRootCauseService)
-> Lens
     ResponseTimeRootCauseService
     ResponseTimeRootCauseService
     (Maybe [ResponseTimeRootCauseEntity])
     (Maybe [ResponseTimeRootCauseEntity])
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) ((Maybe [ResponseTimeRootCauseEntity]
  -> f (Maybe [ResponseTimeRootCauseEntity]))
 -> ResponseTimeRootCauseService -> f ResponseTimeRootCauseService)
-> ((Maybe [ResponseTimeRootCauseEntity]
     -> f (Maybe [ResponseTimeRootCauseEntity]))
    -> Maybe [ResponseTimeRootCauseEntity]
    -> f (Maybe [ResponseTimeRootCauseEntity]))
-> (Maybe [ResponseTimeRootCauseEntity]
    -> f (Maybe [ResponseTimeRootCauseEntity]))
-> ResponseTimeRootCauseService
-> f ResponseTimeRootCauseService
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ResponseTimeRootCauseEntity]
  [ResponseTimeRootCauseEntity]
  [ResponseTimeRootCauseEntity]
  [ResponseTimeRootCauseEntity]
-> Iso
     (Maybe [ResponseTimeRootCauseEntity])
     (Maybe [ResponseTimeRootCauseEntity])
     (Maybe [ResponseTimeRootCauseEntity])
     (Maybe [ResponseTimeRootCauseEntity])
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 AnIso
  [ResponseTimeRootCauseEntity]
  [ResponseTimeRootCauseEntity]
  [ResponseTimeRootCauseEntity]
  [ResponseTimeRootCauseEntity]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The account ID associated to the service.
responseTimeRootCauseService_accountId :: Lens.Lens' ResponseTimeRootCauseService (Prelude.Maybe Prelude.Text)
responseTimeRootCauseService_accountId :: (Maybe Text -> f (Maybe Text))
-> ResponseTimeRootCauseService -> f ResponseTimeRootCauseService
responseTimeRootCauseService_accountId = (ResponseTimeRootCauseService -> Maybe Text)
-> (ResponseTimeRootCauseService
    -> Maybe Text -> ResponseTimeRootCauseService)
-> Lens
     ResponseTimeRootCauseService
     ResponseTimeRootCauseService
     (Maybe Text)
     (Maybe Text)
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)

-- | A collection of associated service names.
responseTimeRootCauseService_names :: Lens.Lens' ResponseTimeRootCauseService (Prelude.Maybe [Prelude.Text])
responseTimeRootCauseService_names :: (Maybe [Text] -> f (Maybe [Text]))
-> ResponseTimeRootCauseService -> f ResponseTimeRootCauseService
responseTimeRootCauseService_names = (ResponseTimeRootCauseService -> Maybe [Text])
-> (ResponseTimeRootCauseService
    -> Maybe [Text] -> ResponseTimeRootCauseService)
-> Lens
     ResponseTimeRootCauseService
     ResponseTimeRootCauseService
     (Maybe [Text])
     (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> ResponseTimeRootCauseService -> f ResponseTimeRootCauseService)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ResponseTimeRootCauseService
-> f ResponseTimeRootCauseService
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The service name.
responseTimeRootCauseService_name :: Lens.Lens' ResponseTimeRootCauseService (Prelude.Maybe Prelude.Text)
responseTimeRootCauseService_name :: (Maybe Text -> f (Maybe Text))
-> ResponseTimeRootCauseService -> f ResponseTimeRootCauseService
responseTimeRootCauseService_name = (ResponseTimeRootCauseService -> Maybe Text)
-> (ResponseTimeRootCauseService
    -> Maybe Text -> ResponseTimeRootCauseService)
-> Lens
     ResponseTimeRootCauseService
     ResponseTimeRootCauseService
     (Maybe Text)
     (Maybe Text)
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 Boolean value indicating if the service is inferred from the trace.
responseTimeRootCauseService_inferred :: Lens.Lens' ResponseTimeRootCauseService (Prelude.Maybe Prelude.Bool)
responseTimeRootCauseService_inferred :: (Maybe Bool -> f (Maybe Bool))
-> ResponseTimeRootCauseService -> f ResponseTimeRootCauseService
responseTimeRootCauseService_inferred = (ResponseTimeRootCauseService -> Maybe Bool)
-> (ResponseTimeRootCauseService
    -> Maybe Bool -> ResponseTimeRootCauseService)
-> Lens
     ResponseTimeRootCauseService
     ResponseTimeRootCauseService
     (Maybe Bool)
     (Maybe Bool)
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 type associated to the service.
responseTimeRootCauseService_type :: Lens.Lens' ResponseTimeRootCauseService (Prelude.Maybe Prelude.Text)
responseTimeRootCauseService_type :: (Maybe Text -> f (Maybe Text))
-> ResponseTimeRootCauseService -> f ResponseTimeRootCauseService
responseTimeRootCauseService_type = (ResponseTimeRootCauseService -> Maybe Text)
-> (ResponseTimeRootCauseService
    -> Maybe Text -> ResponseTimeRootCauseService)
-> Lens
     ResponseTimeRootCauseService
     ResponseTimeRootCauseService
     (Maybe Text)
     (Maybe Text)
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 Core.FromJSON ResponseTimeRootCauseService where
  parseJSON :: Value -> Parser ResponseTimeRootCauseService
parseJSON =
    String
-> (Object -> Parser ResponseTimeRootCauseService)
-> Value
-> Parser ResponseTimeRootCauseService
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResponseTimeRootCauseService"
      ( \Object
x ->
          Maybe [ResponseTimeRootCauseEntity]
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> ResponseTimeRootCauseService
ResponseTimeRootCauseService'
            (Maybe [ResponseTimeRootCauseEntity]
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> ResponseTimeRootCauseService)
-> Parser (Maybe [ResponseTimeRootCauseEntity])
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> ResponseTimeRootCauseService)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe (Maybe [ResponseTimeRootCauseEntity]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EntityPath" Parser (Maybe (Maybe [ResponseTimeRootCauseEntity]))
-> Maybe [ResponseTimeRootCauseEntity]
-> Parser (Maybe [ResponseTimeRootCauseEntity])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ResponseTimeRootCauseEntity]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> ResponseTimeRootCauseService)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> ResponseTimeRootCauseService)
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
"AccountId")
            Parser
  (Maybe [Text]
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> ResponseTimeRootCauseService)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe Bool -> Maybe Text -> ResponseTimeRootCauseService)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Names" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Bool -> Maybe Text -> ResponseTimeRootCauseService)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool -> Maybe Text -> ResponseTimeRootCauseService)
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
"Name")
            Parser (Maybe Bool -> Maybe Text -> ResponseTimeRootCauseService)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> ResponseTimeRootCauseService)
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
"Inferred")
            Parser (Maybe Text -> ResponseTimeRootCauseService)
-> Parser (Maybe Text) -> Parser ResponseTimeRootCauseService
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
"Type")
      )

instance
  Prelude.Hashable
    ResponseTimeRootCauseService

instance Prelude.NFData ResponseTimeRootCauseService