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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.XRay.Types.ErrorRootCauseEntity

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

-- |
-- Create a value of 'ErrorRootCauseService' 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', 'errorRootCauseService_entityPath' - The path of root cause entities found on the service.
--
-- 'accountId', 'errorRootCauseService_accountId' - The account ID associated to the service.
--
-- 'names', 'errorRootCauseService_names' - A collection of associated service names.
--
-- 'name', 'errorRootCauseService_name' - The service name.
--
-- 'inferred', 'errorRootCauseService_inferred' - A Boolean value indicating if the service is inferred from the trace.
--
-- 'type'', 'errorRootCauseService_type' - The type associated to the service.
newErrorRootCauseService ::
  ErrorRootCauseService
newErrorRootCauseService :: ErrorRootCauseService
newErrorRootCauseService =
  ErrorRootCauseService' :: Maybe [ErrorRootCauseEntity]
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> ErrorRootCauseService
ErrorRootCauseService'
    { $sel:entityPath:ErrorRootCauseService' :: Maybe [ErrorRootCauseEntity]
entityPath =
        Maybe [ErrorRootCauseEntity]
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:ErrorRootCauseService' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:names:ErrorRootCauseService' :: Maybe [Text]
names = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ErrorRootCauseService' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:inferred:ErrorRootCauseService' :: Maybe Bool
inferred = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:type':ErrorRootCauseService' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The path of root cause entities found on the service.
errorRootCauseService_entityPath :: Lens.Lens' ErrorRootCauseService (Prelude.Maybe [ErrorRootCauseEntity])
errorRootCauseService_entityPath :: (Maybe [ErrorRootCauseEntity] -> f (Maybe [ErrorRootCauseEntity]))
-> ErrorRootCauseService -> f ErrorRootCauseService
errorRootCauseService_entityPath = (ErrorRootCauseService -> Maybe [ErrorRootCauseEntity])
-> (ErrorRootCauseService
    -> Maybe [ErrorRootCauseEntity] -> ErrorRootCauseService)
-> Lens
     ErrorRootCauseService
     ErrorRootCauseService
     (Maybe [ErrorRootCauseEntity])
     (Maybe [ErrorRootCauseEntity])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ErrorRootCauseService' {Maybe [ErrorRootCauseEntity]
entityPath :: Maybe [ErrorRootCauseEntity]
$sel:entityPath:ErrorRootCauseService' :: ErrorRootCauseService -> Maybe [ErrorRootCauseEntity]
entityPath} -> Maybe [ErrorRootCauseEntity]
entityPath) (\s :: ErrorRootCauseService
s@ErrorRootCauseService' {} Maybe [ErrorRootCauseEntity]
a -> ErrorRootCauseService
s {$sel:entityPath:ErrorRootCauseService' :: Maybe [ErrorRootCauseEntity]
entityPath = Maybe [ErrorRootCauseEntity]
a} :: ErrorRootCauseService) ((Maybe [ErrorRootCauseEntity] -> f (Maybe [ErrorRootCauseEntity]))
 -> ErrorRootCauseService -> f ErrorRootCauseService)
-> ((Maybe [ErrorRootCauseEntity]
     -> f (Maybe [ErrorRootCauseEntity]))
    -> Maybe [ErrorRootCauseEntity]
    -> f (Maybe [ErrorRootCauseEntity]))
-> (Maybe [ErrorRootCauseEntity]
    -> f (Maybe [ErrorRootCauseEntity]))
-> ErrorRootCauseService
-> f ErrorRootCauseService
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ErrorRootCauseEntity]
  [ErrorRootCauseEntity]
  [ErrorRootCauseEntity]
  [ErrorRootCauseEntity]
-> Iso
     (Maybe [ErrorRootCauseEntity])
     (Maybe [ErrorRootCauseEntity])
     (Maybe [ErrorRootCauseEntity])
     (Maybe [ErrorRootCauseEntity])
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
  [ErrorRootCauseEntity]
  [ErrorRootCauseEntity]
  [ErrorRootCauseEntity]
  [ErrorRootCauseEntity]
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.
errorRootCauseService_accountId :: Lens.Lens' ErrorRootCauseService (Prelude.Maybe Prelude.Text)
errorRootCauseService_accountId :: (Maybe Text -> f (Maybe Text))
-> ErrorRootCauseService -> f ErrorRootCauseService
errorRootCauseService_accountId = (ErrorRootCauseService -> Maybe Text)
-> (ErrorRootCauseService -> Maybe Text -> ErrorRootCauseService)
-> Lens
     ErrorRootCauseService
     ErrorRootCauseService
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ErrorRootCauseService' {Maybe Text
accountId :: Maybe Text
$sel:accountId:ErrorRootCauseService' :: ErrorRootCauseService -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: ErrorRootCauseService
s@ErrorRootCauseService' {} Maybe Text
a -> ErrorRootCauseService
s {$sel:accountId:ErrorRootCauseService' :: Maybe Text
accountId = Maybe Text
a} :: ErrorRootCauseService)

