db

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection struct {
	Slug             string `` /* 145-byte string literal not displayed */
	Title            string `json:"Title" yaml:"title" jsonschema:"minLength=1,description=A human-readable name for the collection (i.e. a company name)"`
	Image            string `json:"Image" yaml:"image" jsonschema:"minLength=1,description=An internet-accessible URL to a logo for this collection"`
	Website          string `` /* 143-byte string literal not displayed */
	ContactEmail     string `json:"ContactEmail" yaml:"contactEmail" jsonschema:"description=Contact email address for this collection"`
	BriefDescription string `json:"BriefDescription" yaml:"briefDescription" jsonschema:"minLength=1,description=A brief description of the collection"`
	LongDescription  string `` /* 202-byte string literal not displayed */
	Type             string `` /* 127-byte string literal not displayed */
	Tier             string `` /* 131-byte string literal not displayed */

	CollectionFile string `json:"-" jsonschema:"-"`
}

Collection is a resource type that provides a type of categorization for other curriculum resources like Lessons. A Collection might be defined for a company, an open-source project, or even for an individual, as a home for all curriculum resources with strong relationships to that entity, and as a way of giving more information for that entity.

func (Collection) GetSchema

func (c Collection) GetSchema() *jsonschema.Schema

GetSchema returns a Schema to be used in creation wizards

func (Collection) JSValidate

func (l Collection) JSValidate() bool

JSValidate uses an Antidote resource's struct properties and tags to construct a jsonschema document, and then validates that instance's values against that schema.

type Curriculum

type Curriculum struct {
	Name        string `json:"Name" yaml:"name" jsonschema:"minLength=1,description=Name of this curriculum"`
	Description string `json:"Description" yaml:"description" jsonschema:"minLength=1,description=Description of this curriculum"`
	Website     string `json:"Website" yaml:"website" jsonschema:"minLength=1,description=Website for this curriculum"`
	AVer        string `json:"AVer" yaml:"aVer" jsonschema:"minLength=1,description=The version of Antidote this curriculum was built for"`
	GitRoot     string `json:"GitRoot" yaml:"gitRoot" jsonschema:"minLength=1,description=The web URL to the repository that houses this curriculum"`
}

Curriculum is a resource type that defines a bit of meta-data for a Curriculum as a whole.

func (Curriculum) JSValidate

func (c Curriculum) JSValidate() bool

JSValidate uses an Antidote resource's struct properties and tags to construct a jsonschema document, and then validates that instance's values against that schema.

type CurriculumResource

type CurriculumResource interface {
	JSValidate() bool
	GetSchema() *jsonschema.Schema
}

CurriculumResource is a specific type of database model that is designed to be imported from a YAML file. Only these types of resources require a JSON schema for validation purposes, so as a result, we can identify them by their inclusion of relevant schema validation function(s)

Database models that do not satisfy this interface are used for other purposes, such as state tracking, etc.

type Image

type Image struct {
	Slug string `json:"Slug" yaml:"slug" jsonschema:"Unique identifier for this image,pattern=^[A-Za-z0-9\\-]*$"`

	Description string `json:"Description" yaml:"description" jsonschema:"Description of this image"`

	// Temporary measure to grant privileges to endpoints selectively
	Privileged bool `json:"Privileged" yaml:"privileged" jsonschema:"Should this image be granted admin privileges?"`

	// Used to allow authors to know which interfaces are available, and in which order they'll be connected
	NetworkInterfaces []string `json:"NetworkInterfaces" yaml:"networkInterfaces" jsonschema:"minItems=1"`

	SSHUser     string `json:"SSHUser" yaml:"sshUser" jsonschema:"minLength=1,description=Username for SSH connections"`
	SSHPassword string `json:"SSHPassword" yaml:"sshPassword" jsonschema:"minLength=1,Password for SSH Connections"`

	ConfigUser     string `json:"ConfigUser" yaml:"configUser" jsonschema:"minLength=1,description=Username for configuration scripts"`
	ConfigPassword string `json:"ConfigPassword" yaml:"configPassword" jsonschema:"minLength=1,Password for configuration scripts"`
}

Image is a resource type that provides metadata for endpoint images in use within Lessons

func (Image) GetSchema

func (i Image) GetSchema() *jsonschema.Schema

GetSchema returns a Schema to be used in creation wizards

func (Image) JSValidate

func (i Image) JSValidate() bool

JSValidate uses an Antidote resource's struct properties and tags to construct a jsonschema document, and then validates that instance's values against that schema.

type Lesson

