api

package
v0.1.48 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: Apache-2.0 Imports: 19 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthenticationRequired = errors.New("authentication required")
	ErrGatewayTimeout         = errors.New("gateway timeout")
	ErrNotFound               = errors.New("not found")
	ErrRateLimitExceeded      = errors.New("rate limit exceeded")
)

Functions

This section is empty.

Types

type AccessMode

type AccessMode string
const (
	AccessPrivate AccessMode = "private"
	AccessPublic  AccessMode = "public"
)

type Author

type Author struct {
	UserID string `json:"userId"`

	DisplayName        string `json:"displayName"`
	ExternalProfileURL string `json:"externalProfileUrl"`

	Official bool `json:"official,omitempty"`
}

type Challenge

type Challenge struct {
	CreatedAt string `json:"createdAt" yaml:"createdAt"`
	UpdatedAt string `json:"updatedAt" yaml:"updatedAt"`

	Name        string   `json:"name" yaml:"name"`
	Title       string   `json:"title" yaml:"title"`
	Description string   `json:"description" yaml:"description"`
	Categories  []string `json:"categories" yaml:"categories"`
	Tags        []string `json:"tags,omitempty" yaml:"tags,omitempty"`

	Authors []Author `json:"authors" yaml:"authors"`

	PageURL string `json:"pageUrl" yaml:"pageUrl"`

	AttemptCount    int `json:"attemptCount" yaml:"attemptCount"`
	CompletionCount int `json:"completionCount" yaml:"completionCount"`

	Play *Play `json:"play,omitempty" yaml:"play,omitempty"`

	Tasks map[string]PlayTask `json:"tasks,omitempty" yaml:"tasks,omitempty"`
}

func (*Challenge) GetKind

func (ch *Challenge) GetKind() content.ContentKind

func (*Challenge) GetName

func (ch *Challenge) GetName() string

func (*Challenge) GetPageURL

func (ch *Challenge) GetPageURL() string

func (*Challenge) IsAuthoredBy

func (ch *Challenge) IsAuthoredBy(userID string) bool

func (*Challenge) IsOfficial

func (ch *Challenge) IsOfficial() bool

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts ClientOptions) *Client

func (*Client) CompleteChallenge

func (c *Client) CompleteChallenge(ctx context.Context, name string) (*Challenge, error)

func (*Client) CompleteTutorial added in v0.1.36

func (c *Client) CompleteTutorial(ctx context.Context, name string) (*Tutorial, error)

func (*Client) CreateAuthor

func (c *Client) CreateAuthor(ctx context.Context, req CreateAuthorRequest) (*Author, error)

func (*Client) CreateChallenge

func (c *Client) CreateChallenge(ctx context.Context, req CreateChallengeRequest) (*Challenge, error)

func (*Client) CreateCourse

func (c *Client) CreateCourse(ctx context.Context, req CreateCourseRequest) (*Course, error)

func (*Client) CreatePlay

func (c *Client) CreatePlay(ctx context.Context, req CreatePlayRequest) (*Play, error)

func (*Client) CreatePlayground

func (c *Client) CreatePlayground(ctx context.Context, req CreatePlaygroundRequest) (*Playground, error)

func (*Client) CreateRoadmap

func (c *Client) CreateRoadmap(ctx context.Context, req CreateRoadmapRequest) (*Roadmap, error)

func (*Client) CreateSession

func (c *Client) CreateSession(ctx context.Context) (*Session, error)

func (*Client) CreateSkillPath

func (c *Client) CreateSkillPath(ctx context.Context, req CreateSkillPathRequest) (*SkillPath, error)

func (*Client) CreateTraining

func (c *Client) CreateTraining(ctx context.Context, req CreateTrainingRequest) (*Training, error)

func (*Client) CreateTutorial

func (c *Client) CreateTutorial(ctx context.Context, req CreateTutorialRequest) (*Tutorial, error)

func (*Client) Delete

func (c *Client) Delete(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
) (*http.Response, error)

func (*Client) DeleteChallenge

func (c *Client) DeleteChallenge(ctx context.Context, name string) error

func (*Client) DeleteContentFile

func (c *Client) DeleteContentFile(
	ctx context.Context,
	kind content.ContentKind,
	name string,
	file string,
) error

func (*Client) DeleteCourse

func (c *Client) DeleteCourse(ctx context.Context, name string) error

func (*Client) DeletePlay

func (c *Client) DeletePlay(ctx context.Context, id string) error

func (*Client) DeletePlayground

func (c *Client) DeletePlayground(ctx context.Context, name string) error

func (*Client) DeleteRoadmap

func (c *Client) DeleteRoadmap(ctx context.Context, name string) error

func (*Client) DeleteSession

func (c *Client) DeleteSession(ctx context.Context, id string) error

func (*Client) DeleteSkillPath

