{-# 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.CodeDeploy.Types.GitHubLocation where
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 GitHubLocation = GitHubLocation'
{
GitHubLocation -> Maybe Text
commitId :: Prelude.Maybe Prelude.Text,
GitHubLocation -> Maybe Text
repository :: Prelude.Maybe Prelude.Text
}
deriving (GitHubLocation -> GitHubLocation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GitHubLocation -> GitHubLocation -> Bool
$c/= :: GitHubLocation -> GitHubLocation -> Bool
== :: GitHubLocation -> GitHubLocation -> Bool
$c== :: GitHubLocation -> GitHubLocation -> Bool
Prelude.Eq, ReadPrec [GitHubLocation]
ReadPrec GitHubLocation
Int -> ReadS GitHubLocation
ReadS [GitHubLocation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GitHubLocation]
$creadListPrec :: ReadPrec [GitHubLocation]
readPrec :: ReadPrec GitHubLocation
$creadPrec :: ReadPrec GitHubLocation
readList :: ReadS [GitHubLocation]
$creadList :: ReadS [GitHubLocation]
readsPrec :: Int -> ReadS GitHubLocation
$creadsPrec :: Int -> ReadS GitHubLocation
Prelude.Read, Int -> GitHubLocation -> ShowS
[GitHubLocation] -> ShowS
GitHubLocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GitHubLocation] -> ShowS
$cshowList :: [GitHubLocation] -> ShowS
show :: GitHubLocation -> String
$cshow :: GitHubLocation -> String
showsPrec :: Int -> GitHubLocation -> ShowS
$cshowsPrec :: Int -> GitHubLocation -> ShowS
Prelude.Show, forall x. Rep GitHubLocation x -> GitHubLocation
forall x. GitHubLocation -> Rep GitHubLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GitHubLocation x -> GitHubLocation
$cfrom :: forall x. GitHubLocation -> Rep GitHubLocation x
Prelude.Generic)
newGitHubLocation ::
GitHubLocation
newGitHubLocation :: GitHubLocation
newGitHubLocation =
GitHubLocation'
{ $sel:commitId:GitHubLocation' :: Maybe Text
commitId = forall a. Maybe a
Prelude.Nothing,
$sel:repository:GitHubLocation' :: Maybe Text
repository = forall a. Maybe a
Prelude.Nothing
}
gitHubLocation_commitId :: Lens.Lens' GitHubLocation (Prelude.Maybe Prelude.Text)
gitHubLocation_commitId :: Lens' GitHubLocation (Maybe Text)
gitHubLocation_commitId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GitHubLocation' {Maybe Text
commitId :: Maybe Text
$sel:commitId:GitHubLocation' :: GitHubLocation -> Maybe Text
commitId} -> Maybe Text
commitId) (\s :: GitHubLocation
s@GitHubLocation' {} Maybe Text
a -> GitHubLocation
s {$sel:commitId:GitHubLocation' :: Maybe Text
commitId = Maybe Text
a} :: GitHubLocation)
gitHubLocation_repository :: Lens.Lens' GitHubLocation (Prelude.Maybe Prelude.Text)
gitHubLocation_repository :: Lens' GitHubLocation (Maybe Text)
gitHubLocation_repository = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GitHubLocation' {Maybe Text
repository :: Maybe Text
$sel:repository:GitHubLocation' :: GitHubLocation -> Maybe Text
repository} -> Maybe Text
repository) (\s :: GitHubLocation
s@GitHubLocation' {} Maybe Text
a -> GitHubLocation
s {$sel:repository:GitHubLocation' :: Maybe Text
repository = Maybe Text
a} :: GitHubLocation)
instance Data.FromJSON GitHubLocation where
parseJSON :: Value -> Parser GitHubLocation
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"GitHubLocation"
( \Object
x ->
Maybe Text -> Maybe Text -> GitHubLocation
GitHubLocation'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"commitId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"repository")
)
instance Prelude.Hashable GitHubLocation where
hashWithSalt :: Int -> GitHubLocation -> Int
hashWithSalt Int
_salt GitHubLocation' {Maybe Text
repository :: Maybe Text
commitId :: Maybe Text
$sel:repository:GitHubLocation' :: GitHubLocation -> Maybe Text
$sel:commitId:GitHubLocation' :: GitHubLocation -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
commitId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
repository
instance Prelude.NFData GitHubLocation where
rnf :: GitHubLocation -> ()
rnf GitHubLocation' {Maybe Text
repository :: Maybe Text
commitId :: Maybe Text
$sel:repository:GitHubLocation' :: GitHubLocation -> Maybe Text
$sel:commitId:GitHubLocation' :: GitHubLocation -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
commitId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
repository
instance Data.ToJSON GitHubLocation where
toJSON :: GitHubLocation -> Value
toJSON GitHubLocation' {Maybe Text
repository :: Maybe Text
commitId :: Maybe Text
$sel:repository:GitHubLocation' :: GitHubLocation -> Maybe Text
$sel:commitId:GitHubLocation' :: GitHubLocation -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"commitId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
commitId,
(Key
"repository" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
repository
]
)