Documentation ΒΆ
Index ΒΆ
- Constants
- type Account
- type Allocation
- type AllocationDescriptor
- type ApiError
- type ApiKey
- type AppServer
- type Application
- func (a *Application) CreateDatabase(serverID int, opts CreateDatabaseOptions) (*Database, error)
- func (a *Application) CreateLocation(short, long string) (*Location, error)
- func (a *Application) CreateNode(fields CreateNodeDescriptor) (*Node, error)
- func (a *Application) CreateNodeAllocations(node int, fields CreateAllocationsDescriptor) error
- func (a *Application) CreateServer(fields CreateServerDescriptor) (*AppServer, error)
- func (a *Application) CreateUser(fields CreateUserDescriptor) (*User, error)
- func (a *Application) DeleteDatabase(serverID, databaseID int) error
- func (a *Application) DeleteLocation(id int) error
- func (a *Application) DeleteNode(id int) error
- func (a *Application) DeleteNodeAllocation(node, id int) error
- func (a *Application) DeleteServer(id int, force bool) error
- func (a *Application) DeleteUser(id int) error
- func (a *Application) GetDatabase(serverID, databaseID int, opts ...options.GetDatabaseOptions) (*Database, error)
- func (a *Application) GetEgg(nestID, eggID int, opts ...options.GetEggOptions) (*Egg, error)
- func (a *Application) GetLocation(id int, opts ...options.GetLocationOptions) (*Location, error)
- func (a *Application) GetNest(nestID int, opts ...options.GetNestOptions) (*Nest, error)
- func (a *Application) GetNode(id int, opts ...options.GetNodeOptions) (*Node, error)
- func (a *Application) GetNodeConfiguration(id int) (*NodeConfiguration, error)
- func (a *Application) GetServer(id int, opts ...options.GetServerOptions) (*AppServer, error)
- func (a *Application) GetServerExternal(id string, opts ...options.GetServerOptions) (*AppServer, error)
- func (a *Application) GetUser(id int, opts ...options.GetUserOptions) (*User, error)
- func (a *Application) GetUserExternal(id string, opts ...options.GetUserOptions) (*User, error)
- func (a *Application) ListDatabases(serverID int, opts ...options.ListDatabasesOptions) ([]*Database, error)
- func (a *Application) ListLocations(opts ...options.ListLocationsOptions) ([]*Location, error)
- func (a *Application) ListNestEggs(nestID int, opts ...options.ListEggsOptions) ([]*Egg, error)
- func (a *Application) ListNests(opts ...options.ListNestsOptions) ([]*Nest, error)
- func (a *Application) ListNodeAllocations(node int, opts ...options.ListNodeAllocationsOptions) ([]*Allocation, error)
- func (a *Application) ListNodes(opts ...options.ListNodesOptions) ([]*Node, error)
- func (a *Application) ListServers(opts ...options.ListServersOptions) ([]*AppServer, error)
- func (a *Application) ListUsers(opts ...options.ListUsersOptions) ([]*User, error)
- func (a *Application) ReinstallServer(id int) error
- func (a *Application) ResetDatabasePassword(serverID, databaseID int) (*Database, error)
- func (a *Application) SuspendServer(id int) error
- func (a *Application) UnsuspendServer(id int) error
- func (a *Application) UpdateLocation(id int, short, long string) (*Location, error)
- func (a *Application) UpdateNode(id int, fields UpdateNodeDescriptor) (*Node, error)
- func (a *Application) UpdateServerBuild(id int, fields ServerBuildDescriptor) (*AppServer, error)
- func (a *Application) UpdateServerDetails(id int, fields ServerDetailsDescriptor) (*AppServer, error)
- func (a *Application) UpdateServerStartup(id int, fields ServerStartupDescriptor) (*AppServer, error)
- func (a *Application) UpdateUser(id int, fields UpdateUserDescriptor) (*User, error)
- type ChmodDescriptor
- type Client
- func (c *Client) ChmodServerFiles(identifier string, files ChmodDescriptor) error
- func (c *Client) CompressServerFiles(identifier string, files CompressDescriptor) error
- func (c *Client) CopyServerFile(identifier, location string) error
- func (c *Client) CreateDatabase(identifier, remote, database string) (*ClientDatabase, error)
- func (c *Client) CreateKey(description string, ips []string) (*ApiKey, error)
- func (c *Client) CreateServerFileFolder(identifier string, file CreateFolderDescriptor) error
- func (c *Client) DecompressServerFile(identifier string, file DecompressDescriptor) error
- func (c *Client) DeleteDatabase(identifier, id string) error
- func (c *Client) DeleteKey(identifier string) error
- func (c *Client) DeleteServerFiles(identifier string, files DeleteFilesDescriptor) error
- func (c *Client) DisableTwoFactor(password string) error
- func (c *Client) DownloadServerFile(identifier, file string) (*Downloader, error)
- func (c *Client) EnableTwoFactor(code int) ([]string, error)
- func (c *Client) GetAccount() (*Account, error)
- func (c *Client) GetApiKeys() ([]*ApiKey, error)
- func (c *Client) GetServer(identifier string) (*ClientServer, error)
- func (c *Client) GetServerDatabases(identifier string) ([]*ClientDatabase, error)
- func (c *Client) GetServerFileContents(identifier, file string) ([]byte, error)
- func (c *Client) GetServerFiles(identififer, root string) ([]*File, error)
- func (c *Client) GetServerResources(identifier string) (*Resources, error)
- func (c *Client) GetServerWebSocket(identifier string) (*WebSocketAuth, error)
- func (c *Client) GetServers() ([]*ClientServer, error)
- func (c *Client) GetTwoFactor() (*TwoFactorData, error)
- func (c *Client) PullServerFile(identifier string, file PullDescriptor) error
- func (c *Client) RenameServerFiles(identifier string, files RenameDescriptor) error
- func (c *Client) RotateDatabasePassword(identifier, id string) (*ClientDatabase, error)
- func (c *Client) SendServerCommand(identifier, command string) error
- func (c *Client) SetServerPowerState(identifier, state string) error
- func (c *Client) UpdateEmail(email, password string) error
- func (c *Client) UpdatePassword(old, new string) error
- func (c *Client) UploadServerFile(identifier, path string) (*Uploader, error)
- func (c *Client) WriteServerFile(identifier, name, content string) error
- func (c *Client) WriteServerFileBytes(identifier, name, header string, content []byte) error
- type ClientDatabase
- type ClientServer
- type CompressDescriptor
- type CreateAllocationsDescriptor
- type CreateDatabaseOptions
- type CreateFolderDescriptor
- type CreateNodeDescriptor
- type CreateServerDescriptor
- type CreateUserDescriptor
- type Database
- type DatabaseBackup
- type DatabaseCredentials
- type DatabaseManager
- func (dm *DatabaseManager) CreateDatabase(serverID int, opts CreateDatabaseOptions) (*Database, error)
- func (dm *DatabaseManager) CreateDatabaseBackup(serverID, databaseID int, name string) (*DatabaseBackup, error)
- func (dm *DatabaseManager) DeleteDatabase(serverID, databaseID int) error
- func (dm *DatabaseManager) DeleteDatabaseBackup(serverID, databaseID int, backupID string) error
- func (dm *DatabaseManager) GetDatabase(serverID, databaseID int, opts ...options.GetDatabaseOptions) (*Database, error)
- func (dm *DatabaseManager) GetDatabaseBackup(serverID, databaseID int, backupID string) (*DatabaseBackup, error)
- func (dm *DatabaseManager) GetDatabaseUsage(serverID, databaseID int) (*DatabaseUsage, error)
- func (dm *DatabaseManager) ListDatabaseBackups(serverID, databaseID int) ([]*DatabaseBackup, error)
- func (dm *DatabaseManager) ListDatabases(serverID int, opts ...options.ListDatabasesOptions) ([]*Database, error)
- func (dm *DatabaseManager) RotateDatabasePassword(serverID, databaseID int) (*DatabaseRotatePasswordResponse, error)
- type DatabaseRotatePasswordResponse
- type DatabaseUsage
- type DecompressDescriptor
- type DeleteFilesDescriptor
- type DeployDescriptor
- type DeployableNodesDescriptor
- type Downloader
- type Egg
- type EggConfig
- type EggFileConfig
- type EggLogs
- type EggScript
- type EggStartup
- type EggVariable
- type Error
- type FeatureLimits
- type File
- type Host
- type Limits
- type Location
- type Nest
- type Node
- type NodeConfiguration
- type PullDescriptor
- type RenameDescriptor
- type ResourceUsage
- type Resources
- type ResponseAllocation
- type ResponseDatabase
- type ResponseEgg
- type ResponseLocation
- type ResponseNest
- type ResponseNode
- type ResponseServer
- type ServerBuildDescriptor
- type ServerDetailsDescriptor
- type ServerStartupDescriptor
- type TwoFactorData
- type UpdateNodeDescriptor
- type UpdateUserDescriptor
- type Uploader
- type User
- type WebSocketAuth
Constants ΒΆ
const Version = "1.2.0b"
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type Account ΒΆ
type Allocation ΒΆ
type AllocationDescriptor ΒΆ
type AppServer ΒΆ
type AppServer 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"` Status string `json:"status,omitempty"` Suspended bool `json:"suspended"` Limits Limits `json:"limits"` FeatureLimits FeatureLimits `json:"feature_limits"` UserID int `json:"user"` NodeID int `json:"node"` Allocation int `json:"allocation"` NestID int `json:"nest"` EggID int `json:"egg"` Container struct { StartupCommand string `json:"startup_command"` Image string `json:"image"` Installed int `json:"installed"` Environment map[string]interface{} `json:"environment"` } `json:"container"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Allocations []*Allocation `json:"-"` UserObject *User `json:"-"` Subusers []*User `json:"-"` Location *Location `json:"-"` NodeObject *Node `json:"-"` NestObject *Nest `json:"-"` EggObject *Egg `json:"-"` Variables []*EggVariable `json:"-"` Databases []*Database `json:"-"` // ΠΠΎΠ±Π°Π²Π»ΡΠ΅ΠΌ ΠΏΠΎΠ»Π΅ Π΄Π»Ρ Π±Π°Π· Π΄Π°Π½Π½ΡΡ }
func (*AppServer) BuildDescriptor ΒΆ
func (s *AppServer) BuildDescriptor() *ServerBuildDescriptor
BuildDescriptor creates a ServerBuildDescriptor for the AppServer. It extracts relevant server build details, such as allocation, OOM disabled, limits, and feature limits from the server object. This descriptor is used to initialize or modify server build parameters.
func (*AppServer) DetailsDescriptor ΒΆ
func (s *AppServer) DetailsDescriptor() *ServerDetailsDescriptor
DetailsDescriptor creates a ServerDetailsDescriptor for the AppServer. It extracts relevant server details, such as the external ID, name, user ID, and description from the server object. This descriptor is used to initialize or modify server details.
func (*AppServer) StartupDescriptor ΒΆ
func (s *AppServer) StartupDescriptor() *ServerStartupDescriptor
StartupDescriptor creates a ServerStartupDescriptor for the AppServer. It extracts startup-related information, including the startup command, environment variables, egg ID, and image from the server's container configuration. This descriptor is used to initialize or modify server startup parameters.
type Application ΒΆ
func NewApp ΒΆ
func NewApp(url, key string) (*Application, error)
NewApp creates a new Application instance for interacting with the Pterodactyl API. It requires a valid panel URL and an application API key for authentication. Returns a pointer to the Application instance or an error if the URL or API key is invalid.
func (*Application) CreateDatabase ΒΆ
func (a *Application) CreateDatabase(serverID int, opts CreateDatabaseOptions) (*Database, error)
CreateDatabase creates a new database for a server
func (*Application) CreateLocation ΒΆ
func (a *Application) CreateLocation(short, long string) (*Location, error)
CreateLocation creates a new Location object.
The function takes a short and long description of the location. The descriptions are used to populate the short and long fields of the Location object.
The function returns a pointer to the newly created Location object, or an error if the request fails.
func (*Application) CreateNode ΒΆ
func (a *Application) CreateNode(fields CreateNodeDescriptor) (*Node, error)
CreateNode sends a POST request to create a new node with the specified fields. The fields parameter is a CreateNodeDescriptor containing details about the node. The function returns a pointer to the newly created Node object, or an error if the request fails.
func (*Application) CreateNodeAllocations ΒΆ
func (a *Application) CreateNodeAllocations(node int, fields CreateAllocationsDescriptor) error
CreateNodeAllocations creates a new allocation on the specified node. The fields argument is a CreateAllocationsDescriptor containing details about the allocation. The function returns an error if the request fails.
func (*Application) CreateServer ΒΆ
func (a *Application) CreateServer(fields CreateServerDescriptor) (*AppServer, error)
CreateServer creates a new server from the given descriptor. At least one of Allocation or Deploy must be specified.
func (*Application) CreateUser ΒΆ
func (a *Application) CreateUser(fields CreateUserDescriptor) (*User, error)
CreateUser sends a POST request to create a new user with the specified fields. The fields parameter is a CreateUserDescriptor containing details about the user. The function returns a pointer to the newly created User object, or an error if the request fails.
func (*Application) DeleteDatabase ΒΆ
func (a *Application) DeleteDatabase(serverID, databaseID int) error
DeleteDatabase deletes a specific database
func (*Application) DeleteLocation ΒΆ
func (a *Application) DeleteLocation(id int) error
DeleteLocation deletes a Location object by its ID.
The function takes the ID of the Location to delete.
The function returns an error if the request fails.
func (*Application) DeleteNode ΒΆ
func (a *Application) DeleteNode(id int) error
DeleteNode deletes the node with the given ID.
The function takes an integer ID representing the node to be deleted. The function returns an error if the request fails.
func (*Application) DeleteNodeAllocation ΒΆ
func (a *Application) DeleteNodeAllocation(node, id int) error
DeleteNodeAllocation deletes the allocation with the given ID from the specified node.
The function takes two integer arguments: the first is the node ID, and the second is the allocation ID. The function returns an error if the request fails.
func (*Application) DeleteServer ΒΆ
func (a *Application) DeleteServer(id int, force bool) error
DeleteServer deletes the server with the specified ID. If the force argument is true, it will delete the server even if it is not in a stopped state. The function makes a DELETE request to the API, and on success, returns nil. If any errors occur during the request or response processing, an error is returned.
func (*Application) DeleteUser ΒΆ
func (a *Application) DeleteUser(id int) error
DeleteUser sends a DELETE request to remove the user with the specified ID. The function returns an error if the request fails.
func (*Application) GetDatabase ΒΆ
func (a *Application) GetDatabase(serverID, databaseID int, opts ...options.GetDatabaseOptions) (*Database, error)
GetDatabase retrieves a Database object by its server and database IDs, with the option to include related fields and customize the API request. The opts argument is a variable length argument of options.GetDatabaseOptions structs, which allows for the inclusion of additional fields and filtering.
Parameters:
- serverID: The ID of the server associated with the database.
- databaseID: The ID of the database to retrieve.
- opts: Variadic GetDatabaseOptions for customizing the request.
Returns:
- A pointer to the Database object representing the requested database.
- An error if the request fails or the response cannot be parsed.
func (*Application) GetEgg ΒΆ
func (a *Application) GetEgg(nestID, eggID int, opts ...options.GetEggOptions) (*Egg, error)
GetEgg returns a single Egg object by its ID, with its related servers and variables resolved. The opts argument is a variable length argument of options.GetEggOptions structs. These options are used to customize the API request and response.
The function returns a single Egg object, with its related servers and variables resolved. The error return value is used to indicate any errors that occurred while executing the request.
func (*Application) GetLocation ΒΆ
func (a *Application) GetLocation(id int, opts ...options.GetLocationOptions) (*Location, error)
GetLocation retrieves a Location object by its ID, with the option to include related nodes and servers. The opts argument is a variable length argument of options.GetLocationOptions structs. These options are used to customize the API request and response.
The function returns a single Location object, with its related nodes and servers resolved. The error return value is used to indicate any errors that occurred while executing the request.
func (*Application) GetNest ΒΆ
func (a *Application) GetNest(nestID int, opts ...options.GetNestOptions) (*Nest, error)
GetNest returns a Nest object by its ID, with its related servers and eggs resolved. The function takes a variable number of options, which are used to customize the API request and response. The error return value is used to indicate any errors that occurred while executing the request.
func (*Application) GetNode ΒΆ
func (a *Application) GetNode(id int, opts ...options.GetNodeOptions) (*Node, error)
GetNode retrieves a Node object by its ID, with the option to include related allocations, location, and servers. The opts argument is a variable length argument of options.GetNodeOptions structs, which are used to customize the API request and response. The function returns a single Node object, with its related entities resolved, and an error return value to indicate any errors that occurred while executing the request.
func (*Application) GetNodeConfiguration ΒΆ
func (a *Application) GetNodeConfiguration(id int) (*NodeConfiguration, error)
GetNodeConfiguration returns the configuration of the node with the given ID. The function makes a GET request to the API, and returns the response as a NodeConfiguration object, with an error return value to indicate any errors that occurred while executing the request.
func (*Application) GetServer ΒΆ
func (a *Application) GetServer(id int, opts ...options.GetServerOptions) (*AppServer, error)
GetServer retrieves a Server object by its ID, with its related allocations, user, subusers, location, node, nest, egg, variables, and databases resolved. The function takes a variable number of options, which are used to customize the API request and response. The error return value is used to indicate any errors that occurred while executing the request.
func (*Application) GetServerExternal ΒΆ
func (a *Application) GetServerExternal(id string, opts ...options.GetServerOptions) (*AppServer, error)
GetServerExternal retrieves a Server object by its external ID, with its related allocations, user, subusers, location, node, nest, egg, variables, and databases resolved. The function takes a variable number of options, which are used to customize the API request and response. The error return value is used to indicate any errors that occurred while executing the request.
func (*Application) GetUser ΒΆ
func (a *Application) GetUser(id int, opts ...options.GetUserOptions) (*User, error)
GetUser retrieves a User object by its ID, with its related servers resolved. The function takes a variable number of options, which are used to customize the API request and response. The error return value is used to indicate any errors that occurred while executing the request.
func (*Application) GetUserExternal ΒΆ
func (a *Application) GetUserExternal(id string, opts ...options.GetUserOptions) (*User, error)
GetUserExternal retrieves a User object by its external ID, with its related servers resolved. The function takes a variable number of options, which are used to customize the API request and response. The error return value is used to indicate any errors that occurred while executing the request.
func (*Application) ListDatabases ΒΆ
func (a *Application) ListDatabases(serverID int, opts ...options.ListDatabasesOptions) ([]*Database, error)
ListDatabases retrieves a list of Database objects associated with a specified server ID from the Pterodactyl API. The function supports customization of the API request through optional ListDatabasesOptions, allowing the inclusion of related fields and filtering.
Parameters:
- serverID: The ID of the server for which databases are to be listed.
- opts: Variadic ListDatabasesOptions for customizing the request.
Returns:
- A slice of pointers to Database objects representing the databases associated with the specified server.
- An error if the request fails or the response cannot be parsed.
func (*Application) ListLocations ΒΆ
func (a *Application) ListLocations(opts ...options.ListLocationsOptions) ([]*Location, error)
ListLocations retrieves a list of Location objects from the Pterodactyl API, with the option to include related nodes and servers.
The opts argument is a variable length argument of options.ListLocationsOptions structs. These options are used to customize the API request and response.
The function returns a slice of Location objects, with their related nodes and servers resolved. The error return value is used to indicate any errors that occurred while executing the request.
func (*Application) ListNestEggs ΒΆ
func (a *Application) ListNestEggs(nestID int, opts ...options.ListEggsOptions) ([]*Egg, error)
ListNestEggs retrieves a list of Egg objects from a Nest, with the option to include related servers and variables.
The opts argument is a variable length argument of options.ListEggsOptions structs. These options are used to customize the API request and response.
The function returns a slice of Egg objects, with their related servers and variables resolved. The error return value is used to indicate any errors that occurred while executing the request.
func (*Application) ListNests ΒΆ
func (a *Application) ListNests(opts ...options.ListNestsOptions) ([]*Nest, error)
ListNests retrieves a list of Nest objects from the Pterodactyl API, with the option to include related servers and eggs.
The opts argument is a variable length argument of options.ListNestsOptions structs. These options are used to customize the API request and response.
The function returns a slice of Nest objects, with their related servers and eggs resolved. The error return value is used to indicate any errors that occurred while executing the request.
func (*Application) ListNodeAllocations ΒΆ
func (a *Application) ListNodeAllocations(node int, opts ...options.ListNodeAllocationsOptions) ([]*Allocation, error)
ListNodeAllocations retrieves a list of Allocation objects for a specified node from the Pterodactyl API. The function accepts a node ID and an optional variable-length argument of options.ListNodeAllocationsOptions structs. These options are used to customize the API request and response. The function returns a slice of Allocation objects with their relationships resolved, and an error return value to indicate any errors that occurred during the request.
func (*Application) ListNodes ΒΆ
func (a *Application) ListNodes(opts ...options.ListNodesOptions) ([]*Node, error)
ListNodes retrieves a list of Node objects from the Pterodactyl API, with the option to include related allocations, location, and servers. The opts argument is a variable length argument of options.ListNodesOptions structs, which are used to customize the API request and response. The function returns a slice of Node objects, with their related entities resolved, and an error return value to indicate any errors that occurred while executing the request.
func (*Application) ListServers ΒΆ
func (a *Application) ListServers(opts ...options.ListServersOptions) ([]*AppServer, error)
ListServers retrieves a list of Server objects from the Pterodactyl API, with the option to include related allocations, user, subusers, location, node, nest, egg, variables, and databases.
The opts argument is a variable length argument of options.ListServersOptions structs. These options are used to customize the API request and response.
The function returns a slice of Server objects, with their related allocations, user, subusers, location, node, nest, egg, variables, and databases resolved. The error return value is used to indicate any errors that occurred while executing the request.
func (*Application) ListUsers ΒΆ
func (a *Application) ListUsers(opts ...options.ListUsersOptions) ([]*User, error)
ListUsers retrieves a list of User objects from the Pterodactyl API, with the option to include related servers. The opts argument is a variable length argument of options.ListUsersOptions structs, which are used to customize the API request and response. The function returns a slice of User objects, with their related servers resolved, and an error return value to indicate any errors that occurred while executing the request.
func (*Application) ReinstallServer ΒΆ
func (a *Application) ReinstallServer(id int) error
ReinstallServer reinstalls the server with the specified ID, resetting its configuration to the egg defaults. The function makes a POST request to the API, and on success, returns nil. If any errors occur during the request or response processing, an error is returned.
func (*Application) ResetDatabasePassword ΒΆ
func (a *Application) ResetDatabasePassword(serverID, databaseID int) (*Database, error)
ResetDatabasePassword resets the password for a specific database
func (*Application) SuspendServer ΒΆ
func (a *Application) SuspendServer(id int) error
SuspendServer suspends the server with the specified ID, effectively stopping it but not deallocating its resources. The function makes a POST request to the API, and on success, returns nil. If any errors occur during the request or response processing, an error is returned.
func (*Application) UnsuspendServer ΒΆ
func (a *Application) UnsuspendServer(id int) error
UnsuspendServer resumes the operation of a previously suspended server with the specified ID. The function makes a POST request to the API to unsuspend the server, allowing it to run again. It returns nil if successful, or an error if any issues occur during the request or response processing.
func (*Application) UpdateLocation ΒΆ
func (a *Application) UpdateLocation(id int, short, long string) (*Location, error)
UpdateLocation updates the specified Location object.
The function takes the ID of the Location to update, and a new short and long description of the location. The descriptions are used to populate the short and long fields of the Location object.
The function returns a pointer to the updated Location object, or an error if the request fails.
func (*Application) UpdateNode ΒΆ
func (a *Application) UpdateNode(id int, fields UpdateNodeDescriptor) (*Node, error)
UpdateNode updates the node with the specified ID using the provided fields. It accepts an integer ID representing the node to be updated and a UpdateNodeDescriptor struct with the fields to be updated. If no fields are specified, it returns an error. The function makes a PATCH request to the API, and on success, returns a pointer to the updated Node object. If any errors occur during the request or response processing, an error is returned.
func (*Application) UpdateServerBuild ΒΆ
func (a *Application) UpdateServerBuild(id int, fields ServerBuildDescriptor) (*AppServer, error)
UpdateServerBuild updates the build parameters of a server. The fields parameter must include at least one of Allocation, OOMDisabled, Limits, AddAllocations, RemoveAllocations, or FeatureLimits. The function returns the updated server object if successful.
func (*Application) UpdateServerDetails ΒΆ
func (a *Application) UpdateServerDetails(id int, fields ServerDetailsDescriptor) (*AppServer, error)
UpdateServerDetails updates the details of a server using the specified server ID and details descriptor. It sends a PATCH request to the Pterodactyl API, which updates the server's external ID, name, user, or description based on the provided fields.
Parameters:
- id: The ID of the server to be updated.
- fields: A ServerDetailsDescriptor containing the fields to be updated.
Returns:
- A pointer to the updated AppServer object.
- An error if the request fails, if the response cannot be parsed, or if no details fields are specified.
func (*Application) UpdateServerStartup ΒΆ
func (a *Application) UpdateServerStartup(id int, fields ServerStartupDescriptor) (*AppServer, error)
UpdateServerStartup updates the startup configuration of the server with the specified ID using the provided fields.
- An integer ID representing the server to be updated.
- A ServerStartupDescriptor struct with the fields to be updated.
- If no fields are specified, it returns an error.
- The function makes a PATCH request to the API, and on success, returns a pointer to the updated AppServer object.
- If any errors occur during the request or response processing, an error is returned.
func (*Application) UpdateUser ΒΆ
func (a *Application) UpdateUser(id int, fields UpdateUserDescriptor) (*User, error)
UpdateUser sends a PATCH request to update the user with the specified ID using the provided fields. The fields parameter is a UpdateUserDescriptor containing details about the user. The function returns a pointer to the updated User object, or an error if the request fails.
type ChmodDescriptor ΒΆ
type Client ΒΆ
func NewClient ΒΆ
NewClient returns a new Client instance, given a valid panel URL and client API key. The returned Client instance is used to make API requests to the panel on behalf of the client. The client API key is used to authenticate the requests, and is required to be set. If either the panel URL or the client API key are blank, the function will return an error.
func (*Client) ChmodServerFiles ΒΆ
func (c *Client) ChmodServerFiles(identifier string, files ChmodDescriptor) error
func (*Client) CompressServerFiles ΒΆ
func (c *Client) CompressServerFiles(identifier string, files CompressDescriptor) error
func (*Client) CopyServerFile ΒΆ
func (*Client) CreateDatabase ΒΆ
func (c *Client) CreateDatabase(identifier, remote, database string) (*ClientDatabase, error)
func (*Client) CreateServerFileFolder ΒΆ
func (c *Client) CreateServerFileFolder(identifier string, file CreateFolderDescriptor) error
func (*Client) DecompressServerFile ΒΆ
func (c *Client) DecompressServerFile(identifier string, file DecompressDescriptor) error
func (*Client) DeleteDatabase ΒΆ
func (*Client) DeleteServerFiles ΒΆ
func (c *Client) DeleteServerFiles(identifier string, files DeleteFilesDescriptor) error
func (*Client) DisableTwoFactor ΒΆ
func (*Client) DownloadServerFile ΒΆ
func (c *Client) DownloadServerFile(identifier, file string) (*Downloader, error)
func (*Client) GetAccount ΒΆ
func (*Client) GetApiKeys ΒΆ
func (*Client) GetServerDatabases ΒΆ
func (c *Client) GetServerDatabases(identifier string) ([]*ClientDatabase, error)
func (*Client) GetServerFileContents ΒΆ
func (*Client) GetServerFiles ΒΆ
func (*Client) GetServerResources ΒΆ
func (*Client) GetServerWebSocket ΒΆ
func (c *Client) GetServerWebSocket(identifier string) (*WebSocketAuth, error)
func (*Client) GetServers ΒΆ
func (c *Client) GetServers() ([]*ClientServer, error)
func (*Client) GetTwoFactor ΒΆ
func (c *Client) GetTwoFactor() (*TwoFactorData, error)
func (*Client) PullServerFile ΒΆ
func (c *Client) PullServerFile(identifier string, file PullDescriptor) error
func (*Client) RenameServerFiles ΒΆ
func (c *Client) RenameServerFiles(identifier string, files RenameDescriptor) error
func (*Client) RotateDatabasePassword ΒΆ
func (c *Client) RotateDatabasePassword(identifier, id string) (*ClientDatabase, error)
func (*Client) SendServerCommand ΒΆ
func (*Client) SetServerPowerState ΒΆ
func (*Client) UpdateEmail ΒΆ
func (*Client) UpdatePassword ΒΆ
func (*Client) UploadServerFile ΒΆ
func (*Client) WriteServerFile ΒΆ
type ClientDatabase ΒΆ
type ClientServer ΒΆ
type ClientServer struct { ServerOwner bool `json:"server_owner"` Identifier string `json:"identifier"` UUID string `json:"uuid"` InternalID int `json:"internal_id"` Name string `json:"name"` Node string `json:"node"` SFTP struct { IP string `json:"ip"` Port int64 `json:"port"` } `json:"sftp_details"` Description string `json:"description"` Limits Limits `json:"limits"` Invocation string `json:"invocation"` DockerImage string `json:"docker_image"` EggFeatures []string `json:"egg_features"` FeatureLimits FeatureLimits `json:"feature_limits"` Status string `json:"status"` Suspended bool `json:"is_suspended"` Installing bool `json:"is_installing"` Transferring bool `json:"is_transferring"` }
type CompressDescriptor ΒΆ
type CreateDatabaseOptions ΒΆ
type CreateDatabaseOptions struct { Database string `json:"database"` Remote string `json:"remote"` HostID int `json:"host,omitempty"` }
CreateDatabaseOptions represents the options for creating a new database
type CreateFolderDescriptor ΒΆ
type CreateNodeDescriptor ΒΆ
type CreateNodeDescriptor struct { Name string `json:"name"` Description string `json:"description"` LocationID int `json:"location_id"` Public bool `json:"public"` FQDN string `json:"fqdn"` Scheme string `json:"scheme"` BehindProxy bool `json:"behind_proxy"` Memory int64 `json:"memory"` MemoryOverallocate int64 `json:"memory_overallocate"` Disk int64 `json:"disk"` DiskOverallocate int64 `json:"disk_overallocate"` DaemonBase string `json:"daemon_base"` DaemonSftp int32 `json:"daemon_sftp"` DaemonListen int32 `json:"daemon_listen"` UploadSize int64 `json:"upload_size"` }
type CreateServerDescriptor ΒΆ
type CreateServerDescriptor struct { ExternalID string `json:"external_id,omitempty"` Name string `json:"name"` Description string `json:"description,omitempty"` User int `json:"user"` Egg int `json:"egg"` DockerImage string `json:"docker_image"` Startup string `json:"startup"` Environment map[string]interface{} `json:"environment"` SkipScripts bool `json:"skip_scripts,omitempty"` OOMDisabled bool `json:"oom_disabled"` Limits *Limits `json:"limits"` FeatureLimits FeatureLimits `json:"feature_limits"` Allocation *AllocationDescriptor `json:"allocation,omitempty"` Deploy *DeployDescriptor `json:"deploy,omitempty"` StartOnCompletion bool `json:"start_on_completion,omitempty"` }
type CreateUserDescriptor ΒΆ
type CreateUserDescriptor struct { ExternalID string `json:"external_id,omitempty"` Email string `json:"email"` Username string `json:"username"` Password string `json:"password,omitempty"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Language string `json:"language,omitempty"` RootAdmin bool `json:"root_admin,omitempty"` }
type Database ΒΆ
type Database struct { ID int `json:"id"` ServerID int `json:"server"` HostID int `json:"host"` Database string `json:"database"` Username string `json:"username"` Remote string `json:"remote"` MaxSize int `json:"max_size"` Port int `json:"port,omitempty"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` Host *Host `json:"-"` Password string `json:"password,omitempty"` }
Database represents a database instance for a server
type DatabaseBackup ΒΆ
type DatabaseBackup struct { ID string `json:"uuid"` Name string `json:"name"` Size int64 `json:"bytes"` Successful bool `json:"successful"` CreatedAt time.Time `json:"created_at"` CompletedAt *time.Time `json:"completed_at,omitempty"` }
Goofy ahh backup model
type DatabaseCredentials ΒΆ
type DatabaseCredentials struct {
Password string `json:"password"`
}
type DatabaseManager ΒΆ
type DatabaseManager struct {
// contains filtered or unexported fields
}
func NewDatabaseManager ΒΆ
func NewDatabaseManager(app *Application) *DatabaseManager
NewDatabaseManager returns a new DatabaseManager instance that allows to manage databases on a Pterodactyl panel.
func (*DatabaseManager) CreateDatabase ΒΆ
func (dm *DatabaseManager) CreateDatabase(serverID int, opts CreateDatabaseOptions) (*Database, error)
HELL YEAH DATABASES
func (*DatabaseManager) CreateDatabaseBackup ΒΆ
func (dm *DatabaseManager) CreateDatabaseBackup(serverID, databaseID int, name string) (*DatabaseBackup, error)
Creating goofy ahh backups
func (*DatabaseManager) DeleteDatabase ΒΆ
func (dm *DatabaseManager) DeleteDatabase(serverID, databaseID int) error
KABOOM DATABASEπ₯
func (*DatabaseManager) DeleteDatabaseBackup ΒΆ
func (dm *DatabaseManager) DeleteDatabaseBackup(serverID, databaseID int, backupID string) error
Deleting DatabaseBackup
func (*DatabaseManager) GetDatabase ΒΆ
func (dm *DatabaseManager) GetDatabase(serverID, databaseID int, opts ...options.GetDatabaseOptions) (*Database, error)
Getting Database
func (*DatabaseManager) GetDatabaseBackup ΒΆ
func (dm *DatabaseManager) GetDatabaseBackup(serverID, databaseID int, backupID string) (*DatabaseBackup, error)
Getting Database Backup
func (*DatabaseManager) GetDatabaseUsage ΒΆ
func (dm *DatabaseManager) GetDatabaseUsage(serverID, databaseID int) (*DatabaseUsage, error)
Getting database usage
func (*DatabaseManager) ListDatabaseBackups ΒΆ
func (dm *DatabaseManager) ListDatabaseBackups(serverID, databaseID int) ([]*DatabaseBackup, error)
List of goofy ahh backups
func (*DatabaseManager) ListDatabases ΒΆ
func (dm *DatabaseManager) ListDatabases(serverID int, opts ...options.ListDatabasesOptions) ([]*Database, error)
HELL YEAH 100 DATABSES IN ONE SERVER
func (*DatabaseManager) RotateDatabasePassword ΒΆ
func (dm *DatabaseManager) RotateDatabasePassword(serverID, databaseID int) (*DatabaseRotatePasswordResponse, error)
Changing database password
type DatabaseRotatePasswordResponse ΒΆ
type DatabaseRotatePasswordResponse struct {
Password string `json:"password"`
}
type DatabaseUsage ΒΆ
type DecompressDescriptor ΒΆ
type DeleteFilesDescriptor ΒΆ
type DeployDescriptor ΒΆ
type Downloader ΒΆ
func (*Downloader) Client ΒΆ
func (d *Downloader) Client() *Client
func (*Downloader) Execute ΒΆ
func (d *Downloader) Execute() error
func (*Downloader) URL ΒΆ
func (d *Downloader) URL() string
type Egg ΒΆ
type Egg struct { ID int `json:"id,omitempty"` UUID string `json:"uuid,omitempty"` Name string `json:"name,omitempty"` NestID int `json:"nest,omitempty"` Author string `json:"author,omitempty"` Description string `json:"description,omitempty"` DockerImage string `json:"docker_image,omitempty"` Config EggConfig `json:"config,omitempty"` Startup string `json:"startup,omitempty"` Script EggScript `json:"script,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` NestObject *Nest `json:"-"` Servers []*AppServer `json:"-"` Variables []*EggVariable `json:"-"` }
type EggConfig ΒΆ
type EggConfig struct { Files map[string]EggFileConfig `json:"files,omitempty"` Startup EggStartup `json:"startup,omitempty"` Stop string `json:"stop,omitempty"` Logs EggLogs `json:"logs,omitempty"` Extends interface{} `json:"extends,omitempty"` }
type EggFileConfig ΒΆ
type EggStartup ΒΆ
type EggStartup struct { Done string `json:"done,omitempty"` UserInteraction []string `json:"userInteraction,omitempty"` }
func (*EggStartup) UnmarshalJSON ΒΆ
func (e *EggStartup) UnmarshalJSON(b []byte) error
UnmarshalJSON is a custom unmarshaller for EggStartup to handle the situation where "userInteraction" is not present in the JSON. If "userInteraction" is not present, it is assumed to be an empty array. This custom unmarshaller is necessary because the default unmarshaller for slices in Go will return a nil slice if the slice is not present in the JSON. This is a problem because the nil slice is not the same as an empty slice, and the nil slice will not be deserialized properly by the server. By using a custom unmarshaller, we can ensure that the slice is always deserialized as an empty slice if it is not present in the JSON.
type EggVariable ΒΆ
type EggVariable struct { ID int `json:"id,omitempty"` EggID int `json:"egg_id,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` EnvVariable string `json:"env_variable,omitempty"` DefaultValue string `json:"default_value,omitempty"` UserViewable int `json:"user_viewable,omitempty"` UserEditable int `json:"user_editable,omitempty"` Rules string `json:"rules,omitempty"` CreatedAt string `json:"created_at,omitempty"` UpdatedAt string `json:"updated_at,omitempty"` }
type Error ΒΆ
type FeatureLimits ΒΆ
type File ΒΆ
type File struct { Name string `json:"name"` Mode string `json:"mode"` ModeBits string `json:"mode_bits"` Size int64 `json:"size"` IsFile bool `json:"is_file"` IsSymlink bool `json:"is_symlink"` MimeType string `json:"mimetype"` CreatedAt *time.Time `json:"created_at"` ModifiedAt *time.Time `json:"modified_at,omitempty"` }
type Host ΒΆ
type Host struct { ID int `json:"id"` Name string `json:"name"` Host string `json:"host"` Port int `json:"port"` Username string `json:"username"` Node int `json:"node"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` }
Host represents a database host
type Nest ΒΆ
type Nest struct { ID int `json:"id,omitempty"` UUID string `json:"uuid,omitempty"` Author string `json:"author,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` Eggs []*Egg `json:"-"` Servers []*AppServer `json:"-"` }
type Node ΒΆ
type Node struct { ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` LocationID int `json:"location_id"` Public bool `json:"public"` FQDN string `json:"fqdn"` Scheme string `json:"scheme"` BehindProxy bool `json:"behind_proxy"` Memory int64 `json:"memory"` MemoryOverallocate int64 `json:"memory_overallocate"` Disk int64 `json:"disk"` DiskOverallocate int64 `json:"disk_overallocate"` DaemonBase string `json:"daemon_base"` DaemonSftp int32 `json:"daemon_sftp"` DaemonListen int32 `json:"daemon_listen"` MaintenanceMode bool `json:"maintenance_mode"` UploadSize int64 `json:"upload_size"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Location *Location `json:"-"` Allocations []*Allocation `json:"-"` Servers []*AppServer `json:"-"` }
func (*Node) UpdateDescriptor ΒΆ
func (n *Node) UpdateDescriptor() *UpdateNodeDescriptor
UpdateDescriptor returns a descriptor that can be used to update the current node. All of the fields on the descriptor are optional and will be ignored if they are not provided.
type NodeConfiguration ΒΆ
type NodeConfiguration struct { Debug bool `json:"debug"` UUID string `json:"uuid"` TokenID string `json:"token_id"` Token string `json:"token"` API struct { Host string `json:"host"` Port int32 `json:"port"` SSL struct { Enabled bool `json:"enabled"` Cert string `json:"cert"` Key string `json:"key"` } `json:"ssl"` UploadLimit int64 `json:"upload_limit"` } `json:"api"` System struct { Data string `json:"data"` SFTP struct { BindPort int32 `json:"bind_port"` } `json:"sftp"` } `json:"system"` AllowedMounts []string `json:"allowed_mounts"` Remote string `json:"remote"` }
type PullDescriptor ΒΆ
type RenameDescriptor ΒΆ
type ResourceUsage ΒΆ
type Resources ΒΆ
type Resources struct { State string `json:"current_state,omitempty"` Suspended bool `json:"is_suspended"` Usage ResourceUsage `json:"resources"` }
type ResponseAllocation ΒΆ
type ResponseAllocation struct { *Allocation Relationships struct { Node struct { Attributes *Node `json:"attributes"` } `json:"node"` Server struct { Attributes *AppServer `json:"attributes"` } `json:"server"` } `json:"relationships"` }
type ResponseDatabase ΒΆ
type ResponseDatabase struct { *Database Relationships struct { Host struct { Attributes *Host `json:"attributes"` } `json:"host"` } `json:"relationships"` }
ResponseDatabase represents the API response structure for database queries
type ResponseEgg ΒΆ
type ResponseEgg struct { *Egg Relationships struct { Nest struct { Attributes *Nest `json:"attributes"` } `json:"nest"` Servers struct { Data []struct { Attributes *AppServer `json:"attributes"` } `json:"data"` } `json:"servers"` Variables struct { Data []struct { Attributes *EggVariable `json:"attributes"` } `json:"data"` } `json:"variables"` } `json:"relationships"` }
type ResponseLocation ΒΆ
type ResponseNest ΒΆ
type ResponseNode ΒΆ
type ResponseNode struct { *Node Relationships struct { Allocations struct { Data []struct { Attributes *Allocation `json:"attributes"` } `json:"data"` } `json:"allocations"` Location struct { Attributes *Location `json:"attributes"` } `json:"location"` Servers struct { Data []struct { Attributes *AppServer `json:"attributes"` } `json:"data"` } `json:"servers"` } `json:"relationships"` }
type ResponseServer ΒΆ
type ResponseServer struct { *AppServer Relationships struct { Allocations struct { Data []struct { Attributes *Allocation `json:"attributes"` } `json:"data"` } `json:"allocations"` User struct { Attributes *User `json:"attributes"` } `json:"user"` Subusers struct { Data []struct { Attributes *User `json:"attributes"` } `json:"data"` } `json:"subusers"` Location struct { Attributes *Location `json:"attributes"` } `json:"location"` Node struct { Attributes *Node `json:"attributes"` } `json:"node"` Nest struct { Attributes *Nest `json:"attributes"` } `json:"nest"` Egg struct { Attributes *Egg `json:"attributes"` } `json:"egg"` Variables struct { Data []struct { Attributes *EggVariable `json:"attributes"` } `json:"data"` } `json:"variables"` Databases struct { Data []struct { Attributes *Database `json:"attributes"` } `json:"data"` } `json:"databases"` } `json:"relationships"` }
type ServerBuildDescriptor ΒΆ
type ServerBuildDescriptor struct { Allocation int `json:"allocation,omitempty"` OOMDisabled bool `json:"oom_disabled,omitempty"` Limits Limits `json:"limits,omitempty"` AddAllocations []int `json:"add_allocations,omitempty"` RemoveAllocations []int `json:"remove_allocations,omitempty"` FeatureLimits FeatureLimits `json:"feature_limits,omitempty"` }
type TwoFactorData ΒΆ
type UpdateNodeDescriptor ΒΆ
type UpdateNodeDescriptor struct { Name string `json:"name"` Description string `json:"description"` LocationID int `json:"location_id"` Public bool `json:"public"` FQDN string `json:"fqdn"` Scheme string `json:"scheme"` BehindProxy bool `json:"behind_proxy"` Memory int64 `json:"memory"` MemoryOverallocate int64 `json:"memory_overallocate"` Disk int64 `json:"disk"` DiskOverallocate int64 `json:"disk_overallocate"` DaemonBase string `json:"daemon_base"` DaemonSftp int32 `json:"daemon_sftp"` DaemonListen int32 `json:"daemon_listen"` UploadSize int64 `json:"upload_size"` }
type UpdateUserDescriptor ΒΆ
type UpdateUserDescriptor struct { ExternalID string `json:"external_id,omitempty"` Email string `json:"email,omitempty"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` Language string `json:"language,omitempty"` RootAdmin bool `json:"root_admin,omitempty"` }
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"` TwoFactor bool `json:"2fa"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Servers []*AppServer `json:"-"` }
func (*User) FullName ΒΆ
FullName returns the full name of the user by concatenating the first name and last name with a space in between.
func (*User) UpdateDescriptor ΒΆ
func (u *User) UpdateDescriptor() *UpdateUserDescriptor
UpdateDescriptor returns a descriptor that can be used to update the current user. All of the fields on the descriptor are optional and will be ignored if they are not provided.