func (c *Client) DeleteSkillPath(ctx context.Context, name string) error

func (*Client) DeleteTraining

func (c *Client) DeleteTraining(ctx context.Context, name string) error

func (*Client) DeleteTutorial

func (c *Client) DeleteTutorial(ctx context.Context, name string) error

func (*Client) Download

func (c *Client) Download(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	dest io.Writer,
) error

func (*Client) DownloadContentFile

func (c *Client) DownloadContentFile(
	ctx context.Context,
	kind content.ContentKind,
	name string,
	file string,
	dest string,
) error

func (*Client) DownloadTo

func (c *Client) DownloadTo(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	file string,
) error

func (*Client) ExposePort

func (c *Client) ExposePort(ctx context.Context, id string, req ExposePortRequest) (*Port, error)

func (*Client) ExposeShell

func (c *Client) ExposeShell(ctx context.Context, id string, req ExposeShellRequest) (*Shell, error)

func (*Client) Get

func (c *Client) Get(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
) (*http.Response, error)

func (*Client) GetAuthor

func (c *Client) GetAuthor(ctx context.Context) (*Author, error)

func (*Client) GetChallenge

func (c *Client) GetChallenge(ctx context.Context, name string) (*Challenge, error)

func (*Client) GetCourse

func (c *Client) GetCourse(ctx context.Context, name string) (*Course, error)

func (*Client) GetInto

func (c *Client) GetInto(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	into any,
) error

func (*Client) GetMe

func (c *Client) GetMe(ctx context.Context) (*Me, error)

func (*Client) GetPlay

func (c *Client) GetPlay(ctx context.Context, id string) (*Play, error)

func (*Client) GetPlayground

func (c *Client) GetPlayground(ctx context.Context, name string, opts *GetPlaygroundOptions) (*Playground, error)

func (*Client) GetRoadmap

func (c *Client) GetRoadmap(ctx context.Context, name string) (*Roadmap, error)

func (*Client) GetSession

func (c *Client) GetSession(ctx context.Context, id string) (*Session, error)

func (*Client) GetSkillPath

func (c *Client) GetSkillPath(ctx context.Context, name string) (*SkillPath, error)

func (*Client) GetTraining

func (c *Client) GetTraining(ctx context.Context, name string) (*Training, error)

func (*Client) GetTutorial

func (c *Client) GetTutorial(ctx context.Context, name string) (*Tutorial, error)

func (*Client) ListAuthoredChallenges

func (c *Client) ListAuthoredChallenges(ctx context.Context) ([]Challenge, error)

func (*Client) ListAuthoredCourses

func (c *Client) ListAuthoredCourses(ctx context.Context) ([]Course, error)

func (*Client) ListAuthoredRoadmaps

func (c *Client) ListAuthoredRoadmaps(ctx context.Context) ([]Roadmap, error)

func (*Client) ListAuthoredSkillPaths

func (c *Client) ListAuthoredSkillPaths(ctx context.Context) ([]SkillPath, error)

func (*Client) ListAuthoredTrainings

func (c *Client) ListAuthoredTrainings(ctx context.Context) ([]Training, error)

func (*Client) ListAuthoredTutorials

func (c *Client) ListAuthoredTutorials(ctx context.Context) ([]Tutorial, error)

func (*Client) ListChallenges

func (c *Client) ListChallenges(ctx context.Context, opts *ListChallengesOptions) ([]*Challenge, error)

func (*Client) ListContentFiles

func (c *Client) ListContentFiles(
	ctx context.Context,
	kind content.ContentKind,
	name string,
) ([]string, error)

func (*Client) ListCourses

func (c *Client) ListCourses(ctx context.Context) ([]Course, error)

func (*Client) ListPlaygrounds

func (c *Client) ListPlaygrounds(ctx context.Context, opts *ListPlaygroundsOptions) ([]Playground, error)

func (*Client) ListPlays

func (c *Client) ListPlays(ctx context.Context) ([]*Play, error)

func (*Client) ListPorts

func (c *Client) ListPorts(ctx context.Context, id string) ([]*Port, error)

func (*Client) ListRoadmaps

func (c *Client) ListRoadmaps(ctx context.Context) ([]Roadmap, error)

func (*Client) ListShells

func (c *Client) ListShells(ctx context.Context, id string) ([]*Shell, error)

func (*Client) ListSkillPaths

func (c *Client) ListSkillPaths(ctx context.Context) ([]SkillPath, error)

func (*Client) ListTrainings

func (c *Client) ListTrainings(ctx context.Context) ([]Training, error)

func (*Client) ListTutorials

func (c *Client) ListTutorials(ctx context.Context, opts *ListTutorialsOptions) ([]Tutorial, error)

func (*Client) Patch

func (c *Client) Patch(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	body io.Reader,
) (*http.Response, error)

