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

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

-- | Information about a specified notification rule.
--
-- /See:/ 'newNotificationRuleSummary' smart constructor.
data NotificationRuleSummary = NotificationRuleSummary'
  { -- | The Amazon Resource Name (ARN) of the notification rule.
    NotificationRuleSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The unique ID of the notification rule.
    NotificationRuleSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (NotificationRuleSummary -> NotificationRuleSummary -> Bool
(NotificationRuleSummary -> NotificationRuleSummary -> Bool)
-> (NotificationRuleSummary -> NotificationRuleSummary -> Bool)
-> Eq NotificationRuleSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotificationRuleSummary -> NotificationRuleSummary -> Bool
$c/= :: NotificationRuleSummary -> NotificationRuleSummary -> Bool
== :: NotificationRuleSummary -> NotificationRuleSummary -> Bool
$c== :: NotificationRuleSummary -> NotificationRuleSummary -> Bool
Prelude.Eq, ReadPrec [NotificationRuleSummary]
ReadPrec NotificationRuleSummary
Int -> ReadS NotificationRuleSummary
ReadS [NotificationRuleSummary]
(Int -> ReadS NotificationRuleSummary)
-> ReadS [NotificationRuleSummary]
-> ReadPrec NotificationRuleSummary
-> ReadPrec [NotificationRuleSummary]
-> Read NotificationRuleSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotificationRuleSummary]
$creadListPrec :: ReadPrec [NotificationRuleSummary]
readPrec :: ReadPrec NotificationRuleSummary
$creadPrec :: ReadPrec NotificationRuleSummary
readList :: ReadS [NotificationRuleSummary]
$creadList :: ReadS [NotificationRuleSummary]
readsPrec :: Int -> ReadS NotificationRuleSummary
$creadsPrec :: Int -> ReadS NotificationRuleSummary
Prelude.Read, Int -> NotificationRuleSummary -> ShowS
[NotificationRuleSummary] -> ShowS
NotificationRuleSummary -> String
(Int -> NotificationRuleSummary -> ShowS)
-> (NotificationRuleSummary -> String)
-> ([NotificationRuleSummary] -> ShowS)
-> Show NotificationRuleSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotificationRuleSummary] -> ShowS
$cshowList :: [NotificationRuleSummary] -> ShowS
show :: NotificationRuleSummary -> String
$cshow :: NotificationRuleSummary -> String
showsPrec :: Int -> NotificationRuleSummary -> ShowS
$cshowsPrec :: Int -> NotificationRuleSummary -> ShowS
Prelude.Show, (forall x.
 NotificationRuleSummary -> Rep NotificationRuleSummary x)
-> (forall x.
    Rep NotificationRuleSummary x -> NotificationRuleSummary)
-> Generic NotificationRuleSummary
forall x. Rep NotificationRuleSummary x -> NotificationRuleSummary
forall x. NotificationRuleSummary -> Rep NotificationRuleSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NotificationRuleSummary x -> NotificationRuleSummary
$cfrom :: forall x. NotificationRuleSummary -> Rep NotificationRuleSummary x
Prelude.Generic)

-- |
-- Create a value of 'NotificationRuleSummary' 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:
--
-- 'arn', 'notificationRuleSummary_arn' - The Amazon Resource Name (ARN) of the notification rule.
--
-- 'id', 'notificationRuleSummary_id' - The unique ID of the notification rule.
newNotificationRuleSummary ::
  NotificationRuleSummary
newNotificationRuleSummary :: NotificationRuleSummary
newNotificationRuleSummary =
  NotificationRuleSummary' :: Maybe Text -> Maybe Text -> NotificationRuleSummary
NotificationRuleSummary'
    { $sel:arn:NotificationRuleSummary' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:NotificationRuleSummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the notification rule.
notificationRuleSummary_arn :: Lens.Lens' NotificationRuleSummary (Prelude.Maybe Prelude.Text)
notificationRuleSummary_arn :: (Maybe Text -> f (Maybe Text))
-> NotificationRuleSummary -> f NotificationRuleSummary
notificationRuleSummary_arn = (NotificationRuleSummary -> Maybe Text)
-> (NotificationRuleSummary
    -> Maybe Text -> NotificationRuleSummary)
-> Lens
     NotificationRuleSummary
     NotificationRuleSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotificationRuleSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:NotificationRuleSummary' :: NotificationRuleSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: NotificationRuleSummary
s@NotificationRuleSummary' {} Maybe Text
a -> NotificationRuleSummary
s {$sel:arn:NotificationRuleSummary' :: Maybe Text
arn = Maybe Text
a} :: NotificationRuleSummary)

-- | The unique ID of the notification rule.
notificationRuleSummary_id :: Lens.Lens' NotificationRuleSummary (Prelude.Maybe Prelude.Text)
notificationRuleSummary_id :: (Maybe Text -> f (Maybe Text))
-> NotificationRuleSummary -> f NotificationRuleSummary
notificationRuleSummary_id = (NotificationRuleSummary -> Maybe Text)
-> (NotificationRuleSummary
    -> Maybe Text -> NotificationRuleSummary)
-> Lens
     NotificationRuleSummary
     NotificationRuleSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotificationRuleSummary' {Maybe Text
id :: Maybe Text
$sel:id:NotificationRuleSummary' :: NotificationRuleSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: NotificationRuleSummary
s@NotificationRuleSummary' {} Maybe Text
a -> NotificationRuleSummary
s {$sel:id:NotificationRuleSummary' :: Maybe Text
id = Maybe Text
a} :: NotificationRuleSummary)

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

instance Prelude.Hashable NotificationRuleSummary

instance Prelude.NFData NotificationRuleSummary