-- | A collection of associated service names.
errorRootCauseService_names :: Lens.Lens' ErrorRootCauseService (Prelude.Maybe [Prelude.Text])
errorRootCauseService_names :: (Maybe [Text] -> f (Maybe [Text]))
-> ErrorRootCauseService -> f ErrorRootCauseService
errorRootCauseService_names = (ErrorRootCauseService -> Maybe [Text])
-> (ErrorRootCauseService -> Maybe [Text] -> ErrorRootCauseService)
-> Lens
     ErrorRootCauseService
     ErrorRootCauseService
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ErrorRootCauseService' {Maybe [Text]
names :: Maybe [Text]
$sel:names:ErrorRootCauseService' :: ErrorRootCauseService -> Maybe [Text]
names} -> Maybe [Text]
names) (\s :: ErrorRootCauseService
s@ErrorRootCauseService' {} Maybe [Text]
a -> ErrorRootCauseService
s {$sel:names:ErrorRootCauseService' :: Maybe [Text]
names = Maybe [Text]
a} :: ErrorRootCauseService) ((Maybe [Text] -> f (Maybe [Text]))
 -> ErrorRootCauseService -> f ErrorRootCauseService)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ErrorRootCauseService
-> f ErrorRootCauseService
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.
errorRootCauseService_name :: Lens.Lens' ErrorRootCauseService (Prelude.Maybe Prelude.Text)
errorRootCauseService_name :: (Maybe Text -> f (Maybe Text))
-> ErrorRootCauseService -> f ErrorRootCauseService
errorRootCauseService_name = (ErrorRootCauseService -> Maybe Text)
-> (ErrorRootCauseService -> Maybe Text -> ErrorRootCauseService)
-> Lens
     ErrorRootCauseService
     ErrorRootCauseService
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ErrorRootCauseService' {Maybe Text
name :: Maybe Text
$sel:name:ErrorRootCauseService' :: ErrorRootCauseService -> Maybe Text
name} -> Maybe Text
name) (\s :: ErrorRootCauseService
s@ErrorRootCauseService' {} Maybe Text
a -> ErrorRootCauseService
s {$sel:name:ErrorRootCauseService' :: Maybe Text
name = Maybe Text
a} :: ErrorRootCauseService)

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

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

instance Core.FromJSON ErrorRootCauseService where
  parseJSON :: Value -> Parser ErrorRootCauseService
parseJSON =
    String
-> (Object -> Parser ErrorRootCauseService)
-> Value
-> Parser ErrorRootCauseService
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ErrorRootCauseService"
      ( \Object
x ->
          Maybe [ErrorRootCauseEntity]
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> ErrorRootCauseService
ErrorRootCauseService'
            (Maybe [ErrorRootCauseEntity]
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> ErrorRootCauseService)
-> Parser (Maybe [ErrorRootCauseEntity])
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> ErrorRootCauseService)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [ErrorRootCauseEntity]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EntityPath" Parser (Maybe (Maybe [ErrorRootCauseEntity]))
-> Maybe [ErrorRootCauseEntity]
-> Parser (Maybe [ErrorRootCauseEntity])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ErrorRootCauseEntity]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> ErrorRootCauseService)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Text -> Maybe Bool -> Maybe Text -> ErrorRootCauseService)
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 -> ErrorRootCauseService)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text -> Maybe Bool -> Maybe Text -> ErrorRootCauseService)
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 -> ErrorRootCauseService)
-> Parser (Maybe Text)
-> Parser (Maybe Bool -> Maybe Text -> ErrorRootCauseService)
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 -> ErrorRootCauseService)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> ErrorRootCauseService)
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 -> ErrorRootCauseService)
-> Parser (Maybe Text) -> Parser ErrorRootCauseService
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 ErrorRootCauseService

instance Prelude.NFData ErrorRootCauseService