{-# 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 #-}
module Amazonka.CodeStarNotifications.Types.Target where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Target = Target'
{
Target -> Maybe Text
targetType :: Prelude.Maybe Prelude.Text,
Target -> Maybe (Sensitive Text)
targetAddress :: Prelude.Maybe (Core.Sensitive Prelude.Text)
}
deriving (Target -> Target -> Bool
(Target -> Target -> Bool)
-> (Target -> Target -> Bool) -> Eq Target
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Target -> Target -> Bool
$c/= :: Target -> Target -> Bool
== :: Target -> Target -> Bool
$c== :: Target -> Target -> Bool
Prelude.Eq, Int -> Target -> ShowS
[Target] -> ShowS
Target -> String
(Int -> Target -> ShowS)
-> (Target -> String) -> ([Target] -> ShowS) -> Show Target
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Target] -> ShowS
$cshowList :: [Target] -> ShowS
show :: Target -> String
$cshow :: Target -> String
showsPrec :: Int -> Target -> ShowS
$cshowsPrec :: Int -> Target -> ShowS
Prelude.Show, (forall x. Target -> Rep Target x)
-> (forall x. Rep Target x -> Target) -> Generic Target
forall x. Rep Target x -> Target
forall x. Target -> Rep Target x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Target x -> Target
$cfrom :: forall x. Target -> Rep Target x
Prelude.Generic)
newTarget ::
Target
newTarget :: Target
newTarget =
Target' :: Maybe Text -> Maybe (Sensitive Text) -> Target
Target'
{ $sel:targetType:Target' :: Maybe Text
targetType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:targetAddress:Target' :: Maybe (Sensitive Text)
targetAddress = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
}
target_targetType :: Lens.Lens' Target (Prelude.Maybe Prelude.Text)
target_targetType :: (Maybe Text -> f (Maybe Text)) -> Target -> f Target
target_targetType = (Target -> Maybe Text)
-> (Target -> Maybe Text -> Target)
-> Lens Target Target (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Target' {Maybe Text
targetType :: Maybe Text
$sel:targetType:Target' :: Target -> Maybe Text
targetType} -> Maybe Text
targetType) (\s :: Target
s@Target' {} Maybe Text
a -> Target
s {$sel:targetType:Target' :: Maybe Text
targetType = Maybe Text
a} :: Target)
target_targetAddress :: Lens.Lens' Target (Prelude.Maybe Prelude.Text)
target_targetAddress :: (Maybe Text -> f (Maybe Text)) -> Target -> f Target
target_targetAddress = (Target -> Maybe (Sensitive Text))
-> (Target -> Maybe (Sensitive Text) -> Target)
-> Lens
Target Target (Maybe (Sensitive Text)) (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Target' {Maybe (Sensitive Text)
targetAddress :: Maybe (Sensitive Text)
$sel:targetAddress:Target' :: Target -> Maybe (Sensitive Text)
targetAddress} -> Maybe (Sensitive Text)
targetAddress) (\s :: Target
s@Target' {} Maybe (Sensitive Text)
a -> Target
s {$sel:targetAddress:Target' :: Maybe (Sensitive Text)
targetAddress = Maybe (Sensitive Text)
a} :: Target) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> Target -> f Target)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Target
-> f Target
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
instance Prelude.Hashable Target
instance Prelude.NFData Target
instance Core.ToJSON Target where
toJSON :: Target -> Value
toJSON Target' {Maybe Text
Maybe (Sensitive Text)
targetAddress :: Maybe (Sensitive Text)
targetType :: Maybe Text
$sel:targetAddress:Target' :: Target -> Maybe (Sensitive Text)
$sel:targetType:Target' :: Target -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"TargetType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
targetType,
(Text
"TargetAddress" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
targetAddress
]
)