ssclient

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HOST_MAP = map[string]string{
	"02": "https://api.netooze.com",
	"04": "https://api.netooze.com",
	"06": "https://api.netooze.com",
	"07": "https://api.netooze.com",
	"08": "https://api.netooze.com",
	"09": "https://api.netooze.com",
	"0a": "https://api.netooze.com",
}

Functions

This section is empty.

Types

type BaseClientError

type BaseClientError struct {
	Msg string
	Err error
}

func (*BaseClientError) Error

func (e *BaseClientError) Error() string

func (*BaseClientError) Unwrap

func (e *BaseClientError) Unwrap() error

type ErrorBodyResponse

type ErrorBodyResponse struct {
	Errors []*struct {
		Code    int    `json:"code,omitempty"`
		Message string `json:"message,omitempty"`
	} `json:"errors,omitempty"`
}

type LocationEntity

type LocationEntity struct {
	ID                     string `json:"id,omitempty"`
	SystemVolumeMin        int    `json:"system_volume_min,omitempty"`
	AdditionalVolumeMin    int    `json:"additional_volume_min,omitempty"`
	VolumeMax              int    `json:"volume_max,omitempty"`
	WindowsSystemVolumeMin int    `json:"windows_system_volume_min,omitempty"`
	BandwidthMin           int    `json:"bandwidth_min,omitempty"`
	BandwidthMax           int    `json:"bandwidth_max,omitempty"`
	CPUQuantityOptions     []int  `json:"cpu_quantity_options,omitempty"`
	RAMSizeOptions         []int  `json:"ram_size_options,omitempty"`
}

type LocationEntityWrap

type LocationEntityWrap struct {
	Location *LocationEntity `json:"location,omitempty"`
}

type NICEntity

type NICEntity struct {
	ID            int         `json:"id,omitempty"`
	ServerID      string      `json:"server_id,omitempty"`
	NetworkID     string      `json:"network_id,omitempty"`
	MAC           string      `json:"mac,omitempty"`
	IPAddress     string      `json:"ip_address,omitempty"`
	Mask          int         `json:"mask,omitempty"`
	Gateway       string      `json:"gateway,omitempty"`
	BandwidthMBPS int         `json:"bandwidth_mbps,omitempty"`
	NetworkType   NetworkType `json:"network_type,omitempty"`
}

type NetworkData

type NetworkData struct {
	NetworkID string `json:"network_id,omitempty"`
	Bandwidth int    `json:"bandwidth_mbps,omitempty"`
}

type NetworkResponse

type NetworkResponse struct {
	ID            string   `json:"id,omitempty"`
	Name          string   `json:"name,omitempty"`
	LocationID    string   `json:"location_id,omitempty"`
	Description   string   `json:"description,omitempty"`
	NetworkPrefix string   `json:"network_prefix,omitempty"`
	Mask          int      `json:"mask,omitempty"`
	ServerIDS     []string `json:"server_ids,omitempty"`
	State         string   `json:"state,omitempty"`
	Created       string   `json:"created,omitempty"`
}

type NetworkType

type NetworkType string
const (
	PublicSharedNetwork NetworkType = "PublicShared"
	IsolatedNetwork     NetworkType = "Isolated"
)

type RequestError

type RequestError struct {
	BaseClientError
	Response *resty.Response
	Status   int
	Body     string
}

func NewRequestError

func NewRequestError(response *resty.Response, err error) *RequestError

func (*RequestError) Error

func (e *RequestError) Error() string

type SSClient

