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

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

-- | The error code.
unprocessedStatistics_errorCode :: Lens.Lens' UnprocessedStatistics (Prelude.Maybe Prelude.Text)
unprocessedStatistics_errorCode :: Lens' UnprocessedStatistics (Maybe Text)
unprocessedStatistics_errorCode = 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 :: Lens' UnprocessedStatistics (Maybe Text)
unprocessedStatistics_message = 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)

-- | The name of the sampling rule.
unprocessedStatistics_ruleName :: Lens.Lens' UnprocessedStatistics (Prelude.Maybe Prelude.Text)
unprocessedStatistics_ruleName :: Lens' UnprocessedStatistics (Maybe Text)
unprocessedStatistics_ruleName = 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)

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

instance Prelude.Hashable UnprocessedStatistics where
  hashWithSalt :: Int -> UnprocessedStatistics -> Int
hashWithSalt Int
_salt UnprocessedStatistics' {Maybe Text
ruleName :: Maybe Text
message :: Maybe Text
errorCode :: Maybe Text
$sel:ruleName:UnprocessedStatistics' :: UnprocessedStatistics -> Maybe Text
$sel:message:UnprocessedStatistics' :: UnprocessedStatistics -> Maybe Text
$sel:errorCode:UnprocessedStatistics' :: UnprocessedStatistics -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ruleName

instance Prelude.NFData UnprocessedStatistics where
  rnf :: UnprocessedStatistics -> ()
rnf UnprocessedStatistics' {Maybe Text
ruleName :: Maybe Text
message :: Maybe Text
errorCode :: Maybe Text
$sel:ruleName:UnprocessedStatistics' :: UnprocessedStatistics -> Maybe Text
$sel:message:UnprocessedStatistics' :: UnprocessedStatistics -> Maybe Text
$sel:errorCode:UnprocessedStatistics' :: UnprocessedStatistics -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ruleName