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

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

-- | Sampling statistics from a call to
-- <https://docs.aws.amazon.com/xray/latest/api/API_GetSamplingTargets.html GetSamplingTargets>
-- that X-Ray could not process.
--
-- /See:/ 'newUnprocessedStatistics' smart constructor.
data UnprocessedStatistics = UnprocessedStatistics'
  { -- | The name of the sampling rule.
    UnprocessedStatistics -> Maybe Text
ruleName :: Prelude.Maybe Prelude.Text,
    -- | The error code.
    UnprocessedStatistics -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The error message.
    UnprocessedStatistics -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (UnprocessedStatistics -> UnprocessedStatistics -> Bool
(UnprocessedStatistics -> UnprocessedStatistics -> Bool)
-> (UnprocessedStatistics -> UnprocessedStatistics -> Bool)
-> Eq UnprocessedStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnprocessedStatistics -> UnprocessedStatistics -> Bool
$c/= :: UnprocessedStatistics -> UnprocessedStatistics -> Bool
== :: UnprocessedStatistics -> UnprocessedStatistics -> Bool
$c== :: UnprocessedStatistics -> UnprocessedStatistics -> Bool
Prelude.Eq, ReadPrec [UnprocessedStatistics]
ReadPrec UnprocessedStatistics
Int -> ReadS UnprocessedStatistics
ReadS [UnprocessedStatistics]
(Int -> ReadS UnprocessedStatistics)
-> ReadS [UnprocessedStatistics]
-> ReadPrec UnprocessedStatistics
-> ReadPrec [UnprocessedStatistics]
-> Read UnprocessedStatistics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnprocessedStatistics]
$creadListPrec :: ReadPrec [UnprocessedStatistics]
readPrec :: ReadPrec UnprocessedStatistics
$creadPrec :: ReadPrec UnprocessedStatistics
readList :: ReadS [UnprocessedStatistics]
$creadList :: ReadS [UnprocessedStatistics]
readsPrec :: Int -> ReadS UnprocessedStatistics
$creadsPrec :: Int -> ReadS UnprocessedStatistics
Prelude.Read, Int -> UnprocessedStatistics -> ShowS
[UnprocessedStatistics] -> ShowS
UnprocessedStatistics -> String
(Int -> UnprocessedStatistics -> ShowS)
-> (UnprocessedStatistics -> String)
-> ([UnprocessedStatistics] -> ShowS)
-> Show UnprocessedStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnprocessedStatistics] -> ShowS
$cshowList :: [UnprocessedStatistics] -> ShowS
show :: UnprocessedStatistics -> String
$cshow :: UnprocessedStatistics -> String
showsPrec :: Int -> UnprocessedStatistics -> ShowS
$cshowsPrec :: Int -> UnprocessedStatistics -> ShowS
Prelude.Show, (forall x. UnprocessedStatistics -> Rep UnprocessedStatistics x)
-> (forall x. Rep UnprocessedStatistics x -> UnprocessedStatistics)
-> Generic UnprocessedStatistics
forall x. Rep UnprocessedStatistics x -> UnprocessedStatistics
forall x. UnprocessedStatistics -> Rep UnprocessedStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UnprocessedStatistics x -> UnprocessedStatistics
$cfrom :: forall x. UnprocessedStatistics -> Rep UnprocessedStatistics x
Prelude.Generic)

-- |
-- Create a value of 'UnprocessedStatistics' 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:
--
-- 'ruleName', 'unprocessedStatistics_ruleName' - The name of the sampling rule.
--
-- 'errorCode', 'unprocessedStatistics_errorCode' - The error code.
--
-- 'message', 'unprocessedStatistics_message' - The error message.
newUnprocessedStatistics ::
  UnprocessedStatistics
newUnprocessedStatistics :: UnprocessedStatistics
newUnprocessedStatistics =
  UnprocessedStatistics' :: Maybe Text -> Maybe Text -> Maybe Text -> UnprocessedStatistics
UnprocessedStatistics'
    { $sel:ruleName:UnprocessedStatistics' :: Maybe Text
ruleName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:UnprocessedStatistics' :: Maybe Text
errorCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:message:UnprocessedStatistics' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the sampling rule.
unprocessedStatistics_ruleName :: Lens.Lens' UnprocessedStatistics (Prelude.Maybe Prelude.Text)
unprocessedStatistics_ruleName :: (Maybe Text -> f (Maybe Text))
-> UnprocessedStatistics -> f UnprocessedStatistics
unprocessedStatistics_ruleName = (UnprocessedStatistics -> Maybe Text)
-> (UnprocessedStatistics -> Maybe Text -> UnprocessedStatistics)
-> Lens
     UnprocessedStatistics
     UnprocessedStatistics
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedStatistics' {Maybe Text
ruleName :: Maybe Text
$sel:ruleName:UnprocessedStatistics' :: UnprocessedStatistics -> Maybe Text
ruleName} -> Maybe Text
ruleName) (\s :: UnprocessedStatistics
s@UnprocessedStatistics' {} Maybe Text
a -> UnprocessedStatistics
s {$sel:ruleName:UnprocessedStatistics' :: Maybe Text
ruleName = Maybe Text
a} :: UnprocessedStatistics)

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

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

instance Core.FromJSON UnprocessedStatistics where
  parseJSON :: Value -> Parser UnprocessedStatistics
parseJSON =
    String
-> (Object -> Parser UnprocessedStatistics)
-> Value
-> Parser UnprocessedStatistics
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UnprocessedStatistics"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> UnprocessedStatistics
UnprocessedStatistics'
            (Maybe Text -> Maybe Text -> Maybe Text -> UnprocessedStatistics)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> UnprocessedStatistics)
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
"RuleName")
            Parser (Maybe Text -> Maybe Text -> UnprocessedStatistics)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> UnprocessedStatistics)
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
"ErrorCode")
            Parser (Maybe Text -> UnprocessedStatistics)
-> Parser (Maybe Text) -> Parser UnprocessedStatistics
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 UnprocessedStatistics

instance Prelude.NFData UnprocessedStatistics