{-# 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.CodeStarNotifications.Types.EventTypeSummary
-- 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.CodeStarNotifications.Types.EventTypeSummary where

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

-- | Returns information about an event that has triggered a notification
-- rule.
--
-- /See:/ 'newEventTypeSummary' smart constructor.
data EventTypeSummary = EventTypeSummary'
  { -- | The resource type of the event.
    EventTypeSummary -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The name of the event.
    EventTypeSummary -> Maybe Text
eventTypeName :: Prelude.Maybe Prelude.Text,
    -- | The system-generated ID of the event.
    EventTypeSummary -> Maybe Text
eventTypeId :: Prelude.Maybe Prelude.Text,
    -- | The name of the service for which the event applies.
    EventTypeSummary -> Maybe Text
serviceName :: Prelude.Maybe Prelude.Text
  }
  deriving (EventTypeSummary -> EventTypeSummary -> Bool
(EventTypeSummary -> EventTypeSummary -> Bool)
-> (EventTypeSummary -> EventTypeSummary -> Bool)
-> Eq EventTypeSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventTypeSummary -> EventTypeSummary -> Bool
$c/= :: EventTypeSummary -> EventTypeSummary -> Bool
== :: EventTypeSummary -> EventTypeSummary -> Bool
$c== :: EventTypeSummary -> EventTypeSummary -> Bool
Prelude.Eq, ReadPrec [EventTypeSummary]
ReadPrec EventTypeSummary
Int -> ReadS EventTypeSummary
ReadS [EventTypeSummary]
(Int -> ReadS EventTypeSummary)
-> ReadS [EventTypeSummary]
-> ReadPrec EventTypeSummary
-> ReadPrec [EventTypeSummary]
-> Read EventTypeSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventTypeSummary]
$creadListPrec :: ReadPrec [EventTypeSummary]
readPrec :: ReadPrec EventTypeSummary
$creadPrec :: ReadPrec EventTypeSummary
readList :: ReadS [EventTypeSummary]
$creadList :: ReadS [EventTypeSummary]
readsPrec :: Int -> ReadS EventTypeSummary
$creadsPrec :: Int -> ReadS EventTypeSummary
Prelude.Read, Int -> EventTypeSummary -> ShowS
[EventTypeSummary] -> ShowS
EventTypeSummary -> String
(Int -> EventTypeSummary -> ShowS)
-> (EventTypeSummary -> String)
-> ([EventTypeSummary] -> ShowS)
-> Show EventTypeSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventTypeSummary] -> ShowS
$cshowList :: [EventTypeSummary] -> ShowS
show :: EventTypeSummary -> String
$cshow :: EventTypeSummary -> String
showsPrec :: Int -> EventTypeSummary -> ShowS
$cshowsPrec :: Int -> EventTypeSummary -> ShowS
Prelude.Show, (forall x. EventTypeSummary -> Rep EventTypeSummary x)
-> (forall x. Rep EventTypeSummary x -> EventTypeSummary)
-> Generic EventTypeSummary
forall x. Rep EventTypeSummary x -> EventTypeSummary
forall x. EventTypeSummary -> Rep EventTypeSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventTypeSummary x -> EventTypeSummary
$cfrom :: forall x. EventTypeSummary -> Rep EventTypeSummary x
Prelude.Generic)

-- |
-- Create a value of 'EventTypeSummary' 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:
--
-- 'resourceType', 'eventTypeSummary_resourceType' - The resource type of the event.
--
-- 'eventTypeName', 'eventTypeSummary_eventTypeName' - The name of the event.
--
-- 'eventTypeId', 'eventTypeSummary_eventTypeId' - The system-generated ID of the event.
--
-- 'serviceName', 'eventTypeSummary_serviceName' - The name of the service for which the event applies.
newEventTypeSummary ::
  EventTypeSummary
newEventTypeSummary :: EventTypeSummary
newEventTypeSummary =
  EventTypeSummary' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> EventTypeSummary
