{-# 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.CodeCommit.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
destinationReference :: Prelude.Maybe Prelude.Text,
Target -> Text
repositoryName :: Prelude.Text,
Target -> Text
sourceReference :: 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, ReadPrec [Target]
ReadPrec Target
Int -> ReadS Target
ReadS [Target]
(Int -> ReadS Target)
-> ReadS [Target]
-> ReadPrec Target
-> ReadPrec [Target]
-> Read Target
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Target]
$creadListPrec :: ReadPrec [Target]
readPrec :: ReadPrec Target
$creadPrec :: ReadPrec Target
readList :: ReadS [Target]
$creadList :: ReadS [Target]
readsPrec :: Int -> ReadS Target
$creadsPrec :: Int -> ReadS Target
Prelude.Read, 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 ::
Prelude.Text ->
Prelude.Text ->
Target
newTarget :: Text -> Text -> Target
newTarget Text
pRepositoryName_ Text
pSourceReference_ =
Target' :: Maybe Text -> Text -> Text -> Target
Target'
{ $sel:destinationReference:Target' :: Maybe Text
destinationReference = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:repositoryName:Target' :: Text
repositoryName = Text
pRepositoryName_,
$sel:sourceReference:Target' :: Text
sourceReference = Text
pSourceReference_
}
target_destinationReference :: Lens.Lens' Target (Prelude.Maybe Prelude.Text)
target_destinationReference :: (Maybe Text -> f (Maybe Text)) -> Target -> f Target
target_destinationReference = (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
destinationReference :: Maybe Text
$sel:destinationReference:Target' :: Target -> Maybe Text
destinationReference} -> Maybe Text
destinationReference) (\s :: Target
s@Target' {} Maybe Text
a -> Target
s {$sel:destinationReference:Target' :: Maybe Text
destinationReference = Maybe Text
a} :: Target)
target_repositoryName :: Lens.Lens' Target Prelude.Text
target_repositoryName :: (Text -> f Text) -> Target -> f Target
target_repositoryName = (Target -> Text)
-> (Target -> Text -> Target) -> Lens Target Target Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Target' {Text
repositoryName :: Text
$sel:repositoryName:Target' :: Target -> Text
repositoryName} -> Text
repositoryName) (\s :: Target
s@Target' {} Text
a -> Target
s {$sel:repositoryName:Target' :: Text
repositoryName = Text
a} :: Target)
target_sourceReference :: Lens.Lens' Target Prelude.Text
target_sourceReference :: (Text -> f Text) -> Target -> f Target
target_sourceReference = (Target -> Text)
-> (Target -> Text -> Target) -> Lens Target Target Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Target' {Text
sourceReference :: Text
$sel:sourceReference:Target' :: Target -> Text
sourceReference} -> Text
sourceReference) (\s :: Target
s@Target' {} Text
a -> Target
s {$sel:sourceReference:Target' :: Text
sourceReference = Text
a} :: Target)
instance Prelude.Hashable Target
instance Prelude.NFData Target
instance Core.ToJSON Target where
toJSON :: Target -> Value
toJSON Target' {Maybe Text
Text
sourceReference :: Text
repositoryName :: Text
destinationReference :: Maybe Text
$sel:sourceReference:Target' :: Target -> Text
$sel:repositoryName:Target' :: Target -> Text
$sel:destinationReference:Target' :: Target -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"destinationReference" 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
destinationReference,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"repositoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
repositoryName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"sourceReference" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceReference)
]
)