{-# 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.Code where
import Amazonka.CodeStar.Types.CodeDestination
import Amazonka.CodeStar.Types.CodeSource
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Code = Code'
{
Code -> CodeSource
source :: CodeSource,
Code -> CodeDestination
destination :: CodeDestination
}
deriving (Code -> Code -> Bool
(Code -> Code -> Bool) -> (Code -> Code -> Bool) -> Eq Code
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Code -> Code -> Bool
$c/= :: Code -> Code -> Bool
== :: Code -> Code -> Bool
$c== :: Code -> Code -> Bool
Prelude.Eq, Int -> Code -> ShowS
[Code] -> ShowS
Code -> String
(Int -> Code -> ShowS)
-> (Code -> String) -> ([Code] -> ShowS) -> Show Code
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Code] -> ShowS
$cshowList :: [Code] -> ShowS
show :: Code -> String
$cshow :: Code -> String
showsPrec :: Int -> Code -> ShowS
$cshowsPrec :: Int -> Code -> ShowS
Prelude.Show, (forall x. Code -> Rep Code x)
-> (forall x. Rep Code x -> Code) -> Generic Code
forall x. Rep Code x -> Code
forall x. Code -> Rep Code x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Code x -> Code
$cfrom :: forall x. Code -> Rep Code x
Prelude.Generic)
newCode ::
CodeSource ->
CodeDestination ->
Code
newCode :: CodeSource -> CodeDestination -> Code
newCode CodeSource
pSource_ CodeDestination
pDestination_ =
Code' :: CodeSource -> CodeDestination -> Code
Code'
{ $sel:source:Code' :: CodeSource
source = CodeSource
pSource_,
$sel:destination:Code' :: CodeDestination
destination = CodeDestination
pDestination_
}
code_source :: Lens.Lens' Code CodeSource
code_source :: (CodeSource -> f CodeSource) -> Code -> f Code
code_source = (Code -> CodeSource)
-> (Code -> CodeSource -> Code)
-> Lens Code Code CodeSource CodeSource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Code' {CodeSource
source :: CodeSource
$sel:source:Code' :: Code -> CodeSource
source} -> CodeSource
source) (\s :: Code
s@Code' {} CodeSource
a -> Code
s {$sel:source:Code' :: CodeSource
source = CodeSource
a} :: Code)
code_destination :: Lens.Lens' Code CodeDestination
code_destination :: (CodeDestination -> f CodeDestination) -> Code -> f Code
code_destination = (Code -> CodeDestination)
-> (Code -> CodeDestination -> Code)
-> Lens Code Code CodeDestination CodeDestination
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Code' {CodeDestination
destination :: CodeDestination
$sel:destination:Code' :: Code -> CodeDestination
destination} -> CodeDestination
destination) (\s :: Code
s@Code' {} CodeDestination
a -> Code
s {$sel:destination:Code' :: CodeDestination
destination = CodeDestination
a} :: Code)
instance Prelude.Hashable Code
instance Prelude.NFData Code
instance Core.ToJSON Code where
toJSON :: Code -> Value
toJSON Code' {CodeDestination
CodeSource
destination :: CodeDestination
source :: CodeSource
$sel:destination:Code' :: Code -> CodeDestination
$sel:source:Code' :: Code -> CodeSource
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"source" Text -> CodeSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CodeSource
source),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"destination" Text -> CodeDestination -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CodeDestination
destination)
]
)