models

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 3 Imported by: 4

Documentation

Overview

Package models hosts all sharing models between api endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponse

type APIResponse struct {
	Msg    string `json:"msg"`
	Status bool   `json:"status"`
}

APIResponse represents mutual API response values.

type ClientBase

type ClientBase struct {
	// Base URL for API request. Always be specified with a trailing slash.
	BaseURL *url.URL

	// User agent used when communicating with the SiteHost API.
	UserAgent string

	// API Credentials
	APIKey   string
	ClientID string
}

ClientBase includes the base variables for the client struct.

type CloudServer added in v0.3.1

type CloudServer struct {
	ID                  string   `json:"id"`
	ClientID            string   `json:"client_id"`
	Name                string   `json:"name"`
	Label               string   `json:"label"`
	State               string   `json:"state"`
	PrimaryIP           string   `json:"primary_ip"`
	IPAddrProxy         string   `json:"ip_addr_proxy"`
	ProductID           string   `json:"product_id"`
	Owner               bool     `json:"owner"`
	ImagesUsed          []string `json:"images_used"`
	ImagesRemaining     int      `json:"images_remaining"`
	ContainersRemaining int      `json:"containers_remaining"`
}

CloudServer is a view of a server that can run stacks on. This server also exists under the server API.

type Container added in v0.3.1

type Container struct {
	Name        string      `json:"name"`
	ContainerID string      `json:"container_id"`
	State       string      `json:"state"`
	Size        string      `json:"size"`
	DateCreated string      `json:"date_created"`
	SslEnabled  bool        `json:"ssl_enabled"`
	IsMissing   interface{} `json:"is_missing"`
	Pending     interface{} `json:"pending"`
}

Container represents a container inside a stack.

type DNSRecord added in v0.3.1

type DNSRecord struct {
	ID         string `json:"id"`
	ClientID   string `json:"client_id"`
	Name       string `json:"name"`
	Domain     string `json:"domain"`
	Type       string `json:"type"`
	Content    string `json:"content"`
	TTL        string `json:"ttl"`
	Priority   string `json:"prio"`
	ChangeDate string `json:"change_date"`
	State      string `json:"state"`
}

DNSRecord A dns record from a zone.

type DNSZone added in v0.3.1

type DNSZone struct {
	Name       string `json:"name"`
	ClientID   string `json:"client_id"`
	TemplateID string `json:"template_id"`
	Pending    string `json:"pending"`
}

DNSZone represent a DNS domain.

type EnvironmentVariable added in v0.3.1

type EnvironmentVariable struct {
	Name    string `json:"name"`
	Content string `json:"content"`
}

EnvironmentVariable is a stack environment variable key-pair.

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response `json:"-"`
	Message  string         `json:"msg"`
	Status   bool           `json:"status"`
}

ErrorResponse reports the error caused by an API request.

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

Error returns a ErrorResponse message.

type IP

type IP struct {
	ID         string `json:"id"`
	ServerID   string `json:"server_id"`
	Bridge     string `json:"bridge"`
	MacAddr    string `json:"mac_addr"`
	IPType     string `json:"ip_type"`
	Prefix     string `json:"prefix"`
	Primary    bool   `json:"primary"`
	AddrFamily int    `json:"addr_family"`
	NetworkID  string `json:"network_id"`
	Rdns       string `json:"rdns"`
	IPAddr     string `json:"ip_addr"`
	Network    string `json:"network"`
	Gateway    string `json:"gateway"`
	Netmask    string `json:"netmask"`
	Broadcast  string `json:"broadcast"`
}

IP represents the ips attached to the Server.

type JobDetails

type JobDetails struct {
	Created   string `json:"created"`
	Started   string `json:"started"`
	Completed string `json:"completed"`
	Message   string `json:"message"`
	State     string `json:"state"`
	Logs      []Log  `json:"logs"`
}

JobDetails represents the job information.

type Kernel

type Kernel struct {
	Default    bool   `json:"default"`
	Kernel     string `json:"kernel"`
	Initrd     string `json:"initrd"`
	Modules    string `json:"modules"`
	Hypervisor string `json:"hypervisor"`
}

Kernel represents the kernel available to the Server.

type Log

type Log struct {
	Date    string `json:"date"`
	Level   string `json:"level"`
	Message string `json:"message"`
}

Log represents the logs attached to the JobDetails.

type Pagination added in v0.3.1

