appmesh

package
v0.0.0-...-1a18185 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEFAULT_TOKEN_EXPIRE_SECONDS = 7 * (60 * 60 * 24) // default 7 days

Functions

This section is empty.

Types

type Application

type Application struct {
	// main definition
	Name           string  `json:"name"`
	Owner          *string `json:"owner"`
	Permission     *int    `json:"permission"`
	ShellMode      *bool   `json:"shell"`
	Command        *string `json:"command"`
	Description    *string `json:"description"`
	WorkingDir     *string `json:"working_dir"`
	HealthCheckCMD *string `json:"health_check_cmd"`
	Status         int     `json:"status"`
	StdoutCacheNum *int    `json:"stdout_cache_num"`
	Metadata       *string `json:"metadata"`

	// time
	StartTime     *int64 `json:"start_time"`
	EndTime       *int64 `json:"end_time"`
	LastStartTime *int64 `json:"last_start_time"`
	LastExitTime  *int64 `json:"last_exit_time"`
	NextStartTime *int64 `json:"next_start_time"`
	RegisterTime  *int64 `json:"register_time"`

	StopRetention *string   `json:"retention"`
	Behavior      *Behavior `json:"behavior"`
	// short running definition
	StartIntervalSeconds       *string `json:"start_interval_seconds"`
	StartIntervalSecondsIsCron *bool   `json:"cron"`

	// runtime attributes
	Pid            *int    `json:"pid"`
	ReturnCode     *int    `json:"return_code"`
	Health         *int    `json:"health"`
	FileDescritors *int    `json:"fd"`
	Starts         *int    `json:"starts"`
	PsTree         *string `json:"pstree"`
	ContainerID    *string `json:"container_id"`

	CPU             *float64 `json:"cpu"`
	Memory          *int     `json:"memory"`
	Uuid            *string  `json:"process_uuid"` // for run application
	StdoutCacheSize *int     `json:"stdout_cache_size"`

	Version   *int    `json:"version"`
	LastError *string `json:"last_error"`

	PosixTimeZone *string `json:"posix_timezone"`
	DockerImage   *string `json:"docker_image"`

	DailyLimit    *DailyLimitation    `json:"daily_limitation"`
	ResourceLimit *ResourceLimitation `json:"resource_limit"`
	Env           *Environments       `json:"env"`
	SecEnv        *Environments       `json:"sec_env"`
}

Application json

type Behavior

type Behavior struct {
	Exit string `json:"exit"`
}

Behavior

type Client

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

Client uses REST API for interacting with REST server.

func NewClient

func NewClient(appmeshUri string) *Client

NewClient initializes client for interacting with an instance of REST server;

func NewClientWithAuth

func NewClientWithAuth(appmeshUri string, authenKey string) *Client

func (*Client) AddApp

func (r *Client) AddApp(app Application) (*Application, error)

Add a application

func (*Client) Authentication

func (r *Client) Authentication(jwtToken string, permission string) (bool, error)

login with existing JWT token, permission is option parameter to check

func (*Client) DisableApp

func (r *Client) DisableApp(appName string) error

Disable an application

func (*Client) EnableApp

func (r *Client) EnableApp(appName string) error

Enable an application

func (*Client) GetApp

func (r *Client) GetApp(appName string) (*Application, error)

Get one application

func (*Client) GetAppOutput

func (r *Client) GetAppOutput(appName string, stdoutPosition int64, stdoutIndex int, stdoutMaxsize int, processUuid string) (bool, string, http.Header, error)

Get application stdout

func (*Client) GetApps

func (r *Client) GetApps() ([]Application, error)

Get all applications

func (*Client) GetTags

func (r *Client) GetTags() (Labels, error)

GetTags gets all lables.

func (*Client) Login

func (r *Client) Login(user string, password string, timeoutSeconds int) (bool, string, error)

login with username and password

func (*Client) RemoveApp

func (r *Client) RemoveApp(appName string) error

Remove an application

func (*Client) Run

func (r *Client) Run(app Application, syncrize bool, maxExectimeSeconds int) (int, error)

Remote run application

type DailyLimitation

type DailyLimitation struct {
	DailyStart string `json:"daily_start"`
	DailyEnd   string `json:"daily_end"`
}

Daily time limitation

type Environments

type Environments = map[string]string

Env json

type Headers

type Headers = map[string]string

REST Headers

type JWTResponse

type JWTResponse struct {
	AccessToken   string `json:"Access-Token"`
	ExpireSeconds int    `json:"expire_seconds"`
	ExpireTime    int    `json:"expire_time"`
	Profile       struct {
		AuthTime int    `json:"auth_time"`
		Name     string `json:"name"`
	} `json:"profile"`
	TokenType string `json:"token_type"`
}

https://mholt.github.io/json-to-go/ JWT Response

type Labels

type Labels = map[string]string

Label json

type ResourceLimitation

type ResourceLimitation struct {
	MemoryMb        int `json:"memory_mb"`
	MemoryVirtualMb int `json:"memory_virt_mb"`
	CpuShares       int `json:"cpu_shares"`
}

CPU & Memory limitation

Jump to

Keyboard shortcuts

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