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

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

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

-- | The path of root cause entities found on the service.
errorRootCauseService_entityPath :: Lens.Lens' ErrorRootCauseService (Prelude.Maybe [ErrorRootCauseEntity])
errorRootCauseService_entityPath :: Lens' ErrorRootCauseService (Maybe [ErrorRootCauseEntity])
errorRootCauseService_entityPath = 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) 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.
errorRootCauseService_inferred :: Lens.Lens' ErrorRootCauseService (Prelude.Maybe Prelude.Bool)
errorRootCauseService_inferred :: Lens' ErrorRootCauseService (Maybe Bool)
errorRootCauseService_inferred = 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 service name.
errorRootCauseService_name :: Lens.Lens' ErrorRootCauseService (Prelude.Maybe Prelude.Text)
errorRootCauseService_name :: Lens' ErrorRootCauseService (Maybe Text)
errorRootCauseService_name = 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 collection of associated service names.
errorRootCauseService_names :: Lens.Lens' ErrorRootCauseService (Prelude.Maybe [Prelude.Text])
errorRootCauseService_names :: Lens' ErrorRootCauseService (Maybe [Text])
errorRootCauseService_names = 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) 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.
errorRootCauseService_type :: Lens.Lens' ErrorRootCauseService (Prelude.Maybe Prelude.Text)
errorRootCauseService_type :: Lens' ErrorRootCauseService (Maybe Text)
errorRootCauseService_type = 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 Data.FromJSON ErrorRootCauseService where
  parseJSON :: Value -> Parser ErrorRootCauseService
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ErrorRootCauseService"
      ( \Object
x ->
          Maybe Text
-> Maybe [ErrorRootCauseEntity]
-> Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> ErrorRootCauseService
ErrorRootCauseService'
            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 ErrorRootCauseService where
  hashWithSalt :: Int -> ErrorRootCauseService -> Int
hashWithSalt Int
_salt ErrorRootCauseService' {Maybe Bool
Maybe [Text]
Maybe [ErrorRootCauseEntity]
Maybe Text
type' :: Maybe Text
names :: Maybe [Text]
name :: Maybe Text
inferred :: Maybe Bool
entityPath :: Maybe [ErrorRootCauseEntity]
accountId :: Maybe Text
$sel:type':ErrorRootCauseService' :: ErrorRootCauseService -> Maybe Text
$sel:names:ErrorRootCauseService' :: ErrorRootCauseService -> Maybe [Text]
$sel:name:ErrorRootCauseService' :: ErrorRootCauseService -> Maybe Text
$sel:inferred:ErrorRootCauseService' :: ErrorRootCauseService -> Maybe Bool
$sel:entityPath:ErrorRootCauseService' :: ErrorRootCauseService -> Maybe [ErrorRootCauseEntity]
$sel:accountId:ErrorRootCauseService' :: ErrorRootCauseService -> 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 [ErrorRootCauseEntity]
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 ErrorRootCauseService where
  rnf :: ErrorRootCauseService -> ()
rnf ErrorRootCauseService' {Maybe Bool
Maybe [Text]
Maybe [ErrorRootCauseEntity]
Maybe Text
type' :: Maybe Text
names :: Maybe [Text]
name :: Maybe Text
inferred :: Maybe Bool
entityPath :: Maybe [ErrorRootCauseEntity]
accountId :: Maybe Text
$sel:type':ErrorRootCauseService' :: ErrorRootCauseService -> Maybe Text
$sel:names:ErrorRootCauseService' :: ErrorRootCauseService -> Maybe [Text]
$sel:name:ErrorRootCauseService' :: ErrorRootCauseService -> Maybe Text
$sel:inferred:ErrorRootCauseService' :: ErrorRootCauseService -> Maybe Bool
$sel:entityPath:ErrorRootCauseService' :: ErrorRootCauseService -> Maybe [ErrorRootCauseEntity]
$sel:accountId:ErrorRootCauseService' :: ErrorRootCauseService -> 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 [ErrorRootCauseEntity]
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'