hetzner

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

README

Go Report Card

go-hetzner

Golang client library for Hetzner API.

Usage examples

examples

Changelog

changelog.md

License

Apache 2.0

Documentation

Index

Constants

View Source
const (
	// UserAgent contains user agent identifier
	UserAgent = "intboat/go-hetzner"

	// DefaultEndpoint to be used
	DefaultEndpoint = "https://robot-ws.your-server.de"
)

Variables

This section is empty.

Functions

This section is empty.

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 parameters or null
	Invalid []string `json:"invalid"`

	// Maximum allowed requests
	MaxRequest int `json:"max_request"`
	// Time interval in seconds
	Interval int `json:"interval"`
}

APIError An ErrorResponse reports the error caused by an API request

func (*APIError) Error

func (r *APIError) Error() string

type ActivateCPanelRequest

type ActivateCPanelRequest struct {
	ActiveMeta
	// contains filtered or unexported fields
}

type ActivateLinuxRequest

type ActivateLinuxRequest struct {
	ActiveMeta
	AuthorizedKey *[]string `url:"authorized_key,brackets"` // One or more SSH key fingerprints (optional)
}

type ActivatePleskRequest

type ActivatePleskRequest struct {
	ActiveMeta
	Hostname *string `url:"hostname"` // Hostname
}

type ActivateRescueRequest

type ActivateRescueRequest struct {
	ActiveMeta
	AuthorizedKey *[]string `url:"authorized_key,brackets"` // One or more SSH key fingerprints (optional)
}

type ActivateVncRequest

type ActivateVncRequest struct {
	ActiveMeta
}

type ActivateWindowsRequest

type ActivateWindowsRequest struct {
	ActiveMeta
}

type ActiveMeta

type ActiveMeta struct {
	ServerNumber string // Server ID
	Dist         string `url:"dist"` // Distribution
	Arch         int    `url:"arch"` // Architecture (optional, default: 64)
	Lang         string `url:"lang"` // Language
}

type AuthorizedKey

type AuthorizedKey struct {
	Name        string `json:"name"`
	Fingerprint string `json:"fingerprint"`
	Type        string `json:"type"`
	Size        int    `json:"size"`
}

type Boot

type Boot struct {
	Rescue  *Rescue  `json:"rescue"`
	Linux   *Linux   `json:"linux"`
	Vnc     *Vnc     `json:"vnc"`
	Windows *Windows `json:"windows"`
	Plesk   *Plesk   `json:"plesk"`
	Cpanel  *Cpanel  `json:"cpanel"`
}

type BootService

type BootService interface {
	GetBoot(ServerNumber string) (*Boot, *http.Response, error)

	GetRescue(ServerNumber string) (*Rescue, *http.Response, error)
	ActivateRescue(req ActivateRescueRequest) (*Rescue, *http.Response, error)
	DeactivateRescue(ServerNumber string) (*Rescue, *http.Response, error)

	GetRescueLast(ServerNumber string) (*Rescue, *http.Response, error)
	GetLinux(ServerNumber string) (*Linux, *http.Response, error)
	ActivateLinux(req *ActivateLinuxRequest) (*Linux, *http.Response, error)
	DeactivateLinux(ServerNumber string) (*Linux, *http.Response, error)
	GetLinuxLast(ServerNumber string) (*Linux, *http.Response, error)

	GetVnc(ServerNumber string) (*Vnc, *http.Response, error)
	ActivateVnc(req *ActivateLinuxRequest) (*Vnc, *http.Response, error)
	DeactivateVnc(ServerNumber string) (*Vnc, *http.Response, error)

	GetWindows(ServerNumber string) (*Windows, *http.Response, error)
	ActivateWindows(req *ActivateWindowsRequest) (*Windows, *http.Response, error)
	DeactivateWindows(ServerNumber string) (*Windows, *http.Response, error)

	GetPlesk(ServerNumber string) (*Plesk, *http.Response, error)
	ActivatePlesk(req *ActivateWindowsRequest) (*Plesk, *http.Response, error)
	DeactivatePlesk(ServerNumber string) (*Plesk, *http.Response, error)

	GetCPanel(ServerNumber string) (*Cpanel, *http.Response, error)
	ActivateCPanel(req *ActivateCPanelRequest) (*Cpanel, *http.Response, error)
	DeactivateCPanel(ServerNumber string) (*Cpanel, *http.Response, error)
}

BootService represents a service to work with boot service.

type BootServiceImpl

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

func (*BootServiceImpl) ActivateCPanel

func (s *BootServiceImpl) ActivateCPanel(req *ActivateCPanelRequest) (*Cpanel, *http.Response, error)

ActivateCPanel Activate cPanel installation See: https://robot.your-server.de/doc/webservice/en.html#post-boot-server-number-cpanel

func (*BootServiceImpl) ActivateLinux

func (s *BootServiceImpl) ActivateLinux(req *ActivateLinuxRequest) (*Linux, *http.Response, error)

ActivateLinux Activate Linux installation See: https://robot.your-server.de/doc/webservice/en.html#post-boot-server-number-linux

func (*BootServiceImpl) ActivatePlesk

func (s *BootServiceImpl) ActivatePlesk(req *ActivateWindowsRequest) (*Plesk, *http.Response, error)

ActivatePlesk Activate Plesk installation See: https://robot.your-server.de/doc/webservice/en.html#post-boot-server-number-plesk

func (*BootServiceImpl) ActivateRescue

