Documentation
¶
Overview ¶
*
- Copyright 2020 Whiteblock Inc. All rights reserved.
- Use of this source code is governed by a BSD-style
- license that can be found in the LICENSE file.
*
- Copyright 2020 Whiteblock Inc. All rights reserved.
- Use of this source code is governed by a BSD-style
- license that can be found in the LICENSE file.
*
- Copyright 2020 Whiteblock Inc. All rights reserved.
- Use of this source code is governed by a BSD-style
- license that can be found in the LICENSE file.
Index ¶
- Variables
- func IsFatalError(err error) bool
- type CallToAction
- type Error
- type ErrorType
- type Exec
- type ExecAttach
- type ExecInfo
- type ForkResponse
- type Instance
- type Metadata
- type OrganizationProfile
- type Resize
- type RunningInstance
- type Status
- type Test
- type TestDefinition
- type TestDefinitionSQL
- type TestInfo
- type TestLimits
- type TestMeta
- type TestSQL
- type User
Constants ¶
This section is empty.
Variables ¶
var AccessDenied = errors.New("access denied")
var AlreadyExists = errors.New("already exists")
var EmptyDBResult = errors.New("not found")
var NotAMember = errors.New("not a member of this org")
var ValidationError = errors.New("validation error")
Functions ¶
func IsFatalError ¶
IsFatalError checks whether or not the error is a fatal error
Types ¶
type CallToAction ¶
type Error ¶
type Error struct {
Type ErrorType `json:"type"`
Message string `json:"message"`
Meta map[string]interface{} `json:"meta"`
}
Error is an improve error type for the inclusion of more information
func NewError ¶
func NewError(msg interface{}) Error
NewError creates a new error of the default type
func NewFatalError ¶
func NewFatalError(msg interface{}) Error
NewFatalError creates an error that does not warrant a retry
func (Error) InjectMeta ¶
InjectMeta allows the insertion of meta into the error
func (Error) MarshalText ¶
type Exec ¶
type Exec struct {
Test string `json:"test"` //testid
Target string `json:"target"` //the entity to attach to
Command []string `json:"command"` //the command to run
Privileged bool `json:"privileged"` //should extra privileges be granted
Interactive bool `json:"interactive"`
TTY bool `json:"tty"`
Detach bool `json:"detach"`
}
type ExecAttach ¶
type ForkResponse ¶
type Instance ¶
type Instance struct {
Provider string `json:"provider" db:"provider"`
Project string `json:"project" db:"project"`
Zone string `json:"zone" db:"zone"`
Name string `json:"name" db:"name"`
BiomeID string `json:"biomeId" db:"biome_id"`
IP string `json:"ip" db:"ip"`
HumanName sql.NullString `json:"humanName,omitempty" db:"human_name"`
Index sql.NullInt32 `json:"index,omitempty" db:"index"`
}
Instance represents a virtual machine in the cloud
type Metadata ¶
type Metadata struct {
ID string `json:"id"`
DefinitionID string `json:"definitionID"`
UserID string `json:"userID"`
Header string `json:"header"`
Data []byte `json:"-"`
Path string `json:"path,omitempty"`
Filename string `json:"filename"`
SizeBytes int64 `json:"sizeBytes"`
MD5 string `json:"hash"`
CreatedAt time.Time `json:"createdAt"`
}
Metadata holds a bag of data representing information about an uploaded file
func (*Metadata) FilenameWithPath ¶
FilenameWithPath preserves any path filename that was uploaded with the file in multipath upload, we set the path as the file upload formfile, ie: -F key/path/blah=@file.ext
type OrganizationProfile ¶
type OrganizationProfile struct {
MainCTA CallToAction `json:"mainCTA,omitempty"`
Body string `json:"body,omitempty"`
RightCTAs []CallToAction `json:"rightCTAs,omitempty"`
}
type RunningInstance ¶
type Status ¶
type Status struct {
Test string `json:"test" db:"test_id"`
Org string `json:"org" db:"organization_id"`
Def string `json:"def" db:"definition_id"`
Phase string `json:"phase" db:"phase"`
StepsLeft int `json:"stepsLeft" db:"steps_left"`
Message string `json:"message,omitempty" db:"message"`
Finished bool `json:"finished" db:"finished"`
}
type Test ¶
type Test struct {
ID string `json:"id" db:"id"`
DefinitionID string `json:"definitionID" db:"definition_id"`
OrganizationID string `json:"organizationID" db:"organization_id"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
Status string `json:"status" db:"status"`
DestroyedAt time.Time `json:"destroyedAt" db:"destroyed_at"`
Name string `json:"name" db:"name"`
StripeID string `json:"-" db:"stripe_id"`
BurnRate int64 `json:"burnRate" db:"burn_rate"`
}
Test represents a whiteblock test
type TestDefinition ¶
type TestDefinitionSQL ¶
type TestDefinitionSQL struct {
ID string `json:"id" db:"id"`
KeycloakID string `json:"userID" db:"keycloak_id"`
OrgID string `json:"orgID" db:"organization_id"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
Name sql.NullString `json:"name" db:"name"`
}
func (TestDefinitionSQL) MarshalJSON ¶
func (ts TestDefinitionSQL) MarshalJSON() ([]byte, error)
func (TestDefinitionSQL) TestDefinition ¶
func (td TestDefinitionSQL) TestDefinition() TestDefinition
type TestInfo ¶
type TestInfo struct {
Name string `json:"name"`
Instances []RunningInstance `json:"instances"`
Domains []string `json:"domains"` //domain names
// Ports contains the exposed ports,
// len(Ports) == len(Domains), and Domains[n] should have all of the
// ports in Ports[n] exposed. (Note: may not be always up, but will be up atleast once)
Ports [][]int `json:"ports"` //exposed ports,
// Files contains file name -> url to fetch it
Files map[string]string `json:"files"`
Environment map[string]string `json:"environment"`
DefinitionID string `json:"definitionID" db:"definition_id"`
OrganizationID string `json:"organizationID" db:"organization_id"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
DestroyedAt time.Time `json:"destroyedAt" db:"destroyed_at"`
SpecFile string `json:"specFile"` //the definition spec
}
type TestLimits ¶
type TestSQL ¶
type TestSQL struct {
ID string `json:"id" db:"id"`
DefinitionID string `json:"definitionID" db:"definition_id"`
OrganizationID string `json:"organizationID" db:"organization_id"`
CreatedAt sql.NullTime `json:"createdAt" db:"created_at"`
Status sql.NullString `json:"status" db:"status"`
DestroyedAt sql.NullTime `json:"destroyedAt" db:"destroyed_at"`
Name sql.NullString `json:"name" db:"name"`
StripeID sql.NullString `json:"-" db:"stripe_id"`
BurnRate sql.NullInt64 `json:"burnRate" db:"burn_rate"`
}
TestSQL is the SQL representation of a Test, this structure should only be used when working with Tests in the Database, when Marshalled into JSON, this structure decays into Test
func (TestSQL) MarshalJSON ¶
type User ¶
type User struct {
ID string `json:"id" db:"id"`
KeycloakID string `json:"keycloak_id" db:"keycloak_id"`
Username string `json:"username" db:"username"`
Email string `json:"email" db:"email"`
CreatedAt time.Time `json:"created_at,omitonempty" db:"created_at"`
UpdatedAt time.Time `json:"updated_at,omitonempty" db:"updated_at"`
}