type SSClient struct {
	Key  string
	Host string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(key string, host string) (*SSClient, error)

func (*SSClient) CreateNIC

func (c *SSClient) CreateNIC(serverID, networkID string, bandwidth int) (*TaskIDWrap, error)

func (*SSClient) CreateNICAndWait

func (c *SSClient) CreateNICAndWait(serverID, networkID string, bandwidth int) (*NICEntity, error)

func (*SSClient) CreateNetwork

func (c *SSClient) CreateNetwork(
	name string,
	locationID string,
	description string,
	networkPrefix string,
	mask int,
) (*TaskIDWrap, error)

func (*SSClient) CreateNetworkAndWait

func (c *SSClient) CreateNetworkAndWait(
	name string,
	locationID string,
	description string,
	networkPrefix string,
	mask int,
) (*NetworkResponse, error)

func (*SSClient) CreateSSHKey

func (c *SSClient) CreateSSHKey(
	name string,
	publicKey string,
) (*SSHResponse, error)

func (*SSClient) CreateServer

func (c *SSClient) CreateServer(
	name string,
	locationID string,
	imageID string,
	cpu int,
	ram int,
	volumes []*VolumeData,
	networks []*NetworkData,
	sshKeyIds []int,
) (*TaskIDWrap, error)

func (*SSClient) CreateServerAndWait

func (c *SSClient) CreateServerAndWait(
	name string,
	locationID string,
	imageID string,
	cpu int,
	ram int,
	volumes []*VolumeData,
	networks []*NetworkData,
	sshKeyIds []int,
) (*ServerResponse, error)

func (*SSClient) CreateVolume

func (c *SSClient) CreateVolume(serverID, name string, size int) (*TaskIDWrap, error)

func (*SSClient) CreateVolumeAndWait

func (c *SSClient) CreateVolumeAndWait(
	serverID string,
	name string,
	size int,
) (*VolumeEntity, error)

func (*SSClient) DeleteNIC

func (c *SSClient) DeleteNIC(serverID string, nicID int) error

func (*SSClient) DeleteNetwork

func (c *SSClient) DeleteNetwork(networkID string) error

func (*SSClient) DeleteSSHKey

func (c *SSClient) DeleteSSHKey(sshID int) error

func (*SSClient) DeleteServer

func (c *SSClient) DeleteServer(serverID string) error

func (*SSClient) DeleteVolume

func (c *SSClient) DeleteVolume(serverID string, volumeID int) error

func (*SSClient) GetLocationList

func (c *SSClient) GetLocationList() ([]*LocationEntity, error)

func (*SSClient) GetNIC

func (c *SSClient) GetNIC(serverID string, nicID int) (*NICEntity, error)

func (*SSClient) GetNICList

func (c *SSClient) GetNICList(serverID string) ([]*NICEntity, error)

func (*SSClient) GetNetwork

func (c *SSClient) GetNetwork(networkID string) (*NetworkResponse, error)

func (*SSClient) GetSSHKey

func (c *SSClient) GetSSHKey(sshID int) (*SSHResponse, error)

func (*SSClient) GetServer

func (c *SSClient) GetServer(serverID string) (*ServerResponse, error)

func (*SSClient) GetSnapshotList

func (c *SSClient) GetSnapshotList(serverID string) ([]*SnapshotEntity, error)

func (*SSClient) GetTask

func (c *SSClient) GetTask(taskID string) (*TaskResponse, error)

func (*SSClient) GetVolume

func (c *SSClient) GetVolume(serverID string, volumeID int) (*VolumeEntity, error)

func (*SSClient) UpdateNetwork

func (c *SSClient) UpdateNetwork(networkID, name, description string) (*TaskIDWrap, error)

func (*SSClient) UpdateNetworkAndWait

func (c *SSClient) UpdateNetworkAndWait(networkID, name, description string) (*NetworkResponse, error)

func (*SSClient) UpdatePublicNIC

func (c *SSClient) UpdatePublicNIC(serverID string, nicID, bandwidth int) (*TaskIDWrap, error)

func (*SSClient) UpdatePublicNICAndWait

func (c *SSClient) UpdatePublicNICAndWait(serverID string, nicID, bandwidth int) (*NICEntity, error)

func (*SSClient) UpdateServer

func (c *SSClient) UpdateServer(serverID string, cpu int, ram int) (*TaskIDWrap, error)

func (*SSClient) UpdateServerAndWait

func (c *SSClient) UpdateServerAndWait(serverID string, cpu int, ram int) (*ServerResponse, error)

func (*SSClient) UpdateVolume

func (c *SSClient) UpdateVolume(
	serverID string,
	volumeID int,
	name string,
	size int,
) (*TaskIDWrap, error)

func (*SSClient) UpdateVolumeAndWait

func (c *SSClient) UpdateVolumeAndWait(
	serverID string,
	volumeID int,
	name string,
	size int,
) (*VolumeEntity, error)

type SSHResponse

type SSHResponse struct {
	ID        int    `json:"id,omitempty"`
	Name      string `json:"name,omitempty"`
	PublicKey string `json:"public_key,omitempty"`
}

type ServerResponse

type ServerResponse struct {
	ID         string          `json:"id,omitempty"`
	Name       string          `json:"name,omitempty"`
	LocationID string          `json:"location_id,omitempty"`
	State      string          `json:"state,omitempty"`
	CPU        int             `json:"cpu,omitempty"`
	RAM        int             `json:"ram_mb,omitempty"`
	Volumes    []*VolumeEntity `json:"volumes,omitempty"`
	NICS       []*NICEntity    `json:"nics,omitempty"`
	SSHKeyIDS  []int           `json:"ssh_key_ids,omitempty"`
}

type SnapshotEntity

type SnapshotEntity struct {
	ID       int    `json:"id,omitempty"`
	ServerID string `json:"server_id,omitempty"`
	Name     string `json:"name,omitempty"`
	SizeMB   int    `json:"size_mb,omitempty"`
	Created  string `json:"created,omitempty"`
}

type SnapshotEntityWrap

type SnapshotEntityWrap struct {
	Snapshot *SnapshotEntity `json:"snapshot,omitempty"`
}

type TaskIDWrap

type TaskIDWrap struct {
	ID string `json:"task_id,omitempty"`
}

type TaskResponse

type TaskResponse struct {
	ID          string `json:"id,omitempty"`
	Created     string `json:"created,omitempty"`
	Completed   string `json:"completed,omitempty"`
	IsCompleted string `json:"is_completed,omitempty"`

	ServerID   string `json:"server_id,omitempty"`
	LocationID string `json:"location_id,omitempty"`
	NetworkID  string `json:"network_id,omitempty"`
	VolumeID   int    `json:"volume_id,omitempty"`
	NicID      int    `json:"nic_id,omitempty"`
	SnapshotID int    `json:"snapshot_id,omitempty"`
	DomainID   string `json:"domain_id,omitempty"`
	RecordID   int    `json:"record_id,omitempty"`
}

type VolumeData

type VolumeData struct {
	Name   string `json:"name,omitempty"`
	SizeMB int    `json:"size_mb,omitempty"`
}

type VolumeEntity

type VolumeEntity struct {
	ID      int    `json:"id,omitempty"`
	Name    string `json:"name,omitempty"`
	Size    int    `json:"size_mb,omitempty"`
	Created string `json:"created,omitempty"`
}

type WrongKeyFormatError

type WrongKeyFormatError struct {
	BaseClientError
}

func NewWrongKeyFormatError

func NewWrongKeyFormatError(err error) *WrongKeyFormatError

Jump to

Keyboard shortcuts

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