func (*Client) PatchInto

func (c *Client) PatchInto(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	body io.Reader,
	into any,
) error

func (*Client) Post

func (c *Client) Post(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	body io.Reader,
) (*http.Response, error)

func (*Client) PostInto

func (c *Client) PostInto(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	body io.Reader,
	into any,
) error

func (*Client) Put

func (c *Client) Put(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	body io.Reader,
) (*http.Response, error)

func (*Client) PutContentMarkdown

func (c *Client) PutContentMarkdown(
	ctx context.Context,
	kind content.ContentKind,
	name string,
	file string,
	content string,
) error

func (*Client) PutInto

func (c *Client) PutInto(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	body io.Reader,
	into any,
) error

func (*Client) RequestPlayConn

func (c *Client) RequestPlayConn(ctx context.Context, id string) (*PlayConnHandle, error)

func (*Client) SetCredentials

func (c *Client) SetCredentials(sessionID, accessToken string)

func (*Client) StartChallenge

func (c *Client) StartChallenge(ctx context.Context, name string, opts StartChallengeOptions) (*Challenge, error)

func (*Client) StartTunnel

func (c *Client) StartTunnel(ctx context.Context, id string, req StartTunnelRequest) (*StartTunnelResponse, error)

func (*Client) StartTutorial added in v0.1.36

func (c *Client) StartTutorial(ctx context.Context, name string, opts StartTutorialOptions) (*Tutorial, error)

func (*Client) StopChallenge

func (c *Client) StopChallenge(ctx context.Context, name string) (*Challenge, error)

func (*Client) StopTutorial added in v0.1.36

func (c *Client) StopTutorial(ctx context.Context, name string) (*Tutorial, error)

func (*Client) UnexposePort

func (c *Client) UnexposePort(ctx context.Context, id string, portID string) error

func (*Client) UnexposeShell

func (c *Client) UnexposeShell(ctx context.Context, id string, shellID string) error

func (*Client) UpdatePlayground

func (c *Client) UpdatePlayground(ctx context.Context, name string, req UpdatePlaygroundRequest) (*Playground, error)

func (*Client) Upload

func (c *Client) Upload(
	ctx context.Context,
	url string,
	src io.Reader,
) (*http.Response, error)

func (*Client) UploadContentFile

func (c *Client) UploadContentFile(
	ctx context.Context,
	kind content.ContentKind,
	name string,
	file string,
	src string,
) error

func (*Client) UploadFrom

func (c *Client) UploadFrom(
	ctx context.Context,
	url string,
	file string,
) (*http.Response, error)

type ClientOptions

type ClientOptions struct {
	BaseURL     string
	APIBaseURL  string
	SessionID   string
	AccessToken string
	UserAgent   string
}

type Course

type Course struct {
	CreatedAt string `json:"createdAt" yaml:"createdAt"`
	UpdatedAt string `json:"updatedAt" yaml:"updatedAt"`

	Name  string `json:"name" yaml:"name"`
	Title string `json:"title" yaml:"title"`

	PageURL string `json:"pageUrl" yaml:"pageUrl"`

	Authors []Author `json:"authors" yaml:"authors"`
}

func (*Course) GetKind

func (c *Course) GetKind() content.ContentKind

func (*Course) GetName

func (c *Course) GetName() string

func (*Course) GetPageURL

func (c *Course) GetPageURL() string

func (*Course) IsAuthoredBy

func (c *Course) IsAuthoredBy(userID string) bool

func (*Course) IsOfficial

func (c *Course) IsOfficial() bool

type CourseVariant

type CourseVariant string
const (
	CourseVariantSimple  CourseVariant = "simple"
	CourseVariantModular CourseVariant = "modular"
)

type CreateAuthorRequest

type CreateAuthorRequest struct {
	Author
}

type CreateChallengeRequest

type CreateChallengeRequest struct {
	Name string `json:"name"`
}

type CreateCourseRequest

type CreateCourseRequest struct {
	Name    string        `json:"name"`
	Variant CourseVariant `json:"variant"`
	Sample  bool          `json:"sample"`
}

type CreatePlayRequest

type CreatePlayRequest struct {
	Playground              string              `json:"playground"`
	Tabs                    []PlaygroundTab     `json:"tabs,omitempty"`
	Networks                []PlaygroundNetwork `json:"networks,omitempty"`
	Machines                []PlaygroundMachine `json:"machines,omitempty"`
	InitTasks               map[string]InitTask `json:"initTasks,omitempty"`
	InitConditions          map[string]string   `json:"initConditions,omitempty"`
	SafetyDisclaimerConsent bool                `json:"safetyDisclaimerConsent"`
	AsFreeTierUser          bool                `json:"asFreeTierUser,omitempty"`
}

type CreatePlaygroundRequest