EventTypeSummary'
    { $sel:resourceType:EventTypeSummary' :: Maybe Text
resourceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventTypeName:EventTypeSummary' :: Maybe Text
eventTypeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventTypeId:EventTypeSummary' :: Maybe Text
eventTypeId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceName:EventTypeSummary' :: Maybe Text
serviceName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The resource type of the event.
eventTypeSummary_resourceType :: Lens.Lens' EventTypeSummary (Prelude.Maybe Prelude.Text)
eventTypeSummary_resourceType :: (Maybe Text -> f (Maybe Text))
-> EventTypeSummary -> f EventTypeSummary
eventTypeSummary_resourceType = (EventTypeSummary -> Maybe Text)
-> (EventTypeSummary -> Maybe Text -> EventTypeSummary)
-> Lens EventTypeSummary EventTypeSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventTypeSummary' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:EventTypeSummary' :: EventTypeSummary -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: EventTypeSummary
s@EventTypeSummary' {} Maybe Text
a -> EventTypeSummary
s {$sel:resourceType:EventTypeSummary' :: Maybe Text
resourceType = Maybe Text
a} :: EventTypeSummary)

-- | The name of the event.
eventTypeSummary_eventTypeName :: Lens.Lens' EventTypeSummary (Prelude.Maybe Prelude.Text)
eventTypeSummary_eventTypeName :: (Maybe Text -> f (Maybe Text))
-> EventTypeSummary -> f EventTypeSummary
eventTypeSummary_eventTypeName = (EventTypeSummary -> Maybe Text)
-> (EventTypeSummary -> Maybe Text -> EventTypeSummary)
-> Lens EventTypeSummary EventTypeSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventTypeSummary' {Maybe Text
eventTypeName :: Maybe Text
$sel:eventTypeName:EventTypeSummary' :: EventTypeSummary -> Maybe Text
eventTypeName} -> Maybe Text
eventTypeName) (\s :: EventTypeSummary
s@EventTypeSummary' {} Maybe Text
a -> EventTypeSummary
s {$sel:eventTypeName:EventTypeSummary' :: Maybe Text
eventTypeName = Maybe Text
a} :: EventTypeSummary)

-- | The system-generated ID of the event.
eventTypeSummary_eventTypeId :: Lens.Lens' EventTypeSummary (Prelude.Maybe Prelude.Text)
eventTypeSummary_eventTypeId :: (Maybe Text -> f (Maybe Text))
-> EventTypeSummary -> f EventTypeSummary
eventTypeSummary_eventTypeId = (EventTypeSummary -> Maybe Text)
-> (EventTypeSummary -> Maybe Text -> EventTypeSummary)
-> Lens EventTypeSummary EventTypeSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventTypeSummary' {Maybe Text
eventTypeId :: Maybe Text
$sel:eventTypeId:EventTypeSummary' :: EventTypeSummary -> Maybe Text
eventTypeId} -> Maybe Text
eventTypeId) (\s :: EventTypeSummary
s@EventTypeSummary' {} Maybe Text
a -> EventTypeSummary
s {$sel:eventTypeId:EventTypeSummary' :: Maybe Text
eventTypeId = Maybe Text
a} :: EventTypeSummary)

-- | The name of the service for which the event applies.
eventTypeSummary_serviceName :: Lens.Lens' EventTypeSummary (Prelude.Maybe Prelude.Text)
eventTypeSummary_serviceName :: (Maybe Text -> f (Maybe Text))
-> EventTypeSummary -> f EventTypeSummary
eventTypeSummary_serviceName = (EventTypeSummary -> Maybe Text)
-> (EventTypeSummary -> Maybe Text -> EventTypeSummary)
-> Lens EventTypeSummary EventTypeSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventTypeSummary' {Maybe Text
serviceName :: Maybe Text
$sel:serviceName:EventTypeSummary' :: EventTypeSummary -> Maybe Text
serviceName} -> Maybe Text
serviceName) (\s :: EventTypeSummary
s@EventTypeSummary' {} Maybe Text
a -> EventTypeSummary
s {$sel:serviceName:EventTypeSummary' :: Maybe Text
serviceName = Maybe Text
a} :: EventTypeSummary)

instance Core.FromJSON EventTypeSummary where
  parseJSON :: Value -> Parser EventTypeSummary
parseJSON =
    String
-> (Object -> Parser EventTypeSummary)
-> Value
-> Parser EventTypeSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EventTypeSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> EventTypeSummary
EventTypeSummary'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> EventTypeSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> EventTypeSummary)
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
"ResourceType")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> EventTypeSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> EventTypeSummary)
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
"EventTypeName")
            Parser (Maybe Text -> Maybe Text -> EventTypeSummary)
-> Parser (Maybe Text) -> Parser (Maybe Text -> EventTypeSummary)
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
"EventTypeId")
            Parser (Maybe Text -> EventTypeSummary)
-> Parser (Maybe Text) -> Parser EventTypeSummary
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
"ServiceName")
      )

instance Prelude.Hashable EventTypeSummary

instance Prelude.NFData EventTypeSummary