{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DerivingVia #-} module Hercules.Agent.NixFile.GitSource where import Data.Aeson (FromJSON, ToJSON) import Data.Text qualified as T import Hercules.CNix.Expr (ToRawValue, ViaJSON (ViaJSON)) import Protolude data GitSource = GitSource { GitSource -> Text outPath :: Text, GitSource -> Text ref :: Text, GitSource -> Text rev :: Text, GitSource -> Text shortRev :: Text, GitSource -> Maybe Text branch :: Maybe Text, GitSource -> Maybe Text tag :: Maybe Text, GitSource -> Maybe Text remoteHttpUrl :: Maybe Text, GitSource -> Maybe Text remoteSshUrl :: Maybe Text, GitSource -> Maybe Text webUrl :: Maybe Text, GitSource -> Maybe Text forgeType :: Maybe Text, GitSource -> Maybe Text owner :: Maybe Text, GitSource -> Maybe Text name :: Maybe Text } deriving ((forall x. GitSource -> Rep GitSource x) -> (forall x. Rep GitSource x -> GitSource) -> Generic GitSource forall x. Rep GitSource x -> GitSource forall x. GitSource -> Rep GitSource x forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a $cfrom :: forall x. GitSource -> Rep GitSource x from :: forall x. GitSource -> Rep GitSource x $cto :: forall x. Rep GitSource x -> GitSource to :: forall x. Rep GitSource x -> GitSource Generic, [GitSource] -> Value [GitSource] -> Encoding GitSource -> Value GitSource -> Encoding (GitSource -> Value) -> (GitSource -> Encoding) -> ([GitSource] -> Value) -> ([GitSource] -> Encoding) -> ToJSON GitSource forall a. (a -> Value) -> (a -> Encoding) -> ([a] -> Value) -> ([a] -> Encoding) -> ToJSON a $ctoJSON :: GitSource -> Value toJSON :: GitSource -> Value $ctoEncoding :: GitSource -> Encoding toEncoding :: GitSource -> Encoding $ctoJSONList :: [GitSource] -> Value toJSONList :: [GitSource] -> Value $ctoEncodingList :: [GitSource] -> Encoding toEncodingList :: [GitSource] -> Encoding ToJSON, Value -> Parser [GitSource] Value -> Parser GitSource (Value -> Parser GitSource) -> (Value -> Parser [GitSource]) -> FromJSON GitSource forall a. (Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a $cparseJSON :: Value -> Parser GitSource parseJSON :: Value -> Parser GitSource $cparseJSONList :: Value -> Parser [GitSource] parseJSONList :: Value -> Parser [GitSource] FromJSON, Int -> GitSource -> ShowS [GitSource] -> ShowS GitSource -> String (Int -> GitSource -> ShowS) -> (GitSource -> String) -> ([GitSource] -> ShowS) -> Show GitSource forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> GitSource -> ShowS showsPrec :: Int -> GitSource -> ShowS $cshow :: GitSource -> String show :: GitSource -> String $cshowList :: [GitSource] -> ShowS showList :: [GitSource] -> ShowS Show, GitSource -> GitSource -> Bool (GitSource -> GitSource -> Bool) -> (GitSource -> GitSource -> Bool) -> Eq GitSource forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: GitSource -> GitSource -> Bool == :: GitSource -> GitSource -> Bool $c/= :: GitSource -> GitSource -> Bool /= :: GitSource -> GitSource -> Bool Eq) deriving (Ptr EvalState -> GitSource -> IO RawValue (Ptr EvalState -> GitSource -> IO RawValue) -> ToRawValue GitSource forall a. (Ptr EvalState -> a -> IO RawValue) -> ToRawValue a $ctoRawValue :: Ptr EvalState -> GitSource -> IO RawValue toRawValue :: Ptr EvalState -> GitSource -> IO RawValue ToRawValue) via (ViaJSON GitSource) shortRevFromRev :: Text -> Text shortRevFromRev :: Text -> Text shortRevFromRev = Int -> Text -> Text T.take Int 7 branchFromRef :: Text -> Maybe Text branchFromRef :: Text -> Maybe Text branchFromRef = Text -> Text -> Maybe Text T.stripPrefix Text "refs/heads/" tagFromRef :: Text -> Maybe Text tagFromRef :: Text -> Maybe Text tagFromRef = Text -> Text -> Maybe Text T.stripPrefix Text "refs/tags/"