type CreatePlaygroundRequest struct {
	Name           string              `yaml:"name" json:"name"`
	Base           string              `yaml:"base" json:"base"`
	Title          string              `yaml:"title" json:"title"`
	Description    string              `yaml:"description" json:"description"`
	Categories     []string            `yaml:"categories" json:"categories"`
	Markdown       string              `yaml:"markdown,omitempty" json:"markdown,omitempty"`
	Networks       []PlaygroundNetwork `yaml:"networks" json:"networks"`
	Machines       []PlaygroundMachine `yaml:"machines" json:"machines"`
	Tabs           []PlaygroundTab     `yaml:"tabs" json:"tabs"`
	InitTasks      map[string]InitTask `yaml:"initTasks" json:"initTasks"`
	InitConditions InitConditions      `yaml:"initConditions" json:"initConditions"`
	RegistryAuth   string              `yaml:"registryAuth" json:"registryAuth"`

	AccessControl PlaygroundAccessControl `yaml:"accessControl" json:"accessControl"`
}

type CreateRoadmapRequest

type CreateRoadmapRequest struct {
	Name string `json:"name"`
}

type CreateSkillPathRequest

type CreateSkillPathRequest struct {
	Name string `json:"name"`
}

type CreateTrainingRequest

type CreateTrainingRequest struct {
	Name string `json:"name"`
}

type CreateTutorialRequest

type CreateTutorialRequest struct {
	Name string `json:"name"`
}

type ExposePortRequest

type ExposePortRequest struct {
	Machine     string     `json:"machine"`
	Number      int        `json:"number"`
	Access      AccessMode `json:"access,omitempty"`
	TLS         bool       `json:"tls,omitempty"`
	HostRewrite string     `json:"hostRewrite,omitempty"`
	PathRewrite string     `json:"pathRewrite,omitempty"`
}

type ExposeShellRequest

type ExposeShellRequest struct {
	Machine string     `json:"machine"`
	User    string     `json:"user"`
	Access  AccessMode `json:"access,omitempty"`
}

type GetPlaygroundOptions

type GetPlaygroundOptions struct {
	Format string // <none> | extended
}

type InitCondition

type InitCondition struct {
	Key   string `yaml:"key" json:"key"`
	Value string `yaml:"value" json:"value"`
}

type InitConditionValue

type InitConditionValue struct {
	Key      string   `yaml:"key" json:"key"`
	Default  string   `yaml:"default,omitempty" json:"default,omitempty"`
	Nullable bool     `yaml:"nullable,omitempty" json:"nullable,omitempty"`
	Options  []string `yaml:"options" json:"options"`
}

type InitConditions

type InitConditions struct {
	Values []InitConditionValue `yaml:"values,omitempty" json:"values,omitempty"`
}

type InitTask

type InitTask struct {
	Name           string          `yaml:"name" json:"name"`
	Machine        string          `yaml:"machine,omitempty" json:"machine,omitempty"`
	Init           bool            `yaml:"init,omitempty" json:"init,omitempty"`
	User           string          `yaml:"user" json:"user"`
	TimeoutSeconds int             `yaml:"timeout_seconds,omitempty" json:"timeout_seconds,omitempty"`
	Needs          []string        `yaml:"needs,omitempty" json:"needs,omitempty"`
	Run            string          `yaml:"run" json:"run"`
	Status         int             `yaml:"status,omitempty" json:"status,omitempty"`
	Conditions     []InitCondition `yaml:"conditions,omitempty" json:"conditions,omitempty"`
}

type ListChallengesOptions

type ListChallengesOptions struct {
	Category []string
	Status   []string
}

type ListPlaygroundsOptions

type ListPlaygroundsOptions struct {
	Filter string
}

type ListTutorialsOptions added in v0.1.36

type ListTutorialsOptions struct {
	Category []string
	Status   []string
}

type Machine

type Machine struct {
	Name      string           `json:"name"`
	Users     []MachineUser    `json:"users"`
	Resources MachineResources `json:"resources"`
}

func (*Machine) DefaultUser

func (m *Machine) DefaultUser() *MachineUser

func (*Machine) HasUser

func (m *Machine) HasUser(name string) bool

type MachineDrive added in v0.1.35

type MachineDrive struct {
	Source     string `yaml:"source,omitempty" json:"source,omitempty"`
	Mount      string `yaml:"mount,omitempty" json:"mount,omitempty"`
	Size       string `yaml:"size,omitempty" json:"size,omitempty"`
	Filesystem string `yaml:"filesystem,omitempty" json:"filesystem,omitempty"`
	ReadOnly   bool   `yaml:"readOnly,omitempty" json:"readOnly,omitempty"`
}

type MachineNetwork added in v0.1.35

type MachineNetwork struct {
	Interfaces []MachineNetworkInterface `yaml:"interfaces,omitempty" json:"interfaces,omitempty"`
}

