Documentation ¶
Index ¶
- Constants
- func NewExponentialBackOff() *backoff.ExponentialBackOff
- type APIError
- type ActivateLinuxRequest
- type AuthorizedKey
- type Boot
- type BootService
- type BootServiceImpl
- func (s *BootServiceImpl) ActivateLinux(req *ActivateLinuxRequest) (*Linux, *http.Response, error)
- func (s *BootServiceImpl) DeactivateLinux(serverIP string) (*http.Response, error)
- func (s *BootServiceImpl) GetConfig(serverIP string) (*Boot, *http.Response, error)
- func (s *BootServiceImpl) GetLinuxConfig(serverIP string) (*Linux, *http.Response, error)
- type CancelServerRequest
- type Cancellation
- type Client
- func (c *Client) Call(method, path string, reqBody, resType interface{}, needAuth bool) (*http.Response, error)
- func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) NewRequest(method, path string, request interface{}) (*http.Request, error)
- func (c *Client) WithBackOff(b backoff.BackOff) *Client
- func (c *Client) WithTimeout(timeout time.Duration) *Client
- func (c *Client) WithUserAgent(ua string) *Client
- type Cpanel
- type CreateTransactionRequest
- type ErrorResponse
- type HostKey
- type Linux
- type OrderingService
- type OrderingServiceImpl
- func (s *OrderingServiceImpl) CreateTransaction(req *CreateTransactionRequest) (*Transaction, *http.Response, error)
- func (s *OrderingServiceImpl) GetProduct(id string) (*Product, *http.Response, error)
- func (s *OrderingServiceImpl) GetTransaction(id string) (*Transaction, *http.Response, error)
- func (s *OrderingServiceImpl) ListProducts() ([]*Product, *http.Response, error)
- func (s *OrderingServiceImpl) ListTransactions() ([]*Transaction, *http.Response, error)
- type Plesk
- type Product
- type Rescue
- type Reset
- type ResetCreateRequest
- type ResetCreateResponse
- type ResetService
- type ResetServiceImpl
- type SSHKey
- type SSHKeyCreateRequest
- type SSHKeyService
- type SSHKeyServiceImpl
- func (s *SSHKeyServiceImpl) Create(req *SSHKeyCreateRequest) (*SSHKey, *http.Response, error)
- func (s *SSHKeyServiceImpl) Delete(fingerprint string) (*http.Response, error)
- func (s *SSHKeyServiceImpl) Get(fingerprint string) (*SSHKey, *http.Response, error)
- func (s *SSHKeyServiceImpl) List() ([]*SSHKey, *http.Response, error)
- func (s *SSHKeyServiceImpl) Update(req *SSHKeyUpdateRequest) (*SSHKey, *http.Response, error)
- type SSHKeyUpdateRequest
- type Server
- type ServerService
- type ServerServiceImpl
- func (s *ServerServiceImpl) CancelServer(req *CancelServerRequest) (*Cancellation, *http.Response, error)
- func (s *ServerServiceImpl) GetCancellation(serverIP string) (*Cancellation, *http.Response, error)
- func (s *ServerServiceImpl) GetServer(serverIP string) (*Server, *http.Response, error)
- func (s *ServerServiceImpl) ListServers() ([]*ServerSummary, *http.Response, error)
- func (s *ServerServiceImpl) UpdateServer(req *ServerUpdateRequest) (*Server, *http.Response, error)
- func (s *ServerServiceImpl) WithdrawCancellation(serverIP string) (*http.Response, error)
- type ServerSummary
- type ServerUpdateRequest
- type Transaction
- type VServerCommandRequest
- type VServerService
- type VServerServiceImpl
- type Vnc
- type WOL
- type WOLService
- type WOLServiceImpl
- type Windows
Constants ¶
const ( // Version of this libary Version = "0.1.0" // User agent for this library UserAgent = "appscode/" + Version // DefaultEndpoint to be used DefaultEndpoint = "https://robot-ws.your-server.de" )
const ( DefaultInitialInterval = 50 * time.Millisecond DefaultRandomizationFactor = 0.5 DefaultMultiplier = 1.5 DefaultMaxInterval = 5 * time.Second DefaultMaxElapsedTime = 60 * time.Second )
Default values for ExponentialBackOff.
const ( VServerCommand_Start = "start" VServerCommand_Stop = "stop" VServerCommand_Shutdown = "shutdown" )
Variables ¶
This section is empty.
Functions ¶
func NewExponentialBackOff ¶
func NewExponentialBackOff() *backoff.ExponentialBackOff
NewExponentialBackOff creates an instance of ExponentialBackOff using default values.
Types ¶
type APIError ¶
type APIError struct { // HTTP response that caused this error Response *http.Response `json:"-"` Status int `json:"status"` Code string `json:"code"` Message string `json:"message"` // Array of missing input parameters or null Missing []string `json:"missing"` // Array of invalid input paramaters or null Invalid []string `json:"invalid"` // Maximum allowed requests MaxRequest int `json:"max_request"` // Time interval in seconds Interval int `json:"interval"` }
An ErrorResponse reports the error caused by an API request
type ActivateLinuxRequest ¶
type AuthorizedKey ¶
type BootService ¶
type BootService interface { GetConfig(serverIP string) (*Boot, *http.Response, error) GetLinuxConfig(serverIP string) (*Linux, *http.Response, error) ActivateLinux(req *ActivateLinuxRequest) (*Linux, *http.Response, error) DeactivateLinux(serverIP string) (*http.Response, error) }
See: https://wiki.hetzner.de/index.php/Robot_Webservice/en#Boot
type BootServiceImpl ¶
type BootServiceImpl struct {
// contains filtered or unexported fields
}
func (*BootServiceImpl) ActivateLinux ¶
func (s *BootServiceImpl) ActivateLinux(req *ActivateLinuxRequest) (*Linux, *http.Response, error)
func (*BootServiceImpl) DeactivateLinux ¶
func (s *BootServiceImpl) DeactivateLinux(serverIP string) (*http.Response, error)
func (*BootServiceImpl) GetLinuxConfig ¶
type CancelServerRequest ¶
type Cancellation ¶
type Cancellation struct { ServerIP string `json:"server_ip"` ServerNumber int `json:"server_number"` ServerName string `json:"server_name"` EarliestCancellationDate string `json:"earliest_cancellation_date"` Cancelled bool `json:"cancelled"` CancellationDate string `json:"cancellation_date"` CancellationReason ArrayOrString `json:"cancellation_reason"` }
type Client ¶
type Client struct { // Base URL for API requests. BaseURL string // User agent for client UserAgent string // Debug will dump http request and response Debug bool Boot BootService Ordering OrderingService Reset ResetService Server ServerService SSHKey SSHKeyService VServer VServerService // contains filtered or unexported fields }
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. If specified, the value pointed to by request is www-form-urlencoded and included in as the request body.
func (*Client) WithUserAgent ¶
type CreateTransactionRequest ¶
type CreateTransactionRequest struct { ProductID string `url:"product_id"` AuthorizedKey []string `url:"authorized_key,brackets"` Password string `url:"password,omitempty"` Dist string `url:"dist,omitempty"` Arch int `url:"arch,omitempty"` Lang string `url:"lang,omitempty"` Comment string `url:"comment,omitempty"` Test bool `url:"test"` }
type ErrorResponse ¶
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response // Error message Message string `json:"message"` }
An ErrorResponse reports the error caused by an API request
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type Linux ¶
type Linux struct { ServerIP string `json:"server_ip"` ServerNumber int `json:"server_number"` Dist ArrayOrString `json:"dist"` Arch ArrayOrInt `json:"arch"` Lang ArrayOrString `json:"lang"` Active bool `json:"active"` Password *string `json:"password"` AuthorizedKey []*AuthorizedKey `json:"authorized_key"` HostKey []*HostKey `json:"host_key"` }
type OrderingService ¶
type OrderingService interface { ListProducts() ([]*Product, *http.Response, error) GetProduct(id string) (*Product, *http.Response, error) ListTransactions() ([]*Transaction, *http.Response, error) CreateTransaction(req *CreateTransactionRequest) (*Transaction, *http.Response, error) GetTransaction(id string) (*Transaction, *http.Response, error) }
See: https://wiki.hetzner.de/index.php/Robot_Webservice/en#Server_ordering
type OrderingServiceImpl ¶
type OrderingServiceImpl struct {
// contains filtered or unexported fields
}
func (*OrderingServiceImpl) CreateTransaction ¶
func (s *OrderingServiceImpl) CreateTransaction(req *CreateTransactionRequest) (*Transaction, *http.Response, error)
func (*OrderingServiceImpl) GetProduct ¶
func (*OrderingServiceImpl) GetTransaction ¶
func (s *OrderingServiceImpl) GetTransaction(id string) (*Transaction, *http.Response, error)
func (*OrderingServiceImpl) ListProducts ¶
func (s *OrderingServiceImpl) ListProducts() ([]*Product, *http.Response, error)
func (*OrderingServiceImpl) ListTransactions ¶
func (s *OrderingServiceImpl) ListTransactions() ([]*Transaction, *http.Response, error)
type Product ¶
type Product struct { ID string `json:"id"` Name string `json:"name"` Description []string `json:"description"` Traffic string `json:"traffic"` Dist []string `json:"dist"` Arch []int `json:"arch"` Lang []string `json:"lang"` Price string `json:"price"` PriceSetup string `json:"price_setup"` PriceVat string `json:"price_vat"` PriceSetupVat string `json:"price_setup_vat"` }
type Rescue ¶
type Rescue struct { ServerIP string `json:"server_ip"` ServerNumber int `json:"server_number"` Os ArrayOrString `json:"os"` Arch ArrayOrInt `json:"arch"` Active bool `json:"active"` Password *string `json:"password"` AuthorizedKey []*AuthorizedKey `json:"authorized_key"` HostKey []*HostKey `json:"host_key"` }
type ResetCreateRequest ¶
type ResetCreateResponse ¶
type ResetService ¶
type ResetService interface { List() ([]*Reset, *http.Response, error) Get(serverIP string) (*Reset, *http.Response, error) Create(req *ResetCreateRequest) (*Reset, *http.Response, error) }
See: https://wiki.hetzner.de/index.php/Robot_Webservice/en#Reset
type ResetServiceImpl ¶
type ResetServiceImpl struct {
// contains filtered or unexported fields
}
func (*ResetServiceImpl) Create ¶
func (s *ResetServiceImpl) Create(req *ResetCreateRequest) (*Reset, *http.Response, error)
type SSHKeyCreateRequest ¶
type SSHKeyService ¶
type SSHKeyService interface { List() ([]*SSHKey, *http.Response, error) Create(req *SSHKeyCreateRequest) (*SSHKey, *http.Response, error) Get(fingerprint string) (*SSHKey, *http.Response, error) Update(req *SSHKeyUpdateRequest) (*SSHKey, *http.Response, error) Delete(fingerprint string) (*http.Response, error) }
See: https://wiki.hetzner.de/index.php/Robot_Webservice/en#SSH_keys
type SSHKeyServiceImpl ¶
type SSHKeyServiceImpl struct {
// contains filtered or unexported fields
}
func (*SSHKeyServiceImpl) Create ¶
func (s *SSHKeyServiceImpl) Create(req *SSHKeyCreateRequest) (*SSHKey, *http.Response, error)
func (*SSHKeyServiceImpl) Delete ¶
func (s *SSHKeyServiceImpl) Delete(fingerprint string) (*http.Response, error)
func (*SSHKeyServiceImpl) List ¶
func (s *SSHKeyServiceImpl) List() ([]*SSHKey, *http.Response, error)
func (*SSHKeyServiceImpl) Update ¶
func (s *SSHKeyServiceImpl) Update(req *SSHKeyUpdateRequest) (*SSHKey, *http.Response, error)
type SSHKeyUpdateRequest ¶
type Server ¶
type Server struct { ServerSummary IP []string `json:"ip"` Subnet []struct { IP string `json:"ip"` Mask string `json:"mask"` } `json:"subnet"` Reset bool `json:"reset"` Rescue bool `json:"rescue"` Vnc bool `json:"vnc"` Windows bool `json:"windows"` Plesk bool `json:"plesk"` Cpanel bool `json:"cpanel"` Wol bool `json:"wol"` }
type ServerService ¶
type ServerService interface { ListServers() ([]*ServerSummary, *http.Response, error) GetServer(serverIP string) (*Server, *http.Response, error) UpdateServer(req *ServerUpdateRequest) (*Server, *http.Response, error) GetCancellation(serverIP string) (*Cancellation, *http.Response, error) CancelServer(req *CancelServerRequest) (*Cancellation, *http.Response, error) WithdrawCancellation(serverIP string) (*http.Response, error) }
See: https://wiki.hetzner.de/index.php/Robot_Webservice/en#Server
type ServerServiceImpl ¶
type ServerServiceImpl struct {
// contains filtered or unexported fields
}
func (*ServerServiceImpl) CancelServer ¶
func (s *ServerServiceImpl) CancelServer(req *CancelServerRequest) (*Cancellation, *http.Response, error)
func (*ServerServiceImpl) GetCancellation ¶
func (s *ServerServiceImpl) GetCancellation(serverIP string) (*Cancellation, *http.Response, error)
func (*ServerServiceImpl) ListServers ¶
func (s *ServerServiceImpl) ListServers() ([]*ServerSummary, *http.Response, error)
func (*ServerServiceImpl) UpdateServer ¶
func (s *ServerServiceImpl) UpdateServer(req *ServerUpdateRequest) (*Server, *http.Response, error)
func (*ServerServiceImpl) WithdrawCancellation ¶
func (s *ServerServiceImpl) WithdrawCancellation(serverIP string) (*http.Response, error)
type ServerSummary ¶
type ServerSummary struct { ServerIP string `json:"server_ip"` ServerNumber int `json:"server_number"` ServerName string `json:"server_name"` Product string `json:"product"` Dc string `json:"dc"` Traffic string `json:"traffic"` Flatrate bool `json:"flatrate"` Status string `json:"status"` Throttled bool `json:"throttled"` Cancelled bool `json:"cancelled"` PaidUntil string `json:"paid_until"` }
type ServerUpdateRequest ¶
type Transaction ¶
type Transaction struct { ID string `json:"id"` Date time.Time `json:"date"` Status string `json:"status"` ServerNumber *string `json:"server_number"` ServerIP *string `json:"server_ip"` AuthorizedKey []struct { Key *AuthorizedKey `json:"key"` } `json:"authorized_key"` HostKey []struct { Key *HostKey `json:"key"` } `json:"host_key"` Comment *string `json:"comment"` Product struct { ID string `json:"id"` Name string `json:"name"` Description []string `json:"description"` Traffic string `json:"traffic"` Dist string `json:"dist"` Arch string `json:"arch"` Lang string `json:"lang"` } `json:"product"` }
type VServerCommandRequest ¶
type VServerService ¶
type VServerService interface {
Command(req *VServerCommandRequest) (*http.Response, error)
}
See: https://wiki.hetzner.de/index.php/Robot_Webservice/en#vServer
type VServerServiceImpl ¶
type VServerServiceImpl struct {
// contains filtered or unexported fields
}
func (*VServerServiceImpl) Command ¶
func (s *VServerServiceImpl) Command(req *VServerCommandRequest) (*http.Response, error)
type WOLService ¶
type WOLService interface { Create(serverIP string) (*WOL, *http.Response, error) Get(serverIP string) (*WOL, *http.Response, error) }
See: https://wiki.hetzner.de/index.php/Robot_Webservice/en#Wake_on_LAN
type WOLServiceImpl ¶
type WOLServiceImpl struct {
// contains filtered or unexported fields
}