Documentation ¶
Index ¶
- type APIError
- type CPU
- type ChargeSummary
- type ChargeSummaryItem
- type ChargeSummaryTotal
- type Client
- func (c *Client) CreatePublicKey(ctx context.Context, body CreatePublicKeyRequestBody) (*PublicKey, error)
- func (c *Client) CreateServer(ctx context.Context, body CreateServerRequestBody) (*Server, error)
- func (c *Client) CreateShellUser(ctx context.Context, serverSlug string, ...) (*ShellUser, error)
- func (c *Client) DeletePublicKey(ctx context.Context, id int64) error
- func (c *Client) DeleteServer(ctx context.Context, serverSlug string) (string, error)
- func (c *Client) DeleteShellUser(ctx context.Context, serverSlug string, shellUserID int64) (string, error)
- func (c *Client) GetEvents(ctx context.Context, params GetEventsParams) (Events, error)
- func (c *Client) GetPublicKeys(ctx context.Context) (PublicKeys, error)
- func (c *Client) GetServerBySlug(ctx context.Context, serverSlug string) (*Server, error)
- func (c *Client) GetServers(ctx context.Context, params GetServersParams) (Servers, error)
- func (c *Client) GetServersImages(ctx context.Context) (ServerImages, error)
- func (c *Client) GetServersLocations(ctx context.Context) (ServerLocations, error)
- func (c *Client) GetServersProfiles(ctx context.Context, params GetServersProfilesParams) (ServerProfiles, error)
- func (c *Client) GetShellUsers(ctx context.Context, serverSlug string) (ShellUsers, error)
- func (c *Client) PatchServer(ctx context.Context, serverSlug string, body PatchServerRequestBody) (*Server, error)
- func (c *Client) ReinstallServer(ctx context.Context, serverSlug string, body ReinstallServerRequestBody) (string, error)
- func (c *Client) ResizeDryRun(ctx context.Context, serverSlug string, body ResizeServerRequestBody) (*ServerResize, error)
- func (c *Client) ResizeServer(ctx context.Context, serverSlug string, body ResizeServerRequestBody) (string, error)
- func (c *Client) UpdateShellUserPublicKeys(ctx context.Context, serverSlug string, shellUserID int64, publicKeys []int) (*ShellUser, error)
- type ClientInterface
- type ClientOption
- type ClientTransport
- type CreatePublicKeyRequestBody
- type CreateServerRequestBody
- type CreateShellUserRequestBody
- type EventLog
- type Events
- type GetEventsParams
- type GetServersParams
- type GetServersProfilesParams
- type HttpRequestDoer
- type PatchServerRequestBody
- type Price
- type PublicKey
- type PublicKeys
- type ReinstallServerRequestBody
- type RequestEditorFn
- type ResizeServerRequestBody
- type Server
- type ServerImage
- type ServerImages
- type ServerLocation
- type ServerLocations
- type ServerProfile
- type ServerProfiles
- type ServerResize
- type Servers
- type ShellUser
- type ShellUsers
- type Warning
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CPU ¶
type CPU struct { // Number of cores Cores int64 `json:"cores,omitempty" mapstructure:"cores"` // Number of threads Threads int64 `json:"threads,omitempty" mapstructure:"threads"` }
CPU model
type ChargeSummary ¶
type ChargeSummary struct { // True if the amount will be refunded IsRefund bool `json:"isRefund,omitempty"` // List of charges to be applied or refunded Items []ChargeSummaryItem `json:"items,omitempty"` // Server resize model Total ChargeSummaryTotal `json:"total,omitempty"` }
Server resize model
type ChargeSummaryItem ¶
type ChargeSummaryItem struct { // Price model Price Price `json:"price,omitempty"` // Charge text Text string `json:"text,omitempty"` }
Charge summary items model
type ChargeSummaryTotal ¶
type ChargeSummaryTotal struct { // Price model SubTotal Price `json:"subTotal,omitempty"` // Price model Total Price `json:"total,omitempty"` // Price model Vat Price `json:"vat,omitempty"` }
Server resize model
type Client ¶
type Client struct { // The endpoint of the server conforming to this interface, with scheme, // https://api.deepmap.com for example. This can contain a path relative // to the server, such as https://api.deepmap.com/dev-test, and all the // paths in the swagger spec will be appended to the server. Server string // Doer for performing requests, typically a *http.Client with any // customized settings, such as certificate chains. Client HttpRequestDoer // A list of callbacks for modifying requests which are generated before sending over // the network. RequestEditors []RequestEditorFn }
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) CreatePublicKey ¶
func (*Client) CreateServer ¶
func (*Client) CreateShellUser ¶
func (*Client) DeletePublicKey ¶
func (*Client) DeleteServer ¶
func (*Client) DeleteShellUser ¶
func (*Client) GetPublicKeys ¶
func (c *Client) GetPublicKeys(ctx context.Context) (PublicKeys, error)
func (*Client) GetServerBySlug ¶
func (*Client) GetServers ¶
func (*Client) GetServersImages ¶
func (c *Client) GetServersImages(ctx context.Context) (ServerImages, error)
func (*Client) GetServersLocations ¶
func (c *Client) GetServersLocations(ctx context.Context) (ServerLocations, error)
func (*Client) GetServersProfiles ¶
func (c *Client) GetServersProfiles(ctx context.Context, params GetServersProfilesParams) (ServerProfiles, error)
func (*Client) GetShellUsers ¶
func (*Client) PatchServer ¶
func (*Client) ReinstallServer ¶
func (*Client) ResizeDryRun ¶
func (c *Client) ResizeDryRun(ctx context.Context, serverSlug string, body ResizeServerRequestBody) (*ServerResize, error)
func (*Client) ResizeServer ¶
type ClientInterface ¶
type ClientInterface interface { // GetPublicKeys request GetPublicKeys(ctx context.Context) (PublicKeys, error) CreatePublicKey(ctx context.Context, body CreatePublicKeyRequestBody) (*PublicKey, error) // DeletePublicKey request DeletePublicKey(ctx context.Context, id int64) error // GetEvents request GetEvents(ctx context.Context, params GetEventsParams) (Events, error) // GetServersImages request GetServersImages(ctx context.Context) (ServerImages, error) // GetServersLocations request GetServersLocations(ctx context.Context) (ServerLocations, error) // GetServersProfiles request GetServersProfiles(ctx context.Context, params GetServersProfilesParams) (ServerProfiles, error) // GetServers request GetServers(ctx context.Context, params GetServersParams) (Servers, error) // CreateServer request CreateServer(ctx context.Context, body CreateServerRequestBody) (*Server, error) // DeleteServer request DeleteServer(ctx context.Context, serverSlug string) (string, error) // GetServerBySlug request GetServerBySlug(ctx context.Context, serverSlug string) (*Server, error) PatchServer(ctx context.Context, serverSlug string, body PatchServerRequestBody) (*Server, error) ReinstallServer(ctx context.Context, serverSlug string, body ReinstallServerRequestBody) (string, error) ResizeServer(ctx context.Context, serverSlug string, body ResizeServerRequestBody) (string, error) ResizeDryRun(ctx context.Context, serverSlug string, body ResizeServerRequestBody) (*ServerResize, error) GetShellUsers(ctx context.Context, serverSlug string) (ShellUsers, error) CreateShellUser(ctx context.Context, serverSlug string, shellUser CreateShellUserRequestBody) (*ShellUser, error) DeleteShellUser(ctx context.Context, serverSlug string, shellUserID int64) (string, error) UpdateShellUserPublicKeys(ctx context.Context, serverSlug string, shellUserID int64, publicKeys []int) (*ShellUser, error) }
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientTransport ¶
type ClientTransport struct {
// contains filtered or unexported fields
}
ClientTransport is a custom transport that runs request editor functions before sending the request.
type CreatePublicKeyRequestBody ¶
type CreatePublicKeyRequestBody struct { // PublicKey name Name string `json:"name"` // PublicKey PublicKey string `json:"publicKey"` }
PublicKey model
type CreateServerRequestBody ¶
type CreateServerRequestBody struct { // Slug of the server image. Get this from the /images endpoint. You must pass either this parameter or snapshotId ImageSlug string `json:"imageSlug,omitempty"` // ID of the location. Get this from the /locations endpoint. LocationId string `json:"locationId"` // Name of the server Name string `json:"name"` // Slug of the server profile. Get this from the /profiles endpoint. ProfileSlug string `json:"profileSlug"` // Suggested Slug (shortname) of the server. Up to 12 alphanumeric chars. This slug is effectively your server ID and anything submitted in this field is merely your suggestion for a slug. If omitted or the suggested slug is already taken, the system will automatically generate an appropriate unique slug based on your server Name or suggestion. Always check the return from this method to determine the actual slug your server ended up receiving. Slug string `json:"slug,omitempty"` // SnapshotID from which to create the server. Get this from the /servers/{serverSlug}/snapshots endpoint. You must pass either this parameter or imageSlug. SnapshotId int64 `json:"snapshotId,omitempty"` // Virtualization type for your new server. container means the server will be a Webdock LXD VPS and kvm means it will be a KVM Virtual machine. If you specify a snapshotId in the request, the server type from which the snapshot belongs much match the virtualization selected. Reason being that KVM images are incompatible with LXD images and vice-versa. Virtualization string `json:"virtualization,omitempty"` }
Post Server model
type EventLog ¶
type EventLog struct { // Just a plain text description of the action. Same text as you see in the Event Log in the Webdock Dashboard. Action string `json:"action,omitempty"` // Action Data. A more static/parseable string representation of the action. ActionData string `json:"actionData,omitempty"` // Callback ID CallbackId string `json:"callbackId,omitempty"` // End Time of the event EndTime string `json:"endTime"` // Event Type EventType string `json:"eventType,omitempty"` // Event log ID Id json.Number `json:"id,omitempty"` // Any "Message" or return data from the action once finished executing. Message string `json:"message,omitempty"` // Server Slug ServerSlug string `json:"serverSlug,omitempty"` // Start Time of the event StartTime string `json:"startTime,omitempty"` // Status Status string `json:"status,omitempty"` }
Event log model
type GetEventsParams ¶
type GetEventsParams struct { // Callback ID CallbackId string `json:"callbackId,omitempty"` // Event Type EventType string `json:"eventType,omitempty"` // Page Page int64 `json:"page,omitempty"` // Events per page PerPage int64 `json:"per_page,omitempty"` }
GetEventsParams defines parameters for GetEvents.
type GetServersParams ¶
type GetServersParams struct { // Filter by current status of the server Status string `form:"status,omitempty" json:"status,omitempty"` }
GetServersParams defines parameters for GetServers.
type GetServersProfilesParams ¶
type GetServersProfilesParams struct { // Location of the profile LocationId string `json:"locationId,omitempty" url:"locationId,omitempty"` }
GetServersProfilesParams defines parameters for GetServersProfiles.
type HttpRequestDoer ¶
Doer performs HTTP requests. The standard http.Client implements this interface.
type PatchServerRequestBody ¶
type PatchServerRequestBody struct { // Name of the server Name string `json:"name"` }
PatchServer model
type Price ¶
type Price struct { // Price amount Amount int64 `json:"amount,omitempty"` // Price currency Currency string `json:"currency,omitempty"` }
Price model
type PublicKey ¶
type PublicKey struct { // PublicKey ID Id json.Number `json:"id,omitempty" mapstructure:"id"` // PublicKey creation datetime Created string `json:"created,omitempty" mapstructure:"created_at"` // PublicKey content Key string `json:"key,omitempty" mapstructure:"key"` // PublicKey name Name string `json:"name,omitempty" mapstructure:"name"` }
PublicKey model
type ReinstallServerRequestBody ¶
type ReinstallServerRequestBody struct { // Image slug of the image you want to reload the server with. Any image listed for the server location from /images is valid. ImageSlug string `json:"imageSlug"` }
Reinstall Server model
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type ResizeServerRequestBody ¶
type ResizeServerRequestBody struct { // Profile slug to resize to ProfileSlug string `json:"profileSlug"` }
Resize server model
type Server ¶
type Server struct { // SSH Password Authentication Enabled for this Server SSHPasswordAuthEnabled bool `json:"SSHPasswordAuthEnabled,omitempty" mapstructure:"ssh_password_auth_enabled"` // Wordpress lockdown status WordPressLockDown bool `json:"WordPressLockDown,omitempty" mapstructure:"wordpress_lockdown"` // Aliases - Domain names for the server as known by Webdock. First entry should be treated as the "Main Domain" for the server. Aliases []string `json:"aliases,omitempty" mapstructure:"aliases"` // Creation date/time Date string `json:"date,omitempty" mapstructure:"created_at"` // Server image Image string `json:"image,omitempty" mapstructure:"image_slug"` // IPv4 address Ipv4 string `json:"ipv4" mapstructure:"ipv4"` // IPv6 address Ipv6 string `json:"ipv6" mapstructure:"ipv6"` // Location ID of the server Location string `json:"location" mapstructure:"location_id"` // Server name Name string `json:"name,omitempty" mapstructure:"name"` // Server profile Profile string `json:"profile" mapstructure:"profile_slug"` // Server slug Slug string `json:"slug,omitempty" mapstructure:"slug"` // Last known snapshot runtime (seconds) SnapshotRunTime int64 `json:"snapshotRunTime,omitempty" mapstructure:"snapshot_runtime"` // Server status Status string `json:"status,omitempty" mapstructure:"status"` // Server virtualization type indicating whether it's a Webdock LXD VPS or a KVM Virtual Machine Virtualization string `json:"virtualization,omitempty" mapstructure:"virtualization"` // Webserver type WebServer string `json:"webServer,omitempty" mapstructure:"webserver"` CallbackID string `json:"-" mapstructure:"-"` }
Server model
type ServerImage ¶
type ServerImage struct { // Image name Name string `json:"name,omitempty" mapstructure:"name"` // PHP Version. For example "7.4" PhpVersion string `json:"phpVersion" mapstructure:"php_version"` // Image slug Slug string `json:"slug,omitempty" mapstructure:"slug"` // Web server type WebServer string `json:"webServer" mapstructure:"web_server"` }
ServerImage model
type ServerLocation ¶
type ServerLocation struct { // Location City City string `json:"city,omitempty" mapstructure:"city"` // Location Country Country string `json:"country,omitempty" mapstructure:"country"` // Location Description Description string `json:"description,omitempty" mapstructure:"description"` // Location Icon Icon string `json:"icon,omitempty" mapstructure:"icon"` // Location ID ID string `json:"id,omitempty" mapstructure:"id"` // Location Name Name string `json:"name,omitempty" mapstructure:"name"` }
ServerLocation model
type ServerLocations ¶
type ServerLocations []ServerLocation
type ServerProfile ¶
type ServerProfile struct { // CPU model CPU CPU `json:"cpu,omitempty" mapstructure:"cpu"` // Disk size (in MiB) Disk int64 `json:"disk,omitempty" mapstructure:"disk"` // Profile name Name string `json:"name,omitempty" mapstructure:"name"` // Price model Price Price `json:"price,omitempty" mapstructure:"-"` // RAM memory (in MiB) RAM int64 `json:"ram,omitempty" mapstructure:"ram"` // Profile slug Slug string `json:"slug,omitempty" mapstructure:"slug"` }
ServerProfile model
type ServerProfiles ¶
type ServerProfiles []ServerProfile
ServerProfiles is a collection of ServerProfile
type ServerResize ¶
type ServerResize struct { ChargeSummary *ChargeSummary `json:"chargeSummary,omitempty"` Warnings []Warning `json:"warnings,omitempty"` }
Server resize model
type ShellUser ¶
type ShellUser struct { ID json.Number `json:"id,omitempty" mapstructure:"id"` Username string `json:"username,omitempty" mapstructure:"username"` Password string `json:"password,omitempty" mapstructure:"password"` Group string `json:"group,omitempty" mapstructure:"group"` Shell string `json:"shell,omitempty" mapstructure:"shell"` PublicKeys PublicKeys `json:"publicKeys,omitempty" mapstructure:"public_keys"` Created string `json:"created,omitempty" mapstructure:"created_at"` CallbackID string `json:"-" mapstructure:"-"` }
type ShellUsers ¶
type ShellUsers []ShellUser