type MachineNetworkInterface added in v0.1.35

type MachineNetworkInterface struct {
	Address string `yaml:"address,omitempty" json:"address,omitempty"`
	Network string `yaml:"network,omitempty" json:"network,omitempty"`
}

type MachineResources

type MachineResources struct {
	CPUCount int    `yaml:"cpuCount,omitempty" json:"cpuCount,omitempty"`
	RAMSize  string `yaml:"ramSize,omitempty" json:"ramSize,omitempty"`
}

type MachineStartupFile

type MachineStartupFile struct {
	Path    string `json:"path"`
	Content string `json:"content"`
	Mode    string `json:"mode,omitempty"`
	Owner   string `json:"owner,omitempty"`
	Append  bool   `json:"append,omitempty"`
}

type MachineUser

type MachineUser struct {
	Name    string `yaml:"name" json:"name"`
	Default bool   `yaml:"default,omitempty" json:"default,omitempty"`
	Welcome string `yaml:"welcome,omitempty" json:"welcome,omitempty"`
}

type Me

type Me struct {
	ID string `json:"id" yaml:"userId"`

	GithubProfileId string `json:"githubProfileId" yaml:"githubProfileId"`

	PremiumAccess *PremiumAccess `json:"premiumAccess,omitempty" yaml:"premiumAccess,omitempty"`
}

type Play

type Play struct {
	ID string `json:"id" yaml:"id"`

	CreatedAt   string `json:"createdAt" yaml:"createdAt"`
	UpdatedAt   string `json:"updatedAt" yaml:"updatedAt"`
	LastStateAt string `json:"lastStateAt" yaml:"lastStateAt"`

	ExpiresIn int `json:"expiresIn" yaml:"expiresIn"`

	Playground Playground `json:"playground" yaml:"playground"`

	TutorialName string `json:"tutorialName,omitempty" yaml:"tutorialName"`

	Tutorial *struct {
		Name  string `json:"name" yaml:"name"`
		Title string `json:"title" yaml:"title"`
	} `json:"tutorial,omitempty" yaml:"tutorial"`

	ChallengeName string `json:"challengeName,omitempty" yaml:"challengeName"`

	Challenge *struct {
		Name  string `json:"name" yaml:"name"`
		Title string `json:"title" yaml:"title"`
	} `json:"challenge,omitempty" yaml:"challenge"`

	CourseName string `json:"courseName,omitempty" yaml:"courseName"`

	Course *struct {
		Name  string `json:"name" yaml:"name"`
		Title string `json:"title" yaml:"title"`
	} `json:"course,omitempty" yaml:"course"`

	LessonPath string `json:"lessonPath,omitempty" yaml:"lessonPath"`

	Lesson *struct {
		Name  string `json:"name" yaml:"name"`
		Title string `json:"title" yaml:"title"`
	} `json:"lesson,omitempty" yaml:"lesson"`

	PageURL string `json:"pageUrl" yaml:"pageUrl"`

	Active    bool `json:"active" yaml:"active"`
	Running   bool `json:"running" yaml:"running"`
	Destroyed bool `json:"destroyed" yaml:"destroyed"`
	Failed    bool `json:"failed" yaml:"failed"`

	Machines []Machine `json:"machines" yaml:"machines"`

	Tasks map[string]PlayTask `json:"tasks,omitempty" yaml:"tasks,omitempty"`
}

func (*Play) CountCompletedInitTasks

func (p *Play) CountCompletedInitTasks() int

func (*Play) CountCompletedTasks added in v0.1.48

func (p *Play) CountCompletedTasks() int

func (*Play) CountInitTasks

func (p *Play) CountInitTasks() int

func (*Play) CountTasks added in v0.1.48

func (p *Play) CountTasks() int

func (*Play) GetMachine

func (p *Play) GetMachine(name string) *Machine

func (*Play) IsCompletable

func (p *Play) IsCompletable() bool

func (*Play) IsFailed

func (p *Play) IsFailed() bool

func (*Play) IsInitialized

func (p *Play) IsInitialized() bool

type PlayConn

type PlayConn struct {
	// contains filtered or unexported fields
}

func NewPlayConn

func NewPlayConn(
	ctx context.Context,
	play *Play,
	client *Client,
	origin string,
) *PlayConn

func (*PlayConn) Close

func (pc *PlayConn) Close()

func (*PlayConn) Start

func (pc *PlayConn) Start() error

func (*PlayConn) WaitDone

func (pc *PlayConn) WaitDone() error

func (*PlayConn) WaitPlayReady

func (pc *PlayConn) WaitPlayReady(timeout time.Duration, s *spinner.Spinner) error

type PlayConnHandle

type PlayConnHandle struct {
	URL string `json:"url"`
}

type PlayConnMessage

