alligator

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 13 Imported by: 0

README ΒΆ

🐊 Alligator Go Client for Pterodactyl

This fork attempts to follow Official Pterodactyl API Docs @Dashflo as closely as possible, but is not maintained by Pterodactyl team.

Installation
go get -u github.com/Coneriys/alligator

πŸ”₯ So, what's new?

✨ Support for Filters, Include and Endpoint-specific parameters

*Including support for extended struct fields

package main
 import (
	 gator "github.com/Coneriys/alligator"
	 "github.com/Coneriys/alligator/options"
 )

 func main() {
	 app, _ := gator.NewApp("https://panel.pterodactyl.io", "ApplicationKeyYouCreated")
	 
	 // Fetch some users
	 users, err := app.ListUsers(options.ListUsersOptions{
		 Include: options.IncludeUsers{
			 Servers: true,
		 },
		 Filters: options.FiltersUsers{
			 Username: "example",
		 },
		 SortBy: options.ListUsersSort_UUID_DESC, // Same as "-uuid"
	 })
	 if err != nil {
		 fmt.Printf("%#v", err)
		 return
	 }
	 
	 // options are optional btw
	 // users, err := app.ListUsers() // <- is also valid

	 for _, u := range users {
		 fmt.Printf("%d: %s\n", u.ID, u.Username)
	 }
 }

More examples at πŸ“ _examples

πŸ“ What's done?

  • App API
    • Options
    • Database endpoint support [TESTING]
      • Extended databases details (password, host) [TESTING]
    • Nests endpoint support
      • Extended nest details (eggs, servers)
    • Eggs endpoint support
      • Extended eggs details (nest, servers, variables)
    • Extended user details (servers)
    • Extended nodes details (allocations, location, servers)
    • Extended allocations details (node, server)
    • Extended location details (nodes, servers)
    • Extended servers details (allocations+, user+, subusers+, nest+, egg+, variables+, location+, node+)
    • Extended servers details (databases) [TESTING]
    • Additional methods like /{server}/reinstall and /{server}/force
  • Client API
    • What is this goofy ahh infinite documentation...
  • Pagination (50 servers limit is a pain tbh)
  • Godoc (App)
  • Godoc (Client)

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

View Source
const Version = "1.2.0b"

Variables ΒΆ

This section is empty.

Functions ΒΆ

This section is empty.

Types ΒΆ

type Account ΒΆ

