gs-config/src/main/scala/gs/config/audit/ConfigQuery.scala

37 lines
910 B
Scala

package gs.config.audit
import gs.config.ConfigError
/** Describes queries used to find configuration. Used for auditing purposes and
* is captured by [[ConfigManifest]].
*/
sealed trait ConfigQuery
object ConfigQuery:
/** 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 SuccessfulQuery(
source: ConfigSource,
rawValue: String
) extends ConfigQuery
/** 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 FailedQuery(
sources: List[ConfigSource],
error: ConfigError
)
end ConfigQuery