type Lesson struct {
	Name             string              `json:"Name" yaml:"name" jsonschema:"minLength=1,description=Human-readable name/title for the lesson"`
	Slug             string              `` /* 157-byte string literal not displayed */
	Category         string              `` /* 173-byte string literal not displayed */
	Diagram          string              `json:"Diagram" yaml:"diagram" jsonschema:"description=A public URL to lesson diagram"`
	Video            string              `json:"Video" yaml:"video" jsonschema:"description=YouTube URL to lesson video"`
	Tier             string              `` /* 139-byte string literal not displayed */
	Collection       string              `` /* 137-byte string literal not displayed */
	Description      string              `` /* 155-byte string literal not displayed */
	ShortDescription string              `` /* 138-byte string literal not displayed */
	Prereqs          []string            `` /* 145-byte string literal not displayed */
	Tags             []string            `` /* 135-byte string literal not displayed */
	Stages           []*LessonStage      `` /* 199-byte string literal not displayed */
	Endpoints        []*LessonEndpoint   `` /* 207-byte string literal not displayed */
	Connections      []*LessonConnection `` /* 201-byte string literal not displayed */
	Authors          []*LessonAuthor     `` /* 202-byte string literal not displayed */

	// NOTE - any time you see these dashes, it means this field is used for internal purposes only.
	// When we were using protobuf models for everything, we couldn't do this. But by separating internal
	// models from API models, we can still mark a field like this while still being able to offer it via API.
	// Adding a hash to the json tag for instance doesn't mean we're hiding it from the API.
	LessonFile string `json:"-" yaml:"-" jsonschema:"-"`
	LessonDir  string `json:"-" yaml:"-" jsonschema:"-"`
}

Lesson represents the fields and sub-types for defining a lesson resource in Antidote

func (Lesson) GetSchema

func (l Lesson) GetSchema() *jsonschema.Schema

GetSchema returns a Schema to be used in creation wizards

func (Lesson) JSValidate

func (l Lesson) JSValidate() bool

JSValidate uses an Antidote resource's struct properties and tags to construct a jsonschema document, and then validates that instance's values against that schema.

type LessonAuthor

type LessonAuthor struct {
	Name string `jsonschema:"description=Full name of this author"`
	Link string `jsonschema:"description=URL to this author's profile such as Twitter or Github"`
}

LessonAuthor represents details about an individual who participated in authoring this lesson

type LessonConnection

type LessonConnection struct {
	A string `json:"A" yaml:"a" jsonschema:"required"`
	B string `json:"B" yaml:"b" jsonschema:"required"`
}

LessonConnection is a point-to-point network connection between two LessonEndpoints. The `A` and `B` properties should refer to the Name of LessonEndpoints within a given lesson that should be networked together.

type LessonEndpoint

type LessonEndpoint struct {
	Name  string `json:"Name" yaml:"name" jsonschema:"description=Name of the endpoint"`
	Image string `json:"Image" yaml:"image" jsonschema:"description=The Image ref this endpoint uses,pattern=^[A-Za-z0-9\\-]*$"`

	ConfigurationType string `` /* 185-byte string literal not displayed */

	// Since we're starting to use the filename to derive certain things about configuration (i.e.
	// which NAPALM driver to use) we will store the filename (only the name, no path) here on ingest
	// so we know where to look when it comes time to push a configuration
	ConfigurationFile string `json:"-" yaml:"-" jsonschema:"-"`

	AdditionalPorts []int32 `` /* 145-byte string literal not displayed */

	Presentations []*LessonPresentation `` /* 237-byte string literal not displayed */
}

LessonEndpoint is typically a container that runs some software in a Lesson. This can be a network device, or a simple container with some Python libraries installed - it doesn't really matter. It's just some software that you want to have running in a lesson for educational purposes

type LessonGuideType

type LessonGuideType string
const (
	GuideMarkdown LessonGuideType = "markdown"
	GuideJupyter  LessonGuideType = "jupyter"
)

type LessonPresentation

type LessonPresentation struct {
	Name string           `json:"Name" yaml:"name" jsonschema:"required"`
	Port int32            `json:"Port" yaml:"port" jsonschema:"required,minimum=1"`
	Type PresentationType `json:"Type" yaml:"type" jsonschema:"required,enum=http,enum=ssh"`
}

LessonPresentation is a particular view into a LessonEndpoint. It's a way of specifying how an endpoint should be made available to the user in the front-end

type LessonStage