func (s *BootServiceImpl) ActivateRescue(req ActivateRescueRequest) (*Rescue, *http.Response, error)

ActivateRescue Activate Rescue System See: https://robot.your-server.de/doc/webservice/en.html#post-boot-server-number-rescue

func (*BootServiceImpl) ActivateVnc

func (s *BootServiceImpl) ActivateVnc(req *ActivateLinuxRequest) (*Vnc, *http.Response, error)

ActivateVnc Activate VNC installation See: https://robot.your-server.de/doc/webservice/en.html#post-boot-server-number-vnc

func (*BootServiceImpl) ActivateWindows

func (s *BootServiceImpl) ActivateWindows(req *ActivateWindowsRequest) (*Windows, *http.Response, error)

ActivateWindows Activate Windows installation. You need to order the Windows addon for the server via the Robot web panel first. After a reboot, the installation will start, and all data on the server will be deleted. See: https://robot.your-server.de/doc/webservice/en.html#post-boot-server-number-windows

func (*BootServiceImpl) DeactivateCPanel

func (s *BootServiceImpl) DeactivateCPanel(ServerNumber string) (*Cpanel, *http.Response, error)

DeactivateCPanel Deactivate cPanel installation See: https://robot.your-server.de/doc/webservice/en.html#delete-boot-server-number-cpanel

func (*BootServiceImpl) DeactivateLinux

func (s *BootServiceImpl) DeactivateLinux(ServerNumber string) (*Linux, *http.Response, error)

DeactivateLinux Deactivate Linux installation See: https://robot.your-server.de/doc/webservice/en.html#delete-boot-server-number-linux

func (*BootServiceImpl) DeactivatePlesk

func (s *BootServiceImpl) DeactivatePlesk(ServerNumber string) (*Plesk, *http.Response, error)

DeactivatePlesk Deactivate Plesk installation See: https://robot.your-server.de/doc/webservice/en.html#delete-boot-server-number-plesk

func (*BootServiceImpl) DeactivateRescue

func (s *BootServiceImpl) DeactivateRescue(ServerNumber string) (*Rescue, *http.Response, error)

DeactivateRescue Deactivate Rescue System See: https://robot.your-server.de/doc/webservice/en.html#delete-boot-server-number-rescue

func (*BootServiceImpl) DeactivateVnc

func (s *BootServiceImpl) DeactivateVnc(ServerNumber string) (*Vnc, *http.Response, error)

DeactivateVnc Deactivate VNC installation See: https://robot.your-server.de/doc/webservice/en.html#delete-boot-server-number-vnc

func (*BootServiceImpl) DeactivateWindows

func (s *BootServiceImpl) DeactivateWindows(ServerNumber string) (*Windows, *http.Response, error)

DeactivateWindows Deactivate Windows installation See: https://robot.your-server.de/doc/webservice/en.html#delete-boot-server-number-vnc

func (*BootServiceImpl) GetBoot

func (s *BootServiceImpl) GetBoot(ServerNumber string) (*Boot, *http.Response, error)

GetBoot Query the current boot configuration status for a server. There can be only one configuration active at any time for one server. See: https://robot.your-server.de/doc/webservice/en.html#get-boot-server-number

func (*BootServiceImpl) GetCPanel

func (s *BootServiceImpl) GetCPanel(ServerNumber string) (*Cpanel, *http.Response, error)

GetCPanel Query boot options for the cPanel installation See: https://robot.your-server.de/doc/webservice/en.html#get-boot-server-ip-cpanel

func (*BootServiceImpl) GetLinux

func (s *BootServiceImpl) GetLinux(ServerNumber string) (*Linux, *http.Response, error)

GetLinux Query boot options for the Linux installation See: https://robot.your-server.de/doc/webservice/en.html#get-boot-server-number-linux

func (*BootServiceImpl) GetLinuxLast

func (s *BootServiceImpl) GetLinuxLast(ServerNumber string) (*Linux, *http.Response, error)

GetLinuxLast Show data of last Linux installation See: https://robot.your-server.de/doc/webservice/en.html#get-boot-server-number-linux-last

func (*BootServiceImpl) GetPlesk

func (s *BootServiceImpl) GetPlesk(ServerNumber string) (*Plesk, *http.Response, error)

GetPlesk Query boot options for the Plesk installation See: https://robot.your-server.de/doc/webservice/en.html#get-boot-server-number-windows

func (*BootServiceImpl) GetRescue

func (s *BootServiceImpl) GetRescue(ServerNumber string) (*Rescue, *http.Response, error)

GetRescue Query boot options for the Rescue System See: https://robot.your-server.de/doc/webservice/en.html#get-boot-server-number-rescue

func (*BootServiceImpl) GetRescueLast

func (s *BootServiceImpl) GetRescueLast(ServerNumber string) (*Rescue, *http.Response, error)

GetRescueLast Show data of last rescue activation See: https://robot.your-server.de/doc/webservice/en.html#get-boot-server-number-rescue-last

func (*BootServiceImpl) GetVnc

func (s *BootServiceImpl) GetVnc(ServerNumber string) (*Vnc, *http.Response, error)

GetVnc Query boot options for the VNC installation See: https://robot.your-server.de/doc/webservice/en.html#get-boot-server-number-vnc

func (*BootServiceImpl) GetWindows

func (s *BootServiceImpl) GetWindows(ServerNumber string) (*Windows, *http.Response, error)

