{-# 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.DevOpsGuru.Types.RecommendationRelatedAnomaly
-- 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.DevOpsGuru.Types.RecommendationRelatedAnomaly where

import qualified Amazonka.Core as Core
import Amazonka.DevOpsGuru.Types.RecommendationRelatedAnomalyResource
import Amazonka.DevOpsGuru.Types.RecommendationRelatedAnomalySourceDetail
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about an anomaly that is related to a recommendation.
--
-- /See:/ 'newRecommendationRelatedAnomaly' smart constructor.
data RecommendationRelatedAnomaly = RecommendationRelatedAnomaly'
  { -- | An array of objects that represent resources in which DevOps Guru
    -- detected anomalous behavior. Each object contains the name and type of
    -- the resource.
    RecommendationRelatedAnomaly
-> Maybe [RecommendationRelatedAnomalyResource]
resources :: Prelude.Maybe [RecommendationRelatedAnomalyResource],
    -- | Information about where the anomalous behavior related the
    -- recommendation was found. For example, details in Amazon CloudWatch
    -- metrics.
    RecommendationRelatedAnomaly
-> Maybe [RecommendationRelatedAnomalySourceDetail]
sourceDetails :: Prelude.Maybe [RecommendationRelatedAnomalySourceDetail]
  }
  deriving (RecommendationRelatedAnomaly
-> RecommendationRelatedAnomaly -> Bool
(RecommendationRelatedAnomaly
 -> RecommendationRelatedAnomaly -> Bool)
-> (RecommendationRelatedAnomaly
    -> RecommendationRelatedAnomaly -> Bool)
-> Eq RecommendationRelatedAnomaly
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecommendationRelatedAnomaly
-> RecommendationRelatedAnomaly -> Bool
$c/= :: RecommendationRelatedAnomaly
-> RecommendationRelatedAnomaly -> Bool
== :: RecommendationRelatedAnomaly
-> RecommendationRelatedAnomaly -> Bool
$c== :: RecommendationRelatedAnomaly
-> RecommendationRelatedAnomaly -> Bool
Prelude.Eq, ReadPrec [RecommendationRelatedAnomaly]
ReadPrec RecommendationRelatedAnomaly
Int -> ReadS RecommendationRelatedAnomaly
ReadS [RecommendationRelatedAnomaly]
(Int -> ReadS RecommendationRelatedAnomaly)
-> ReadS [RecommendationRelatedAnomaly]
-> ReadPrec RecommendationRelatedAnomaly
-> ReadPrec [RecommendationRelatedAnomaly]
-> Read RecommendationRelatedAnomaly
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecommendationRelatedAnomaly]
$creadListPrec :: ReadPrec [RecommendationRelatedAnomaly]
readPrec :: ReadPrec RecommendationRelatedAnomaly
$creadPrec :: ReadPrec RecommendationRelatedAnomaly
readList :: ReadS [RecommendationRelatedAnomaly]
$creadList :: ReadS [RecommendationRelatedAnomaly]
readsPrec :: Int -> ReadS RecommendationRelatedAnomaly
$creadsPrec :: Int -> ReadS RecommendationRelatedAnomaly
Prelude.Read, Int -> RecommendationRelatedAnomaly -> ShowS
[RecommendationRelatedAnomaly] -> ShowS
RecommendationRelatedAnomaly -> String
(Int -> RecommendationRelatedAnomaly -> ShowS)
-> (RecommendationRelatedAnomaly -> String)
-> ([RecommendationRelatedAnomaly] -> ShowS)
-> Show RecommendationRelatedAnomaly
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecommendationRelatedAnomaly] -> ShowS
$cshowList :: [RecommendationRelatedAnomaly] -> ShowS
show :: RecommendationRelatedAnomaly -> String
$cshow :: RecommendationRelatedAnomaly -> String
showsPrec :: Int -> RecommendationRelatedAnomaly -> ShowS
$cshowsPrec :: Int -> RecommendationRelatedAnomaly -> ShowS
Prelude.Show, (forall x.
 RecommendationRelatedAnomaly -> Rep RecommendationRelatedAnomaly x)
-> (forall x.
    Rep RecommendationRelatedAnomaly x -> RecommendationRelatedAnomaly)
-> Generic RecommendationRelatedAnomaly
forall x.
Rep RecommendationRelatedAnomaly x -> RecommendationRelatedAnomaly
forall x.
RecommendationRelatedAnomaly -> Rep RecommendationRelatedAnomaly x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RecommendationRelatedAnomaly x -> RecommendationRelatedAnomaly
$cfrom :: forall x.
RecommendationRelatedAnomaly -> Rep RecommendationRelatedAnomaly x
Prelude.Generic)

-- |
-- Create a value of 'RecommendationRelatedAnomaly' 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:
--
-- 'resources', 'recommendationRelatedAnomaly_resources' - An array of objects that represent resources in which DevOps Guru
-- detected anomalous behavior. Each object contains the name and type of
-- the resource.
--
-- 'sourceDetails', 'recommendationRelatedAnomaly_sourceDetails' - Information about where the anomalous behavior related the
-- recommendation was found. For example, details in Amazon CloudWatch
-- metrics.
newRecommendationRelatedAnomaly ::
  RecommendationRelatedAnomaly
