{-# 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.Lens as Lens
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
(GitHubLocation -> GitHubLocation -> Bool)
-> (GitHubLocation -> GitHubLocation -> Bool) -> Eq GitHubLocation
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]
(Int -> ReadS GitHubLocation)
-> ReadS [GitHubLocation]
-> ReadPrec GitHubLocation
-> ReadPrec [GitHubLocation]
-> Read 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
(Int -> GitHubLocation -> ShowS)
-> (GitHubLocation -> String)
-> ([GitHubLocation] -> ShowS)
-> Show GitHubLocation
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. GitHubLocation -> Rep GitHubLocation x)
-> (forall x. Rep GitHubLocation x -> GitHubLocation)
-> Generic GitHubLocation
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' :: Maybe Text -> Maybe Text -> GitHubLocation
GitHubLocation'
{ $sel:commitId:GitHubLocation' :: Maybe Text
commitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:repository:GitHubLocation' :: Maybe Text
repository = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
gitHubLocation_commitId :: Lens.Lens' GitHubLocation (Prelude.Maybe Prelude.Text)
gitHubLocation_commitId :: (Maybe Text -> f (Maybe Text))
-> GitHubLocation -> f GitHubLocation
gitHubLocation_commitId = (GitHubLocation -> Maybe Text)
-> (GitHubLocation -> Maybe Text -> GitHubLocation)
-> Lens GitHubLocation GitHubLocation (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> GitHubLocation -> f GitHubLocation
gitHubLocation_repository = (GitHubLocation -> Maybe Text)
-> (GitHubLocation -> Maybe Text -> GitHubLocation)
-> Lens GitHubLocation GitHubLocation (Maybe Text) (Maybe Text)
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 Core.FromJSON GitHubLocation where
parseJSON :: Value -> Parser GitHubLocation
parseJSON =
String
-> (Object -> Parser GitHubLocation)
-> Value
-> Parser GitHubLocation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"GitHubLocation"
( \Object
x ->
Maybe Text -> Maybe Text -> GitHubLocation
GitHubLocation'
(Maybe Text -> Maybe Text -> GitHubLocation)
-> Parser (Maybe Text) -> Parser (Maybe Text -> GitHubLocation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"commitId")
Parser (Maybe Text -> GitHubLocation)
-> Parser (Maybe Text) -> Parser GitHubLocation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"repository")
)
instance Prelude.Hashable GitHubLocation
instance Prelude.NFData GitHubLocation
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"commitId" 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
commitId,
(Text
"repository" 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
repository
]
)