GetWindows Query boot options for the windows installation See: https://robot.your-server.de/doc/webservice/en.html#get-boot-server-number-windows

type CancelServerRequest

type CancelServerRequest struct {
	ServerNumber       string // Server ID
	CancellationDate   string `url:"cancellation_date"`             // Date to which the server should be cancelled
	CancellationReason string `url:"cancellation_reason,omitempty"` // Cancellation reason, optional
	ReserveLocation    bool   `url:"reserve_location"`              // Whether server location shall be reserved ('true' or 'false')
}

type Cancellation

type Cancellation struct {
	ServerIp                 string   `json:"server_ip"`
	ServerIpv6Net            string   `json:"server_ipv6_net"`
	ServerNumber             int      `json:"server_number"`
	ServerName               string   `json:"server_name"`
	EarliestCancellationDate JSONTime `json:"earliest_cancellation_date"`
	Cancelled                bool     `json:"cancelled"`
	Reserved                 bool     `json:"reserved"`
	ReservationPossible      bool     `json:"reservation_possible"`
	CancellationDate         JSONTime `json:"cancellation_date"`
	CancellationReason       []string `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
	Failover FailoverService
	IP       IpService
	Subnet   SubnetService
	Wol      WOLService
	Traffic  TrafficService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(username, password string) *Client

func (*Client) Call

func (c *Client) Call(method, path string, reqBody, resType interface{}) (*http.Response, error)

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)

Do send 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

func (c *Client) NewRequest(method, path string, request interface{}) (*http.Request, error)

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) WithTimeout

func (c *Client) WithTimeout(timeout time.Duration) *Client

func (*Client) WithUserAgent

func (c *Client) WithUserAgent(ua string) *Client

type Cpanel

type Cpanel struct {
	ServerIp      string   `json:"server_ip"`
	ServerIpv6Net string   `json:"server_ipv6_net"`
	ServerNumber  int      `json:"server_number"`
	Dist          []string `json:"dist"`
	Arch          []int    `json:"arch"`
	Lang          []string `json:"lang"`
	Active        bool     `json:"active"`
	Password      *string  `json:"password"`
	Hostname      *string  `json:"hostname"`
}

type CreateTransactionRequest

type CreateTransactionRequest struct {
	ProductID     string   `url:"product_id"`
	AuthorizedKey []string `url:"authorized_key,brackets"`
	Password      string   `url:"password,omitempty"`
	Location      string   `url:"location"`
	Dist          string   `url:"dist,omitempty"`
	Arch          int      `url:"arch,omitempty"`
	Lang          string   `url:"lang,omitempty"`
	Comment       string   `url:"comment,omitempty"`
	Addon         []string `url:"addon,brackets"`
	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 Failover

type Failover struct {
	IP             string `json:"ip"`
	Netmask        string `json:"netmask"`
	ServerIP       string `json:"server_ip"`
	ServerNumber   int    `json:"server_number"`
	ActiveServerIP string `json:"active_server_ip"`
}

FailoverSummary contains information about failover ip

type FailoverService

type FailoverService interface {
	List() ([]*Failover, *http.Response, error)
	Get(failoverIP string) (*Failover, *http.Response, error)
	Switch(req FailoverSwitchRequest) (*Failover, *http.Response, error)
	Delete(failoverIP string) (*Failover, *http.Response, error)
}

FailoverService represents a service to work with failover ips.

type FailoverServiceImpl

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

func (*FailoverServiceImpl) Delete

func (s *FailoverServiceImpl) Delete(failoverIP string) (*Failover, *http.Response, error)

Delete the routing of a failover IP When successful, returns updated information about the failover IP See: https://robot.your-server.de/doc/webservice/en.html#delete-failover-failover-ip

func (*FailoverServiceImpl) Get

func (s *FailoverServiceImpl) Get(failoverIP string) (*Failover, *http.Response, error)

Get Query specific failover IP address data See: https://robot.your-server.de/doc/webservice/en.html#get-failover-failover-ip

func (*FailoverServiceImpl) List

func (s *FailoverServiceImpl) List() ([]*Failover, *http.Response, error)

List Query failover data for all servers See: https://robot.your-server.de/doc/webservice/en.html#get-failover

func (*FailoverServiceImpl) Switch

Switch traffic of failoverIP to the server with ip newActiveIP. When successful, returns updated information about the failover IP See: https://robot.your-server.de/doc/webservice/en.html#post-failover-failover-ip

type FailoverSwitchRequest

type FailoverSwitchRequest struct {
	FailoverIP     string
	ActiveServerIP string `url:"active_server_ip"` // Main IP address of the server where the failover IP should be routed to.
}

FailoverSwitchRequest describes parameters of POST /failover API call

type HostKey

type HostKey struct {
	Fingerprint string `json:"fingerprint"`
	Type        string `json:"type"`
	Size        int    `json:"size"`
}

type IP

type IP struct {
	IP              string `json:"ip"`
	Locked          bool   `json:"locked"`
	SeparateMac     string `json:"separate_mac"`
	ServerIp        string `json:"server_ip"`
	ServerNumber    int    `json:"server_number"`
	TrafficDaily    int    `json:"traffic_daily"`
	TrafficHourly   int    `json:"traffic_hourly"`
	TrafficMonthly  int    `json:"traffic_monthly"`
	TrafficWarnings bool   `json:"traffic_warnings"`
}

type IpService

type IpService interface {
	List() ([]*IP, *http.Response, error)
	Get(ip string) (*IpSummary, *http.Response, error)
	UpdateWarring(req *IpUpdateRequest) (*IpSummary, *http.Response, error)

	GetMac(ip string) (*Mac, *http.Response, error)
	CreateMac(ip string) (*Mac, *http.Response, error)
	DeleteMac(ip string) (*Mac, *http.Response, error)
}

IpService represents a service to work with IP.

type IpServiceImpl

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

func (*IpServiceImpl) CreateMac

func (s *IpServiceImpl) CreateMac(ip string) (*Mac, *http.Response, error)

CreateMac Generate a separate MAC address See: https://robot.your-server.de/doc/webservice/en.html#put-ip-ip-mac

func (*IpServiceImpl) DeleteMac

func (s *IpServiceImpl) DeleteMac(ip string) (*Mac, *http.Response, error)

DeleteMac Remove a separate MAC address See: https://robot.your-server.de/doc/webservice/en.html#delete-ip-ip-mac

func (*IpServiceImpl) Get

func (s *IpServiceImpl) Get(ip string) (*IpSummary, *http.Response, error)

Get Query data for a specific IP address See: https://robot.your-server.de/doc/webservice/en.html#get-ip-ip

func (*IpServiceImpl) GetMac

func (s *IpServiceImpl) GetMac(ip string) (*Mac, *http.Response, error)

GetMac Query if it is possible to set a separate MAC address. Returns the MAC address if it is set. See: https://robot.your-server.de/doc/webservice/en.html#get-ip-ip-mac

func (*IpServiceImpl) List

func (s *IpServiceImpl) List() ([]*IP, *http.Response, error)

List Query list of all single IP addresses See: https://robot.your-server.de/doc/webservice/en.html#get-ip

func (*IpServiceImpl) UpdateWarring

func (s *IpServiceImpl) UpdateWarring(req *IpUpdateRequest) (*IpSummary, *http.Response, error)

UpdateWarring update traffic warning options for an IP address See: https://robot.your-server.de/doc/webservice/en.html#post-ip-ip

type IpSummary

type IpSummary struct {
	IP
	Broadcast string `json:"broadcast"`
	Gateway   string `json:"gateway"`
	Mask      int    `json:"mask"`
}

type IpUpdateRequest

type IpUpdateRequest struct {
	IP              string
	TrafficWarnings string `url:"traffic_warnings"` // Enable/disable traffic warnings (true, false)
	TrafficHourly   string `url:"traffic_hourly"`   // Hourly traffic limit in MB
	TrafficDaily    string `url:"traffic_daily"`    // Daily traffic limit in MB
	TrafficMonthly  string `url:"traffic_monthly"`  // Monthly traffic limit in GB
}

type JSONTime

type JSONTime struct {
	time.Time
}

func (*JSONTime) MarshalJSON

func (t *JSONTime) MarshalJSON() ([]byte, error)

func (*JSONTime) UnmarshalJSON

func (t *JSONTime) UnmarshalJSON(data []byte) error

type Linux

type Linux struct {
	ServerIp      string           `json:"server_ip"`
	ServerIpv6Net string           `json:"server_ipv6_net"`
	ServerNumber  int              `json:"server_number"`
	Dist          []string         `json:"dist"`
	Arch          []int            `json:"arch"`
	Lang          []string         `json:"lang"`
	Active        bool             `json:"active"`
	Password      *string          `json:"password"`
	AuthorizedKey []*AuthorizedKey `json:"authorized_key"`
	HostKey       []*HostKey       `json:"host_key"`
}

type Mac

type Mac struct {
	IP  string `json:"ip"`
	Mac string `json:"mac"`
}

type MarketProduct

type MarketProduct struct {
	Id              int      `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"`
	Cpu             string   `json:"cpu"`
	CpuBenchmark    int      `json:"cpu_benchmark"`
	MemorySize      int      `json:"memory_size"`
	HddSize         int      `json:"hdd_size"`
	HddText         string   `json:"hdd_text"`
	HddCount        int      `json:"hdd_count"`
	Datacenter      string   `json:"datacenter"`
	NetworkSpeed    string   `json:"network_speed"`
	Price           float64  `json:"price,string"`
	PriceSetup      float64  `json:"price_setup,string"`
	PriceVat        float64  `json:"price_vat,string"`
	PriceSetupVat   float64  `json:"price_setup_vat,string"`
	FixedPrice      bool     `json:"fixed_price"`
	NextReduce      int      `json:"next_reduce"`
	NextReduceDate  JSONTime `json:"next_reduce_date"`
	OrderableAddons []struct {
		Id     string `json:"id"`
		Name   string `json:"name"`
		Min    int    `json:"min"`
		Max    int    `json:"max"`
		Prices []struct {
			Location string `json:"location"`
			Price    struct {
				Net   float64 `json:"net,string"`
				Gross float64 `json:"gross,string"`
			} `json:"price"`
			PriceSetup struct {
				Net   float64 `json:"net,string"`
				Gross float64 `json:"gross,string"`
			} `json:"price_setup"`
		} `json:"prices"`
	} `json:"orderable_addons"`
}

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)

	ListMarketProducts() ([]*MarketProduct, *http.Response, error)
	GetMarketProduct(id string) (*Product, *http.Response, error)

	ListMarketTransactions() ([]*Transaction, *http.Response, error)
	CreateMarketTransaction(req *CreateTransactionRequest) (*Transaction, *http.Response, error)
	GetMarketTransaction(id string) (*Transaction, *http.Response, error)
}

