gs-config/src/main/scala/gs/config/v0/audit/ConfigQueryResult.scala

39 lines
1,017 B
Scala

package gs.config.v0.audit
import gs.config.v0.ConfigError
/** Describes queries used to find configuration. Used for auditing purposes and
* is captured by [[ConfigManifest]].
*/
sealed trait ConfigQueryResult
object ConfigQueryResult:
given CanEqual[ConfigQueryResult, ConfigQueryResult] = CanEqual.derived
/** Represents a query for some configuration that completed successfully.
*
* @param source
* The source which provided the value.
* @param rawValue
* The raw value that the source returned.
*/
case class Success(
source: String,
rawValue: String
) extends ConfigQueryResult
/** Represents a query for some configuration that failed.
*
* @param sources
* List of all sources, in order, that were consulted to attempt to get
* this value.
* @param error
* The reason why this query failed.
*/
case class Failure(
sources: List[String],
error: ConfigError
) extends ConfigQueryResult
end ConfigQueryResult