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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a segment that failed processing.
--
-- /See:/ 'newUnprocessedTraceSegment' smart constructor.
data UnprocessedTraceSegment = UnprocessedTraceSegment'
  { -- | The error that caused processing to fail.
    UnprocessedTraceSegment -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The segment\'s ID.
    UnprocessedTraceSegment -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The error message.
    UnprocessedTraceSegment -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (UnprocessedTraceSegment -> UnprocessedTraceSegment -> Bool
(UnprocessedTraceSegment -> UnprocessedTraceSegment -> Bool)
-> (UnprocessedTraceSegment -> UnprocessedTraceSegment -> Bool)
-> Eq UnprocessedTraceSegment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnprocessedTraceSegment -> UnprocessedTraceSegment -> Bool
$c/= :: UnprocessedTraceSegment -> UnprocessedTraceSegment -> Bool
== :: UnprocessedTraceSegment -> UnprocessedTraceSegment -> Bool
$c== :: UnprocessedTraceSegment -> UnprocessedTraceSegment -> Bool
Prelude.Eq, ReadPrec [UnprocessedTraceSegment]
ReadPrec UnprocessedTraceSegment
Int -> ReadS UnprocessedTraceSegment
ReadS [UnprocessedTraceSegment]
(Int -> ReadS UnprocessedTraceSegment)
-> ReadS [UnprocessedTraceSegment]
-> ReadPrec UnprocessedTraceSegment
-> ReadPrec [UnprocessedTraceSegment]
-> Read UnprocessedTraceSegment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnprocessedTraceSegment]
$creadListPrec :: ReadPrec [UnprocessedTraceSegment]
readPrec :: ReadPrec UnprocessedTraceSegment
$creadPrec :: ReadPrec UnprocessedTraceSegment
readList :: ReadS [UnprocessedTraceSegment]
$creadList :: ReadS [UnprocessedTraceSegment]
readsPrec :: Int -> ReadS UnprocessedTraceSegment
$creadsPrec :: Int -> ReadS UnprocessedTraceSegment
Prelude.Read, Int -> UnprocessedTraceSegment -> ShowS
[UnprocessedTraceSegment] -> ShowS
UnprocessedTraceSegment -> String
(Int -> UnprocessedTraceSegment -> ShowS)
-> (UnprocessedTraceSegment -> String)
-> ([UnprocessedTraceSegment] -> ShowS)
-> Show UnprocessedTraceSegment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnprocessedTraceSegment] -> ShowS
$cshowList :: [UnprocessedTraceSegment] -> ShowS
show :: UnprocessedTraceSegment -> String
$cshow :: UnprocessedTraceSegment -> String
showsPrec :: Int -> UnprocessedTraceSegment -> ShowS
$cshowsPrec :: Int -> UnprocessedTraceSegment -> ShowS
Prelude.Show, (forall x.
 UnprocessedTraceSegment -> Rep UnprocessedTraceSegment x)
-> (forall x.
    Rep UnprocessedTraceSegment x -> UnprocessedTraceSegment)
-> Generic UnprocessedTraceSegment
forall x. Rep UnprocessedTraceSegment x -> UnprocessedTraceSegment
forall x. UnprocessedTraceSegment -> Rep UnprocessedTraceSegment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UnprocessedTraceSegment x -> UnprocessedTraceSegment
$cfrom :: forall x. UnprocessedTraceSegment -> Rep UnprocessedTraceSegment x
Prelude.Generic)

-- |
-- Create a value of 'UnprocessedTraceSegment' 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:
--
-- 'errorCode', 'unprocessedTraceSegment_errorCode' - The error that caused processing to fail.
--
-- 'id', 'unprocessedTraceSegment_id' - The segment\'s ID.
--
-- 'message', 'unprocessedTraceSegment_message' - The error message.
newUnprocessedTraceSegment ::
  UnprocessedTraceSegment
newUnprocessedTraceSegment :: UnprocessedTraceSegment
newUnprocessedTraceSegment =
  UnprocessedTraceSegment' :: Maybe Text -> Maybe Text -> Maybe Text -> UnprocessedTraceSegment