OrderingService represents a service to work with server ordering. To use the Robot webservice for ordering servers, please activate this function in your Robot administrative interface first via "Administration; Settings; Web Service Settings; Ordering".

type OrderingServiceImpl

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

func (*OrderingServiceImpl) CreateMarketTransaction

func (s *OrderingServiceImpl) CreateMarketTransaction(req *CreateTransactionRequest) (
	*Transaction, *http.Response, error,
)

CreateMarketTransaction Order a new server from the server market. If the order is successful, the status code 201 CREATED is returned. See: https://robot.your-server.de/doc/webservice/en.html#post-order-server_market-transaction

func (*OrderingServiceImpl) CreateTransaction

CreateTransaction Order a new server. If the order is successful, the status code 201 CREATED is returned. See: https://robot.your-server.de/doc/webservice/en.html#post-order-server-transaction

func (*OrderingServiceImpl) GetMarketProduct

func (s *OrderingServiceImpl) GetMarketProduct(id string) (*Product, *http.Response, error)

GetMarketProduct Query a specific server market product See: https://robot.your-server.de/doc/webservice/en.html#get-order-server_market-product-product-id

func (*OrderingServiceImpl) GetMarketTransaction

func (s *OrderingServiceImpl) GetMarketTransaction(id string) (*Transaction, *http.Response, error)

GetMarketTransaction Query a specific order transaction See: https://robot.your-server.de/doc/webservice/en.html#get-order-server_market-transaction-id

func (*OrderingServiceImpl) GetProduct

func (s *OrderingServiceImpl) GetProduct(id string) (*Product, *http.Response, error)

GetProduct Query a specific server product See: https://robot.your-server.de/doc/webservice/en.html#get-order-server-product-product-id

func (*OrderingServiceImpl) GetTransaction

func (s *OrderingServiceImpl) GetTransaction(id string) (*Transaction, *http.Response, error)

GetTransaction Query a specific order transaction See: https://robot.your-server.de/doc/webservice/en.html#get-order-server-transaction-id

func (*OrderingServiceImpl) ListMarketProducts

func (s *OrderingServiceImpl) ListMarketProducts() ([]*MarketProduct, *http.Response, error)

ListMarketProducts Product overview of currently offered server market products See: https://robot.your-server.de/doc/webservice/en.html#get-order-server_market-product

func (*OrderingServiceImpl) ListMarketTransactions

func (s *OrderingServiceImpl) ListMarketTransactions() ([]*Transaction, *http.Response, error)

ListMarketTransactions Overview of all server orders within the last 30 days See: https://robot.your-server.de/doc/webservice/en.html#get-order-server_market-product-product-id

func (*OrderingServiceImpl) ListProducts

func (s *OrderingServiceImpl) ListProducts() ([]*Product, *http.Response, error)

ListProducts Product overview of currently offered standard server products See: https://robot.your-server.de/doc/webservice/en.html#get-order-server-product

func (*OrderingServiceImpl) ListTransactions

func (s *OrderingServiceImpl) ListTransactions() ([]*Transaction, *http.Response, error)

ListTransactions Overview of all server orders within the last 30 days See: https://robot.your-server.de/doc/webservice/en.html#get-order-server-product-product-id

type Plesk

type Plesk struct {
	ServerIp      string   `json:"server_ip"`
	ServerIpv6Net string   `json:"server_ipv6_net"`
	ServerNumber  int      `json:"server_number"`
	Dist          []string `json:"dist"`
	Arch          []int    `json:"arch"`
	Lang          []string `json:"lang"`
	Active        bool     `json:"active"`
	Password      *string  `json:"password"`
	Hostname      *string  `json:"hostname"`
}

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"`
	Location    []string `json:"location"`
	Prices      []struct {
		Location string `json:"location"`
		Price    struct {
			Net   float64 `json:"net,string"`
			Gross float64 `json:"gross,string"`
		} `json:"price"`
		PriceSetup struct {
			Net   float64 `json:"net,string"`
			Gross float64 `json:"gross,string"`
		} `json:"price_setup"`
	} `json:"prices"`
	OrderableAddons []struct {
		Id     string `json:"id"`
		Name   string `json:"name"`
		Min    int    `json:"min"`
		Max    int    `json:"max"`
		Prices []struct {
			Location string `json:"location"`
			Price    struct {
				Net   float64 `json:"net,string"`
				Gross float64 `json:"gross,string"`
			} `json:"price"`
			PriceSetup struct {
				Net   float64 `json:"net,string"`
				Gross float64 `json:"gross,string"`
			} `json:"price_setup"`
		} `json:"prices"`
	} `json:"orderable_addons"`
}

type RDNS

type RDNS struct {
	IP  string `json:"ip"`
	Ptr string `json:"ptr"`
}

type RDNSService

type RDNSService interface {
	List() ([]*RDNS, *http.Response, error)
	Get(ip string) (*RDNS, *http.Response, error)
	Create(req *RDNSUpdateRequest) (*RDNS, *http.Response, error)
	Update(req *RDNSUpdateRequest) (*RDNS, *http.Response, error)
	Delete(ip string) (*RDNS, *http.Response, error)
}

RDNSService represents a service to work with Reverse DNS.

type RDNSServiceImpl

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

func (*RDNSServiceImpl) Create

func (s *RDNSServiceImpl) Create(req *RDNSUpdateRequest) (*RDNS, *http.Response, error)

