<!-- Code generated by gomarkdoc. DO NOT EDIT -->

# 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>)


<a name="AddTrackContainer"></a>
## func [AddTrackContainer](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/TrackContainers.go#L26>)

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

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

<a name="CheckID"></a>
## func [CheckID](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/TrackContainers.go#L212>)

```go
func CheckID(ID string) (string, error)
```

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

<a name="GetServerPort"></a>
## func [GetServerPort](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/container.go#L170>)

```go
func GetServerPort(IpAddress string) (string, error)
```

GetServerPort Helper function to do find out server port information

<a name="GetSpecs"></a>
## func [GetSpecs](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/ServerSpecs.go#L14>)

```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

<a name="PrettyPrint"></a>
## func [PrettyPrint](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/ServerSpecs.go#L54>)

```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

<a name="RemoveContainerGroups"></a>
## func [RemoveContainerGroups](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L139>)

```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

<a name="RemoveContianer"></a>
## func [RemoveContianer](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/container.go#L84>)

```go
func RemoveContianer(IP string, ID string) error
```

RemoveContianer Stops and removes container from the server

<a name="RemoveGroup"></a>
## func [RemoveGroup](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L47>)

```go
func RemoveGroup(GroupID string) error
```

RemoveGroup Removes group based on the group ID provided

<a name="RemoveTrackedContainer"></a>
## func [RemoveTrackedContainer](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/TrackContainers.go#L82>)

```go
func RemoveTrackedContainer(id string) error
```

RemoveTrackedContainer This function removos tracked container from the trackcontainer JSON file

<a name="StartContainer"></a>
## func [StartContainer](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/container.go#L24>)

```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

<a name="ViewContainers"></a>
## func [ViewContainers](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/container.go#L130>)

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

ViewContainers This function displays all containers available on server side

<a name="Group"></a>
## type [Group](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L18-L24>)

Group Information about a single group

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

<a name="AddContainerToGroup"></a>
### func [AddContainerToGroup](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L73>)

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

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

<a name="CreateGroup"></a>
### func [CreateGroup](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L27>)

```go
func CreateGroup() (*Group, error)
```

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

<a name="GetGroup"></a>
### func [GetGroup](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L166>)

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

GetGroup Gets group information based on group id provided

<a name="RemoveContainerGroup"></a>
### func [RemoveContainerGroup](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L104>)

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

RemoveContainerGroup Remove Container from the group ID specified

<a name="Group.AddContainer"></a>
### func \(\*Group\) [AddContainer](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L250>)

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

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

<a name="Group.AddGroupToFile"></a>
### func \(\*Group\) [AddGroupToFile](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L186>)

```go
func (grp *Group) AddGroupToFile() error
```

AddGroupToFile Adds Group struct to the GroupTrackContainer File

<a name="Group.RemoveContainerGroup"></a>
### func \(\*Group\) [RemoveContainerGroup](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L256>)

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

RemoveContainerGroup Removes container information from the group

<a name="Groups"></a>
## type [Groups](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L13-L15>)

Groups Data Structure type

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

<a name="ReadGroup"></a>
### func [ReadGroup](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L207>)

```go
func ReadGroup() (*Groups, error)
```

ReadGroup Function reads grouptrackcontainers.json and converts result to Groups

<a name="Groups.RemoveContainerGroups"></a>
### func \(\*Groups\) [RemoveContainerGroups](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L268>)

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

RemoveContainerGroups removes container found in all groups

<a name="Groups.WriteGroup"></a>
### func \(\*Groups\) [WriteGroup](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L231>)

```go
func (grp *Groups) WriteGroup() error
```

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

<a name="ResponseMAPPort"></a>
## type [ResponseMAPPort](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/MAPPort.go#L9-L11>)



```go
type ResponseMAPPort struct {
    IPAddress string
}
```

<a name="MAPPort"></a>
### func [MAPPort](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/MAPPort.go#L13>)

```go
func MAPPort(port string, domainName string) (*ResponseMAPPort, error)
```



<a name="TrackContainer"></a>
## type [TrackContainer](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/TrackContainers.go#L19-L23>)

TrackContainer Stores information of current containers

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

<a name="GetContainerInformation"></a>
### func [GetContainerInformation](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/TrackContainers.go#L153>)

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

GetContainerInformation gets information about container based on container ID provided

<a name="TrackContainer.ModifyContainerGroups"></a>
### func \(\*TrackContainer\) [ModifyContainerGroups](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/GroupTrackContainer.go#L285>)

```go
func (TC *TrackContainer) ModifyContainerGroups() error
```

ModifyContainerGroups Modifies container information is all groups available

<a name="TrackContainer.ModifyContainerInformation"></a>
### func \(\*TrackContainer\) [ModifyContainerInformation](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/TrackContainers.go#L170>)

```go
func (TC *TrackContainer) ModifyContainerInformation() error
```

ModifyContainerInformation Modifies information inside the container

<a name="TrackContainers"></a>
## type [TrackContainers](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/TrackContainers.go#L14-L16>)

TrackContainers This struct stores arrays of current containers running

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

<a name="ReadTrackContainers"></a>
### func [ReadTrackContainers](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/TrackContainers.go#L134>)

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

ReadTrackContainers Reads containers which are currently tracked

<a name="ViewTrackedContainers"></a>
### func [ViewTrackedContainers](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/TrackContainers.go#L120>)

```go
func ViewTrackedContainers() (error, *TrackContainers)
```

ViewTrackedContainers View Containers currently tracked

<a name="TrackContainers.WriteContainers"></a>
### func \(\*TrackContainers\) [WriteContainers](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/client/TrackContainers.go#L195>)

```go
func (TC *TrackContainers) WriteContainers() error
```

WriteContainers Write information back to the config file

Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