type PlayConnMessage struct {
	Kind    string   `json:"kind"`
	Machine string   `json:"machine,omitempty"`
	Task    PlayTask `json:"task,omitempty"`
}

type PlayTask

type PlayTask struct {
	Name    string         `json:"name"`
	Init    bool           `json:"init"`
	Helper  bool           `json:"helper"`
	Status  PlayTaskStatus `json:"status"`
	Version int            `json:"version"`
}

type PlayTaskStatus

type PlayTaskStatus int
const (
	PlayTaskStatusNone      PlayTaskStatus = 0
	PlayTaskStatusCreated   PlayTaskStatus = 10
	PlayTaskStatusBlocked   PlayTaskStatus = 20
	PlayTaskStatusRunning   PlayTaskStatus = 30
	PlayTaskStatusFailed    PlayTaskStatus = 35
	PlayTaskStatusCompleted PlayTaskStatus = 40
)

type Playground

type Playground struct {
	ID             string              `yaml:"id" json:"id"`
	Owner          string              `yaml:"owner" json:"owner"`
	Name           string              `yaml:"name" json:"name"`
	Base           string              `yaml:"base" json:"base"`
	Title          string              `yaml:"title" json:"title"`
	Description    string              `yaml:"description" json:"description"`
	Categories     []string            `yaml:"categories" json:"categories"`
	Cover          string              `yaml:"cover,omitempty" json:"cover,omitempty"`
	Markdown       string              `yaml:"markdown,omitempty" json:"markdown,omitempty"`
	Published      bool                `yaml:"published" json:"published"`
	PageURL        string              `yaml:"pageUrl" json:"pageUrl"`
	Networks       []PlaygroundNetwork `yaml:"networks" json:"networks"`
	Machines       []PlaygroundMachine `yaml:"machines" json:"machines"`
	Tabs           []PlaygroundTab     `yaml:"tabs" json:"tabs"`
	InitTasks      map[string]InitTask `yaml:"initTasks,omitempty" json:"initTasks,omitempty"`
	InitConditions InitConditions      `yaml:"initConditions,omitempty" json:"initConditions,omitempty"`
	RegistryAuth   string              `yaml:"registryAuth,omitempty" json:"registryAuth,omitempty"`

	AccessControl PlaygroundAccessControl `yaml:"accessControl" json:"accessControl"`
	UserAccess    PlaygroundUserAccess    `yaml:"userAccess,omitempty" json:"userAccess,omitempty"`
}

type PlaygroundAccess deprecated

type PlaygroundAccess struct {
	Mode  string   `yaml:"mode" json:"mode"`
	Users []string `yaml:"users,omitempty" json:"users,omitempty"`
}

Deprecated: Use PlaygroundAccessControl instead

type PlaygroundAccessControl

type PlaygroundAccessControl struct {
	CanList  []string `yaml:"canList,omitempty" json:"canList,omitempty"`
	CanRead  []string `yaml:"canRead,omitempty" json:"canRead,omitempty"`
	CanStart []string `yaml:"canStart,omitempty" json:"canStart,omitempty"`
}

type PlaygroundMachine

type PlaygroundMachine struct {
	Name         string               `yaml:"name" json:"name"`
	Users        []MachineUser        `yaml:"users,omitempty" json:"users,omitempty"`
	Kernel       string               `yaml:"kernel,omitempty" json:"kernel,omitempty"`
	Drives       []MachineDrive       `yaml:"drives,omitempty" json:"drives,omitempty"`
	Network      *MachineNetwork      `yaml:"network,omitempty" json:"network,omitempty"`
	Resources    *MachineResources    `yaml:"resources,omitempty" json:"resources,omitempty"`
	StartupFiles []MachineStartupFile `yaml:"startupFiles,omitempty" json:"startupFiles,omitempty"`
	NoSSH        bool                 `yaml:"noSSH,omitempty" json:"noSSH,omitempty"`
}

type PlaygroundManifest

type PlaygroundManifest struct {
	Kind        string         `yaml:"kind" json:"kind"`
	Name        string         `yaml:"name" json:"name"`
	Base        string         `yaml:"base,omitempty" json:"base,omitempty"`
	Title       string         `yaml:"title,omitempty" json:"title,omitempty"`
	Description string         `yaml:"description,omitempty" json:"description,omitempty"`
	Cover       string         `yaml:"cover,omitempty" json:"cover,omitempty"`
	Categories  []string       `yaml:"categories,omitempty" json:"categories,omitempty"`
	Markdown    string         `yaml:"markdown,omitempty" json:"markdown,omitempty"`
	Playground  PlaygroundSpec `yaml:"playground" json:"playground"`
}

type PlaygroundNetwork added in v0.1.35

