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

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

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

-- |
-- Create a value of 'FaultRootCauseService' 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', 'faultRootCauseService_entityPath' - The path of root cause entities found on the service.
--
-- 'accountId', 'faultRootCauseService_accountId' - The account ID associated to the service.
--
-- 'names', 'faultRootCauseService_names' - A collection of associated service names.
--
-- 'name', 'faultRootCauseService_name' - The service name.
--
-- 'inferred', 'faultRootCauseService_inferred' - A Boolean value indicating if the service is inferred from the trace.
--
-- 'type'', 'faultRootCauseService_type' - The type associated to the service.
newFaultRootCauseService ::
  FaultRootCauseService
newFaultRootCauseService :: FaultRootCauseService
newFaultRootCauseService =
  FaultRootCauseService' :: Maybe [FaultRootCauseEntity]
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> FaultRootCauseService
FaultRootCauseService'
    { $sel:entityPath:FaultRootCauseService' :: Maybe [FaultRootCauseEntity]
entityPath =
        Maybe [FaultRootCauseEntity]
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:FaultRootCauseService' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:names:FaultRootCauseService' :: Maybe [Text]
names = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:FaultRootCauseService' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:inferred:FaultRootCauseService' :: Maybe Bool
inferred = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:type':FaultRootCauseService' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

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

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

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

instance Prelude.NFData FaultRootCauseService