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

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

-- | Information about an AWS resource that emitted and event that is related
-- to a recommendation in an insight.
--
-- /See:/ 'newRecommendationRelatedEventResource' smart constructor.
data RecommendationRelatedEventResource = RecommendationRelatedEventResource'
  { -- | The name of the resource that emitted the event. This corresponds to the
    -- @Name@ field in an @EventResource@ object.
    RecommendationRelatedEventResource -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The type of the resource that emitted the event. This corresponds to the
    -- @Type@ field in an @EventResource@ object.
    RecommendationRelatedEventResource -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (RecommendationRelatedEventResource
-> RecommendationRelatedEventResource -> Bool
(RecommendationRelatedEventResource
 -> RecommendationRelatedEventResource -> Bool)
-> (RecommendationRelatedEventResource
    -> RecommendationRelatedEventResource -> Bool)
-> Eq RecommendationRelatedEventResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecommendationRelatedEventResource
-> RecommendationRelatedEventResource -> Bool
$c/= :: RecommendationRelatedEventResource
-> RecommendationRelatedEventResource -> Bool
== :: RecommendationRelatedEventResource
-> RecommendationRelatedEventResource -> Bool
$c== :: RecommendationRelatedEventResource
-> RecommendationRelatedEventResource -> Bool
Prelude.Eq, ReadPrec [RecommendationRelatedEventResource]
ReadPrec RecommendationRelatedEventResource
Int -> ReadS RecommendationRelatedEventResource
ReadS [RecommendationRelatedEventResource]
(Int -> ReadS RecommendationRelatedEventResource)
-> ReadS [RecommendationRelatedEventResource]
-> ReadPrec RecommendationRelatedEventResource
-> ReadPrec [RecommendationRelatedEventResource]
-> Read RecommendationRelatedEventResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecommendationRelatedEventResource]
$creadListPrec :: ReadPrec [RecommendationRelatedEventResource]
readPrec :: ReadPrec RecommendationRelatedEventResource
$creadPrec :: ReadPrec RecommendationRelatedEventResource
readList :: ReadS [RecommendationRelatedEventResource]
$creadList :: ReadS [RecommendationRelatedEventResource]
readsPrec :: Int -> ReadS RecommendationRelatedEventResource
$creadsPrec :: Int -> ReadS RecommendationRelatedEventResource
Prelude.Read, Int -> RecommendationRelatedEventResource -> ShowS
[RecommendationRelatedEventResource] -> ShowS
RecommendationRelatedEventResource -> String
(Int -> RecommendationRelatedEventResource -> ShowS)
-> (RecommendationRelatedEventResource -> String)
-> ([RecommendationRelatedEventResource] -> ShowS)
-> Show RecommendationRelatedEventResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecommendationRelatedEventResource] -> ShowS
$cshowList :: [RecommendationRelatedEventResource] -> ShowS
show :: RecommendationRelatedEventResource -> String
$cshow :: RecommendationRelatedEventResource -> String
showsPrec :: Int -> RecommendationRelatedEventResource -> ShowS
$cshowsPrec :: Int -> RecommendationRelatedEventResource -> ShowS
Prelude.Show, (forall x.
 RecommendationRelatedEventResource
 -> Rep RecommendationRelatedEventResource x)
-> (forall x.
    Rep RecommendationRelatedEventResource x
    -> RecommendationRelatedEventResource)
-> Generic RecommendationRelatedEventResource
forall x.
Rep RecommendationRelatedEventResource x
-> RecommendationRelatedEventResource
forall x.
RecommendationRelatedEventResource
-> Rep RecommendationRelatedEventResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RecommendationRelatedEventResource x
-> RecommendationRelatedEventResource
$cfrom :: forall x.
RecommendationRelatedEventResource
-> Rep RecommendationRelatedEventResource x
Prelude.Generic)

-- |
-- Create a value of 'RecommendationRelatedEventResource' 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', 'recommendationRelatedEventResource_name' - The name of the resource that emitted the event. This corresponds to the
-- @Name@ field in an @EventResource@ object.
--
-- 'type'', 'recommendationRelatedEventResource_type' - The type of the resource that emitted the event. This corresponds to the
-- @Type@ field in an @EventResource@ object.
newRecommendationRelatedEventResource ::
  RecommendationRelatedEventResource
newRecommendationRelatedEventResource :: RecommendationRelatedEventResource
newRecommendationRelatedEventResource =
  RecommendationRelatedEventResource' :: Maybe Text -> Maybe Text -> RecommendationRelatedEventResource
RecommendationRelatedEventResource'
    { $sel:name:RecommendationRelatedEventResource' :: Maybe Text
name =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':RecommendationRelatedEventResource' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the resource that emitted the event. This corresponds to the
-- @Name@ field in an @EventResource@ object.
recommendationRelatedEventResource_name :: Lens.Lens' RecommendationRelatedEventResource (Prelude.Maybe Prelude.Text)
recommendationRelatedEventResource_name :: (Maybe Text -> f (Maybe Text))
-> RecommendationRelatedEventResource
-> f RecommendationRelatedEventResource
recommendationRelatedEventResource_name = (RecommendationRelatedEventResource -> Maybe Text)
-> (RecommendationRelatedEventResource
    -> Maybe Text -> RecommendationRelatedEventResource)
-> Lens
     RecommendationRelatedEventResource
     RecommendationRelatedEventResource
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationRelatedEventResource' {Maybe Text
name :: Maybe Text
$sel:name:RecommendationRelatedEventResource' :: RecommendationRelatedEventResource -> Maybe Text
name} -> Maybe Text
name) (\s :: RecommendationRelatedEventResource
s@RecommendationRelatedEventResource' {} Maybe Text
a -> RecommendationRelatedEventResource
s {$sel:name:RecommendationRelatedEventResource' :: Maybe Text
name = Maybe Text
a} :: RecommendationRelatedEventResource)

-- | The type of the resource that emitted the event. This corresponds to the
-- @Type@ field in an @EventResource@ object.
recommendationRelatedEventResource_type :: Lens.Lens' RecommendationRelatedEventResource (Prelude.Maybe Prelude.Text)
recommendationRelatedEventResource_type :: (Maybe Text -> f (Maybe Text))
-> RecommendationRelatedEventResource
-> f RecommendationRelatedEventResource
recommendationRelatedEventResource_type = (RecommendationRelatedEventResource -> Maybe Text)
-> (RecommendationRelatedEventResource
    -> Maybe Text -> RecommendationRelatedEventResource)
-> Lens
     RecommendationRelatedEventResource
     RecommendationRelatedEventResource
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationRelatedEventResource' {Maybe Text
type' :: Maybe Text
$sel:type':RecommendationRelatedEventResource' :: RecommendationRelatedEventResource -> Maybe Text
type'} -> Maybe Text
type') (\s :: RecommendationRelatedEventResource
s@RecommendationRelatedEventResource' {} Maybe Text
a -> RecommendationRelatedEventResource
s {$sel:type':RecommendationRelatedEventResource' :: Maybe Text
type' = Maybe Text
a} :: RecommendationRelatedEventResource)

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

instance
  Prelude.Hashable
    RecommendationRelatedEventResource

instance
  Prelude.NFData
    RecommendationRelatedEventResource