newRecommendationRelatedAnomaly :: RecommendationRelatedAnomaly
newRecommendationRelatedAnomaly =
  RecommendationRelatedAnomaly' :: Maybe [RecommendationRelatedAnomalyResource]
-> Maybe [RecommendationRelatedAnomalySourceDetail]
-> RecommendationRelatedAnomaly
RecommendationRelatedAnomaly'
    { $sel:resources:RecommendationRelatedAnomaly' :: Maybe [RecommendationRelatedAnomalyResource]
resources =
        Maybe [RecommendationRelatedAnomalyResource]
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceDetails:RecommendationRelatedAnomaly' :: Maybe [RecommendationRelatedAnomalySourceDetail]
sourceDetails = Maybe [RecommendationRelatedAnomalySourceDetail]
forall a. Maybe a
Prelude.Nothing
    }

-- | An array of objects that represent resources in which DevOps Guru
-- detected anomalous behavior. Each object contains the name and type of
-- the resource.
recommendationRelatedAnomaly_resources :: Lens.Lens' RecommendationRelatedAnomaly (Prelude.Maybe [RecommendationRelatedAnomalyResource])
recommendationRelatedAnomaly_resources :: (Maybe [RecommendationRelatedAnomalyResource]
 -> f (Maybe [RecommendationRelatedAnomalyResource]))
-> RecommendationRelatedAnomaly -> f RecommendationRelatedAnomaly
recommendationRelatedAnomaly_resources = (RecommendationRelatedAnomaly
 -> Maybe [RecommendationRelatedAnomalyResource])
-> (RecommendationRelatedAnomaly
    -> Maybe [RecommendationRelatedAnomalyResource]
    -> RecommendationRelatedAnomaly)
-> Lens
     RecommendationRelatedAnomaly
     RecommendationRelatedAnomaly
     (Maybe [RecommendationRelatedAnomalyResource])
     (Maybe [RecommendationRelatedAnomalyResource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationRelatedAnomaly' {Maybe [RecommendationRelatedAnomalyResource]
resources :: Maybe [RecommendationRelatedAnomalyResource]
$sel:resources:RecommendationRelatedAnomaly' :: RecommendationRelatedAnomaly
-> Maybe [RecommendationRelatedAnomalyResource]
resources} -> Maybe [RecommendationRelatedAnomalyResource]
resources) (\s :: RecommendationRelatedAnomaly
s@RecommendationRelatedAnomaly' {} Maybe [RecommendationRelatedAnomalyResource]
a -> RecommendationRelatedAnomaly
s {$sel:resources:RecommendationRelatedAnomaly' :: Maybe [RecommendationRelatedAnomalyResource]
resources = Maybe [RecommendationRelatedAnomalyResource]
a} :: RecommendationRelatedAnomaly) ((Maybe [RecommendationRelatedAnomalyResource]
  -> f (Maybe [RecommendationRelatedAnomalyResource]))
 -> RecommendationRelatedAnomaly -> f RecommendationRelatedAnomaly)
-> ((Maybe [RecommendationRelatedAnomalyResource]
     -> f (Maybe [RecommendationRelatedAnomalyResource]))
    -> Maybe [RecommendationRelatedAnomalyResource]
    -> f (Maybe [RecommendationRelatedAnomalyResource]))
-> (Maybe [RecommendationRelatedAnomalyResource]
    -> f (Maybe [RecommendationRelatedAnomalyResource]))
-> RecommendationRelatedAnomaly
-> f RecommendationRelatedAnomaly
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RecommendationRelatedAnomalyResource]
  [RecommendationRelatedAnomalyResource]
  [RecommendationRelatedAnomalyResource]
  [RecommendationRelatedAnomalyResource]