UnprocessedTraceSegment'
    { $sel:errorCode:UnprocessedTraceSegment' :: Maybe Text
errorCode =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:UnprocessedTraceSegment' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:message:UnprocessedTraceSegment' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The error that caused processing to fail.
unprocessedTraceSegment_errorCode :: Lens.Lens' UnprocessedTraceSegment (Prelude.Maybe Prelude.Text)
unprocessedTraceSegment_errorCode :: (Maybe Text -> f (Maybe Text))
-> UnprocessedTraceSegment -> f UnprocessedTraceSegment
unprocessedTraceSegment_errorCode = (UnprocessedTraceSegment -> Maybe Text)
-> (UnprocessedTraceSegment
    -> Maybe Text -> UnprocessedTraceSegment)
-> Lens
     UnprocessedTraceSegment
     UnprocessedTraceSegment
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedTraceSegment' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:UnprocessedTraceSegment' :: UnprocessedTraceSegment -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: UnprocessedTraceSegment
s@UnprocessedTraceSegment' {} Maybe Text
a -> UnprocessedTraceSegment
s {$sel:errorCode:UnprocessedTraceSegment' :: Maybe Text
errorCode = Maybe Text
a} :: UnprocessedTraceSegment)

-- | The segment\'s ID.
unprocessedTraceSegment_id :: Lens.Lens' UnprocessedTraceSegment (Prelude.Maybe Prelude.Text)
unprocessedTraceSegment_id :: (Maybe Text -> f (Maybe Text))
-> UnprocessedTraceSegment -> f UnprocessedTraceSegment
unprocessedTraceSegment_id = (UnprocessedTraceSegment -> Maybe Text)
-> (UnprocessedTraceSegment
    -> Maybe Text -> UnprocessedTraceSegment)
-> Lens
     UnprocessedTraceSegment
     UnprocessedTraceSegment
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedTraceSegment' {Maybe Text
id :: Maybe Text
$sel:id:UnprocessedTraceSegment' :: UnprocessedTraceSegment -> Maybe Text
id} -> Maybe Text
id) (\s :: UnprocessedTraceSegment
s@UnprocessedTraceSegment' {} Maybe Text
a -> UnprocessedTraceSegment
s {$sel:id:UnprocessedTraceSegment' :: Maybe Text
id = Maybe Text
a} :: UnprocessedTraceSegment)

-- | The error message.
unprocessedTraceSegment_message :: Lens.Lens' UnprocessedTraceSegment (Prelude.Maybe Prelude.Text)
unprocessedTraceSegment_message :: (Maybe Text -> f (Maybe Text))
-> UnprocessedTraceSegment -> f UnprocessedTraceSegment
unprocessedTraceSegment_message = (UnprocessedTraceSegment -> Maybe Text)
-> (UnprocessedTraceSegment
    -> Maybe Text -> UnprocessedTraceSegment)
-> Lens
     UnprocessedTraceSegment
     UnprocessedTraceSegment
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedTraceSegment' {Maybe Text
message :: Maybe Text
$sel:message:UnprocessedTraceSegment' :: UnprocessedTraceSegment -> Maybe Text
message} -> Maybe Text
message) (\s :: UnprocessedTraceSegment
s@UnprocessedTraceSegment' {} Maybe Text
a -> UnprocessedTraceSegment
s {$sel:message:UnprocessedTraceSegment' :: Maybe Text
message = Maybe Text
a} :: UnprocessedTraceSegment)

instance Core.FromJSON UnprocessedTraceSegment where
  parseJSON :: Value -> Parser UnprocessedTraceSegment
parseJSON =
    String
-> (Object -> Parser UnprocessedTraceSegment)
-> Value
-> Parser UnprocessedTraceSegment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UnprocessedTraceSegment"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> UnprocessedTraceSegment
UnprocessedTraceSegment'
            (Maybe Text -> Maybe Text -> Maybe Text -> UnprocessedTraceSegment)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> UnprocessedTraceSegment)
forall (f :: * -> *) a b. Functor 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
"ErrorCode")
            Parser (Maybe Text -> Maybe Text -> UnprocessedTraceSegment)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> UnprocessedTraceSegment)
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
"Id")
            Parser (Maybe Text -> UnprocessedTraceSegment)
-> Parser (Maybe Text) -> Parser UnprocessedTraceSegment
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
"Message")
      )

instance Prelude.Hashable UnprocessedTraceSegment

instance Prelude.NFData UnprocessedTraceSegment