PterodactylGoApi

package module
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: MIT Imports: 8 Imported by: 1

README

PterodactylGoApi

Learned and extended form https://github.com/pterodactyl/whmcs
fit for pterodactyl panel version 1.11.2
this package may help you to operate the panel with simply calling functions

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Allocation added in v0.2.3

type Allocation struct {
	ID       int    `json:"id"`
	IP       string `json:"ip"`
	Alias    string `json:"alias"`
	Port     int    `json:"port"`
	Assigned bool   `json:"assigned"`
}

type Client added in v0.2.3

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

Client Pterodactyl API client

func NewClient added in v0.2.3

func NewClient(url string, token string) *Client

NewClient initial a new client instance

func (*Client) CreateServer added in v0.2.3

func (this *Client) CreateServer(serverInfo Server) error

func (*Client) CreateUser added in v0.2.3

func (this *Client) CreateUser(userInfo interface{}) error

func (*Client) DeleteServer added in v0.2.3

func (this *Client) DeleteServer(serverExternalID string) error

func (*Client) DeleteUser added in v0.2.3

func (this *Client) DeleteUser(externalID string) error

func (*Client) GetAllEggs added in v0.2.3

func (this *Client) GetAllEggs(nestID int) ([]Egg, error)

func (*Client) GetAllNests added in v0.2.3

func (this *Client) GetAllNests() ([]Nest, error)

func (*Client) GetAllServers added in v0.2.3

func (this *Client) GetAllServers() ([]Server, error)

func (*Client) GetAllUsers added in v0.2.3

func (this *Client) GetAllUsers() ([]User, error)

func (*Client) GetAllocations added in v0.2.3

func (this *Client) GetAllocations(nodeID int) ([]Allocation, error)

func (*Client) GetEgg added in v0.2.3

func (this *Client) GetEgg(nestID int, eggID int) (*Egg, error)

func (*Client) GetEnv added in v0.2.3

func (this *Client) GetEnv(nestID int, eggID int) (map[string]string, error)

func (*Client) GetNest added in v0.2.3

func (this *Client) GetNest(nestID int) (*Nest, error)

func (*Client) GetNode added in v0.2.3

func (this *Client) GetNode(nodeID int) (*Node, error)

func (*Client) GetServer added in v0.2.3

func (this *Client) GetServer(ID interface{}, isExternal bool) (*Server, error)

func (*Client) GetServerID added in v0.2.3

func (this *Client) GetServerID(serverExternalID string) int

func (*Client) GetUser added in v0.2.3

func (this *Client) GetUser(ID interface{}, isExternal bool) (*User, error)

func (*Client) HostName added in v0.2.3

func (this *Client) HostName() string

func (*Client) ReinstallServer added in v0.2.3

func (this *Client) ReinstallServer(serverExternalID string) error

func (*Client) SuspendServer added in v0.2.3

func (this *Client) SuspendServer(serverExternalID string) error

func (*Client) TestConnection added in v0.2.3

func (this *Client) TestConnection()

func (*Client) UnsuspendServer added in v0.2.3

func (this *Client) UnsuspendServer(serverExternalID string) error

func (*Client) UpdateServerBuild added in v0.2.3

func (this *Client) UpdateServerBuild(externalID string, build PostUpdateBuild) error

func (*Client) UpdateServerDetail added in v0.2.3

func (this *Client) UpdateServerDetail(externalID string, details PostUpdateDetails) error

func (*Client) UpdateServerStartup added in v0.2.3

func (this *Client) UpdateServerStartup(externalID string, packID int) error

type ContainerInfo added in v0.2.4

type ContainerInfo struct {
	StartupCommand string `json:"startup_command"`
	Image          string `json:"image"`
	Installed      int    `json:"installed"`
}

type Egg added in v0.2.3

