Documentation
¶
Overview ¶
Package fossil provides a wrapper for the Pterodactyl and WISP APIs.
Index ¶
- Constants
- type Allocation
- type ApplicationCredentials
- func (c *ApplicationCredentials) CreateDatabase(sid int, db *Database) (err error)
- func (c *ApplicationCredentials) CreateLocation(shortName, longName string) (loc *Location, err error)
- func (c *ApplicationCredentials) CreateServer(sv *ApplicationServer) (err error)
- func (c *ApplicationCredentials) CreateUser(u *User, password ...string) (err error)
- func (c *ApplicationCredentials) DeleteDatabase(sid int, dbid int) (err error)
- func (c *ApplicationCredentials) DeleteLocation(lid int) (err error)
- func (c *ApplicationCredentials) DeleteServer(sid int) (err error)
- func (c *ApplicationCredentials) DeleteUser(id int) (err error)
- func (c *ApplicationCredentials) ForceDeleteServer(sid int) (err error)
- func (c *ApplicationCredentials) GetDatabase(sid int, dbid int) (db *Database, err error)
- func (c *ApplicationCredentials) GetDatabases(sid int) (dbs []*Database, err error)
- func (c *ApplicationCredentials) GetEgg(nestID int, eggID int) (egg *Egg, err error)
- func (c *ApplicationCredentials) GetEggs(nestID int) (eggs []*Egg, err error)
- func (c *ApplicationCredentials) GetLocation(id int) (loc *Location, err error)
- func (c *ApplicationCredentials) GetLocations() (locations []*Location, err error)
- func (c *ApplicationCredentials) GetNest(id int) (nest *Nest, err error)
- func (c *ApplicationCredentials) GetNests() (nests []*Nest, err error)
- func (c *ApplicationCredentials) GetServer(internalID int) (sv *ApplicationServer, err error)
- func (c *ApplicationCredentials) GetServerExternal(externalID string) (sv *ApplicationServer, err error)
- func (c *ApplicationCredentials) GetServers() (svs []*ApplicationServer, err error)
- func (c *ApplicationCredentials) GetUser(id int) (user *User, err error)
- func (c *ApplicationCredentials) GetUserExternal(eid string) (user *User, err error)
- func (c *ApplicationCredentials) GetUsers() (users []*User, err error)
- func (c *ApplicationCredentials) RebuildServer(sid int) (err error)
- func (c *ApplicationCredentials) ReinstallServer(sid int) (err error)
- func (c *ApplicationCredentials) ResetDatabasePassword(sid int, dbid int) (err error)
- func (c *ApplicationCredentials) SuspendServer(sid int) (err error)
- func (c *ApplicationCredentials) UnsuspendServer(sid int) (err error)
- func (c *ApplicationCredentials) UpdateBuild(sv *ApplicationServer, addAlloc []int, removeAlloc []int) (err error)
- func (c *ApplicationCredentials) UpdateDetails(sv *ApplicationServer) (err error)
- func (c *ApplicationCredentials) UpdateLocationName(loc *Location) (err error)
- func (c *ApplicationCredentials) UpdateStartup(sv *ApplicationServer) (err error)
- func (c *ApplicationCredentials) UpdateUser(u *User, password ...string) (err error)
- type ApplicationServer
- type CPU
- type ClientCredentials
- func (c *ClientCredentials) ExecuteCommand(id string, cmd string) (err error)
- func (c *ClientCredentials) GetServer(id string) (sv *ClientServer, err error)
- func (c *ClientCredentials) GetServerStatus(id string) (ss *ServerStatus, err error)
- func (c *ClientCredentials) GetServers() (svs []*ClientServer, err error)
- func (c *ClientCredentials) SetPowerState(id string, state string) (err error)
- type ClientServer
- type Container
- type Credentials
- type Database
- type Disk
- type Egg
- type EggConfig
- type EggScript
- type EggStartup
- type Limits
- type Location
- type Memory
- type Meta
- type Nest
- type Players
- type ServerStatus
- type User
Constants ¶
const ( ON = "start" OFF = "stop" RESTART = "restart" KILL = "kill" )
Power States
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocation ¶
type Allocation struct {
Primary bool `json:"primary"`
IP string `json:"ip"`
Alias string `json:"alias"`
Port int `json:"port"`
}
Allocation holds all the information relating to the allocation data of a server
type ApplicationCredentials ¶
type ApplicationCredentials Credentials
ApplicationCredentials allow you to authenticate as a administrator, and access nodes, servers users with creation and destruction privileges.
func NewApplication ¶
func NewApplication(url, apiToken string) *ApplicationCredentials
NewApplication Creates a new ApplicationCredentials object used to interact with Pterodactyl as administrator.
func (*ApplicationCredentials) CreateDatabase ¶
func (c *ApplicationCredentials) CreateDatabase(sid int, db *Database) (err error)
CreateDatabase creates a new database based on the provided information
func (*ApplicationCredentials) CreateLocation ¶
func (c *ApplicationCredentials) CreateLocation(shortName, longName string) (loc *Location, err error)
CreateLocation makes a new location with the provided names
func (*ApplicationCredentials) CreateServer ¶
func (c *ApplicationCredentials) CreateServer(sv *ApplicationServer) (err error)
CreateServer creates a new server
func (*ApplicationCredentials) CreateUser ¶
func (c *ApplicationCredentials) CreateUser(u *User, password ...string) (err error)
CreateUser makes a new account with the provided data. The password argument can be optionally set.
func (*ApplicationCredentials) DeleteDatabase ¶
func (c *ApplicationCredentials) DeleteDatabase(sid int, dbid int) (err error)
DeleteDatabase marks the specified database in the specified server for deletion
func (*ApplicationCredentials) DeleteLocation ¶
func (c *ApplicationCredentials) DeleteLocation(lid int) (err error)
DeleteLocation marks a server as suspended
func (*ApplicationCredentials) DeleteServer ¶
func (c *ApplicationCredentials) DeleteServer(sid int) (err error)
DeleteServer marks a server for deletion
func (*ApplicationCredentials) DeleteUser ¶
func (c *ApplicationCredentials) DeleteUser(id int) (err error)
DeleteUser marks a user for deletion.
func (*ApplicationCredentials) ForceDeleteServer ¶
func (c *ApplicationCredentials) ForceDeleteServer(sid int) (err error)
ForceDeleteServer forcefully deletes a server. This is an ungraceful way to delete the server, and when possible DeleteServer should be preferred.
func (*ApplicationCredentials) GetDatabase ¶
func (c *ApplicationCredentials) GetDatabase(sid int, dbid int) (db *Database, err error)
GetDatabase fetches, if present, the database matching the id in the server's databases
func (*ApplicationCredentials) GetDatabases ¶
func (c *ApplicationCredentials) GetDatabases(sid int) (dbs []*Database, err error)
GetDatabases fetches all the associated databases for a server
func (*ApplicationCredentials) GetEgg ¶
func (c *ApplicationCredentials) GetEgg(nestID int, eggID int) (egg *Egg, err error)
GetEgg searches for a specific eggs inside a nest
func (*ApplicationCredentials) GetEggs ¶
func (c *ApplicationCredentials) GetEggs(nestID int) (eggs []*Egg, err error)
GetEggs fetches all eggs inside a nest
func (*ApplicationCredentials) GetLocation ¶
func (c *ApplicationCredentials) GetLocation(id int) (loc *Location, err error)
GetLocation fetches the location with the given ID
func (*ApplicationCredentials) GetLocations ¶
func (c *ApplicationCredentials) GetLocations() (locations []*Location, err error)
GetLocations fetches all available locations
func (*ApplicationCredentials) GetNest ¶
func (c *ApplicationCredentials) GetNest(id int) (nest *Nest, err error)
GetNest fetches, if present, a specific nest.
func (*ApplicationCredentials) GetNests ¶
func (c *ApplicationCredentials) GetNests() (nests []*Nest, err error)
GetNests fetches all available nests
func (*ApplicationCredentials) GetServer ¶
func (c *ApplicationCredentials) GetServer(internalID int) (sv *ApplicationServer, err error)
GetServer fetches the server with the given Internal ID if it exists
func (*ApplicationCredentials) GetServerExternal ¶
func (c *ApplicationCredentials) GetServerExternal(externalID string) (sv *ApplicationServer, err error)
GetServerExternal fetches the server with the given External ID if it exists
func (*ApplicationCredentials) GetServers ¶
func (c *ApplicationCredentials) GetServers() (svs []*ApplicationServer, err error)
GetServers fetches the servers of all the users
func (*ApplicationCredentials) GetUser ¶
func (c *ApplicationCredentials) GetUser(id int) (user *User, err error)
GetUser fetches, if present, the user with the matching Internal ID
func (*ApplicationCredentials) GetUserExternal ¶
func (c *ApplicationCredentials) GetUserExternal(eid string) (user *User, err error)
GetUserExternal fetches, if present, the user with the matching External ID
func (*ApplicationCredentials) GetUsers ¶
func (c *ApplicationCredentials) GetUsers() (users []*User, err error)
GetUsers fetches all the registered users from the API
func (*ApplicationCredentials) RebuildServer ¶
func (c *ApplicationCredentials) RebuildServer(sid int) (err error)
RebuildServer starts a server rebuild
func (*ApplicationCredentials) ReinstallServer ¶
func (c *ApplicationCredentials) ReinstallServer(sid int) (err error)
ReinstallServer marks a server for reinstallation
func (*ApplicationCredentials) ResetDatabasePassword ¶
func (c *ApplicationCredentials) ResetDatabasePassword(sid int, dbid int) (err error)
ResetDatabasePassword resets the password for the specified database of the specified server
func (*ApplicationCredentials) SuspendServer ¶
func (c *ApplicationCredentials) SuspendServer(sid int) (err error)
SuspendServer marks a server as suspended
func (*ApplicationCredentials) UnsuspendServer ¶
func (c *ApplicationCredentials) UnsuspendServer(sid int) (err error)
UnsuspendServer marks a server as active
func (*ApplicationCredentials) UpdateBuild ¶
func (c *ApplicationCredentials) UpdateBuild(sv *ApplicationServer, addAlloc []int, removeAlloc []int) (err error)
UpdateBuild modifies the server's limit and allocation configuration
func (*ApplicationCredentials) UpdateDetails ¶
func (c *ApplicationCredentials) UpdateDetails(sv *ApplicationServer) (err error)
UpdateDetails modifies the server name, user, external id and description
func (*ApplicationCredentials) UpdateLocationName ¶
func (c *ApplicationCredentials) UpdateLocationName(loc *Location) (err error)
UpdateLocationName modifies the short and long names of a location
func (*ApplicationCredentials) UpdateStartup ¶
func (c *ApplicationCredentials) UpdateStartup(sv *ApplicationServer) (err error)
UpdateStartup modifies the server's startup parameters, egg and image configuration
func (*ApplicationCredentials) UpdateUser ¶
func (c *ApplicationCredentials) UpdateUser(u *User, password ...string) (err error)
UpdateUser modifies the user as per the passed object. Be aware that not all parameters can be modified. Modifiable parameters include: External ID, Username, First name, Last name, Password, Root admin and Language. The password parameter can be optionally set.
type ApplicationServer ¶
type ApplicationServer struct {
ID int
Name string
Description string
Limits Limits
ExternalID string
UUID string
Suspended bool
User int
Node int
Nest int
Egg int
Pack int
Allocation int
AllocationsDetails []Allocation
Container Container
Updated time.Time
Created time.Time
}
ApplicationServer defines Pterodactyl server as an administrator would see it. It is fetched and interacted with the api token.
func (*ApplicationServer) String ¶
func (s *ApplicationServer) String() string
type ClientCredentials ¶
type ClientCredentials Credentials
ClientCredentials are user-specific, and can only be used to access and modify servers associated with that user. They do not allow administrator-level control of the servers.
func NewClient ¶
func NewClient(url, clientToken string) *ClientCredentials
NewClient creates a new ClientCredentials object used to interact with Pterodactyl as a user.
func (*ClientCredentials) ExecuteCommand ¶
func (c *ClientCredentials) ExecuteCommand(id string, cmd string) (err error)
ExecuteCommand allows the execution of a console command on the specified server
func (*ClientCredentials) GetServer ¶
func (c *ClientCredentials) GetServer(id string) (sv *ClientServer, err error)
GetServer fetches the server with the given ID if it exists
func (*ClientCredentials) GetServerStatus ¶
func (c *ClientCredentials) GetServerStatus(id string) (ss *ServerStatus, err error)
GetServerStatus fetches the server's status and usage
func (*ClientCredentials) GetServers ¶
func (c *ClientCredentials) GetServers() (svs []*ClientServer, err error)
GetServers fetches all the servers of the client
func (*ClientCredentials) SetPowerState ¶
func (c *ClientCredentials) SetPowerState(id string, state string) (err error)
SetPowerState changes the power state of a server. Will result in error if the server is already in that state or is unable to change state.
type ClientServer ¶
type ClientServer struct {
ID string
Name string
Description string
Limits Limits
AllocationDetails []Allocation
IsOwner bool
}
ClientServer defines Pterodactyl server as a user would see it. It is fetched and interacted with the client token.
func (*ClientServer) String ¶
func (s *ClientServer) String() string
type Container ¶
type Container struct {
StartupCommand string `json:"startup_command"`
Image string `json:"image"`
Installed bool `json:"installed"`
Environment map[string]string `json:"environment"`
}
Container holds all the Docker Image settings
type Credentials ¶
Credentials is the base object for ClientCredentials and ApplicationCredentials, and should not be used independently.
type Database ¶
type Database struct {
ID int `json:"id"`
Server int `json:"server"`
Host int `json:"host"`
Database string `json:"database"`
Username string `json:"username"`
Remote string `json:"remote"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Database contains all the information of a specific Pterodactyl database
type Egg ¶
type Egg struct {
ID int `json:"id"`
UUID string `json:"uuid"`
Nest int `json:"nest"`
Author string `json:"author"`
Description string `json:"description"`
DockerImage string `json:"docker_image"`
Config EggConfig `json:"config"`
Startup string `json:"startup"`
Script EggScript `json:"script"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Egg represents the information regarding an egg
type EggConfig ¶
type EggConfig struct {
Startup EggStartup `json:"startup"`
Stop string `json:"stop"`
CustomConfig []string `json:"custom_config"`
Extends string `json:"extends"`
}
EggConfig represents the configurations of an egg
type EggScript ¶
type EggScript struct {
Privileged bool `json:"privileged"`
Install string `json:"install"`
Entry string `json:"entry"`
Container string `json:"container"`
Extends string `json:"extends"`
}
EggScript represents the script configuration of an egg
type EggStartup ¶
type EggStartup struct {
Done string `json:"done"`
UserInteraction []string `json:"userInteraction"`
}
EggStartup represents the startup settings of an egg
type Limits ¶
type Limits struct {
Memory int `json:"memory"`
Swap int `json:"swap"`
Disk int `json:"disk"`
IO int `json:"io"`
CPU int `json:"cpu"`
Databases int `json:"-"`
Allocations int `json:"-"`
}
Limits contains all the allocated usage limits set for a server
type Location ¶
type Location struct {
ID int `json:"id"`
ShortName string `json:"short"`
LongName string `json:"long"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
}
Location represents a server location
type Meta ¶
type Meta struct {
Pagination struct {
Total int `json:"total"`
Count int `json:"count"`
PerPage int `json:"per_page"`
CurrentPage int `json:"current_page"`
TotalPages int `json:"total_pages"`
Links struct {
Previous string `json:"previous,omitempty"`
Next string `json:"next,omitempty"`
} `json:"links"`
} `json:"pagination"`
}
Meta contains the metadata of an API response
type Nest ¶
type Nest struct {
ID int `json:"id"`
UUID string `json:"uuid"`
Author string `json:"author"`
Name string `json:"name"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Nest represents the information regarding a nest
type Players ¶
Players holds the number of users in a server and the max amount permitted. Some Pterodactyl API-based software DO NOT provide this information.
type ServerStatus ¶
ServerStatus contains the client-visible server usage information
type User ¶
type User struct {
ID int `json:"id"`
ExternalID string `json:"external_id"`
UUID string `json:"uuid"`
Username string `json:"username"`
Email string `json:"email"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Language string `json:"language"`
RootAdmin bool `json:"root_admin"`
TwoFactorAuthentication bool `json:"2fa"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
User holds user information