scenario

package
Version: v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package scenario is a package for loading scenario manifests from a `scenarios.yaml` file and accessing and manipulating them programmatically.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manifest

type Manifest struct {
	// Name - the name of the manifest e.g. scenarios
	Name string `yaml:"name"`
	// Kind - unique name and version string idenitfying the schema of this
	// document
	Kind string `yaml:"kind"`
	// Scenarios - a list of Scenario structs representing the scenarios
	Scenarios []Scenario `yaml:"scenarios"`
}

Manifest structure representing a `scenarios.yaml` document

func LoadManifest

func LoadManifest(manifestPath string) (*Manifest, error)

LoadManifest loads a manifest named `scenarios.yaml` from the supplied path

func (*Manifest) Contains

func (m *Manifest) Contains(id string) bool

Contains returns a boolean indicating whether a ScenarioManifest contains a Scenario with the supplied id

func (*Manifest) Find

func (m *Manifest) Find(id string) *Scenario

Find returns a scenario for the supplied id

type Scenario

type Scenario struct {
	// A machine parseable unique id for the scenario
	Id string `yaml:"id"`
	// Path to the scenario - paths are relative to the ScenarioManifest that
	// defines this scenario
	Path string `yaml:"path"`
	// A human-friendly readable name for this scenario for use in user interfaces
	DisplayName string `yaml:"name"`
	// A Difficulty level for this scenario for use in user interfaces
	Difficulty string `yaml:"difficulty"`
	// A short description of the scenario to be used in the user interfaces
	Description string `yaml:"description"`
	// The category of the scenario to be used in the user interfaces
	Category string `yaml:"category"`
}

Scenario structure representing a scenario

func (*Scenario) Validate

func (s *Scenario) Validate(manifestPath string) error

Validate a scenario relative to its manifest

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL