Documentation
¶
Overview ¶
Package models hosts all sharing models between api endpoints.
Index ¶
- type APIResponse
- type ClientBase
- type CloudImage
- type CloudServer
- type Container
- type DNSRecord
- type DNSZone
- type Database
- type DatabaseUser
- type EnvironmentVariable
- type ErrorResponse
- type Filtering
- type Grant
- type IP
- type IPAddress
- type Job
- type JobDetails
- type Kernel
- type Log
- type Pagination
- type Partition
- type Port
- type SSHKey
- type Server
- type Stack
- type StackImage
- type StackImageVersion
- type Subscription
- type User
- type Volume
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
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 CloudImage ¶ added in v0.4.0
type CloudImage struct {
ID string `json:"id"`
ClientID string `json:"client_id"`
Label string `json:"label"`
Code string `json:"code"`
Version string `json:"version"`
// this is a string in the api docs for the cloud image call...
// but below, in the cloud stack image call, it's a struct...
Labels string `json:"labels"`
Changelog string `json:"changelog"`
DateAdded string `json:"date_added"`
DateUpdated string `json:"date_updated"`
IsPublic shtypes.MaybeBool `json:"is_public"`
IsMissing shtypes.MaybeBool `json:"is_missing"`
ProjectID string `json:"project_id"`
RegistryID string `json:"registry_id"`
ForkedFrom string `json:"forked_from"`
Pending string `json:"pending"`
ClientName string `json:"client_name"`
ImageType string `json:"image_type"`
RegistryURL string `json:"registry_url"`
VersionCount int `json:"version_count"`
ContainerCount int `json:"container_count"`
BuildStatus string `json:"build_status"`
}
CloudImage represents an image in the /cloud/images.
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 Database ¶ added in v0.4.0
type Database struct {
ID string `json:"id"`
DBName string `json:"db_name"`
MySQLHost string `json:"mysql_host"`
Size interface{} `json:"size"`
ClientID string `json:"client_id"`
ServerID string `json:"server_id"`
Pending string `json:"pending"`
IsMissing string `json:"is_missing"`
DateAdded string `json:"date_added"`
DateUpdated string `json:"date_updated"`
ServerName string `json:"server_name"`
ServerLabel string `json:"server_label"`
ServerIP string `json:"server_ip"`
ServerOwner bool `json:"server_owner"`
Container string `json:"container"`
Grants []Grant `json:"grants"`
}
Database represents a database on a cloud server. Some properties may or may not be populated depending on how we call.
type DatabaseUser ¶ added in v0.4.0
type DatabaseUser struct {
Username string `json:"username"`
Password string `json:"password"`
MysqlHost string `json:"mysql_host"`
ServerID string `json:"server_id"`
ClientID string `json:"client_id"`
Pending interface{} `json:"pending"`
IsMissing string `json:"is_missing"`
DateAdded string `json:"date_added"`
DateUpdated string `json:"date_updated"`
ServerName string `json:"server_name"`
ServerLabel string `json:"server_label"`
Grants []Grant `json:"grants"`
}
DatabaseUser represents a database user on a cloud server.
type EnvironmentVariable ¶ added in v0.3.1
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 Filtering ¶ added in v0.4.0
type Filtering struct {
SortBy string `url:"filters[sort_by],omitempty"`
SortDir string `url:"filters[sort_dir],omitempty"`
PageSize int `url:"filters[page_size],omitempty"`
PageNumber int `url:"filters[page_number],omitempty"`
}
Filtering is a struct for filtering results.
type Grant ¶ added in v0.4.0
type Grant struct {
DBName string `json:"db_name"`
Username string `json:"username"`
Host string `json:"host"`
MySQLHost string `json:"mysql_host"`
Grants []string `json:"grants"`
Pending interface{} `json:"pending"`
IsMissing string `json:"is_missing"`
DateAdded string `json:"date_added"`
DateUpdated string `json:"date_updated"`
}
Grant represents database grants.
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 IPAddress ¶ added in v0.4.0
type IPAddress struct {
IP string `json:"ip_addr"`
Netmask string `json:"netmask"`
Prefix string `json:"prefix"`
Reserved string `json:"reserved"`
RDNS string `json:"rdns"`
Family string `json:"addr_family"`
DateAllocated string `json:"date_allocated"`
}
IPAddress does what it says on the can. It's an IP address.
type JobDetails ¶
type JobDetails struct {
State string `json:"state"`
Created string `json:"created"`
Started string `json:"started"`
Completed string `json:"completed"`
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"`
CustomImageAccess shtypes.MaybeBool `json:"custom_image_access"`
}
SSHKey represents an SSH key in the SiteHost Api.
type Server ¶
type Server struct {
Name string `json:"name"`
Label string `json:"label"`
ClientID shtypes.MaybeString `json:"client_id"`
Created string `json:"created"`
Type string `json:"type"`
RAM string `json:"ram"`
Root string `json:"root"`
Disk shtypes.MaybeBigInt `json:"disk"`
Cores shtypes.MaybeBigInt `json:"cores"`
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 StackImage ¶ added in v0.4.0
type StackImage struct {
ID string `json:"id"`
ClientID string `json:"client_id"`
Label string `json:"label"`
Code string `json:"code"`
Version string `json:"version"`
Labels map[string]interface{} `json:"labels"`
Changelog string `json:"changelog"`
DateAdded string `json:"date_added"`
DateUpdated string `json:"date_updated"`
IsPublic shtypes.MaybeBool `json:"is_public"`
IsMissing shtypes.MaybeBool `json:"is_missing"`
ProjectID string `json:"project_id"`
RegistryID string `json:"registry_id"`
ForkedFrom string `json:"forked_from"`
Pending interface{} `json:"pending"`
ClientName string `json:"client_name"`
ImageType string `json:"image_type"`
RegistryURL string `json:"registry_url"`
VersionCount int `json:"version_count"`
ContainerCount int `json:"container_count"`
BuildStatus string `json:"build_status"`
Versions []StackImageVersion `json:"versions"`
}
StackImage represents an image in the /cloud/stack/images.
type StackImageVersion ¶ added in v0.4.0
type StackImageVersion struct {
ID string `json:"id"`
ClientID string `json:"client_id"`
ImageIDs string `json:"image_id"`
Version string `json:"version"`
Labels string `json:"labels"`
DateAdded string `json:"date_added"`
DateUpdated string `json:"date_updated"`
IsMissing string `json:"is_missing"`
ForceConfig string `json:"force_config"`
BuildID string `json:"build_id"`
BuildStatus string `json:"build_status"`
Pending interface{} `json:"pending"`
}
StackImageVersion stores the version information for a StackImage.
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.
type User ¶ added in v0.4.0
type User struct {
Username string `json:"username"`
ServerID string `json:"server_id"`
ClientID string `json:"client_id"`
HomeDir string `json:"home_dir"`
SSHKeys []SSHKey `json:"ssh_keys"`
Pending interface{} `json:"pending"`
IsMissing shtypes.MaybeBool `json:"is_missing"`
DateAdded string `json:"date_added"`
DateUpdated string `json:"date_updated"`
ServerName string `json:"server_name"`
ServerLabel string `json:"server_label"`
ServerOwner shtypes.MaybeBool `json:"server_owner"`
Image string `json:"image"`
Containers []string `json:"containers"`
Volumes []string `json:"volumes"`
ReadOnlyConfig shtypes.MaybeBool `json:"read_only_config"`
IPAddr string `json:"ip_addr"`
}
User represents a SSH/SFTP user.
type Volume ¶ added in v0.4.0
type Volume struct {
Hash string `json:"hash"`
Source struct {
Filename string `json:"filename"`
URL string `json:"url"`
} `json:"source"`
Type string `json:"type"`
Volumes struct {
Application struct {
Dest string `json:"dest"`
GID int `json:"gid"`
Mode string `json:"mode"`
UID int `json:"uid"`
} `json:"application"`
} `json:"volumes"`
}
Volume is for storing the volume information for a container.