Files
p2p-rendering-computation/plugin/docs.md

225 lines
7.3 KiB
Markdown

<!-- Code generated by gomarkdoc. DO NOT EDIT -->
# plugin
```go
import "github.com/Akilan1999/p2p-rendering-computation/plugin"
```
## Index
- [func CheckRunPlugin\(PluginName string, ID string\) error](<#CheckRunPlugin>)
- [func DeletePlugin\(pluginname string\) error](<#DeletePlugin>)
- [func DownloadPlugin\(pluginurl string\) error](<#DownloadPlugin>)
- [func RunPluginContainer\(PluginName string, ContainerID string\) error](<#RunPluginContainer>)
- [type ExecuteIP](<#ExecuteIP>)
- [func \(e \*ExecuteIP\) ModifyHost\(p \*Plugin\) error](<#ExecuteIP.ModifyHost>)
- [func \(e \*ExecuteIP\) RunAnsible\(p \*Plugin\) error](<#ExecuteIP.RunAnsible>)
- [type Host](<#Host>)
- [func ReadHost\(filename string\) \(\*Host, error\)](<#ReadHost>)
- [type Plugin](<#Plugin>)
- [func RunPlugin\(pluginName string, IPAddresses \[\]\*ExecuteIP\) \(\*Plugin, error\)](<#RunPlugin>)
- [func SearchPlugin\(pluginname string\) \(\*Plugin, error\)](<#SearchPlugin>)
- [func \(p \*Plugin\) AutoSetPorts\(containerID string\) error](<#Plugin.AutoSetPorts>)
- [func \(p \*Plugin\) CopyToTmpPlugin\(\) error](<#Plugin.CopyToTmpPlugin>)
- [func \(p \*Plugin\) ExecutePlugin\(\) error](<#Plugin.ExecutePlugin>)
- [func \(p \*Plugin\) NumPorts\(\) error](<#Plugin.NumPorts>)
- [type Plugins](<#Plugins>)
- [func DetectPlugins\(\) \(\*Plugins, error\)](<#DetectPlugins>)
<a name="CheckRunPlugin"></a>
## func [CheckRunPlugin](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L330>)
```go
func CheckRunPlugin(PluginName string, ID string) error
```
CheckRunPlugin Checks if the ID belongs to the group or container calls the plugin function the appropriate amount of times
<a name="DeletePlugin"></a>
## func [DeletePlugin](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/packageManager.go#L46>)
```go
func DeletePlugin(pluginname string) error
```
DeletePlugin The following function deletes a plugin based on the plugin name provided.
<a name="DownloadPlugin"></a>
## func [DownloadPlugin](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/packageManager.go#L13>)
```go
func DownloadPlugin(pluginurl string) error
```
DownloadPlugin This functions downloads package from a git repo.
<a name="RunPluginContainer"></a>
## func [RunPluginContainer](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L284>)
```go
func RunPluginContainer(PluginName string, ContainerID string) error
```
RunPluginContainer Runs ansible plugin based on plugin name and container name which is derived from the tracked containers file We pass in the group ID as a parameter because when we modify the ports taken
<a name="ExecuteIP"></a>
## type [ExecuteIP](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L40-L45>)
ExecuteIP IP Address to execute Ansible instruction
```go
type ExecuteIP struct {
ContainerID string
IPAddress string
SSHPortNo string
Success bool
}
```
<a name="ExecuteIP.ModifyHost"></a>
### func \(\*ExecuteIP\) [ModifyHost](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L234>)
```go
func (e *ExecuteIP) ModifyHost(p *Plugin) error
```
ModifyHost adds IP address , port no to the config file
<a name="ExecuteIP.RunAnsible"></a>
### func \(\*ExecuteIP\) [RunAnsible](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L199>)
```go
func (e *ExecuteIP) RunAnsible(p *Plugin) error
```
RunAnsible Executes based on credentials on the struct
<a name="Host"></a>
## type [Host](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L49-L66>)
Host Struct for ansible host Generated from https://zhwt.github.io/yaml-to-go/
```go
type Host struct {
All struct {
Vars struct {
AnsiblePythonInterpreter string `yaml:"ansible_python_interpreter"`
} `yaml:"vars"`
} `yaml:"all"`
Main struct {
Hosts struct {
Host1 struct {
AnsibleHost string `yaml:"ansible_host"`
AnsiblePort int `yaml:"ansible_port"`
AnsibleUser string `yaml:"ansible_user"`
AnsibleSSHPass string `yaml:"ansible_ssh_pass"`
AnsibleSudoPass string `yaml:"ansible_sudo_pass"`
} `yaml:"host1"`
} `yaml:"hosts"`
} `yaml:"main"`
}
```
<a name="ReadHost"></a>
### func [ReadHost](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L266>)
```go
func ReadHost(filename string) (*Host, error)
```
ReadHost Reads host file and adds
<a name="Plugin"></a>
## type [Plugin](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L31-L37>)
Plugin Information about the plugins available
```go
type Plugin struct {
FolderName string
PluginDescription string
Execute []*ExecuteIP
NumOfPorts int
// contains filtered or unexported fields
}
```
<a name="RunPlugin"></a>
### func [RunPlugin](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L131>)
```go
func RunPlugin(pluginName string, IPAddresses []*ExecuteIP) (*Plugin, error)
```
RunPlugin Executes plugins based on the plugin name provided
<a name="SearchPlugin"></a>
### func [SearchPlugin](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L114>)
```go
func SearchPlugin(pluginname string) (*Plugin, error)
```
SearchPlugin Detects plugin information based on the name provided on the parameter
<a name="Plugin.AutoSetPorts"></a>
### func \(\*Plugin\) [AutoSetPorts](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L383>)
```go
func (p *Plugin) AutoSetPorts(containerID string) error
```
AutoSetPorts Automatically maps free ports to site.yml file
<a name="Plugin.CopyToTmpPlugin"></a>
### func \(\*Plugin\) [CopyToTmpPlugin](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L366>)
```go
func (p *Plugin) CopyToTmpPlugin() error
```
CopyToTmpPlugin This function would ensure that we create a copy of the plugin in the tmp directory, and it would be executed from there. This due to the reason of automating port allocation when running plugins
<a name="Plugin.ExecutePlugin"></a>
### func \(\*Plugin\) [ExecutePlugin](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L174>)
```go
func (p *Plugin) ExecutePlugin() error
```
ExecutePlugin Function to execute plugins that are called
<a name="Plugin.NumPorts"></a>
### func \(\*Plugin\) [NumPorts](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L446>)
```go
func (p *Plugin) NumPorts() error
```
NumPorts Gets the Number the ports the plugin requires
<a name="Plugins"></a>
## type [Plugins](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L26-L28>)
Plugins Array of all plugins detected
```go
type Plugins struct {
PluginsDetected []*Plugin
}
```
<a name="DetectPlugins"></a>
### func [DetectPlugins](<https://github.com/Akilan1999/p2p-rendering-computation/blob/master/plugin/plugin.go#L69>)
```go
func DetectPlugins() (*Plugins, error)
```
DetectPlugins Detects all the plugins available
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)