type Egg struct {
	Id           int                    `json:"id"`
	Uuid         string                 `json:"uuid"`
	Name         string                 `json:"name"`
	Nest         int                    `json:"nest"`
	Author       string                 `json:"author"`
	Description  string                 `json:"Description"`
	DockerImage  string                 `json:"docker_image"`
	DockerImages map[string]string      `json:"docker_images"`
	Config       map[string]interface{} `json:"config"`
	Script       ScriptInfo             `json:"script"`
	StartUp      string                 `json:"startup"`
	CreatedAt    time.Time              `json:"created_at"`
	UpdatedAt    time.Time              `json:"updated_at"`
}

type FeatureLimit added in v0.2.4

type FeatureLimit struct {
	Databases   int `json:"databases"`
	Allocations int `json:"allocations"`
	Backups     int `json:"backups"`
}

type Nest added in v0.2.3

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"`
}

type Node added in v0.2.3

type Node struct {
	Id                 int       `json:"id"`
	Public             bool      `json:"public"`
	Name               string    `json:"name"`
	Description        string    `json:"Description"`
	LocationId         int       `json:"location_id"`
	FQDN               string    `json:"fqdn"`
	Scheme             string    `json:"scheme"`
	BehindProxy        bool      `json:"behind_proxy"`
	MaintenanceMode    bool      `json:"maintenance_mode"`
	Memory             int       `json:"memory"`
	MemoryOverAllocate int       `json:"memory_overallocate"`
	Disk               int       `json:"disk"`
	DiskOverAllocate   int       `json:"disk_overallocate"`
	UploadSize         int       `json:"upload_size"`
	DaemonListen       int       `json:"daemon_listen"`
	DaemonSftp         int       `json:"daemon_sftp"`
	DaemonBase         string    `json:"daemon_base"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
}

type PostPteUser

type PostPteUser struct {
	ExternalId string `json:"external_id"`
	Username   string `json:"username"`
	Email      string `json:"email"`
	Language   string `json:"language"`
	RootAdmin  bool   `json:"root_admin"`
	Password   string `json:"password"`
	FirstName  string `json:"first_name"`
	LastName   string `json:"last_name"`
}

type PostUpdateBuild

type PostUpdateBuild struct {
	Allocation  int
	CPU         int
	Memory      int
	Swap        int
	IO          int
	Disk        int
	OomDisabled bool
	Database    int
	Allocations int
}

type PostUpdateDetails

type PostUpdateDetails struct {
	UserID      int
	ServerName  string
	Description string
	ExternalID  string
}

type ScriptInfo added in v0.2.4

type ScriptInfo struct {
	Privileged bool        `json:"privileged"`
	Install    string      `json:"install"`
	Entry      string      `json:"entry"`
	Container  string      `json:"container"`
	Extends    interface{} `json:"extends"`
}

type Server added in v0.2.3

type Server struct {
	Id            int           `json:"id"`
	ExternalId    string        `json:"external_id"`
	Uuid          string        `json:"uuid"`
	Identifier    string        `json:"identifier"`
	Name          string        `json:"name"`
	Description   string        `json:"Description"`
	Suspended     bool          `json:"suspended"`
	Limits        ServerLimit   `json:"limits"`
	FeatureLimits FeatureLimit  `json:"feature_limits"`
	UserId        int           `json:"user"`
	NodeId        int           `json:"node"`
	Allocation    int           `json:"allocation"`
	NestId        int           `json:"nest"`
	EggId         int           `json:"egg"`
	Container     ContainerInfo `json:"container"`
	UpdatedAt     time.Time     `json:"updated_at"`
	CreatedAt     time.Time     `json:"created_at"`
}

type ServerLimit added in v0.2.3

type ServerLimit struct {
	Memory      int  `json:"memory"`
	Swap        int  `json:"swap"`
	Disk        int  `json:"disk"`
	IO          int  `json:"io"`
	CPU         int  `json:"cpu"`
	OOMDisabled bool `json:"oom_disabled"`
}

type User added in v0.2.3

type User struct {
	Uid        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"`
	TwoFA      bool      `json:"2fa"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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