network

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegisterBaseUrl = "/api/aslan/vm/agents/register"
	VerifyBaseUrl   = "/api/aslan/vm/agents/verify"

	RequestJobBaseUrl = "/api/aslan/vm/agents/job/request"
	ReportJobBaseUrl  = "/api/aslan/vm/agents/job/report"
)

Variables

This section is empty.

Functions

func GetFullURL

func GetFullURL(host, base string) string

Types

type AgentConfig

type AgentConfig struct {
	Token string `json:"token"`
	URL   string `json:"url"`
}

type HeartbeatParameters

type HeartbeatParameters struct {
	MemTotal      uint64 `json:"mem_total"`
	UsedMem       uint64 `json:"used_mem"`
	DiskSpace     uint64 `json:"disk_space"`
	FreeDiskSpace uint64 `json:"free_disk_space"`
	Hostname      string `json:"hostname"`
}

type HeartbeatServerRequest

type HeartbeatServerRequest struct {
	Token      string               `json:"token"`
	Parameters *HeartbeatParameters `json:"parameters"`
}

type HeartbeatServerResponse

type HeartbeatServerResponse struct {
	NeedOffline            bool   `json:"need_offline"`
	NeedUpdateAgentVersion bool   `json:"need_update_agent_version"`
	AgentVersion           string `json:"agent_version"`
	ScheduleWorkflow       bool   `json:"schedule_workflow"`
	WorkDir                string `json:"work_dir"`
	Concurrency            int    `json:"concurrency"`
	CacheType              string `json:"cache_type"`
	ServerURL              string `json:"server_url"`
	VmName                 string `json:"vm_name"`
	Description            string `json:"description"`
	ZadigVersion           string `json:"zadig_version"`
}

func Heartbeat

func Heartbeat(config *AgentConfig, parameters *HeartbeatParameters) (*HeartbeatServerResponse, error)

type RegisterAgentParameters

type RegisterAgentParameters struct {
	IP            string `json:"ip"`
	OS            string `json:"os"`
	Arch          string `json:"arch"`
	CurrentUser   string `json:"current_user"`
	MemTotal      uint64 `json:"mem_total"`
	UsedMem       uint64 `json:"used_mem"`
	CpuNum        int    `json:"cpu_num"`
	DiskSpace     uint64 `json:"disk_space"`
	FreeDiskSpace uint64 `json:"free_disk_space"`
	Hostname      string `json:"hostname"`
	AgentVersion  string `json:"agent_version"`
	WorkDir       string `json:"work_dir"`
}

type RegisterAgentRequest

type RegisterAgentRequest struct {
	Token      string                   `json:"token"`
	Parameters *RegisterAgentParameters `json:"parameters"`
}

type RegisterAgentResponse

type RegisterAgentResponse struct {
	AgentID          string `json:"agent_id"`
	VmName           string `json:"vm_name"`
	Token            string `json:"token"`
	Description      string `json:"description"`
	Concurrency      int    `json:"task_concurrency"`
	AgentVersion     string `json:"agent_version"`
	ZadigVersion     string `json:"zadig_version"`
	ScheduleWorkflow bool   `json:"schedule_workflow"`
	WorkDir          string `json:"work_dir"`
}

func RegisterAgent

func RegisterAgent(config *AgentConfig, parameters *RegisterAgentParameters) (*RegisterAgentResponse, error)

type ReportJobRequest

type ReportJobRequest struct {
	Token     string `json:"token"`
	JobID     string `json:"job_id"`
	JobStatus string `json:"job_status"`
	JobLog    string `json:"job_log"`
	JobError  string `json:"job_error"`
	JobOutput []byte `json:"job_output"`
	Seq       int    `json:"seq"`
}

type VerifyAgentParameters

type VerifyAgentParameters struct {
	IP   string `json:"ip"`
	OS   string `json:"os"`
	Arch string `json:"arch"`
}

type VerifyAgentRequest

type VerifyAgentRequest struct {
	Token      string                 `json:"token"`
	Parameters *VerifyAgentParameters `json:"parameters"`
}

type VerifyAgentResponse

type VerifyAgentResponse struct {
	Verified bool `json:"verified"`
}

func VerifyAgent

func VerifyAgent(config *AgentConfig, parameters *VerifyAgentParameters) (*VerifyAgentResponse, error)

type ZadigClient

type ZadigClient struct {
	AgentConfig *AgentConfig
	Config      *config.AgentConfig
}

func NewZadigClient

func NewZadigClient() *ZadigClient

func (*ZadigClient) ReportJob

func (c *ZadigClient) ReportJob(parameters *types.ReportJobParameters) (*types.ReportAgentJobResp, error)

func (*ZadigClient) RequestJob

func (c *ZadigClient) RequestJob() (*types.ZadigJobTask, error)

Jump to

Keyboard shortcuts

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