type LessonStage struct {
	Description   string          `json:"Description,omitempty" yaml:"description,omitempty"`
	GuideType     LessonGuideType `json:"GuideType" yaml:"guideType" jsonschema:"required,enum=markdown,enum=jupyter"`
	GuideContents string          `json:"-"  yaml:"-" jsonschema:"-"`
	StageVideo    string          `json:"StageVideo" yaml:"stageVideo" jsonschema:"description=URL to lesson stage video"`
}

LessonStage is a specific state that a Lesson can be in. This can be thought of like chapters in a book. A Lesson might have one or more LessonStages.

type LiveEndpoint

type LiveEndpoint struct {
	Name              string              `json:"Name"`
	Image             string              `json:"Image"`
	Ports             []int32             `json:"Ports"`
	Presentations     []*LivePresentation `json:"Presentations"`
	ConfigurationType string              `json:"ConfigurationType"`
	ConfigurationFile string              `json:"ConfigurationFile"`
	SSHUser           string              `json:"SSHUser"`
	SSHPassword       string              `json:"SSHPassword"`

	Host string `json:"Host"`
}

LiveEndpoint is a running instance of a LessonEndpoint, with additional details that are relevant at runtime.

type LiveLesson

type LiveLesson struct {
	ID            string                   `json:"LiveLessonId"`
	SessionID     string                   `json:"SessionId"`
	AntidoteID    string                   `json:"AntidoteID"`
	LessonSlug    string                   `json:"LessonSlug"`
	LiveEndpoints map[string]*LiveEndpoint `json:"LiveEndpoints"`
	CurrentStage  int32                    `json:"LessonStage"`
	GuideContents string                   `json:"GuideContents"`
	GuideType     string                   `json:"GuideType"`
	GuideDomain   string                   `json:"GuideDomain"`
	Status        LiveLessonStatus         `json:"Status"`
	CreatedTime   time.Time                `json:"CreatedTime"`
	Error         bool                     `json:"Error"`
	HealthyTests  int32                    `json:"HealthyTests"`
	TotalTests    int32                    `json:"TotalTests"`
	Diagram       string                   `json:"Diagram"`
	Video         string                   `json:"Video"`
	StageVideo    string                   `json:"StageVideo"`
}

LiveLesson is a runtime instance of a Lesson in use. It represents a specific lesson (via LessonID) being requested by a specific session (via SessionID) and holds all of the runtime state that Antidote needs to know about it to serve it to the front-end appropriately

type LiveLessonStatus

type LiveLessonStatus string

LiveLessonStatus is backed by a set of possible const values for livelesson statuses below

const (
	// Status_INITIALIZED means the livelesson has been created but not yet executed upon
	// by the scheduler
	Status_INITIALIZED LiveLessonStatus = "INITIALIZED"

	// Status_BOOTING means the necessary instructions for initial resource creation
	// have been/are being sent to Kubernetes and we are waiting for health checks to pass
	Status_BOOTING LiveLessonStatus = "BOOTING"

	// Status_CONFIGURATION means health checks have passed, and we have sent instructions to Kubernetes
	// to spin up configuration pods/jobs, and are waiting for those to finish. This status can be used for
	// both initial configuration, as well as inter-stage configuration (moving from BOOTING to CONFIGURATION
	// or from READY to CONFIGURATION)
	Status_CONFIGURATION LiveLessonStatus = "CONFIGURATION"

	// Status_READY indicates that a livelesson is ready for consumption
	Status_READY LiveLessonStatus = "READY"
)

type LivePresentation

type LivePresentation struct {
	Name      string           `json:"Name"`
	Port      int32            `json:"Port"`
	Type      PresentationType `json:"Type"`
	HepDomain string           `json:"HepDomain"`
}

LivePresentation is a running instance of a LessonPresentation, with additional details that are relevant at runtime.

type LiveSession

type LiveSession struct {
	ID string `json:"id"`

	SourceIP string `json:"sourceIP"`

	// This replaces the old whitelist model. To preserve a session through GC, set this to true.
	// Set to false by default on creation
	Persistent bool `json:"persistent"`

	CreatedTime time.Time `json:"CreatedTime"`
}

LiveSession represents a single provisioned session for interacting with Antidote. LiveSessions hold a one-to-many relationship with LiveLessons - any number of LiveLessons can refer to a single LiveSession ID.

type PresentationType

type PresentationType string

PresentationType is backed by a set of possible const values for presentation types below

const (

	// PresentationType_http is for presentations that use iframes to present a web front-end to the user
	PresentationType_http PresentationType = "http"

	// PresentationType_ssh is for presentations that provide an interactive terminal
	PresentationType_ssh PresentationType = "ssh"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL