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

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

-- | The service within the service graph that has anomalously high fault
-- rates.
--
-- /See:/ 'newAnomalousService' smart constructor.
data AnomalousService = AnomalousService'
  { AnomalousService -> Maybe ServiceId
serviceId :: Prelude.Maybe ServiceId
  }
  deriving (AnomalousService -> AnomalousService -> Bool
(AnomalousService -> AnomalousService -> Bool)
-> (AnomalousService -> AnomalousService -> Bool)
-> Eq AnomalousService
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnomalousService -> AnomalousService -> Bool
$c/= :: AnomalousService -> AnomalousService -> Bool
== :: AnomalousService -> AnomalousService -> Bool
$c== :: AnomalousService -> AnomalousService -> Bool
Prelude.Eq, ReadPrec [AnomalousService]
ReadPrec AnomalousService
Int -> ReadS AnomalousService
ReadS [AnomalousService]
(Int -> ReadS AnomalousService)
-> ReadS [AnomalousService]
-> ReadPrec AnomalousService
-> ReadPrec [AnomalousService]
-> Read AnomalousService
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnomalousService]
$creadListPrec :: ReadPrec [AnomalousService]
readPrec :: ReadPrec AnomalousService
$creadPrec :: ReadPrec AnomalousService
readList :: ReadS [AnomalousService]
$creadList :: ReadS [AnomalousService]
readsPrec :: Int -> ReadS AnomalousService
$creadsPrec :: Int -> ReadS AnomalousService
Prelude.Read, Int -> AnomalousService -> ShowS
[AnomalousService] -> ShowS
AnomalousService -> String
(Int -> AnomalousService -> ShowS)
-> (AnomalousService -> String)
-> ([AnomalousService] -> ShowS)
-> Show AnomalousService
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnomalousService] -> ShowS
$cshowList :: [AnomalousService] -> ShowS
show :: AnomalousService -> String
$cshow :: AnomalousService -> String
showsPrec :: Int -> AnomalousService -> ShowS
$cshowsPrec :: Int -> AnomalousService -> ShowS
Prelude.Show, (forall x. AnomalousService -> Rep AnomalousService x)
-> (forall x. Rep AnomalousService x -> AnomalousService)
-> Generic AnomalousService
forall x. Rep AnomalousService x -> AnomalousService
forall x. AnomalousService -> Rep AnomalousService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnomalousService x -> AnomalousService
$cfrom :: forall x. AnomalousService -> Rep AnomalousService x
Prelude.Generic)

-- |
-- Create a value of 'AnomalousService' 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:
--
-- 'serviceId', 'anomalousService_serviceId' - Undocumented member.
newAnomalousService ::
  AnomalousService
newAnomalousService :: AnomalousService
newAnomalousService =
  AnomalousService' :: Maybe ServiceId -> AnomalousService
AnomalousService' {$sel:serviceId:AnomalousService' :: Maybe ServiceId
serviceId = Maybe ServiceId
forall a. Maybe a
Prelude.Nothing}

-- | Undocumented member.
anomalousService_serviceId :: Lens.Lens' AnomalousService (Prelude.Maybe ServiceId)
anomalousService_serviceId :: (Maybe ServiceId -> f (Maybe ServiceId))
-> AnomalousService -> f AnomalousService
anomalousService_serviceId = (AnomalousService -> Maybe ServiceId)
-> (AnomalousService -> Maybe ServiceId -> AnomalousService)
-> Lens
     AnomalousService
     AnomalousService
     (Maybe ServiceId)
     (Maybe ServiceId)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalousService' {Maybe ServiceId
serviceId :: Maybe ServiceId
$sel:serviceId:AnomalousService' :: AnomalousService -> Maybe ServiceId
serviceId} -> Maybe ServiceId
serviceId) (\s :: AnomalousService
s@AnomalousService' {} Maybe ServiceId
a -> AnomalousService
s {$sel:serviceId:AnomalousService' :: Maybe ServiceId
serviceId = Maybe ServiceId
a} :: AnomalousService)

instance Core.FromJSON AnomalousService where
  parseJSON :: Value -> Parser AnomalousService
parseJSON =
    String
-> (Object -> Parser AnomalousService)
-> Value
-> Parser AnomalousService
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AnomalousService"
      ( \Object
x ->
          Maybe ServiceId -> AnomalousService
AnomalousService'
            (Maybe ServiceId -> AnomalousService)
-> Parser (Maybe ServiceId) -> Parser AnomalousService
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ServiceId)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ServiceId")
      )

instance Prelude.Hashable AnomalousService

instance Prelude.NFData AnomalousService