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

-- | The Amazon Web Services resources in which DevOps Guru detected unusual
-- behavior that resulted in the generation of an anomaly. When DevOps Guru
-- detects multiple related anomalies, it creates and insight with details
-- about the anomalous behavior and suggestions about how to correct the
-- problem.
--
-- /See:/ 'newAnomalyResource' smart constructor.
data AnomalyResource = AnomalyResource'
  { -- | The name of the Amazon Web Services resource.
    AnomalyResource -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The type of the Amazon Web Services resource.
    AnomalyResource -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (AnomalyResource -> AnomalyResource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnomalyResource -> AnomalyResource -> Bool
$c/= :: AnomalyResource -> AnomalyResource -> Bool
== :: AnomalyResource -> AnomalyResource -> Bool
$c== :: AnomalyResource -> AnomalyResource -> Bool
Prelude.Eq, ReadPrec [AnomalyResource]
ReadPrec AnomalyResource
Int -> ReadS AnomalyResource
ReadS [AnomalyResource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnomalyResource]
$creadListPrec :: ReadPrec [AnomalyResource]
readPrec :: ReadPrec AnomalyResource
$creadPrec :: ReadPrec AnomalyResource
readList :: ReadS [AnomalyResource]
$creadList :: ReadS [AnomalyResource]
readsPrec :: Int -> ReadS AnomalyResource
$creadsPrec :: Int -> ReadS AnomalyResource
Prelude.Read, Int -> AnomalyResource -> ShowS
[AnomalyResource] -> ShowS
AnomalyResource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnomalyResource] -> ShowS
$cshowList :: [AnomalyResource] -> ShowS
show :: AnomalyResource -> String
$cshow :: AnomalyResource -> String
showsPrec :: Int -> AnomalyResource -> ShowS
$cshowsPrec :: Int -> AnomalyResource -> ShowS
Prelude.Show, forall x. Rep AnomalyResource x -> AnomalyResource
forall x. AnomalyResource -> Rep AnomalyResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnomalyResource x -> AnomalyResource
$cfrom :: forall x. AnomalyResource -> Rep AnomalyResource x
Prelude.Generic)

-- |
-- Create a value of 'AnomalyResource' 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:
--
-- 'name', 'anomalyResource_name' - The name of the Amazon Web Services resource.
--
-- 'type'', 'anomalyResource_type' - The type of the Amazon Web Services resource.
newAnomalyResource ::
  AnomalyResource
newAnomalyResource :: AnomalyResource
newAnomalyResource =
  AnomalyResource'
    { $sel:name:AnomalyResource' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:type':AnomalyResource' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the Amazon Web Services resource.
anomalyResource_name :: Lens.Lens' AnomalyResource (Prelude.Maybe Prelude.Text)
anomalyResource_name :: Lens' AnomalyResource (Maybe Text)
anomalyResource_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyResource' {Maybe Text
name :: Maybe Text
$sel:name:AnomalyResource' :: AnomalyResource -> Maybe Text
name} -> Maybe Text
name) (\s :: AnomalyResource
s@AnomalyResource' {} Maybe Text
a -> AnomalyResource
s {$sel:name:AnomalyResource' :: Maybe Text
name = Maybe Text
a} :: AnomalyResource)

-- | The type of the Amazon Web Services resource.
anomalyResource_type :: Lens.Lens' AnomalyResource (Prelude.Maybe Prelude.Text)
anomalyResource_type :: Lens' AnomalyResource (Maybe Text)
anomalyResource_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyResource' {Maybe Text
type' :: Maybe Text
$sel:type':AnomalyResource' :: AnomalyResource -> Maybe Text
type'} -> Maybe Text
type') (\s :: AnomalyResource
s@AnomalyResource' {} Maybe Text
a -> AnomalyResource
s {$sel:type':AnomalyResource' :: Maybe Text
type' = Maybe Text
a} :: AnomalyResource)

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

instance Prelude.Hashable AnomalyResource where
  hashWithSalt :: Int -> AnomalyResource -> Int
hashWithSalt Int
_salt AnomalyResource' {Maybe Text
type' :: Maybe Text
name :: Maybe Text
$sel:type':AnomalyResource' :: AnomalyResource -> Maybe Text
$sel:name:AnomalyResource' :: AnomalyResource -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
type'

instance Prelude.NFData AnomalyResource where
  rnf :: AnomalyResource -> ()
rnf AnomalyResource' {Maybe Text
type' :: Maybe Text
name :: Maybe Text
$sel:type':AnomalyResource' :: AnomalyResource -> Maybe Text
$sel:name:AnomalyResource' :: AnomalyResource -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
type'