Documentation ¶
Index ¶
- Constants
- type Allocation
- type AllocationAttributes
- type ClientServer
- type ClientServerConsoleCommand
- type ClientServerPowerAction
- type ClientServerUtilization
- type ClientServers
- type CrocConfig
- func (config *CrocConfig) CreateLocation(newLocation LocationAttributes) (Location, error)
- func (config *CrocConfig) CreateNode(newNode NodeAttributes) (Node, error)
- func (config *CrocConfig) CreateNodeAllocations(newNodeAllocations AllocationAttributes, nodeID int) error
- func (config *CrocConfig) CreateServer(newServer ServerChange) (Server, error)
- func (config *CrocConfig) CreateUser(newUser UserAttributes) (User, error)
- func (config *CrocConfig) DeleteLocation(locationID int) error
- func (config *CrocConfig) DeleteNode(nodeID int) error
- func (config *CrocConfig) DeleteNodeAllocation(nodeID int, allocID int) error
- func (config *CrocConfig) DeleteServer(serverid int) error
- func (config *CrocConfig) DeleteUser(userID int) error
- func (config *CrocConfig) EditLocation(editLocation LocationAttributes, locationID int) (Location, error)
- func (config *CrocConfig) EditNode(editNode NodeAttributes, nodeID int) (Node, error)
- func (config *CrocConfig) EditServerBuild(newServer ServerChange, serverid int) (Server, error)
- func (config *CrocConfig) EditServerDetails(newServer ServerChange, serverid int) (Server, error)
- func (config *CrocConfig) EditServerStartup(newServer ServerChange, serverid int) (Server, error)
- func (config *CrocConfig) EditUser(editUser UserAttributes, userID int) (User, error)
- func (config *CrocConfig) GetEggs() (Eggs, error)
- func (config *CrocConfig) GetLocation(locationID int) (Location, error)
- func (config *CrocConfig) GetLocationByPage(pageID int) (Locations, error)
- func (config *CrocConfig) GetLocations() (Locations, error)
- func (config *CrocConfig) GetNests() (Nests, error)
- func (config *CrocConfig) GetNode(nodeID int) (Node, error)
- func (config *CrocConfig) GetNodeAllocationByID(nodeID int, allocationID int) (int, bool, error)
- func (config *CrocConfig) GetNodeAllocationByPort(nodeID int, portNum int) (int, bool, error)
- func (config *CrocConfig) GetNodeAllocations(nodeID int) (NodeAllocations, error)
- func (config *CrocConfig) GetNodeAllocationsByPage(nodeID int, pageID int) (NodeAllocations, error)
- func (config *CrocConfig) GetNodes() (Nodes, error)
- func (config *CrocConfig) GetNodesByPage(pageID int) (Nodes, error)
- func (config *CrocConfig) GetServer(serverid int) (Server, error)
- func (config *CrocConfig) GetServerAllocations(serverid int) ([]int, error)
- func (config *CrocConfig) GetServers() (Servers, error)
- func (config *CrocConfig) GetUser(userID int) (User, error)
- func (config *CrocConfig) GetUserByExternal(externalID string) (User, error)
- func (config *CrocConfig) GetUserByPage(pageID int) (User, error)
- func (config *CrocConfig) GetUsers() (Users, error)
- type Egg
- type Eggs
- type Error
- type ErrorResponse
- type Links
- type Location
- type LocationAttributes
- type Locations
- type Meta
- type Nest
- type Nests
- type Node
- type NodeAllocations
- type NodeAttributes
- type Nodes
- type Pagination
- type Server
- type ServerAllocRetalionData
- type ServerAllocation
- type ServerAttributes
- type ServerChange
- type ServerContainer
- type ServerFeatureLimits
- type ServerLimits
- type ServerRealtions
- type ServerRelData
- type ServerRelDataAttributes
- type Servers
- type User
- type UserAttributes
- type Users
Constants ¶
const VERSION = "0.0.2-alpha"
VERSION of crocgodyl follows Semantic Versioning. (http://semver.org/)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocation ¶
type Allocation struct { Object string `json:"object,omitempty"` Attributes AllocationAttributes `json:"attributes,omitempty"` }
Allocation is the struct for an allocation on the node
type AllocationAttributes ¶
type AllocationAttributes struct { ID int `json:"id,omitempty"` IP string `json:"ip,omitempty"` Alias string `json:"alias,omitempty"` Port int `json:"port,omitempty"` Ports []string `json:"ports,omitempty"` Assigned bool `json:"assigned,omitempty"` }
AllocationAttributes is the struct for the allocations on the node.
type ClientServer ¶
type ClientServer struct { Object string `json:"object"` Attributes struct { ServerOwner bool `json:"server_owner"` Identifier string `json:"identifier"` UUID string `json:"uuid"` Name string `json:"name"` Description string `json:"description"` Limits struct { Memory int `json:"memory"` Swap int `json:"swap"` Disk int `json:"disk"` Io int `json:"io"` CPU int `json:"cpu"` } `json:"limits"` FeatureLimits struct { Databases int `json:"databases"` Allocations int `json:"allocations"` } `json:"feature_limits"` } `json:"attributes"` }
ClientServer is the server object view returning single server information. GET this from the '/api/client/servers/<server_ID>' endpoint
type ClientServerConsoleCommand ¶
type ClientServerConsoleCommand struct {
Command string `json:"command"`
}
ClientServerConsoleCommand is the struct for sending a command for the server console GET this from the '/api/client/servers/<server_ID>/command' endpoint
type ClientServerPowerAction ¶
type ClientServerPowerAction struct {
Signal string `json:"signal"`
}
ClientServerPowerAction is the struct for sending a power command for the server GET this from the '/api/client/servers/<server_ID>/power' endpoint
type ClientServerUtilization ¶
type ClientServerUtilization struct { Object string `json:"object"` Attributes struct { State string `json:"state"` Memory struct { Current int `json:"current"` Limit int `json:"limit"` } `json:"memory"` CPU struct { Current float64 `json:"current"` Cores []float64 `json:"cores"` Limit int `json:"limit"` } `json:"cpu"` Disk struct { Current int `json:"current"` Limit int `json:"limit"` } `json:"disk"` } `json:"attributes"` }
ClientServerUtilization is the server statistics reported by the daemon. GET this from the '/api/client/servers/<server_ID>/utilization' endpoint
type ClientServers ¶
type ClientServers struct { Object string `json:"object"` ClientServer []ClientServer `json:"data"` Meta struct { Pagination struct { Total int `json:"total"` Count int `json:"count"` PerPage int `json:"per_page"` CurrentPage int `json:"current_page"` TotalPages int `json:"total_pages"` Links []interface{} `json:"links"` } `json:"pagination"` } `json:"meta"` }
ClientServers is the default all servers view for the client API. GET this from the '/api/client' endpoint
type CrocConfig ¶
CrocConfig is the config for crocgodyl
func NewCrocConfig ¶
func NewCrocConfig(panelURL string, clientToken string, appToken string) (config *CrocConfig, err error)
NewCrocConfig sets up the API interface with
func (*CrocConfig) CreateLocation ¶
func (config *CrocConfig) CreateLocation(newLocation LocationAttributes) (Location, error)
CreateLocation creates a user.
func (*CrocConfig) CreateNode ¶
func (config *CrocConfig) CreateNode(newNode NodeAttributes) (Node, error)
CreateNode creates a user.
func (*CrocConfig) CreateNodeAllocations ¶
func (config *CrocConfig) CreateNodeAllocations(newNodeAllocations AllocationAttributes, nodeID int) error
CreateNodeAllocations creates a user. the panel does not response with a repsonse but a 204
func (*CrocConfig) CreateServer ¶
func (config *CrocConfig) CreateServer(newServer ServerChange) (Server, error)
CreateServer creates a new server via the API. A complete ServerChange is required.
func (*CrocConfig) CreateUser ¶
func (config *CrocConfig) CreateUser(newUser UserAttributes) (User, error)
CreateUser creates a user.
func (*CrocConfig) DeleteLocation ¶
func (config *CrocConfig) DeleteLocation(locationID int) error
DeleteLocation deletes a location. It only requires a locationID as an int
func (*CrocConfig) DeleteNode ¶
func (config *CrocConfig) DeleteNode(nodeID int) error
DeleteNode send a delete request to the panel for a node Returns any errors from the panel in json format
func (*CrocConfig) DeleteNodeAllocation ¶
func (config *CrocConfig) DeleteNodeAllocation(nodeID int, allocID int) error
DeleteNodeAllocation send a delete request to the panel for a node allocation. Returns any errors from the panel in json format.
func (*CrocConfig) DeleteServer ¶
func (config *CrocConfig) DeleteServer(serverid int) error
DeleteServer deletes a server. It only requires a server id as a string
func (*CrocConfig) DeleteUser ¶
func (config *CrocConfig) DeleteUser(userID int) error
DeleteUser deletes a user. It only requires a user id as a string
func (*CrocConfig) EditLocation ¶
func (config *CrocConfig) EditLocation(editLocation LocationAttributes, locationID int) (Location, error)
EditLocation creates a user.
func (*CrocConfig) EditNode ¶
func (config *CrocConfig) EditNode(editNode NodeAttributes, nodeID int) (Node, error)
EditNode edits a nodes information.
func (*CrocConfig) EditServerBuild ¶
func (config *CrocConfig) EditServerBuild(newServer ServerChange, serverid int) (Server, error)
EditServerBuild creates a new server via the API. The server name and user are required when updating a server.
func (*CrocConfig) EditServerDetails ¶
func (config *CrocConfig) EditServerDetails(newServer ServerChange, serverid int) (Server, error)
EditServerDetails creates a new server via the API. The server name and user are required when updating a server.
func (*CrocConfig) EditServerStartup ¶
func (config *CrocConfig) EditServerStartup(newServer ServerChange, serverid int) (Server, error)
EditServerStartup creates a new server via the API. The server name and user are required when updating a server.
func (*CrocConfig) EditUser ¶
func (config *CrocConfig) EditUser(editUser UserAttributes, userID int) (User, error)
EditUser creates a user. Send a UserAttributes to the panel to update the user. You cannot edit the id or created/updated fields for the user.
func (*CrocConfig) GetEggs ¶
func (config *CrocConfig) GetEggs() (Eggs, error)
GetEggs returns all available nodes.
func (*CrocConfig) GetLocation ¶
func (config *CrocConfig) GetLocation(locationID int) (Location, error)
GetLocation returns a single location by locationID.
func (*CrocConfig) GetLocationByPage ¶
func (config *CrocConfig) GetLocationByPage(pageID int) (Locations, error)
GetLocationByPage returns all available locations by page.
func (*CrocConfig) GetLocations ¶
func (config *CrocConfig) GetLocations() (Locations, error)
GetLocations returns all available nodes. Depending on how man locations you have this may take a while.
func (*CrocConfig) GetNests ¶
func (config *CrocConfig) GetNests() (Nests, error)
GetNests returns all available nodes.
func (*CrocConfig) GetNode ¶
func (config *CrocConfig) GetNode(nodeID int) (Node, error)
GetNode inforation on a single node. nodeID is an int
func (*CrocConfig) GetNodeAllocationByID ¶
GetNodeAllocationByID returns the allocation id and assigned status
func (*CrocConfig) GetNodeAllocationByPort ¶
GetNodeAllocationByPort returns the allocation id and assigned status
func (*CrocConfig) GetNodeAllocations ¶
func (config *CrocConfig) GetNodeAllocations(nodeID int) (NodeAllocations, error)
GetNodeAllocations information on a single node. Depending on how man allocations you have this may take a while.
func (*CrocConfig) GetNodeAllocationsByPage ¶
func (config *CrocConfig) GetNodeAllocationsByPage(nodeID int, pageID int) (NodeAllocations, error)
GetNodeAllocationsByPage information on a single node by page count. nodeID is an int
func (*CrocConfig) GetNodes ¶
func (config *CrocConfig) GetNodes() (Nodes, error)
GetNodes returns all available nodes.
func (*CrocConfig) GetNodesByPage ¶
func (config *CrocConfig) GetNodesByPage(pageID int) (Nodes, error)
GetNodesByPage inforation on a single node. nodeID is an int
func (*CrocConfig) GetServer ¶
func (config *CrocConfig) GetServer(serverid int) (Server, error)
GetServer returns Information on a single server.
func (*CrocConfig) GetServerAllocations ¶
func (config *CrocConfig) GetServerAllocations(serverid int) ([]int, error)
GetServerAllocations will return a list of allocations for the server in a []int array
func (*CrocConfig) GetServers ¶
func (config *CrocConfig) GetServers() (Servers, error)
GetServers returns all available servers.
func (*CrocConfig) GetUser ¶
func (config *CrocConfig) GetUser(userID int) (User, error)
GetUser returns Information on a single user.
func (*CrocConfig) GetUserByExternal ¶
func (config *CrocConfig) GetUserByExternal(externalID string) (User, error)
GetUserByExternal returns Information on a single user by their externalID. The externalID is a string as that is what the panel requires.
func (*CrocConfig) GetUserByPage ¶
func (config *CrocConfig) GetUserByPage(pageID int) (User, error)
GetUserByPage returns Information on users by their page number. The externalID is a string as that is what the panel requires.
func (*CrocConfig) GetUsers ¶
func (config *CrocConfig) GetUsers() (Users, error)
GetUsers returns Information on all users.
type Egg ¶
type Egg struct { Object string `json:"object"` Attributes struct { ID int `json:"id"` UUID string `json:"uuid"` Nest int `json:"nest"` Author string `json:"author"` Description string `json:"description"` DockerImage string `json:"docker_image"` Config struct { Files struct { ConfigYml struct { Parser string `json:"parser"` Find struct { Listeners0QueryEnabled bool `json:"listeners[0].query_enabled"` Listeners0QueryPort string `json:"listeners[0].query_port"` Listeners0Host string `json:"listeners[0].host"` ServersAddress struct { One27111 string `json:"127.1.1.1"` Localhost string `json:"localhost"` } `json:"servers.*.address"` } `json:"find"` } `json:"config.yml"` } `json:"files"` Startup struct { Done string `json:"done"` UserInteraction []string `json:"userInteraction"` } `json:"startup"` Stop string `json:"stop"` Logs struct { Custom bool `json:"custom"` Location string `json:"location"` } `json:"logs"` Extends interface{} `json:"extends"` } `json:"config"` Startup string `json:"startup"` Script struct { Privileged bool `json:"privileged"` Install string `json:"install"` Entry string `json:"entry"` Container string `json:"container"` Extends interface{} `json:"extends"` } `json:"script"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } `json:"attributes"` }
Egg is the struct for an egg on the panel.
type Error ¶
type Error struct { Code string `json:"code,omitempty"` Status string `json:"status,omitempty"` Detail string `json:"detail,omitempty"` Source struct { Field string `json:"field,omitempty"` } `json:"source,omitempty"` }
Error is the struct from the panels for errors.
type ErrorResponse ¶
type ErrorResponse struct {
Errors []Error `json:"errors"`
}
ErrorResponse is the response from the panels for errors.
type Links ¶
type Links struct { Previous string `json:"previous,omitempty"` Next string `json:"next,omitempty"` }
Links is the struct for the links in the Pagination struct
type Location ¶
type Location struct { Object string `json:"object,omitempty"` Attributes LocationAttributes `json:"attributes,omitempty"` }
Location is the struct for a single location. GET this from the '/api/application/locations/<location_ID>` endpoint
type LocationAttributes ¶
type LocationAttributes struct { ID int `json:"id,omitempty"` Short string `json:"short,omitempty"` Long string `json:"long,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` }
LocationAttributes is the struct for a locations attributes. GET this from the '/api/application/locations/<location_ID>` endpoint You can only edit the short and long(description) names on a location.
type Locations ¶
type Locations struct { Object string `json:"object,omitempty"` Locations []Location `json:"data,omitempty"` Meta Meta `json:"meta,omitempty"` }
Locations is the struct for all the nodes added to the panel. GET this from the '/api/application/locations` endpoint
type Meta ¶
type Meta struct {
Pagination Pagination `json:"pagination,omitempty"`
}
Meta is the meta information on some queries
type Nest ¶
type Nest struct { Object string `json:"object"` Attributes struct { ID int `json:"id"` UUID string `json:"uuid"` Author string `json:"author"` Name string `json:"name"` Description string `json:"description"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } `json:"attributes"` }
Nest is the struct for a nest on the panel.
type Nests ¶
type Nests struct { Object string `json:"object"` Nest []Nest `json:"data"` Meta struct { Pagination struct { Total int `json:"total"` Count int `json:"count"` PerPage int `json:"per_page"` CurrentPage int `json:"current_page"` TotalPages int `json:"total_pages"` Links []interface{} `json:"links"` } `json:"pagination"` } `json:"meta"` }
Nests is the struct for the nests on the panel.
type Node ¶
type Node struct { Object string `json:"object,omitempty"` Attributes NodeAttributes `json:"attributes,omitempty"` }
Node is the struct for a single node.
type NodeAllocations ¶
type NodeAllocations struct { Object string `json:"object,omitempty"` Allocations []Allocation `json:"data,omitempty"` Meta Meta `json:"meta,omitempty"` }
NodeAllocations are the allocations for a single node.
type NodeAttributes ¶
type NodeAttributes struct { ID int `json:"id,omitempty"` Public bool `json:"public,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` LocationID int `json:"location_id,omitempty"` Fqdn string `json:"fqdn,omitempty"` Scheme string `json:"scheme,omitempty"` BehindProxy bool `json:"behind_proxy,omitempty"` MaintenanceMode bool `json:"maintenance_mode,omitempty"` Memory int `json:"memory,omitempty"` MemoryOverallocate int `json:"memory_overallocate"` Disk int `json:"disk,omitempty"` DiskOverallocate int `json:"disk_overallocate"` UploadSize int `json:"upload_size,omitempty"` DaemonListen int `json:"daemon_listen,omitempty"` DaemonSftp int `json:"daemon_sftp,omitempty"` DaemonBase string `json:"daemon_base,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
NodeAttributes is the struct for the attributes of a node
type Nodes ¶
type Nodes struct { Object string `json:"object,omitempty"` Node []Node `json:"data,omitempty"` Meta Meta `json:"meta,omitempty"` }
Nodes is the struct for all the nodes added to the panel.
type Pagination ¶
type Pagination struct { Total int `json:"total,omitempty"` Count int `json:"count,omitempty"` PerPage int `json:"per_page,omitempty"` CurrentPage int `json:"current_page,omitempty"` TotalPages int `json:"total_pages,omitempty"` Links []Links `json:"links"` }
Pagination is the information how many responses there on a page and how many pages there are.
type Server ¶
type Server struct { Object string `json:"object,omitempty"` Attributes ServerAttributes `json:"attributes,omitempty"` }
Server is the struct for a server on the panel.
type ServerAllocRetalionData ¶
type ServerAllocRetalionData struct { Object string `json:"object,omitempty"` Attributes struct { ID int `json:"id,omitempty"` IP string `json:"ip,omitempty"` Alias string `json:"alias,omitempty"` Port int `json:"port,omitempty"` Assigned bool `json:"assigned,omitempty"` } }
ServerAllocRetalionData is the struct for Allocation Relationships on a Server
type ServerAllocation ¶
type ServerAllocation struct { Default int `json:"default,omitempty"` Additional []int `json:"additional,omitempty"` }
ServerAllocation is only used when creating a server
type ServerAttributes ¶
type ServerAttributes struct { ID int `json:"id,omitempty"` ExternalID interface{} `json:"external_id,omitempty"` UUID string `json:"uuid,omitempty"` Identifier string `json:"identifier,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Suspended bool `json:"suspended,omitempty"` Limits ServerLimits `json:"limits,omitempty"` FeatureLimits ServerFeatureLimits `json:"feature_limits,omitempty"` User int `json:"user,omitempty"` Node int `json:"node,omitempty"` Allocation int `json:"allocation,omitempty"` Relationships ServerRealtions `json:"relationships,omitempty"` Nest int `json:"nest,omitempty"` Egg int `json:"egg,omitempty"` Pack interface{} `json:"pack,omitempty"` Container ServerContainer `json:"container,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` }
ServerAttributes are the attributes for a server.
type ServerChange ¶
type ServerChange struct { Name string `json:"name,omitempty"` User int `json:"user,omitempty"` Egg int `json:"egg,omitempty"` DockerImage string `json:"docker_image,omitempty"` Startup string `json:"startup,omitempty"` Environment map[string]string `json:"environment,omitempty"` Limits ServerLimits `json:"limits,omitempty"` FeatureLimits ServerFeatureLimits `json:"feature_limits,omitempty"` Allocation ServerAllocation `json:"allocation,omitempty"` }
ServerChange is the struct for the required data for creating/modifying a server.
type ServerContainer ¶
type ServerContainer struct { StartupCommand string `json:"startup_command,omitempty"` Image string `json:"image,omitempty"` Installed bool `json:"installed,omitempty"` Environment map[string]string `json:"environment,omitempty"` }
ServerContainer is the config on the docker container the server runs in.
type ServerFeatureLimits ¶
type ServerFeatureLimits struct { Databases int `json:"databases,omitempty"` Allocations int `json:"allocations,omitempty"` }
ServerFeatureLimits this is the limit on Databases and extra Allocations on a server
type ServerLimits ¶
type ServerLimits struct { Memory int `json:"memory,omitempty"` Swap int `json:"swap,omitempty"` Disk int `json:"disk,omitempty"` Io int `json:"io,omitempty"` CPU int `json:"cpu,omitempty"` }
ServerLimits are the system resource limits for a server
type ServerRealtions ¶
type ServerRealtions struct { Allocations struct { Object string `json:"object,omitempty"` Data []ServerAllocRetalionData `json:"data,omitempty"` } `json:"allocations,omitempty"` }
ServerRealtions is the struct for Relationships for a Server
type ServerRelData ¶
type ServerRelData struct { Object string `json:"object,omitempty"` Attributes ServerRelDataAttributes `json:"attributes,omitempty"` }
ServerRelData is the data for the server relationship
type ServerRelDataAttributes ¶
type ServerRelDataAttributes struct { ID int `json:"id,omitempty"` IP string `json:"ip,omitempty"` Alias interface{} `json:"alias,omitempty"` Port int `json:"port,omitempty"` Assigned bool `json:"assigned,omitempty"` }
ServerRelDataAttributes are the attributes for the server relationship data
type Servers ¶
type Servers struct { Object string `json:"object,omitempty"` Server []Server `json:"data,omitempty"` Meta Meta `json:"meta,omitempty"` }
Servers is the struct for the servers on the panel.
type User ¶
type User struct { Object string `json:"object,omitempty"` Attributes UserAttributes `json:"attributes,omitempty"` }
User is the struct for all the panel users. GET this from the '/api/application/users/<user_ID>` endpoint The panel does not and will not return a password. You can update a password using the API.
type UserAttributes ¶
type UserAttributes struct { ID int `json:"id,omitempty"` ExternalID string `json:"external_id,omitempty"` UUID string `json:"uuid,omitempty"` Username string `json:"username,omitempty"` Email string `json:"email,omitempty"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` Language string `json:"language,omitempty"` RootAdmin bool `json:"root_admin,omitempty"` TwoFa bool `json:"2fa,omitempty"` Password string `json:"password,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
UserAttributes is the struct for all the panel users.