client

package
v0.0.0-...-9d99875 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTrackContainer

func AddTrackContainer(d *docker.DockerVM, ipAddress string) error

AddTrackContainer Adds new container which has been added to the track container

func CheckID

func CheckID(ID string) (string, error)

CheckID Checks if the ID belongs to a group or a single container

func GetServerPort

func GetServerPort(IpAddress string) (string, error)

GetServerPort Helper function to do find out server port information

func GetSpecs

func GetSpecs(IP string) (*server.SysInfo, error)

GetSpecs Gets Specs from the server such CPU, GPU usage and other basic information which helps set a cluster of computer

func PrettyPrint

func PrettyPrint(data interface{})

PrettyPrint print the contents of the obj ( Reference: https://stackoverflow.com/questions/24512112/how-to-print-struct-variables-in-console

func RemoveContainerGroups

func RemoveContainerGroups(ContainerID string) error

RemoveContainerGroups Remove Container from groups (i.e which ever groups has information about that container). This is mostly called when a container is deleted or removed from the tracked container list

func RemoveContianer

func RemoveContianer(IP string, ID string) error

RemoveContianer Stops and removes container from the server

func RemoveGroup

func RemoveGroup(GroupID string) error

RemoveGroup Removes group based on the group ID provided

func RemoveTrackedContainer

func RemoveTrackedContainer(id string) error

RemoveTrackedContainer This function removos tracked container from the trackcontainer JSON file

func StartContainer

func StartContainer(IP string, NumPorts int, GPU bool, ContainerName string) (*docker.DockerVM, error)

StartContainer Start container using REST api Implementation From the selected server IP address TODO: Test cases for this function Calls URL ex: http://0.0.0.0:8088/startcontainer?ports=0&GPU=false&ContainerName=docker-ubuntu-sshd

func UpdateIpTable

func UpdateIpTable(IpAddress string, serverPort string) error

UpdateIpTable Does the following to update it's IP table

func UpdateIpTableListClient

func UpdateIpTableListClient() error

UpdateIpTableListClient updates IP tables (Default 3 hops) based on server information available on the ip tables

func UploadMultipartFile

func UploadMultipartFile(client http.Client, uri, key, path string) ([]byte, error)

func ViewContainers

func ViewContainers(IP string) (*docker.DockerContainers, error)

ViewContainers This function displays all containers available on server side

Types

type Group

type Group struct {
	ID                 string            `json:"ID"`
	TrackContainerList []*TrackContainer `json:"TrackContainer"`
	// contains filtered or unexported fields
}

Group Information about a single group

func AddContainerToGroup

func AddContainerToGroup(ContainerID string, GroupID string) (*Group, error)

AddContainerToGroup Adds container information to the Group based on the Group ID

func CreateGroup

func CreateGroup() (*Group, error)

CreateGroup Creates a new group to add a set of track containers

func GetGroup

func GetGroup(GroupID string) (*Group, error)

GetGroup Gets group information based on group id provided

func RemoveContainerGroup

func RemoveContainerGroup(ContainerID string, GroupID string) (*Group, error)

RemoveContainerGroup Remove Container from the group ID specified

func (*Group) AddContainer

func (grp *Group) AddContainer(Container *TrackContainer) error

AddContainer Adds a container to the Tracked container list of the group

func (*Group) AddGroupToFile

func (grp *Group) AddGroupToFile() error

AddGroupToFile Adds Group struct to the GroupTrackContainer File

func (*Group) RemoveContainerGroup

func (grp *Group) RemoveContainerGroup(Container *TrackContainer) error

RemoveContainerGroup Removes container information from the group

type Groups

type Groups struct {
	GroupList []*Group `json:"Groups"`
}

Groups Data Structure type

func ReadGroup

func ReadGroup() (*Groups, error)

ReadGroup Function reads grouptrackcontainers.json and converts result to Groups

func (*Groups) RemoveContainerGroups

func (grp *Groups) RemoveContainerGroups(Container *TrackContainer) error

RemoveContainerGroups removes container found in all groups

func (*Groups) WriteGroup

func (grp *Groups) WriteGroup() error

WriteGroup Function to write type Groups to the grouptrackcontainers.json file

type TrackContainer

type TrackContainer struct {
	Id        string           `json:"ID"`
	Container *docker.DockerVM `json:"Container"`
	IpAddress string           `json:"IpAddress"`
}

TrackContainer Stores information of current containers

func GetContainerInformation

func GetContainerInformation(ID string) (*TrackContainer, error)

GetContainerInformation gets information about container based on container ID provided

func (*TrackContainer) ModifyContainerGroups

func (TC *TrackContainer) ModifyContainerGroups() error

ModifyContainerGroups Modifies container information is all groups available

func (*TrackContainer) ModifyContainerInformation

func (TC *TrackContainer) ModifyContainerInformation() error

ModifyContainerInformation Modifies information inside the container

type TrackContainers

type TrackContainers struct {
	TrackContainerList []TrackContainer `json:"TrackContainer"`
}

TrackContainers This struct stores arrays of current containers running

func ReadTrackContainers

func ReadTrackContainers(filename string) (*TrackContainers, error)

ReadTrackContainers Reads containers which are currently tracked

func ViewTrackedContainers

func ViewTrackedContainers() (error, *TrackContainers)

ViewTrackedContainers View Containers currently tracked

func (*TrackContainers) WriteContainers

func (TC *TrackContainers) WriteContainers() error

WriteContainers Write information back to the config file

Jump to

Keyboard shortcuts

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