type PlaygroundNetwork struct {
	Name    string `yaml:"name" json:"name"`
	Subnet  string `yaml:"subnet" json:"subnet"`
	Gateway string `yaml:"gateway,omitempty" json:"gateway,omitempty"`
	Private bool   `yaml:"private,omitempty" json:"private,omitempty"`
}

type PlaygroundSpec

type PlaygroundSpec struct {
	Networks       []PlaygroundNetwork `yaml:"networks,omitempty" json:"networks,omitempty"`
	Machines       []PlaygroundMachine `yaml:"machines,omitempty" json:"machines,omitempty"`
	Tabs           []PlaygroundTab     `yaml:"tabs,omitempty" json:"tabs,omitempty"`
	InitTasks      map[string]InitTask `yaml:"initTasks,omitempty" json:"initTasks,omitempty"`
	InitConditions InitConditions      `yaml:"initConditions,omitempty" json:"initConditions,omitempty"`
	RegistryAuth   string              `yaml:"registryAuth,omitempty" json:"registryAuth,omitempty"`

	// Deprecated: Use PlaygroundAccessControl instead
	Access *PlaygroundAccess `yaml:"access,omitempty" json:"access,omitempty"`

	AccessControl PlaygroundAccessControl `yaml:"accessControl" json:"accessControl"`
}

func (*PlaygroundSpec) HasAccessControl

func (s *PlaygroundSpec) HasAccessControl() bool

type PlaygroundTab

type PlaygroundTab struct {
	ID          string `yaml:"id,omitempty" json:"id,omitempty"`
	Kind        string `yaml:"kind" json:"kind"`
	Name        string `yaml:"name" json:"name"`
	Machine     string `yaml:"machine,omitempty" json:"machine,omitempty"`
	Number      int    `yaml:"number,omitempty" json:"number,omitempty"`
	Access      string `yaml:"access,omitempty" json:"access,omitempty"`
	Tls         bool   `yaml:"tls,omitempty" json:"tls,omitempty"`
	HostRewrite string `yaml:"hostRewrite,omitempty" json:"hostRewrite,omitempty"`
	PathRewrite string `yaml:"pathRewrite,omitempty" json:"pathRewrite,omitempty"`
	URL         string `yaml:"url,omitempty" json:"url,omitempty"`
}

type PlaygroundUserAccess

type PlaygroundUserAccess struct {
	CanList  bool `yaml:"canList" json:"canList"`
	CanRead  bool `yaml:"canRead" json:"canRead"`
	CanStart bool `yaml:"canStart" json:"canStart"`
}

type Port

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

	PlayID string `json:"playId"`

	Machine string `json:"machine"`

	Number int `json:"number"`

	Hostname string `json:"hostname"`

	AccessMode AccessMode `json:"access"`

	TLS bool `json:"tls"`

	HostRewrite string `json:"hostRewrite,omitempty"`

	PathRewrite string `json:"pathRewrite,omitempty"`

	URL string `json:"url"`
}

type PortAccess

type PortAccess string
const (
	PortAccessPublic  PortAccess = "public"
	PortAccessPrivate PortAccess = "private"
)

type PremiumAccess

type PremiumAccess struct {
	Until    string `json:"until,omitempty" yaml:"until,omitempty"`
	Lifetime bool   `json:"lifetime,omitempty" yaml:"lifetime,omitempty"`
	Trial    bool   `json:"trial,omitempty" yaml:"trial,omitempty"`
}

type Roadmap

type Roadmap struct {
	CreatedAt string `json:"createdAt" yaml:"createdAt"`
	UpdatedAt string `json:"updatedAt" yaml:"updatedAt"`

	Name  string `json:"name" yaml:"name"`
	Title string `json:"title" yaml:"title"`

	PageURL string `json:"pageUrl" yaml:"pageUrl"`

	Authors []Author `json:"authors" yaml:"authors"`
}

func (*Roadmap) GetKind

func (t *Roadmap) GetKind() content.ContentKind

func (*Roadmap) GetName

func (t *Roadmap) GetName() string

func (*Roadmap) GetPageURL

func (t *Roadmap) GetPageURL() string

func (*Roadmap) IsAuthoredBy

func (t *Roadmap) IsAuthoredBy(userID string) bool

func (*Roadmap) IsOfficial

func (t *Roadmap) IsOfficial() bool

type Session

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

	UserID string `json:"userId"`

	Authenticated bool `json:"authenticated"`

	AccessToken string `json:"accessToken"`

	AuthURL string `json:"authUrl"`
}

type Shell

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

	PlayID string `json:"playId"`

	Machine string `json:"machine"`

	User string `json:"user"`

	Hostname string `json:"hostname"`

	AccessMode AccessMode `json:"access"`

	URL string `json:"url"`
}

type SkillPath

