server

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package server represents our SiteHost `/server` API endpoint.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a Service to work with API Jobs.

func New

func New(c *api.Client) *Client

New is used to instantiate the Client struct.

func (*Client) CommitDiskChanges

func (s *Client) CommitDiskChanges(ctx context.Context, request CommitDiskChangesRequest) (response CommitDiskChangesResponse, err error)

CommitDiskChanges function commits changes to upgrade a server.

func (*Client) Create

func (s *Client) Create(ctx context.Context, opts CreateRequest) (response CreateResponse, err error)

Create a server.

func (*Client) Delete

func (s *Client) Delete(ctx context.Context, request DeleteRequest) (response DeleteResponse, err error)

Delete a server with the provided name.

func (*Client) Get

func (s *Client) Get(ctx context.Context, request GetRequest) (response GetResponse, err error)

Get information about the server.

func (*Client) List added in v0.3.1

func (s *Client) List(ctx context.Context) (response ListResponse, err error)

List information about the server.

func (*Client) Update

func (s *Client) Update(ctx context.Context, opts UpdateRequest) (response UpdateResponse, err error)

Update a Server.

func (*Client) Upgrade

func (s *Client) Upgrade(ctx context.Context, opts UpgradeRequest) (response UpdateResponse, err error)

Upgrade a server's plan .

type CommitDiskChangesRequest

type CommitDiskChangesRequest struct {
	ServerName string `json:"name"`
}

CommitDiskChangesRequest represents request params for CommitDiskChanges server endpoint.

type CommitDiskChangesResponse

type CommitDiskChangesResponse struct {
	Return struct {
		JobID string `json:"job_id"`
	} `json:"return"`
	models.APIResponse
}

CommitDiskChangesResponse represents a result of a commit changes Server call.

type CreateRequest

type CreateRequest struct {
	ClientID    string        `json:"client_id"`
	Label       string        `json:"label"`
	Location    string        `json:"location"`
	ProductCode string        `json:"product_code"`
	Image       string        `json:"image"`
	Params      ParamsOptions `json:"params"`
}

CreateRequest represents a request to create a Server.

type CreateResponse

type CreateResponse struct {
	Return struct {
		JobID    string   `json:"job_id"`
		Name     string   `json:"name"`
		Password string   `json:"password"`
		Ips      []string `json:"ips"`
		ServerID string   `json:"server_id"`
	} `json:"return"`
	models.APIResponse
}

CreateResponse represents a result of the create a Server call.

type DeleteRequest

type DeleteRequest struct {
	Name string `json:"name"`
}

DeleteRequest represents a request to delete a Server.

type DeleteResponse

type DeleteResponse struct {
	Return struct {
		JobID string `json:"job_id"`
	} `json:"return"`
	models.APIResponse
}

DeleteResponse represents a result of a delete Server call.

type GetRequest

type GetRequest struct {
	ServerName string `json:"name"`
}

GetRequest represents request params for get server endpoint.

type GetResponse

type GetResponse struct {
	Server models.Server `json:"return"`
	models.APIResponse
}

GetResponse represents a result of a get Server call.

type ListResponse added in v0.3.1

type ListResponse struct {
	Return struct {
		models.Pagination
		Servers []models.Server `json:"data"`
	} `json:"return"`
	models.APIResponse
}

ListResponse lists all servers.

type ParamsOptions

type ParamsOptions struct {
	Name      string   `json:"name,omitempty"`
	IPv4      []string `json:"ipv4"`
	IPv6      []string `json:"ipv6,omitempty"`
	SSHKeys   []string `json:"ssh_keys,omitempty"`
	ContactID string   `json:"contact_id,omitempty"`
	Backup    string   `json:"backup,omitempty"`
	SendEmail string   `json:"send_email,omitempty"`
}

ParamsOptions represents the additional parameters in the request to create a Server.

type UpdateRequest

type UpdateRequest struct {
	Name  string `json:"name"`
	Label string `json:"label"`
}

UpdateRequest represents a request to update a Server.

type UpdateResponse

type UpdateResponse struct {
	models.APIResponse
}

UpdateResponse represents a result of a update Server call.

type UpgradeRequest

type UpgradeRequest struct {
	Name string `json:"name"`
	Plan string `json:"plan"`
}

UpgradeRequest represents a request to upgrade a Server.

type UpgradeResponse

type UpgradeResponse struct {
	models.APIResponse
}

UpgradeResponse represents a result of a upgrade Server call.

Jump to

Keyboard shortcuts

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