type Account struct {
	ID        int    `json:"id"`
	Admin     bool   `json:"admin"`
	Username  string `json:"username"`
	Email     string `json:"email"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Language  string `json:"language"`
}

func (*Account) FullName ΒΆ

func (a *Account) FullName() string

type Allocation ΒΆ

type Allocation struct {
	ID       int        `json:"id"`
	IP       string     `json:"ip"`
	Alias    string     `json:"alias,omitempty"`
	Port     int32      `json:"port"`
	Notes    string     `json:"notes,omitempty"`
	Assigned bool       `json:"assigned"`
	Node     *Node      `json:"-"`
	Server   *AppServer `json:"-"`
}

type AllocationDescriptor ΒΆ

type AllocationDescriptor struct {
	Default    int   `json:"default"`
	Additional []int `json:"additional,omitempty"`
}

type ApiError ΒΆ

type ApiError struct {
	Errors []*Error `json:"errors"`
}

func (*ApiError) Error ΒΆ

func (e *ApiError) Error() string

type ApiKey ΒΆ

type ApiKey struct {
	Identifier  string     `json:"identifier"`
	Description string     `json:"description"`
	AllowedIPs  []string   `json:"allowed_ips"`
	CreatedAt   *time.Time `json:"created_at"`
	LastUsedAt  *time.Time `json:"last_used_at,omitempty"`
}

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 ΒΆ

type Application struct {
	PanelURL string
	ApiKey   string
	Http     *http.Client
}

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 ChmodDescriptor struct {
	Root  string `json:"root"`
	Files []struct {
		File string `json:"file"`
		Mode uint32 `json:"mode"`
	} `json:"files"`
}

type Client ΒΆ

type Client struct {
	PanelURL string
	ApiKey   string
	Http     *http.Client
}

func NewClient ΒΆ

func NewClient(url, key string) (*Client, error)

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 (c *Client) CopyServerFile(identifier, location string) error

func (*Client) CreateDatabase ΒΆ

func (c *Client) CreateDatabase(identifier, remote, database string) (*ClientDatabase, error)

func (*Client) CreateKey ΒΆ

func (c *Client) CreateKey(description string, ips []string) (*ApiKey, 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 (c *Client) DeleteDatabase(identifier, id string) error

func (*Client) DeleteKey ΒΆ

func (c *Client) DeleteKey(identifier string) error

func (*Client) DeleteServerFiles ΒΆ

func (c *Client) DeleteServerFiles(identifier string, files DeleteFilesDescriptor) error

func (*Client) DisableTwoFactor ΒΆ

func (c *Client) DisableTwoFactor(password string) error

func (*Client) DownloadServerFile ΒΆ

func (c *Client) DownloadServerFile(identifier, file string) (*Downloader, error)

func (*Client) EnableTwoFactor ΒΆ

func (c *Client) EnableTwoFactor(code int) ([]string, error)

func (*Client) GetAccount ΒΆ

func (c *Client) GetAccount() (*Account, error)

func (*Client) GetApiKeys ΒΆ

func (c *Client) GetApiKeys() ([]*ApiKey, error)

func (*Client) GetServer ΒΆ

func (c *Client) GetServer(identifier string) (*ClientServer, error)

func (*Client) GetServerDatabases ΒΆ

func (c *Client) GetServerDatabases(identifier string) ([]*ClientDatabase, error)

func (*Client) GetServerFileContents ΒΆ

func (c *Client) GetServerFileContents(identifier, file string) ([]byte, error)

func (*Client) GetServerFiles ΒΆ

func (c *Client) GetServerFiles(identififer, root string) ([]*File, error)

func (*Client) GetServerResources ΒΆ

func (c *Client) GetServerResources(identifier string) (*Resources, error)

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 (c *Client) SendServerCommand(identifier, command string) error

func (*Client) SetServerPowerState ΒΆ

func (c *Client) SetServerPowerState(identifier, state string) error

func (*Client) UpdateEmail ΒΆ

func (c *Client) UpdateEmail(email, password string) error

func (*Client) UpdatePassword ΒΆ

func (c *Client) UpdatePassword(old, new string) error

func (*Client) UploadServerFile ΒΆ

func (c *Client) UploadServerFile(identifier, path string) (*Uploader, error)

func (*Client) WriteServerFile ΒΆ

func (c *Client) WriteServerFile(identifier, name, content string) error

func (*Client) WriteServerFileBytes ΒΆ

func (c *Client) WriteServerFileBytes(identifier, name, header string, content []byte) error

type ClientDatabase ΒΆ

type ClientDatabase struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Username string `json:"username"`
	Host     struct {
		Address string `json:"address"`
		Port    int64  `json:"port"`
	} `json:"host"`
	ConnectionsFrom string `json:"connections_from"`
	MaxConnections  int    `json:"max_connections"`
}

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 CompressDescriptor struct {
	Root  string   `json:"root"`
	Files []string `json:"files"`
}

type CreateAllocationsDescriptor ΒΆ

type CreateAllocationsDescriptor struct {
	IP    string   `json:"ip"`
	Alias string   `json:"alias,omitempty"`
	Ports []string `json:"ports"`
}

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 CreateFolderDescriptor struct {
	Root string `json:"root"`
	Name string `json:"name"`
}

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 DatabaseUsage struct {
	Current int64 `json:"current"`
	Max     int64 `json:"max"`
}

type DecompressDescriptor ΒΆ

type DecompressDescriptor struct {
	Root string `json:"root"`
	File string `json:"file"`
}

type DeleteFilesDescriptor ΒΆ

type DeleteFilesDescriptor struct {
	Root  string   `json:"root"`
	Files []string `json:"files"`
}

type DeployDescriptor ΒΆ

type DeployDescriptor struct {
	Locations   []int    `json:"locations"`
	DedicatedIP bool     `json:"dedicated_ip"`
	PortRange   []string `json:"port_range"`
}

type DeployableNodesDescriptor ΒΆ

type DeployableNodesDescriptor struct {
	Page         int   `json:"page,omitempty"`
	Memory       int64 `json:"memory"`
	Disk         int64 `json:"disk"`
	LocationsIDs []int `json:"location_ids,omitempty"`
}

type Downloader ΒΆ

type Downloader struct {
	Name string
	Path string
	// contains filtered or unexported fields
}

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 EggFileConfig struct {
	Parser string            `json:"parser,omitempty"`
	Find   map[string]string `json:"find,omitempty"`
}

type EggLogs ΒΆ

type EggLogs struct {
	Custom   bool   `json:"custom,omitempty"`
	Location string `json:"location,omitempty"`
}

type EggScript ΒΆ

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

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 Error struct {
	Code   string      `json:"code"`
	Status string      `json:"status"`
	Detail string      `json:"detail"`
	Meta   interface{} `json:"meta,omitempty"`
}

func (*Error) Error ΒΆ

func (e *Error) Error() string

type FeatureLimits ΒΆ

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

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 Limits ΒΆ

type Limits struct {
	Memory      int64  `json:"memory"`
	Swap        int64  `json:"swap"`
	Disk        int64  `json:"disk"`
	IO          int64  `json:"io"`
	CPU         int64  `json:"cpu"`
	Threads     string `json:"threads"`
	OOMDisabled bool   `json:"oom_disabled"`
}

type Location ΒΆ

type Location struct {
	ID        int          `json:"id"`
	Short     string       `json:"short"`
	Long      string       `json:"long"`
	CreatedAt *time.Time   `json:"created_at"`
	UpdatedAt *time.Time   `json:"updated_at,omitempty"`
	Nodes     []*Node      `json:"-"`
	Servers   []*AppServer `json:"-"`
}

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 PullDescriptor struct {
	URL        string `json:"url"`
	Directory  string `json:"directory,omitempty"`
	Filename   string `json:"filename,omitempty"`
	UseHeader  bool   `json:"use_header,omitempty"`
	Foreground bool   `json:"foreground,omitempty"`
}

type RenameDescriptor ΒΆ

type RenameDescriptor struct {
	Root  string `json:"root"`
	Files []struct {
		From string `json:"from"`
		To   string `json:"to"`
	} `json:"files"`
}

type ResourceUsage ΒΆ

type ResourceUsage struct {
	MemoryBytes    int64   `json:"memory_bytes"`
	DiskBytes      int64   `json:"disk_bytes"`
	CPUAbsolute    float64 `json:"cpu_absolute"`
	NetworkRxBytes int64   `json:"network_rx_bytes"`
	NetworkTxBytes int64   `json:"network_tx_bytes"`
	Uptime         int64   `json:"uptime"`
}

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 ResponseLocation struct {
	*Location
	Relationships struct {
		Nodes struct {
			Data []struct {
				Attributes *Node `json:"attributes"`
			} `json:"data"`
		} `json:"nodes"`
		Servers struct {
			Data []struct {
				Attributes *AppServer `json:"attributes"`
			} `json:"data"`
		} `json:"servers"`
	}
}

type ResponseNest ΒΆ

type ResponseNest struct {
	*Nest
	Relationships struct {
		Eggs struct {
			Data []struct {
				Attributes *Egg `json:"attributes"`
			} `json:"data"`
		} `json:"eggs"`
		Servers struct {
			Data []struct {
				Attributes *AppServer `json:"attributes"`
			} `json:"data"`
		} `json:"servers"`
	} `json:"relationships"`
}

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 ServerDetailsDescriptor ΒΆ

type ServerDetailsDescriptor struct {
	ExternalID  string `json:"external_id,omitempty"`
	Name        string `json:"name,omitempty"`
	User        int    `json:"user,omitempty"`
	Description string `json:"description,omitempty"`
}

type ServerStartupDescriptor ΒΆ

type ServerStartupDescriptor struct {
	Startup     string                 `json:"startup"`
	Environment map[string]interface{} `json:"environment"`
	Egg         int                    `json:"egg,omitempty"`
	Image       string                 `json:"image"`
	SkipScripts bool                   `json:"skip_scripts"`
}

type TwoFactorData ΒΆ

type TwoFactorData struct {
	ImageURLData string `json:"image_url_data"`
	Secret       string `json:"secret"`
}

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 Uploader ΒΆ

type Uploader struct {
	Path string
	// contains filtered or unexported fields
}

func (*Uploader) Client ΒΆ

func (u *Uploader) Client() *Client

func (*Uploader) Execute ΒΆ

func (u *Uploader) Execute() error

func (*Uploader) URL ΒΆ

func (u *Uploader) URL() string

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 ΒΆ

func (u *User) FullName() string

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.

type WebSocketAuth ΒΆ

type WebSocketAuth struct {
	Socket string `json:"socket"`
	Token  string `json:"token"`
}

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

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