Create new reverse DNS entry for one IP address. Once the reverse DNS entry is successfully created, the status code 201 CREATED is returned. See: https://robot.your-server.de/doc/webservice/en.html#put-rdns-ip

func (*RDNSServiceImpl) Delete

func (s *RDNSServiceImpl) Delete(ip string) (*RDNS, *http.Response, error)

Delete reverse DNS entry for one IP See: https://robot.your-server.de/doc/webservice/en.html#delete-rdns-ip

func (*RDNSServiceImpl) Get

func (s *RDNSServiceImpl) Get(ip string) (*RDNS, *http.Response, error)

Get Query the current reverse DNS entry for one IP address See: https://robot.your-server.de/doc/webservice/en.html#get-ip-ip

func (*RDNSServiceImpl) List

func (s *RDNSServiceImpl) List() ([]*RDNS, *http.Response, error)

List Query all rDNS entries See: https://robot.your-server.de/doc/webservice/en.html#get-rdns

func (*RDNSServiceImpl) Update

func (s *RDNSServiceImpl) Update(req *RDNSUpdateRequest) (*RDNS, *http.Response, error)

Update create or Update a reverse DNS entry for one IP. Once the reverse DNS entry is successfully created, the status code is set to 201 created. On successful updates, the status code is 200 OK. See: https://robot.your-server.de/doc/webservice/en.html#post-rdns-ip

type RDNSUpdateRequest

type RDNSUpdateRequest struct {
	IP  string `url:"ip"`
	Ptr string `url:"ptr"`
}

type Rescue

type Rescue struct {
	ServerIp      string           `json:"server_ip"`
	ServerIpv6Net string           `json:"server_ipv6_net"`
	ServerNumber  int              `json:"server_number"`
	Os            []string         `json:"os"`
	Arch          []int            `json:"arch"`
	Active        bool             `json:"active"`
	Password      *string          `json:"password"`
	AuthorizedKey []*AuthorizedKey `json:"authorized_key"`
	HostKey       []*HostKey       `json:"host_key"`
}

type Reset

type Reset struct {
	ServerIP        string   `json:"server_ip"`
	ServerIpv6Net   string   `json:"server_ipv6_net"`
	ServerNumber    int      `json:"server_number"`
	Type            []string `json:"type"`
	OperatingStatus string   `json:"operating_status"`
}

type ResetCreateRequest

type ResetCreateRequest struct {
	ServerNumber string
	Type         string `url:"type"`
}

type ResetCreateResponse

type ResetCreateResponse struct {
	ServerIP      string `json:"server_ip"`
	ServerIpv6Net string `json:"server_ipv6_net"`
	ServerNumber  int    `json:"server_number"`
	Type          string `json:"type"`
}

type ResetService

type ResetService interface {
	List() ([]*Reset, *http.Response, error)
	Get(serverIP string) (*Reset, *http.Response, error)
	Reset(req *ResetCreateRequest) (*Reset, *http.Response, error)
}

ResetService represents a service to work with Reset ordering.

type ResetServiceImpl

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

func (*ResetServiceImpl) Get

func (s *ResetServiceImpl) Get(serverNumber string) (*Reset, *http.Response, error)

Get Query reset options for a specific server See: https://robot.your-server.de/doc/webservice/en.html#get-reset-server-number

func (*ResetServiceImpl) List

func (s *ResetServiceImpl) List() ([]*Reset, *http.Response, error)

List Query reset options for all servers See: https://robot.your-server.de/doc/webservice/en.html#get-reset

func (*ResetServiceImpl) Reset

Reset Execute reset on specific server See: https://robot.your-server.de/doc/webservice/en.html#post-reset-server-number

type SSHKey

type SSHKey struct {
	Name        string `json:"name"`
	Fingerprint string `json:"fingerprint"`
	Type        string `json:"type"`
	Size        int    `json:"size"`
	Data        string `json:"data"`
}

type SSHKeyCreateRequest

type SSHKeyCreateRequest struct {
	Name string `url:"name"` // SSH key name
	Data string `url:"data"` // SSH key data in OpenSSH or SSH2 format
}

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)
}

SSHKeyService represents a service to work with SSH service.

type SSHKeyServiceImpl

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

func (*SSHKeyServiceImpl) Create

Create Add a new SSH key. Once the key is successfully added, the status code 201 CREATED is returned. See: https://robot.your-server.de/doc/webservice/en.html#post-key

func (*SSHKeyServiceImpl) Delete

func (s *SSHKeyServiceImpl) Delete(fingerprint string) (*http.Response, error)

Delete Remove public key See: https://robot.your-server.de/doc/webservice/en.html#delete-key-fingerprint

func (*SSHKeyServiceImpl) Get

func (s *SSHKeyServiceImpl) Get(fingerprint string) (*SSHKey, *http.Response, error)

Get Query a specific SSH key See: https://robot.your-server.de/doc/webservice/en.html#get-key-fingerprint

func (*SSHKeyServiceImpl) List

func (s *SSHKeyServiceImpl) List() ([]*SSHKey, *http.Response, error)

List Query all SSH keys See: https://robot.your-server.de/doc/webservice/en.html#get-key

type SSHKeyUpdateRequest

type SSHKeyUpdateRequest struct {
	Fingerprint string // Key fingerprint
	Name        string `url:"name"` // SSH key name
}

type Server

