{-# 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.CodeStar.Types.CodeDestination where
import Amazonka.CodeStar.Types.CodeCommitCodeDestination
import Amazonka.CodeStar.Types.GitHubCodeDestination
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CodeDestination = CodeDestination'
{
CodeDestination -> Maybe CodeCommitCodeDestination
codeCommit :: Prelude.Maybe CodeCommitCodeDestination,
CodeDestination -> Maybe GitHubCodeDestination
gitHub :: Prelude.Maybe GitHubCodeDestination
}
deriving (CodeDestination -> CodeDestination -> Bool
(CodeDestination -> CodeDestination -> Bool)
-> (CodeDestination -> CodeDestination -> Bool)
-> Eq CodeDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeDestination -> CodeDestination -> Bool
$c/= :: CodeDestination -> CodeDestination -> Bool
== :: CodeDestination -> CodeDestination -> Bool
$c== :: CodeDestination -> CodeDestination -> Bool
Prelude.Eq, Int -> CodeDestination -> ShowS
[CodeDestination] -> ShowS
CodeDestination -> String
(Int -> CodeDestination -> ShowS)
-> (CodeDestination -> String)
-> ([CodeDestination] -> ShowS)
-> Show CodeDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeDestination] -> ShowS
$cshowList :: [CodeDestination] -> ShowS
show :: CodeDestination -> String
$cshow :: CodeDestination -> String
showsPrec :: Int -> CodeDestination -> ShowS
$cshowsPrec :: Int -> CodeDestination -> ShowS
Prelude.Show, (forall x. CodeDestination -> Rep CodeDestination x)
-> (forall x. Rep CodeDestination x -> CodeDestination)
-> Generic CodeDestination
forall x. Rep CodeDestination x -> CodeDestination
forall x. CodeDestination -> Rep CodeDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeDestination x -> CodeDestination
$cfrom :: forall x. CodeDestination -> Rep CodeDestination x
Prelude.Generic)
newCodeDestination ::
CodeDestination
newCodeDestination :: CodeDestination
newCodeDestination =
CodeDestination' :: Maybe CodeCommitCodeDestination
-> Maybe GitHubCodeDestination -> CodeDestination
CodeDestination'
{ $sel:codeCommit:CodeDestination' :: Maybe CodeCommitCodeDestination
codeCommit = Maybe CodeCommitCodeDestination
forall a. Maybe a
Prelude.Nothing,
$sel:gitHub:CodeDestination' :: Maybe GitHubCodeDestination
gitHub = Maybe GitHubCodeDestination
forall a. Maybe a
Prelude.Nothing
}
codeDestination_codeCommit :: Lens.Lens' CodeDestination (Prelude.Maybe CodeCommitCodeDestination)
codeDestination_codeCommit :: (Maybe CodeCommitCodeDestination
-> f (Maybe CodeCommitCodeDestination))
-> CodeDestination -> f CodeDestination
codeDestination_codeCommit = (CodeDestination -> Maybe CodeCommitCodeDestination)
-> (CodeDestination
-> Maybe CodeCommitCodeDestination -> CodeDestination)
-> Lens
CodeDestination
CodeDestination
(Maybe CodeCommitCodeDestination)
(Maybe CodeCommitCodeDestination)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeDestination' {Maybe CodeCommitCodeDestination
codeCommit :: Maybe CodeCommitCodeDestination
$sel:codeCommit:CodeDestination' :: CodeDestination -> Maybe CodeCommitCodeDestination
codeCommit} -> Maybe CodeCommitCodeDestination
codeCommit) (\s :: CodeDestination
s@CodeDestination' {} Maybe CodeCommitCodeDestination
a -> CodeDestination
s {$sel:codeCommit:CodeDestination' :: Maybe CodeCommitCodeDestination
codeCommit = Maybe CodeCommitCodeDestination
a} :: CodeDestination)
codeDestination_gitHub :: Lens.Lens' CodeDestination (Prelude.Maybe GitHubCodeDestination)
codeDestination_gitHub :: (Maybe GitHubCodeDestination -> f (Maybe GitHubCodeDestination))
-> CodeDestination -> f CodeDestination
codeDestination_gitHub = (CodeDestination -> Maybe GitHubCodeDestination)
-> (CodeDestination
-> Maybe GitHubCodeDestination -> CodeDestination)
-> Lens
CodeDestination
CodeDestination
(Maybe GitHubCodeDestination)
(Maybe GitHubCodeDestination)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeDestination' {Maybe GitHubCodeDestination
gitHub :: Maybe GitHubCodeDestination
$sel:gitHub:CodeDestination' :: CodeDestination -> Maybe GitHubCodeDestination
gitHub} -> Maybe GitHubCodeDestination
gitHub) (\s :: CodeDestination
s@CodeDestination' {} Maybe GitHubCodeDestination
a -> CodeDestination
s {$sel:gitHub:CodeDestination' :: Maybe GitHubCodeDestination
gitHub = Maybe GitHubCodeDestination
a} :: CodeDestination)
instance Prelude.Hashable CodeDestination
instance Prelude.NFData CodeDestination
instance Core.ToJSON CodeDestination where
toJSON :: CodeDestination -> Value
toJSON CodeDestination' {Maybe CodeCommitCodeDestination
Maybe GitHubCodeDestination
gitHub :: Maybe GitHubCodeDestination
codeCommit :: Maybe CodeCommitCodeDestination
$sel:gitHub:CodeDestination' :: CodeDestination -> Maybe GitHubCodeDestination
$sel:codeCommit:CodeDestination' :: CodeDestination -> Maybe CodeCommitCodeDestination
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"codeCommit" Text -> CodeCommitCodeDestination -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CodeCommitCodeDestination -> Pair)
-> Maybe CodeCommitCodeDestination -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CodeCommitCodeDestination
codeCommit,
(Text
"gitHub" Text -> GitHubCodeDestination -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (GitHubCodeDestination -> Pair)
-> Maybe GitHubCodeDestination -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GitHubCodeDestination
gitHub
]
)