libvirtApiClient

package
v0.0.0-...-b654961 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 6

Documentation

Index

Constants

View Source
const HostURL string = "http://127.0.0.1:8050"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	UserID   int    `json:"user_id"`
	Username string `json:"username"`
	Token    string `json:"token"`
}

type AuthStruct

type AuthStruct struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type BindDiskResponse

type BindDiskResponse struct {
	ID      string `json:"id"`
	Path    string `json:"path"`
	Target  string `json:"target"`
	Address string `json:"address"`
}

type Client

type Client struct {
	HostURL    string
	HTTPClient DoRequester
	Token      string
	Auth       AuthStruct
}

func NewClient

func NewClient(conf Config, requester DoRequester) (*Client, error)

func (*Client) BindDisk

func (c *Client) BindDisk(disk_id int, node_id string) (*BindDiskResponse, error)

func (*Client) CreateDisk

func (c *Client) CreateDisk(size int) (*Disk, error)

func (*Client) CreateLoadBalancer

func (c *Client) CreateLoadBalancer(bind_payload LoadBalancer) (string, error)

func (*Client) CreateNetwork

func (c *Client) CreateNetwork(name string) (*NetworkR, error)

func (*Client) DeleteDisk

func (c *Client) DeleteDisk(id int) error

func (*Client) DeleteLoadBalancer

func (c *Client) DeleteLoadBalancer(bind_payload LoadBalancer) error

func (*Client) DeleteNetwork

func (c *Client) DeleteNetwork(id int) error

func (*Client) GetAllLoadBalancers

func (c *Client) GetAllLoadBalancers() ([]LoadBalancer, error)

func (*Client) GetDisk

func (c *Client) GetDisk(id int) (*Disk, error)

func (*Client) GetDisks

func (c *Client) GetDisks() (*[]Disk, error)

func (*Client) GetLoadBalancer

func (c *Client) GetLoadBalancer(bind_payload LoadBalancer) (*LoadBalancer, bool, error)

func (*Client) GetNetwork

func (c *Client) GetNetwork(id int) (*NetworkR, error)

func (*Client) GetNetworkByName

func (c *Client) GetNetworkByName(name string) (*NetworkR, error)

func (*Client) GetNodeByMetadata

func (c *Client) GetNodeByMetadata() (*NodeV2, error)

func (*Client) GetNodeByName

func (c *Client) GetNodeByName(name string) (*NodeV2, error)

func (*Client) GetNodes

func (c *Client) GetNodes() (*[]NodeV2, error)

func (*Client) GetToken

func (c *Client) GetToken() string

func (*Client) SignIn

func (c *Client) SignIn() (*AuthResponse, error)

func (*Client) UnBindDisk

func (c *Client) UnBindDisk(disk_id int, node_id string) error

func (*Client) UpdateLoadBalancer

func (c *Client) UpdateLoadBalancer(bind_payload LoadBalancer) error

func (*Client) UpdateNetwork

func (c *Client) UpdateNetwork(network NetworkR) (*NetworkR, error)

type Config

type Config struct {
	Username *string `json:"username"`
	Password *string `json:"password"`
	Url      *string `json:"url"`
}

type Disk

type Disk struct {
	ID    int `json:"id"`
	VM_ID int `json:"vm_id"`
	Size  int `json:"size"`
}

type DoRequester

type DoRequester interface {
	Do(req *http.Request) (*http.Response, error)
}

type LoadBalancer

type LoadBalancer struct {
	Ports     []Port_Service `json:"ports"`
	Nodes     []Node         `json:"nodes"`
	Namespace string         `json:"namespace"`
	Name      string         `json:"name"`
	Ip        string         `json:"ip,omitempty"`
}

type NetworkInterface

type NetworkInterface struct {
	Mac     string `json:"mac"`
	Ip      string `json:"ip"`
	Name    string `json:"name"`
	Source  string `json:"source"`
	Model   string `json:"model"`
	Address string `json:"address"`
}

type NetworkR

type NetworkR struct {
	ID     int    `json:"id"`
	Name   string `json:"name"`
	Status int    `json:"status"`
}

type Node

type Node struct {
	Name string `json:"name"`
	IP   string `json:"ip"`
}

type NodeV2

type NodeV2 struct {
	ID        int                `json:"id"`
	Name      string             `json:"name"`
	Interface []NetworkInterface `json:"interface"`
	Type      string             `json:"type"`
	Disks     []Disk             `json:"disks"`
}

type PayloadAddSsh

type PayloadAddSsh struct {
	User string `json:"user"`
	Key  []byte `json:"key"`
}

to fix - test

type Port_Service

type Port_Service struct {
	Name     string `json:"name"`
	Protocol string `json:"protocol"`
	Port     int    `json:"port"`
	NodePort int    `json:"nodeport"`
}

type Worker

type Worker struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Internal string `json:"internal"`
	External string `json:"external"`
}

Jump to

Keyboard shortcuts

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