type Server struct {
	ServerSummary
	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"`
	HotSwap          bool `json:"hot_swap"`
	LinkedStoragebox int  `json:"linked_storagebox"`
}

type ServerService

type ServerService interface {
	List() ([]*ServerSummary, *http.Response, error)
	Get(serverIP string) (*Server, *http.Response, error)
	Update(req *UpdateServerRequest) (*Server, *http.Response, error)

	GetCancellation(serverIP string) (*Cancellation, *http.Response, error)
	CancelServer(req *CancelServerRequest) (*Cancellation, *http.Response, error)
	WithdrawCancellation(serverIP string) (*http.Response, error)
}

ServerService represents a service to work with server service.

type ServerServiceImpl

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

func (*ServerServiceImpl) Get

func (s *ServerServiceImpl) Get(ServerNumber string) (*Server, *http.Response, error)

Get Query server data for a specific server See: https://robot.your-server.de/doc/webservice/en.html#get-server-server-number

func (*ServerServiceImpl) GetCancellation

func (s *ServerServiceImpl) GetCancellation(ServerNumber string) (*Cancellation, *http.Response, error)

GetCancellation Query cancellation data for a server See: https://robot.your-server.de/doc/webservice/en.html#get-server-server-number-cancellation

func (*ServerServiceImpl) List

List Query data of all servers See: https://robot.your-server.de/doc/webservice/en.html#get-server

func (*ServerServiceImpl) Update

Update server name for a specific server See: https://robot.your-server.de/doc/webservice/en.html#post-server-server-number

func (*ServerServiceImpl) WithdrawCancellation

func (s *ServerServiceImpl) WithdrawCancellation(ServerNumber string) (*http.Response, error)

WithdrawCancellation Withdraw a server cancellation See: https://robot.your-server.de/doc/webservice/en.html#delete-server-server-number-cancellation

func (*ServerServiceImpl) WithdrawOrder

WithdrawOrder Withdraw a server order See: https://robot.your-server.de/doc/webservice/en.html#post-server-server-number-reversal

type ServerSummary

type ServerSummary struct {
	ServerIP      string   `json:"server_ip"`
	ServerIpv6Net string   `json:"server_ipv6_net"`
	ServerNumber  int      `json:"server_number"`
	ServerName    string   `json:"server_name"`
	Product       string   `json:"product"`
	Dc            string   `json:"dc"`
	Traffic       string   `json:"traffic"`
	Status        string   `json:"status"`
	Cancelled     bool     `json:"cancelled"`
	PaidUntil     string   `json:"paid_until"`
	Ip            []string `json:"ip"`
	Subnet        []struct {
		Ip   string `json:"ip"`
		Mask string `json:"mask"`
	} `json:"subnet"`
}

type Subnet

type Subnet struct {
	IP              string `json:"ip"`
	Mask            int    `json:"mask"`
	Gateway         string `json:"gateway"`
	ServerIp        string `json:"server_ip"`
	ServerNumber    int    `json:"server_number"`
	Failover        bool   `json:"failover"`
	Locked          bool   `json:"locked"`
	TrafficWarnings bool   `json:"traffic_warnings"`
	TrafficHourly   int    `json:"traffic_hourly"`
	TrafficDaily    int    `json:"traffic_daily"`
	TrafficMonthly  int    `json:"traffic_monthly"`
}

type SubnetMac

type SubnetMac struct {
	IP          string              `json:"ip"`
	Mask        int                 `json:"mask"`
	Mac         string              `json:"mac"`
	PossibleMac []map[string]string `json:"possible_mac"`
}

type SubnetService

type SubnetService interface {
	List() ([]*Subnet, *http.Response, error)
	Get(ip string) (*Subnet, *http.Response, error)
	UpdateWarring(req *SubnetUpdateRequest) (*Subnet, *http.Response, error)

	GetMac(ip string) (*SubnetMac, *http.Response, error)
	CreateMac(ip string) (*SubnetMac, *http.Response, error)
	DeleteMac(ip string) (*SubnetMac, *http.Response, error)
}

SubnetService represents a service to work with Subnet.

type SubnetServiceImpl

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

func (*SubnetServiceImpl) CreateMac

func (s *SubnetServiceImpl) CreateMac(netIP string) (*SubnetMac, *http.Response, error)

CreateMac Generate a separate MAC address See: https://robot.your-server.de/doc/webservice/en.html#put-subnet-net-ip-mac

func (*SubnetServiceImpl) DeleteMac

func (s *SubnetServiceImpl) DeleteMac(netIP string) (*SubnetMac, *http.Response, error)

DeleteMac Remove a separate MAC address and set it to the default value (The MAC address of the servers main IP address). See: https://robot.your-server.de/doc/webservice/en.html#delete-subnet-net-ip-mac

func (*SubnetServiceImpl) Get

func (s *SubnetServiceImpl) Get(netIP string) (*Subnet, *http.Response, error)

Get Query data of a specific subnet See: https://robot.your-server.de/doc/webservice/en.html#get-subnet-net-ip

func (*SubnetServiceImpl) GetMac

func (s *SubnetServiceImpl) GetMac(netIP string) (*SubnetMac, *http.Response, error)

GetMac Query if it is possible to set a separate MAC address. See: https://robot.your-server.de/doc/webservice/en.html#get-subnet-net-ip-mac

func (*SubnetServiceImpl) List

func (s *SubnetServiceImpl) List() ([]*Subnet, *http.Response, error)