type Pagination struct {
	TotalItems   int `json:"total_items"`
	CurrentItems int `json:"current_items"`
	CurrentPage  int `json:"current_page"`
	TotalPages   int `json:"total_pages"`
}

Pagination represents the pagination information return by the API.

type Partition

type Partition struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	Device         string `json:"device"`
	Mountpoint     string `json:"mountpoint"`
	Size           string `json:"size"`
	NewSize        string `json:"new_size"`
	Fstype         string `json:"fstype"`
	Drbd           string `json:"drbd"`
	Backup         string `json:"backup"`
	DiskTotal      string `json:"disk_total"`
	DiskUsed       string `json:"disk_used"`
	InodesTotal    string `json:"inodes_total"`
	InodesUsed     string `json:"inodes_used"`
	AlertThreshold string `json:"alert_threshold"`
	Type           string `json:"type"`
}

Partition represents the disk partitions attached to the Server.

type SSHKey added in v0.3.1

type SSHKey struct {
	ID          string `json:"id"`
	ClientID    string `json:"client_id"`
	Label       string `json:"label"`
	Content     string `json:"content"`
	DateAdded   string `json:"date_added"`
	DateUpdated string `json:"date_updated"`
}

SSHKey represents an SSH key in the SiteHost Api.

type Server

type Server struct {
	Name             string `json:"name"`
	Label            string `json:"label"`
	ClientID         string `json:"client_id,string"`
	Created          string `json:"created"`
	Type             string `json:"type"`
	RAM              string `json:"ram"`
	Root             string `json:"root"`
	Disk             int64  `json:"disk,string"`
	Cores            int    `json:"cores,string"`
	Core             string `json:"core"`
	Arch             string `json:"arch"`
	Kernel           string `json:"kernel"`
	Initrd           string `json:"initrd"`
	Modules          string `json:"modules"`
	Distro           string `json:"distro"`
	Os               string `json:"os"`
	Rescue           string `json:"rescue"`
	Managed          string `json:"managed"`
	Locked           string `json:"locked"`
	LockedFrom       string `json:"locked_from"`
	LockedUntil      string `json:"locked_until"`
	LockedComment    string `json:"locked_comment"`
	State            string `json:"state"`
	MaintDate        string `json:"maint_date"`
	MaintDateEnd     string `json:"maint_date_end"`
	EmailLogs        string `json:"email_logs"`
	VncPort          string `json:"vnc_port"`
	VncScreen        string `json:"vnc_screen"`
	IPAddrLimit      string `json:"ip_addr_limit"`
	Notes            string `json:"notes"`
	Ips              []IP
	Interfaces       []string      `json:"interfaces"`
	GroupID          string        `json:"group_id"`
	Partitions       []Partition   `json:"partitions"`
	BackupTypes      []interface{} `json:"backup_types"`
	AvailableKernels []Kernel      `json:"available_kernels"`
	ProductCode      string        `json:"product_code"`
	ProductType      string        `json:"product_type"`
	ProductName      string        `json:"product_name"`
	Subscription     Subscription  `json:"subscription"`
	LocationName     string        `json:"location_name"`
	LocationCode     string        `json:"location_code"`
	Mirror           string        `json:"mirror"`
	LastJob          JobDetails    `json:"last_job"`
	BackupsEnabled   bool          `json:"backups_enabled"`
	BackupsProduct   interface{}   `json:"backups_product"`
	LocationNode     string        `json:"location_node"`
}

Server represents a Server in the SiteHost.

type Stack added in v0.3.1

type Stack struct {
	ClientID    string      `json:"client_id"`
	ServerID    string      `json:"server_id"`
	Server      string      `json:"server_name"`
	ServerLabel string      `json:"server_label"`
	Name        string      `json:"name"`
	Label       string      `json:"label"`
	DockerFile  string      `json:"docker_file"`
	IPAddress   string      `json:"ip_addr_server"`
	DateAdded   string      `json:"date_added"`
	DateUpdated string      `json:"date_updated"`
	Containers  []Container `json:"containers"`
	ServerOwner bool        `json:"server_owner"`
	Pending     interface{} `json:"pending"`
	IsMissing   interface{} `json:"is_missing"`
}

Stack represents a cloud stack and it's configuration.

type Subscription

type Subscription struct {
	Code  string `json:"code"`
	Name  string `json:"name"`
	Price string `json:"price"`
}

Subscription represents the subscription attached to the Server.

Jump to

Keyboard shortcuts

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