# client
```go
import "github.com/Akilan1999/p2p-rendering-computation/client"
```
## Index
- [func AddTrackContainer\(d \*docker.DockerVM, ipAddress string\) error](<#AddTrackContainer>)
- [func CheckID\(ID string\) \(string, error\)](<#CheckID>)
- [func GetServerPort\(IpAddress string\) \(string, error\)](<#GetServerPort>)
- [func GetSpecs\(IP string\) \(\*server.SysInfo, error\)](<#GetSpecs>)
- [func PrettyPrint\(data interface\{\}\)](<#PrettyPrint>)
- [func RemoveContainerGroups\(ContainerID string\) error](<#RemoveContainerGroups>)
- [func RemoveContianer\(IP string, ID string\) error](<#RemoveContianer>)
- [func RemoveGroup\(GroupID string\) error](<#RemoveGroup>)
- [func RemoveTrackedContainer\(id string\) error](<#RemoveTrackedContainer>)
- [func StartContainer\(IP string, NumPorts int, GPU bool, ContainerName string, baseImage string\) \(\*docker.DockerVM, error\)](<#StartContainer>)
- [func ViewContainers\(IP string\) \(\*docker.DockerContainers, error\)](<#ViewContainers>)
- [type Group](<#Group>)
- [func AddContainerToGroup\(ContainerID string, GroupID string\) \(\*Group, error\)](<#AddContainerToGroup>)
- [func CreateGroup\(\) \(\*Group, error\)](<#CreateGroup>)
- [func GetGroup\(GroupID string\) \(\*Group, error\)](<#GetGroup>)
- [func RemoveContainerGroup\(ContainerID string, GroupID string\) \(\*Group, error\)](<#RemoveContainerGroup>)
- [func \(grp \*Group\) AddContainer\(Container \*TrackContainer\) error](<#Group.AddContainer>)
- [func \(grp \*Group\) AddGroupToFile\(\) error](<#Group.AddGroupToFile>)
- [func \(grp \*Group\) RemoveContainerGroup\(Container \*TrackContainer\) error](<#Group.RemoveContainerGroup>)
- [type Groups](<#Groups>)
- [func ReadGroup\(\) \(\*Groups, error\)](<#ReadGroup>)
- [func \(grp \*Groups\) RemoveContainerGroups\(Container \*TrackContainer\) error](<#Groups.RemoveContainerGroups>)
- [func \(grp \*Groups\) WriteGroup\(\) error](<#Groups.WriteGroup>)
- [type ResponseMAPPort](<#ResponseMAPPort>)
- [func MAPPort\(port string, domainName string\) \(\*ResponseMAPPort, error\)](<#MAPPort>)
- [type TrackContainer](<#TrackContainer>)
- [func GetContainerInformation\(ID string\) \(\*TrackContainer, error\)](<#GetContainerInformation>)
- [func \(TC \*TrackContainer\) ModifyContainerGroups\(\) error](<#TrackContainer.ModifyContainerGroups>)
- [func \(TC \*TrackContainer\) ModifyContainerInformation\(\) error](<#TrackContainer.ModifyContainerInformation>)
- [type TrackContainers](<#TrackContainers>)
- [func ReadTrackContainers\(filename string\) \(\*TrackContainers, error\)](<#ReadTrackContainers>)
- [func ViewTrackedContainers\(\) \(error, \*TrackContainers\)](<#ViewTrackedContainers>)
- [func \(TC \*TrackContainers\) WriteContainers\(\) error](<#TrackContainers.WriteContainers>)
## func [AddTrackContainer]()
```go
func AddTrackContainer(d *docker.DockerVM, ipAddress string) error
```
AddTrackContainer Adds new container which has been added to the track container
## func [CheckID]()
```go
func CheckID(ID string) (string, error)
```
CheckID Checks if the ID belongs to a group or a single container
## func [GetServerPort]()
```go
func GetServerPort(IpAddress string) (string, error)
```
GetServerPort Helper function to do find out server port information
## func [GetSpecs]()
```go
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]()
```go
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]()
```go
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]()
```go
func RemoveContianer(IP string, ID string) error
```
RemoveContianer Stops and removes container from the server
## func [RemoveGroup]()
```go
func RemoveGroup(GroupID string) error
```
RemoveGroup Removes group based on the group ID provided
## func [RemoveTrackedContainer]()
```go
func RemoveTrackedContainer(id string) error
```
RemoveTrackedContainer This function removos tracked container from the trackcontainer JSON file
## func [StartContainer]()
```go
func StartContainer(IP string, NumPorts int, GPU bool, ContainerName string, baseImage 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 [ViewContainers]()
```go
func ViewContainers(IP string) (*docker.DockerContainers, error)
```
ViewContainers This function displays all containers available on server side
## type [Group]()
Group Information about a single group
```go
type Group struct {
ID string `json:"ID"`
TrackContainerList []*TrackContainer `json:"TrackContainer"`
// contains filtered or unexported fields
}
```
### func [AddContainerToGroup]()
```go
func AddContainerToGroup(ContainerID string, GroupID string) (*Group, error)
```
AddContainerToGroup Adds container information to the Group based on the Group ID
### func [CreateGroup]()
```go
func CreateGroup() (*Group, error)
```
CreateGroup Creates a new group to add a set of track containers
### func [GetGroup]()
```go
func GetGroup(GroupID string) (*Group, error)
```
GetGroup Gets group information based on group id provided
### func [RemoveContainerGroup]()
```go
func RemoveContainerGroup(ContainerID string, GroupID string) (*Group, error)
```
RemoveContainerGroup Remove Container from the group ID specified
### func \(\*Group\) [AddContainer]()
```go
func (grp *Group) AddContainer(Container *TrackContainer) error
```
AddContainer Adds a container to the Tracked container list of the group
### func \(\*Group\) [AddGroupToFile]()
```go
func (grp *Group) AddGroupToFile() error
```
AddGroupToFile Adds Group struct to the GroupTrackContainer File
### func \(\*Group\) [RemoveContainerGroup]()
```go
func (grp *Group) RemoveContainerGroup(Container *TrackContainer) error
```
RemoveContainerGroup Removes container information from the group
## type [Groups]()
Groups Data Structure type
```go
type Groups struct {
GroupList []*Group `json:"Groups"`
}
```
### func [ReadGroup]()
```go
func ReadGroup() (*Groups, error)
```
ReadGroup Function reads grouptrackcontainers.json and converts result to Groups
### func \(\*Groups\) [RemoveContainerGroups]()
```go
func (grp *Groups) RemoveContainerGroups(Container *TrackContainer) error
```
RemoveContainerGroups removes container found in all groups
### func \(\*Groups\) [WriteGroup]()
```go
func (grp *Groups) WriteGroup() error
```
WriteGroup Function to write type Groups to the grouptrackcontainers.json file
## type [ResponseMAPPort]()
```go
type ResponseMAPPort struct {
IPAddress string
}
```
### func [MAPPort]()
```go
func MAPPort(port string, domainName string) (*ResponseMAPPort, error)
```
## type [TrackContainer]()
TrackContainer Stores information of current containers
```go
type TrackContainer struct {
Id string `json:"ID"`
Container *docker.DockerVM `json:"Container"`
IpAddress string `json:"IpAddress"`
}
```
### func [GetContainerInformation]()
```go
func GetContainerInformation(ID string) (*TrackContainer, error)
```
GetContainerInformation gets information about container based on container ID provided
### func \(\*TrackContainer\) [ModifyContainerGroups]()
```go
func (TC *TrackContainer) ModifyContainerGroups() error
```
ModifyContainerGroups Modifies container information is all groups available
### func \(\*TrackContainer\) [ModifyContainerInformation]()
```go
func (TC *TrackContainer) ModifyContainerInformation() error
```
ModifyContainerInformation Modifies information inside the container
## type [TrackContainers]()
TrackContainers This struct stores arrays of current containers running
```go
type TrackContainers struct {
TrackContainerList []TrackContainer `json:"TrackContainer"`
}
```
### func [ReadTrackContainers]()
```go
func ReadTrackContainers(filename string) (*TrackContainers, error)
```
ReadTrackContainers Reads containers which are currently tracked
### func [ViewTrackedContainers]()
```go
func ViewTrackedContainers() (error, *TrackContainers)
```
ViewTrackedContainers View Containers currently tracked
### func \(\*TrackContainers\) [WriteContainers]()
```go
func (TC *TrackContainers) WriteContainers() error
```
WriteContainers Write information back to the config file
Generated by [gomarkdoc]()