Documentation ¶
Index ¶
- Constants
- func IsInvalidCredentialsError(err error) bool
- func IsRequestError(err error) bool
- type BackupRequest
- type InstallationScript
- type OutputLineMatcher
- type PanelRequest
- func (r *PanelRequest) Error() *RequestError
- func (r *PanelRequest) Get(url string) (*http.Response, error)
- func (r *PanelRequest) GetAllServerConfigurations() (map[string]json.RawMessage, *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 SftpAuthRequest) (*SftpAuthResponse, error)
- type ProcessConfiguration
- type ProcessStopConfiguration
- type RequestError
- type RequestErrorBag
- type ServerConfigurationResponse
- type SftpAuthRequest
- type SftpAuthResponse
Constants ¶
const ( ProcessStopCommand = "command" ProcessStopSignal = "signal" ProcessStopNativeStop = "stop" )
Variables ¶
This section is empty.
Functions ¶
func IsRequestError ¶
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 OutputLineMatcher ¶
type OutputLineMatcher struct {
// contains filtered or unexported fields
}
func (*OutputLineMatcher) Matches ¶
func (olm *OutputLineMatcher) Matches(s string) bool
Determine if a given string "s" matches the given line.
func (*OutputLineMatcher) String ¶
func (olm *OutputLineMatcher) String() string
Return the matcher's raw comparison string.
func (*OutputLineMatcher) UnmarshalJSON ¶
func (olm *OutputLineMatcher) UnmarshalJSON(data []byte) error
Unmarshal the startup lines into individual structs for easier matching abilities.
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]json.RawMessage, *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 SftpAuthRequest) (*SftpAuthResponse, error)
type ProcessConfiguration ¶
type ProcessConfiguration struct { Startup struct { Done []*OutputLineMatcher `json:"done"` UserInteraction []string `json:"user_interaction"` StripAnsi bool `json:"strip_ansi"` } `json:"startup"` Stop ProcessStopConfiguration `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"` // contains filtered or unexported fields }
func (*RequestError) Error ¶
func (re *RequestError) Error() string
Returns the error response in a string form that can be more easily consumed.
func (*RequestError) String ¶
func (re *RequestError) String() string
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.