List Query list of all subnets See: https://robot.your-server.de/doc/webservice/en.html#get-subnet

func (*SubnetServiceImpl) UpdateWarring

func (s *SubnetServiceImpl) UpdateWarring(req *SubnetUpdateRequest) (*Subnet, *http.Response, error)

UpdateWarring Update traffic warning options for a subnet See: https://robot.your-server.de/doc/webservice/en.html#post-subnet-net-ip

type SubnetUpdateRequest

type SubnetUpdateRequest struct {
	NetIP           string // Net IP
	TrafficWarnings string `url:"traffic_warnings"` // Enable/disable traffic warnings (true, false)
	TrafficHourly   string `url:"traffic_hourly"`   // Hourly traffic limit in MB
	TrafficDaily    string `url:"traffic_daily"`    // Daily traffic limit in MB
	TrafficMonthly  string `url:"traffic_monthly"`  // Monthly traffic limit in GB
}

type Traffic

type Traffic struct {
	Type string                    `json:"type"`
	From string                    `json:"from"`
	To   string                    `json:"to"`
	Data map[string]TrafficDataRow `json:"data"`
}

type TrafficDataRow

type TrafficDataRow struct {
	In  float64 `json:"in"`
	Out float64 `json:"out"`
	Sum float64 `json:"sum"`
}

type TrafficGroup

type TrafficGroup struct {
	Type string                               `json:"type"`
	From string                               `json:"from"`
	To   string                               `json:"to"`
	Data map[string]map[string]TrafficDataRow `json:"data"`
}

type TrafficRequest

type TrafficRequest struct {
	IP           []string `url:"ip,brackets"`     // One or more IP addresses
	Subnet       []string `url:"subnet,brackets"` // One or more subnet addresses
	From         string   `url:"from"`            // Date/Time from
	To           string   `url:"to"`              // Date/Time to
	Type         string   `url:"type"`            // For type "day" the data is grouped by hours, for type "month" by days and for type "year" by months.
	SingleValues bool     `url:"single_values" `  // If set to "true" the traffic data is returned not as a sum over the whole interval but grouped by hour, day or month (optional)
}

type TrafficService

type TrafficService interface {
	Get(req TrafficRequest) (*Traffic, *http.Response, error)
	GetByGroup(req TrafficRequest) (*TrafficGroup, *http.Response, error)
}

TrafficService represents a service to work with Traffic.

type TrafficServiceImpl

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

func (*TrafficServiceImpl) Get

Get Query traffic data for multiple IPs or Subnet See: https://robot.your-server.de/doc/webservice/en.html#post-traffic

func (*TrafficServiceImpl) GetByGroup

GetByGroup Query traffic data for multiple IPs or Subnet, traffic data is returned not as a sum over the whole interval but grouped by hour, day or month See: https://robot.your-server.de/doc/webservice/en.html#post-traffic

type Transaction

type Transaction struct {
	Id            string        `json:"id"`
	Date          time.Time     `json:"date"`
	Status        string        `json:"status"`
	ServerNumber  interface{}   `json:"server_number"`
	ServerIp      interface{}   `json:"server_ip"`
	AuthorizedKey []interface{} `json:"authorized_key"`
	HostKey       []interface{} `json:"host_key"`
	Comment       interface{}   `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"`
		Location    interface{} `json:"location"`
	} `json:"product"`
	Addons []string `json:"addons"`
}

type UpdateServerRequest

type UpdateServerRequest struct {
	ServerNumber string // Server ID
	ServerName   string `url:"server_name"` // Server name
}

type Vnc

type Vnc struct {
	ServerIp      string   `json:"server_ip"`
	ServerIpv6Net string   `json:"server_ipv6_net"`
	ServerNumber  int      `json:"server_number"`
	Dist          []string `json:"dist"`
	Arch          []int    `json:"arch"`
	Lang          []string `json:"lang"`
	Active        bool     `json:"active"`
	Password      *string  `json:"password"`
}

type WOL

type WOL struct {
	ServerIp      string `json:"server_ip"`
	ServerIpv6Net string `json:"server_ipv6_net"`
	ServerNumber  int    `json:"server_number"`
}

type WOLService

type WOLService interface {
	Create(serverIP string) (*WOL, *http.Response, error)
	Get(serverIP string) (*WOL, *http.Response, error)
}

WOLService represents a service to work with Wake on LAN service.

type WOLServiceImpl

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

func (*WOLServiceImpl) Create

func (s *WOLServiceImpl) Create(serverNumber string) (*WOL, *http.Response, error)

Create Send Wake On LAN packet to server See: https://robot.your-server.de/doc/webservice/en.html#post-wol-server-number

func (*WOLServiceImpl) Get

func (s *WOLServiceImpl) Get(serverNumber string) (*WOL, *http.Response, error)

Get Query Wake On LAN data See: https://robot.your-server.de/doc/webservice/en.html#get-wol-server-number

type Windows

type Windows struct {
	ServerIp      string   `json:"server_ip"`
	ServerIpv6Net string   `json:"server_ipv6_net"`
	ServerNumber  int      `json:"server_number"`
	Dist          []string `json:"dist"`
	Lang          []string `json:"lang"`
	Active        bool     `json:"active"`
	Password      *string  `json:"password"`
}

type WithdrawOrderRequest

type WithdrawOrderRequest struct {
	ServerNumber   string // Server ID
	ReversalReason string `url:"reversal_reason"` // Reason for withdrawal, optional
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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