{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data Code = Code'
{
Code -> CodeSource
source :: CodeSource,
Code -> CodeDestination
destination :: CodeDestination
}
deriving (Code -> Code -> Bool
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
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. 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'
{ $sel:source:Code' :: CodeSource
source = CodeSource
pSource_,
$sel:destination:Code' :: CodeDestination
destination = CodeDestination
pDestination_
}
code_source :: Lens.Lens' Code CodeSource
code_source :: Lens' Code CodeSource
code_source = 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 :: Lens' Code CodeDestination
code_destination = 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 where
hashWithSalt :: Int -> Code -> Int
hashWithSalt Int
_salt Code' {CodeDestination
CodeSource
destination :: CodeDestination
source :: CodeSource
$sel:destination:Code' :: Code -> CodeDestination
$sel:source:Code' :: Code -> CodeSource
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CodeSource
source
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CodeDestination
destination
instance Prelude.NFData Code where
rnf :: Code -> ()
rnf Code' {CodeDestination
CodeSource
destination :: CodeDestination
source :: CodeSource
$sel:destination:Code' :: Code -> CodeDestination
$sel:source:Code' :: Code -> CodeSource
..} =
forall a. NFData a => a -> ()
Prelude.rnf CodeSource
source
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf CodeDestination
destination
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"source" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= CodeSource
source),
forall a. a -> Maybe a
Prelude.Just (Key
"destination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= CodeDestination
destination)
]
)