Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) GetClusterFirewallRules(nodeName string) ([]FirewallRule, error)
- func (c *Client) GetClusterResources() ([]Resource, error)
- func (c *Client) GetFirewallRules(res Resource) ([]FirewallRule, error)
- func (c *Client) GetNodeNetwork(nodeName string) ([]NodeNetworkInterface, error)
- func (c *Client) GetNodes() ([]Node, error)
- func (c *Client) GetRawResponse(url string) (interface{}, error)
- func (c *Client) SendRequest(req *http.Request) (responseBody []byte, err error)
- type FirewallRule
- type Node
- type NodeNetworkInterface
- type Resource
Constants ¶
const ( TypeVM = "qemu" TypeNode = "node" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client http.Client and connection information
func NewClient ¶
func NewClient(i connection.Info, transportSettings *http.Transport) *Client
NewClient create new client with TLS check disabled and information to log with a token to the API
func (*Client) GetClusterFirewallRules ¶
func (c *Client) GetClusterFirewallRules(nodeName string) ([]FirewallRule, error)
GetClusterFirewallRules query the /nodes/<node name>/network URL on the Proxmox API
func (*Client) GetClusterResources ¶
GetClusterResources query the /cluster/resources URL on the Proxmox API
func (*Client) GetFirewallRules ¶
func (c *Client) GetFirewallRules(res Resource) ([]FirewallRule, error)
GetFirewallRules query the /nodes/<node name>/firewall/rules or the /nodes/<node name>/qemu/<VMID>/firewall/rules URL on the Proxmox API
func (*Client) GetNodeNetwork ¶
func (c *Client) GetNodeNetwork(nodeName string) ([]NodeNetworkInterface, error)
GetNodeNetwork query the /nodes/<node name>/network URL on the Proxmox API
func (*Client) GetRawResponse ¶
GetRawResponse query the API endpoint and return a map containing the response body
type FirewallRule ¶
type FirewallRule struct { //Mandatory Action string `json:"action"` //ACCEPT, DROP, REJECT or security group RuleType string `json:"type"` //in, out or group //Optional Comment string `json:"comment"` Destination string `json:"dest"` DestinationPort string `json:"dport"` Enable string `json:"enable"` NetworkInterface string `json:"iface"` LogLevel string `json:"log"` // emerg, alert, crit, err, warning, notice, info, debug or nolog Position int `json:"pos"` Protocol string `json:"prot"` Source string `json:"source"` SourcePort string `json:"sport"` }
FirewallRuleVM VM firewall rule following iptables-based firewall service
type Node ¶
type Node struct { Name string `json:"node,omitempty"` Status string `json:"status"` SslFingerprint string `json:"ssl_fingerprint,omitempty"` }
Node Node resource type at /nodes
type NodeNetworkInterface ¶
type NodeNetworkInterface struct { Name string `json:"iface"` InterfaceType string `json:"type"` Active int `json:"active"` IPAddress string `json:"address"` Gateway string `json:"gateway"` Autostart int `json:"autostart"` BridgePorts string `json:"bridge_ports"` CIDR string `json:"cidr"` Families []string `json:"families"` Options []string `json:"options"` }
NodeNetworkInterface Network interface for a given Node at /nodes/<node name>/network
type Resource ¶
type Resource struct { AllocatedCPU float64 `json:"maxcpu"` AllocatedRAMBytes int `json:"maxmem"` // bytes CPU float64 `json:"cpu"` // % ID string `json:"id"` Name string `json:"name,omitempty"` Node string `json:"node"` Pool string `json:"pool,omitempty"` RAM int `json:"mem"` // bytes Status string `json:"status"` Template int `json:"template,omitempty"` Type string `json:"type,omitempty"` Uptime int `json:"uptime"` // sec VMID int `json:"vmid,omitempty"` }
Resource resource at /cluster/resources