type SkillPath struct {
	CreatedAt string `json:"createdAt" yaml:"createdAt"`
	UpdatedAt string `json:"updatedAt" yaml:"updatedAt"`

	Name  string `json:"name" yaml:"name"`
	Title string `json:"title" yaml:"title"`

	PageURL string `json:"pageUrl" yaml:"pageUrl"`

	Authors []Author `json:"authors" yaml:"authors"`
}

func (*SkillPath) GetKind

func (t *SkillPath) GetKind() content.ContentKind

func (*SkillPath) GetName

func (t *SkillPath) GetName() string

func (*SkillPath) GetPageURL

func (t *SkillPath) GetPageURL() string

func (*SkillPath) IsAuthoredBy

func (t *SkillPath) IsAuthoredBy(userID string) bool

func (*SkillPath) IsOfficial

func (t *SkillPath) IsOfficial() bool

type StartChallengeOptions

type StartChallengeOptions struct {
	SafetyDisclaimerConsent bool
	AsFreeTierUser          bool
}

type StartTunnelRequest

type StartTunnelRequest struct {
	Machine          string     `json:"machine"`
	Port             int        `json:"port"`
	Access           PortAccess `json:"access"`
	GenerateLoginURL bool       `json:"generateLoginUrl"`
	SSHUser          string     `json:"sshUser"`
	SSHPubKey        string     `json:"sshPubKey"`
}

type StartTunnelResponse

type StartTunnelResponse struct {
	URL      string `json:"url"`
	LoginURL string `json:"loginUrl"`
}

type StartTutorialOptions added in v0.1.36

type StartTutorialOptions struct {
	SafetyDisclaimerConsent bool
	AsFreeTierUser          bool
}

type Training

type Training struct {
	CreatedAt string `json:"createdAt" yaml:"createdAt"`
	UpdatedAt string `json:"updatedAt" yaml:"updatedAt"`

	Name  string `json:"name" yaml:"name"`
	Title string `json:"title" yaml:"title"`

	PageURL string `json:"pageUrl" yaml:"pageUrl"`

	Authors []Author `json:"authors" yaml:"authors"`
}

func (*Training) GetKind

func (t *Training) GetKind() content.ContentKind

func (*Training) GetName

func (t *Training) GetName() string

func (*Training) GetPageURL

func (t *Training) GetPageURL() string

func (*Training) IsAuthoredBy

func (t *Training) IsAuthoredBy(userID string) bool

func (*Training) IsOfficial

func (t *Training) IsOfficial() bool

type Tutorial

type Tutorial struct {
	CreatedAt string `json:"createdAt" yaml:"createdAt"`
	UpdatedAt string `json:"updatedAt" yaml:"updatedAt"`

	Name        string   `json:"name" yaml:"name"`
	Title       string   `json:"title" yaml:"title"`
	Description string   `json:"description" yaml:"description"`
	Categories  []string `json:"categories" yaml:"categories"`
	Tags        []string `json:"tags,omitempty" yaml:"tags,omitempty"`

	Authors []Author `json:"authors" yaml:"authors"`

	PageURL string `json:"pageUrl" yaml:"pageUrl"`

	AttemptCount    int `json:"attemptCount" yaml:"attemptCount"`
	CompletionCount int `json:"completionCount" yaml:"completionCount"`

	Play *Play `json:"play,omitempty" yaml:"play,omitempty"`
}

func (*Tutorial) GetKind

func (t *Tutorial) GetKind() content.ContentKind

func (*Tutorial) GetName

func (t *Tutorial) GetName() string

func (*Tutorial) GetPageURL

func (t *Tutorial) GetPageURL() string

func (*Tutorial) IsAuthoredBy

func (t *Tutorial) IsAuthoredBy(userID string) bool

func (*Tutorial) IsOfficial

func (t *Tutorial) IsOfficial() bool

type UpdatePlaygroundRequest

type UpdatePlaygroundRequest struct {
	Title          string              `yaml:"title" json:"title"`
	Description    string              `yaml:"description" json:"description"`
	Categories     []string            `yaml:"categories" json:"categories"`
	Cover          string              `yaml:"cover,omitempty" json:"cover,omitempty"`
	Markdown       string              `yaml:"markdown,omitempty" json:"markdown,omitempty"`
	Networks       []PlaygroundNetwork `yaml:"networks" json:"networks"`
	Machines       []PlaygroundMachine `yaml:"machines" json:"machines"`
	Tabs           []PlaygroundTab     `yaml:"tabs" json:"tabs"`
	InitTasks      map[string]InitTask `yaml:"initTasks" json:"initTasks"`
	InitConditions InitConditions      `yaml:"initConditions" json:"initConditions"`
	RegistryAuth   string              `yaml:"registryAuth" json:"registryAuth"`

	AccessControl PlaygroundAccessControl `yaml:"accessControl" json:"accessControl"`
}

Jump to

Keyboard shortcuts

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