-> Iso
     (Maybe [RecommendationRelatedAnomalyResource])
     (Maybe [RecommendationRelatedAnomalyResource])
     (Maybe [RecommendationRelatedAnomalyResource])
     (Maybe [RecommendationRelatedAnomalyResource])
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
  [RecommendationRelatedAnomalyResource]
  [RecommendationRelatedAnomalyResource]
  [RecommendationRelatedAnomalyResource]
  [RecommendationRelatedAnomalyResource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Information about where the anomalous behavior related the
-- recommendation was found. For example, details in Amazon CloudWatch
-- metrics.
recommendationRelatedAnomaly_sourceDetails :: Lens.Lens' RecommendationRelatedAnomaly (Prelude.Maybe [RecommendationRelatedAnomalySourceDetail])
recommendationRelatedAnomaly_sourceDetails :: (Maybe [RecommendationRelatedAnomalySourceDetail]
 -> f (Maybe [RecommendationRelatedAnomalySourceDetail]))
-> RecommendationRelatedAnomaly -> f RecommendationRelatedAnomaly
recommendationRelatedAnomaly_sourceDetails = (RecommendationRelatedAnomaly
 -> Maybe [RecommendationRelatedAnomalySourceDetail])
-> (RecommendationRelatedAnomaly
    -> Maybe [RecommendationRelatedAnomalySourceDetail]
    -> RecommendationRelatedAnomaly)
-> Lens
     RecommendationRelatedAnomaly
     RecommendationRelatedAnomaly
     (Maybe [RecommendationRelatedAnomalySourceDetail])
     (Maybe [RecommendationRelatedAnomalySourceDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationRelatedAnomaly' {Maybe [RecommendationRelatedAnomalySourceDetail]
sourceDetails :: Maybe [RecommendationRelatedAnomalySourceDetail]
$sel:sourceDetails:RecommendationRelatedAnomaly' :: RecommendationRelatedAnomaly
-> Maybe [RecommendationRelatedAnomalySourceDetail]
sourceDetails} -> Maybe [RecommendationRelatedAnomalySourceDetail]
sourceDetails) (\s :: RecommendationRelatedAnomaly
s@RecommendationRelatedAnomaly' {} Maybe [RecommendationRelatedAnomalySourceDetail]
a -> RecommendationRelatedAnomaly
s {$sel:sourceDetails:RecommendationRelatedAnomaly' :: Maybe [RecommendationRelatedAnomalySourceDetail]
sourceDetails = Maybe [RecommendationRelatedAnomalySourceDetail]
a} :: RecommendationRelatedAnomaly) ((Maybe [RecommendationRelatedAnomalySourceDetail]
  -> f (Maybe [RecommendationRelatedAnomalySourceDetail]))
 -> RecommendationRelatedAnomaly -> f RecommendationRelatedAnomaly)
-> ((Maybe [RecommendationRelatedAnomalySourceDetail]
     -> f (Maybe [RecommendationRelatedAnomalySourceDetail]))
    -> Maybe [RecommendationRelatedAnomalySourceDetail]
    -> f (Maybe [RecommendationRelatedAnomalySourceDetail]))
-> (Maybe [RecommendationRelatedAnomalySourceDetail]
    -> f (Maybe [RecommendationRelatedAnomalySourceDetail]))
-> RecommendationRelatedAnomaly
-> f RecommendationRelatedAnomaly
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RecommendationRelatedAnomalySourceDetail]
  [RecommendationRelatedAnomalySourceDetail]
  [RecommendationRelatedAnomalySourceDetail]
  [RecommendationRelatedAnomalySourceDetail]
-> Iso
     (Maybe [RecommendationRelatedAnomalySourceDetail])
     (Maybe [RecommendationRelatedAnomalySourceDetail])
     (Maybe [RecommendationRelatedAnomalySourceDetail])
     (Maybe [RecommendationRelatedAnomalySourceDetail])
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
  [RecommendationRelatedAnomalySourceDetail]
  [RecommendationRelatedAnomalySourceDetail]
  [RecommendationRelatedAnomalySourceDetail]
  [RecommendationRelatedAnomalySourceDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON RecommendationRelatedAnomaly where
  parseJSON :: Value -> Parser RecommendationRelatedAnomaly
parseJSON =
    String
-> (Object -> Parser RecommendationRelatedAnomaly)
-> Value
-> Parser RecommendationRelatedAnomaly
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RecommendationRelatedAnomaly"
      ( \Object
x ->
          Maybe [RecommendationRelatedAnomalyResource]
-> Maybe [RecommendationRelatedAnomalySourceDetail]
-> RecommendationRelatedAnomaly
RecommendationRelatedAnomaly'
            (Maybe [RecommendationRelatedAnomalyResource]
 -> Maybe [RecommendationRelatedAnomalySourceDetail]
 -> RecommendationRelatedAnomaly)
-> Parser (Maybe [RecommendationRelatedAnomalyResource])
-> Parser
     (Maybe [RecommendationRelatedAnomalySourceDetail]
      -> RecommendationRelatedAnomaly)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser (Maybe (Maybe [RecommendationRelatedAnomalyResource]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Resources" Parser (Maybe (Maybe [RecommendationRelatedAnomalyResource]))
-> Maybe [RecommendationRelatedAnomalyResource]
-> Parser (Maybe [RecommendationRelatedAnomalyResource])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [RecommendationRelatedAnomalyResource]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe [RecommendationRelatedAnomalySourceDetail]
   -> RecommendationRelatedAnomaly)
-> Parser (Maybe [RecommendationRelatedAnomalySourceDetail])
-> Parser RecommendationRelatedAnomaly
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Parser
     (Maybe (Maybe [RecommendationRelatedAnomalySourceDetail]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceDetails" Parser (Maybe (Maybe [RecommendationRelatedAnomalySourceDetail]))
-> Maybe [RecommendationRelatedAnomalySourceDetail]
-> Parser (Maybe [RecommendationRelatedAnomalySourceDetail])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [RecommendationRelatedAnomalySourceDetail]
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    RecommendationRelatedAnomaly

instance Prelude.NFData RecommendationRelatedAnomaly