Documentation ¶
Index ¶
- Constants
- type BackupRequest
- type InstallationScript
- type PanelRequest
- func (r *PanelRequest) Error() *RequestError
- func (r *PanelRequest) Get(url string) (*http.Response, error)
- func (r *PanelRequest) GetAllServerConfigurations() (map[string]*ServerConfigurationResponse, *RequestError, error)
- func (r *PanelRequest) GetClient() *http.Client
- func (r *PanelRequest) GetEndpoint(endpoint string) string
- func (r *PanelRequest) GetInstallationScript(uuid string) (InstallationScript, *RequestError, error)
- func (r *PanelRequest) GetServerConfiguration(uuid string) (*ServerConfigurationResponse, *RequestError, error)
- func (r *PanelRequest) HasError() bool
- func (r *PanelRequest) HttpResponseCode() int
- func (r *PanelRequest) Post(url string, data []byte) (*http.Response, error)
- func (r *PanelRequest) ReadBody() ([]byte, error)
- func (r *PanelRequest) SendArchiveStatus(uuid string, successful bool) (*RequestError, error)
- func (r *PanelRequest) SendBackupStatus(backup string, data BackupRequest) (*RequestError, error)
- func (r *PanelRequest) SendInstallationStatus(uuid string, successful bool) (*RequestError, error)
- func (r *PanelRequest) SendTransferFailure(uuid string) (*RequestError, error)
- func (r *PanelRequest) SendTransferSuccess(uuid string) (*RequestError, error)
- func (r *PanelRequest) SetHeaders(req *http.Request) *http.Request
- func (r *PanelRequest) ValidateSftpCredentials(request sftp_server.AuthenticationRequest) (*sftp_server.AuthenticationResponse, error)
- type ProcessConfiguration
- type RequestError
- type RequestErrorBag
- type ServerConfigurationResponse
Constants ¶
const ( ProcessStopCommand = "command" ProcessStopSignal = "signal" ProcessStopNativeStop = "stop" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackupRequest ¶
type InstallationScript ¶
type InstallationScript struct { ContainerImage string `json:"container_image"` Entrypoint string `json:"entrypoint"` Script string `json:"script"` }
Defines installation script information for a server process. This is used when a server is installed for the first time, and when a server is marked for re-installation.
type PanelRequest ¶
func (*PanelRequest) Error ¶
func (r *PanelRequest) Error() *RequestError
Returns the error message from the API call as a string. The error message will be formatted similar to the below example:
HttpNotFoundException: The requested resource does not exist. (HTTP/404)
func (*PanelRequest) GetAllServerConfigurations ¶
func (r *PanelRequest) GetAllServerConfigurations() (map[string]*ServerConfigurationResponse, *RequestError, error)
GetAllServerConfigurations fetches configurations for all servers assigned to this node.
func (*PanelRequest) GetClient ¶
func (r *PanelRequest) GetClient() *http.Client
Builds the base request instance that can be used with the HTTP client.
func (*PanelRequest) GetEndpoint ¶
func (r *PanelRequest) GetEndpoint(endpoint string) string
func (*PanelRequest) GetInstallationScript ¶
func (r *PanelRequest) GetInstallationScript(uuid string) (InstallationScript, *RequestError, error)
Fetches installation information for the server process.
func (*PanelRequest) GetServerConfiguration ¶
func (r *PanelRequest) GetServerConfiguration(uuid string) (*ServerConfigurationResponse, *RequestError, error)
Fetches the server configuration and returns the struct for it.
func (*PanelRequest) HasError ¶
func (r *PanelRequest) HasError() bool
Determines if the API call encountered an error. If no request has been made the response will be false.
func (*PanelRequest) HttpResponseCode ¶
func (r *PanelRequest) HttpResponseCode() int
func (*PanelRequest) ReadBody ¶
func (r *PanelRequest) ReadBody() ([]byte, error)
Reads the body from the response and returns it, then replaces it on the response so that it can be read again later.
func (*PanelRequest) SendArchiveStatus ¶
func (r *PanelRequest) SendArchiveStatus(uuid string, successful bool) (*RequestError, error)
func (*PanelRequest) SendBackupStatus ¶
func (r *PanelRequest) SendBackupStatus(backup string, data BackupRequest) (*RequestError, error)
Notifies the panel that a specific backup has been completed and is now available for a user to view and download.
func (*PanelRequest) SendInstallationStatus ¶
func (r *PanelRequest) SendInstallationStatus(uuid string, successful bool) (*RequestError, error)
Marks a server as being installed successfully or unsuccessfully on the panel.
func (*PanelRequest) SendTransferFailure ¶
func (r *PanelRequest) SendTransferFailure(uuid string) (*RequestError, error)
func (*PanelRequest) SendTransferSuccess ¶
func (r *PanelRequest) SendTransferSuccess(uuid string) (*RequestError, error)
func (*PanelRequest) SetHeaders ¶
func (r *PanelRequest) SetHeaders(req *http.Request) *http.Request
func (*PanelRequest) ValidateSftpCredentials ¶
func (r *PanelRequest) ValidateSftpCredentials(request sftp_server.AuthenticationRequest) (*sftp_server.AuthenticationResponse, error)
type ProcessConfiguration ¶
type ProcessConfiguration struct { Startup struct { Done string `json:"done"` UserInteraction []string `json:"userInteraction"` } `json:"startup"` Stop struct { Type string `json:"type"` Value string `json:"value"` } `json:"stop"` ConfigurationFiles []parser.ConfigurationFile `json:"configs"` }
Defines the process configuration for a given server instance. This sets what the daemon is looking for to mark a server as done starting, what to do when stopping, and what changes to make to the configuration file for a server.
type RequestError ¶
type RequestError struct { Code string `json:"code"` Status string `json:"status"` Detail string `json:"detail"` }
func (*RequestError) String ¶
func (re *RequestError) String() string
Returns the error response in a string form that can be more easily consumed.
type RequestErrorBag ¶
type RequestErrorBag struct {
Errors []RequestError `json:"errors"`
}
type ServerConfigurationResponse ¶
type ServerConfigurationResponse struct { Settings json.RawMessage `json:"settings"` ProcessConfiguration *ProcessConfiguration `json:"process_configuration"` }
Holds the server configuration data returned from the Panel. When a server process is started, Wings communicates with the Panel to fetch the latest build information as well as get all of the details needed to parse the given Egg.
This means we do not need to hit Wings each time part of the server is updated, and the Panel serves as the source of truth at all times. This also means if a configuration is accidentally wiped on Wings we can self-recover without too much hassle, so long as Wings is aware of what servers should exist on it.