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

import Amazonka.CodeStarNotifications.Types.TargetStatus
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

-- | Information about the targets specified for a notification rule.
--
-- /See:/ 'newTargetSummary' smart constructor.
data TargetSummary = TargetSummary'
  { -- | The Amazon Resource Name (ARN) of the Chatbot topic or Chatbot client.
    TargetSummary -> Maybe (Sensitive Text)
targetAddress :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The status of the target.
    TargetSummary -> Maybe TargetStatus
targetStatus :: Prelude.Maybe TargetStatus,
    -- | The type of the target (for example, @SNS@).
    --
    -- -   Chatbot topics are specified as @SNS@.
    --
    -- -   Chatbot clients are specified as @AWSChatbotSlack@.
    TargetSummary -> Maybe Text
targetType :: Prelude.Maybe Prelude.Text
  }
  deriving (TargetSummary -> TargetSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TargetSummary -> TargetSummary -> Bool
$c/= :: TargetSummary -> TargetSummary -> Bool
== :: TargetSummary -> TargetSummary -> Bool
$c== :: TargetSummary -> TargetSummary -> Bool
Prelude.Eq, Int -> TargetSummary -> ShowS
[TargetSummary] -> ShowS
TargetSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TargetSummary] -> ShowS
$cshowList :: [TargetSummary] -> ShowS
show :: TargetSummary -> String
$cshow :: TargetSummary -> String
showsPrec :: Int -> TargetSummary -> ShowS
$cshowsPrec :: Int -> TargetSummary -> ShowS
Prelude.Show, forall x. Rep TargetSummary x -> TargetSummary
forall x. TargetSummary -> Rep TargetSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TargetSummary x -> TargetSummary
$cfrom :: forall x. TargetSummary -> Rep TargetSummary x
Prelude.Generic)

-- |
-- Create a value of 'TargetSummary' 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:
--
-- 'targetAddress', 'targetSummary_targetAddress' - The Amazon Resource Name (ARN) of the Chatbot topic or Chatbot client.
--
-- 'targetStatus', 'targetSummary_targetStatus' - The status of the target.
--
-- 'targetType', 'targetSummary_targetType' - The type of the target (for example, @SNS@).
--
-- -   Chatbot topics are specified as @SNS@.
--
-- -   Chatbot clients are specified as @AWSChatbotSlack@.
newTargetSummary ::
  TargetSummary
newTargetSummary :: TargetSummary
newTargetSummary =
  TargetSummary'
    { $sel:targetAddress:TargetSummary' :: Maybe (Sensitive Text)
targetAddress = forall a. Maybe a
Prelude.Nothing,
      $sel:targetStatus:TargetSummary' :: Maybe TargetStatus
targetStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:targetType:TargetSummary' :: Maybe Text
targetType = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the Chatbot topic or Chatbot client.
targetSummary_targetAddress :: Lens.Lens' TargetSummary (Prelude.Maybe Prelude.Text)
targetSummary_targetAddress :: Lens' TargetSummary (Maybe Text)
targetSummary_targetAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetSummary' {Maybe (Sensitive Text)
targetAddress :: Maybe (Sensitive Text)
$sel:targetAddress:TargetSummary' :: TargetSummary -> Maybe (Sensitive Text)
targetAddress} -> Maybe (Sensitive Text)
targetAddress) (\s :: TargetSummary
s@TargetSummary' {} Maybe (Sensitive Text)
a -> TargetSummary
s {$sel:targetAddress:TargetSummary' :: Maybe (Sensitive Text)
targetAddress = Maybe (Sensitive Text)
a} :: TargetSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The status of the target.
targetSummary_targetStatus :: Lens.Lens' TargetSummary (Prelude.Maybe TargetStatus)
targetSummary_targetStatus :: Lens' TargetSummary (Maybe TargetStatus)
targetSummary_targetStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetSummary' {Maybe TargetStatus
targetStatus :: Maybe TargetStatus
$sel:targetStatus:TargetSummary' :: TargetSummary -> Maybe TargetStatus
targetStatus} -> Maybe TargetStatus
targetStatus) (\s :: TargetSummary
s@TargetSummary' {} Maybe TargetStatus
a -> TargetSummary
s {$sel:targetStatus:TargetSummary' :: Maybe TargetStatus
targetStatus = Maybe TargetStatus
a} :: TargetSummary)

-- | The type of the target (for example, @SNS@).
--
-- -   Chatbot topics are specified as @SNS@.
--
-- -   Chatbot clients are specified as @AWSChatbotSlack@.
targetSummary_targetType :: Lens.Lens' TargetSummary (Prelude.Maybe Prelude.Text)
targetSummary_targetType :: Lens' TargetSummary (Maybe Text)
targetSummary_targetType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetSummary' {Maybe Text
targetType :: Maybe Text
$sel:targetType:TargetSummary' :: TargetSummary -> Maybe Text
targetType} -> Maybe Text
targetType) (\s :: TargetSummary
s@TargetSummary' {} Maybe Text
a -> TargetSummary
s {$sel:targetType:TargetSummary' :: Maybe Text
targetType = Maybe Text
a} :: TargetSummary)

instance Data.FromJSON TargetSummary where
  parseJSON :: Value -> Parser TargetSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TargetSummary"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe TargetStatus -> Maybe Text -> TargetSummary
TargetSummary'
            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
"TargetAddress")
            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
"TargetStatus")
            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
"TargetType")
      )

instance Prelude.Hashable TargetSummary where
  hashWithSalt :: Int -> TargetSummary -> Int
hashWithSalt Int
_salt TargetSummary' {Maybe Text
Maybe (Sensitive Text)
Maybe TargetStatus
targetType :: Maybe Text
targetStatus :: Maybe TargetStatus
targetAddress :: Maybe (Sensitive Text)
$sel:targetType:TargetSummary' :: TargetSummary -> Maybe Text
$sel:targetStatus:TargetSummary' :: TargetSummary -> Maybe TargetStatus
$sel:targetAddress:TargetSummary' :: TargetSummary -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
targetAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TargetStatus
targetStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
targetType

instance Prelude.NFData TargetSummary where
  rnf :: TargetSummary -> ()
rnf TargetSummary' {Maybe Text
Maybe (Sensitive Text)
Maybe TargetStatus
targetType :: Maybe Text
targetStatus :: Maybe TargetStatus
targetAddress :: Maybe (Sensitive Text)
$sel:targetType:TargetSummary' :: TargetSummary -> Maybe Text
$sel:targetStatus:TargetSummary' :: TargetSummary -> Maybe TargetStatus
$sel:targetAddress:TargetSummary' :: TargetSummary -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
targetAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TargetStatus
targetStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
targetType