supervisor

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAPIHost string = "http://www.gitcenter.dev"

DefaultAPIHost 默认API接口地址

Variables

Functions

func PostJSON

func PostJSON(uri string, v interface{}, headers ...map[string]string) ([]byte, error)

PostJSON post json 数据请求

Types

type ActionData

type ActionData struct {
	RetCode int64
	StdErr  string
	StdOut  string
}

type ActionReq

type ActionReq struct {
	Aid      uint64
	AppName  string
	ZoneCode string
	HostName string
	Action   ActionType
}

type ActionResp

type ActionResp struct {
	Code int64
	Msg  string
	Data map[string]*ActionData
}

type ActionType

type ActionType int32
const (
	ActionType_StatusAction ActionType = 0
	ActionType_StartAction  ActionType = 1
	ActionType_StopAction   ActionType = 2
	ActionType_RelaodAction ActionType = 3
)

noinspection ALL

type BaseRet

type BaseRet struct {
	StatusCode int    `json:"status_code"`
	Message    string `json:"message"`
}

type Client

type Client struct {
	Host string
	// contains filtered or unexported fields
}

func NewOpsClient

func NewOpsClient(host string, mac *Mac) *Client

func (*Client) CreateProject

func (c *Client) CreateProject(req *CreateProjectReq) (*CreateProjectRet, error)

func (*Client) Supervisor

func (c *Client) Supervisor(req *OpsSupervisorReq) (*OpsSupervisorRet, error)

type CreateProjectDataRet

type CreateProjectDataRet struct {
	AccessKey    string `json:"access_key"`
	AccessSecret string `json:"access_secret"`
}

type CreateProjectReq

type CreateProjectReq struct {
	ProjectName string `json:"project_name"`
	DeployPath  string `json:"deploy_path"`
	Username    string `json:"username"`
	Password    string `json:"password"`
}

func (*CreateProjectReq) ToString

func (t *CreateProjectReq) ToString() string

type CreateProjectRet

type CreateProjectRet struct {
	BaseRet
	Data CreateProjectDataRet `json:"data"`
}

func (*CreateProjectRet) ToString

func (t *CreateProjectRet) ToString() string

type Mac

type Mac struct {
	AccessKey    []byte
	AccessSecret []byte
}

func NewMac

func NewMac(accessKey, accessSecret string) *Mac

func (*Mac) GenarateHeaderMap

func (m *Mac) GenarateHeaderMap() map[string]string

func (*Mac) Sign

func (m *Mac) Sign() string

type OpsSupervisorExecInfo

type OpsSupervisorExecInfo struct {
	RetCode int    `json:"retcode"`
	StdErr  string `json:"stderr"`
	StdOut  string `json:"stdout"`
}

type OpsSupervisorReq

type OpsSupervisorReq struct {
	ProjectName string   `json:"project_name"`
	ServersId   []string `json:"servers_id"`
	Cmd         string   `json:"cmd"`
	Args        []string `json:"args"`
}

type OpsSupervisorRet

type OpsSupervisorRet struct {
	BaseRet
	Data map[string]OpsSupervisorExecInfo `json:"data"`
}

type Req

type Req struct {
	AppName            string
	IdcSrvPubAppName   string
	IdcSrvPubAddr      string
	IdcSrvAccessKey    string
	IdcSrvAccessSecret string
	ServerName         string
}

type Ret

type Ret struct {
	BaseRet
	Data map[string]RetExecInfo `json:"data"`
}

type RetExecInfo

type RetExecInfo struct {
	RetCode int    `json:"retcode"`
	StdErr  string `json:"stderr"`
	StdOut  string `json:"stdout"`
}

type Supervisor

type Supervisor struct{}

func NewSupervisor

func NewSupervisor() *Supervisor

func (*Supervisor) DoCtrl

func (s *Supervisor) DoCtrl(action string, supervisorReq Req) (ret *OpsSupervisorRet, err error)

Jump to

Keyboard shortcuts

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