object

package
v1.106.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoConnect    = "no_connect"
	Connecting   = "connecting"
	Connected    = "connected"
	Disconnected = "disconnected"
)

Variables

This section is empty.

Functions

func AddAsset

func AddAsset(asset *Asset) (bool, error)

func AddMachine added in v1.101.0

func AddMachine(machine *Machine) (bool, error)

func AddProvider added in v1.101.0

func AddProvider(provider *Provider) (bool, error)

func AddRecord

func AddRecord(record *Record) bool

func AddSession

func AddSession(session *Session) (bool, error)

func CloseDBSession

func CloseDBSession(id string, code int, msg string) error

func CloseSession

func CloseSession(id string, code int, msg string) error

func CommitRecord added in v1.101.0

func CommitRecord(record *Record) (bool, error)

func DeleteAsset

func DeleteAsset(asset *Asset) (bool, error)

func DeleteMachine added in v1.101.0

func DeleteMachine(machine *Machine) (bool, error)

func DeleteProvider added in v1.101.0

func DeleteProvider(provider *Provider) (bool, error)

func DeleteRecord

func DeleteRecord(record *Record) (bool, error)

func DeleteSession

func DeleteSession(session *Session) (bool, error)

func DeleteSessionById

func DeleteSessionById(id string) (bool, error)

func GetAssetCount

func GetAssetCount(owner, field, value string) (int64, error)

func GetMachineCount added in v1.101.0

func GetMachineCount(owner, field, value string) (int64, error)

func GetProviderCount added in v1.101.0

func GetProviderCount(owner, field, value string) (int64, error)

func GetRecordCount

func GetRecordCount(owner, field, value string) (int64, error)

func GetSession

func GetSession(owner string, offset, limit int, field, value, sortField, sortOrder string) *xorm.Session

func GetSessionCount

func GetSessionCount(owner, status, field, value string) (int64, error)

func InitAdapter

func InitAdapter()

func InitConfig

func InitConfig()

func QueryRecord added in v1.101.0

func QueryRecord(id string) (string, error)

func SyncMachinesCloud added in v1.101.0

func SyncMachinesCloud(owner string) (bool, error)

func UpdateAsset

func UpdateAsset(id string, asset *Asset) (bool, error)

func UpdateMachine added in v1.101.0

func UpdateMachine(id string, machine *Machine) (bool, error)

func UpdateProvider added in v1.101.0

func UpdateProvider(id string, provider *Provider) (bool, error)

func UpdateRecord

func UpdateRecord(id string, record *Record) (bool, error)

func UpdateSession

func UpdateSession(id string, session *Session, columns ...string) (bool, error)

func WriteCloseMessage

func WriteCloseMessage(session *guacamole.Session, mode string, code int, msg string)

Types

type Adapter

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

Adapter represents the MySQL adapter for policy storage.

func NewAdapter

func NewAdapter(driverName string, dataSourceName string) *Adapter

NewAdapter is the constructor for Adapter.

type Asset

type Asset struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`

	Category string `xorm:"varchar(100)" json:"category"`
	Type     string `xorm:"varchar(100)" json:"type"`
	Tag      string `xorm:"varchar(100)" json:"tag"`

	MachineName string `xorm:"varchar(100)" json:"machineName"`
	Os          string `xorm:"varchar(100)" json:"os"`

	PublicIp  string `xorm:"varchar(100)" json:"publicIp"`
	PrivateIp string `xorm:"varchar(100)" json:"privateIp"`

	Size    string `xorm:"varchar(100)" json:"size"`
	CpuSize string `xorm:"varchar(100)" json:"cpuSize"`
	MemSize string `xorm:"varchar(100)" json:"memSize"`

	RemoteProtocol string `xorm:"varchar(100)" json:"remoteProtocol"`
	RemotePort     int    `json:"remotePort"`
	RemoteUsername string `xorm:"varchar(100)" json:"remoteUsername"`
	RemotePassword string `xorm:"varchar(100)" json:"remotePassword"`

	AutoQuery   bool `json:"autoQuery"`
	IsPermanent bool `json:"isPermanent"`

	Language string `xorm:"varchar(100)" json:"language"`

	EnableRemoteApp bool         `json:"enableRemoteApp"`
	RemoteApps      []*RemoteApp `json:"remoteApps"`
	Services        []*Service   `json:"services"`
	Patches         []*Patch     `json:"patches"`
}

func GetAsset

func GetAsset(id string) (*Asset, error)

func GetAssets

func GetAssets(owner string) ([]*Asset, error)

func GetMaskedAsset

func GetMaskedAsset(asset *Asset, errs ...error) (*Asset, error)

func GetMaskedAssets

func GetMaskedAssets(assets []*Asset, errs ...error) ([]*Asset, error)

func GetPaginationAssets

func GetPaginationAssets(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Asset, error)

type Machine added in v1.101.0

type Machine struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	Id          string `xorm:"varchar(100)" json:"id"`
	Provider    string `xorm:"varchar(100)" json:"provider"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
	ExpireTime  string `xorm:"varchar(100)" json:"expireTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`

	Region   string `xorm:"varchar(100)" json:"region"`
	Zone     string `xorm:"varchar(100)" json:"zone"`
	Category string `xorm:"varchar(100)" json:"category"`
	Type     string `xorm:"varchar(100)" json:"type"`
	Size     string `xorm:"varchar(100)" json:"size"`
	Tag      string `xorm:"varchar(100)" json:"tag"`
	State    string `xorm:"varchar(100)" json:"state"`

	Image     string `xorm:"varchar(100)" json:"image"`
	Os        string `xorm:"varchar(100)" json:"os"`
	PublicIp  string `xorm:"varchar(100)" json:"publicIp"`
	PrivateIp string `xorm:"varchar(100)" json:"privateIp"`
	CpuSize   string `xorm:"varchar(100)" json:"cpuSize"`
	MemSize   string `xorm:"varchar(100)" json:"memSize"`

	// DB info
	RemoteProtocol string `xorm:"varchar(100)" json:"remoteProtocol"`
	RemotePort     int    `json:"remotePort"`
	RemoteUsername string `xorm:"varchar(100)" json:"remoteUsername"`
	RemotePassword string `xorm:"varchar(100)" json:"remotePassword"`
}

func GetMachine added in v1.101.0

func GetMachine(id string) (*Machine, error)

func GetMachines added in v1.101.0

func GetMachines(owner string) ([]*Machine, error)

func GetMaskedMachine added in v1.101.0

func GetMaskedMachine(machine *Machine, errs ...error) (*Machine, error)

func GetMaskedMachines added in v1.101.0

func GetMaskedMachines(machines []*Machine, errs ...error) ([]*Machine, error)

func GetPaginationMachines added in v1.101.0

func GetPaginationMachines(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Machine, error)

func (*Machine) GetId added in v1.101.0

func (machine *Machine) GetId() string

type Patch added in v1.62.0

type Patch struct {
	Name           string `json:"name"`
	Category       string `json:"category"`
	Title          string `json:"title"`
	Url            string `json:"url"`
	Size           string `json:"size"`
	ExpectedStatus string `json:"expectedStatus"`
	Status         string `json:"status"`
	InstallTime    string `json:"installTime"`
	Message        string `json:"message"`
}

type Provider added in v1.101.0

type Provider struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`

	Category string `xorm:"varchar(100)" json:"category"`
	Type     string `xorm:"varchar(100)" json:"type"`

	ClientId     string `xorm:"varchar(100)" json:"clientId"`
	ClientSecret string `xorm:"varchar(100)" json:"clientSecret"`
	Region       string `xorm:"varchar(100)" json:"region"`
	Network      string `xorm:"varchar(100)" json:"network"`
	Chain        string `xorm:"varchar(100)" json:"chain"`
	BrowserUrl   string `xorm:"varchar(200)" json:"browserUrl"`

	State       string `xorm:"varchar(100)" json:"state"`
	ProviderUrl string `xorm:"varchar(200)" json:"providerUrl"`
}

func GetMaskedProvider added in v1.101.0

func GetMaskedProvider(provider *Provider, errs ...error) (*Provider, error)

func GetMaskedProviders added in v1.101.0

func GetMaskedProviders(providers []*Provider, errs ...error) ([]*Provider, error)

func GetPaginationProviders added in v1.101.0

func GetPaginationProviders(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Provider, error)

func GetProvider added in v1.101.0

func GetProvider(id string) (*Provider, error)

func GetProviders added in v1.101.0

func GetProviders(owner string) ([]*Provider, error)

type Record

type Record struct {
	Id int `xorm:"int notnull pk autoincr" json:"id"`

	Owner       string `xorm:"varchar(100) index" json:"owner"`
	Name        string `xorm:"varchar(100) index" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	Organization string `xorm:"varchar(100)" json:"organization"`
	ClientIp     string `xorm:"varchar(100)" json:"clientIp"`
	User         string `xorm:"varchar(100)" json:"user"`
	Method       string `xorm:"varchar(100)" json:"method"`
	RequestUri   string `xorm:"varchar(1000)" json:"requestUri"`
	Action       string `xorm:"varchar(1000)" json:"action"`
	Language     string `xorm:"varchar(100)" json:"language"`

	Object   string `xorm:"mediumtext" json:"object"`
	Response string `xorm:"mediumtext" json:"response"`

	Provider    string `xorm:"varchar(100)" json:"provider"`
	Block       string `xorm:"varchar(100)" json:"block"`
	IsTriggered bool   `json:"isTriggered"`
}

func GetPaginationRecords

func GetPaginationRecords(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Record, error)

func GetRecord

func GetRecord(id string) (*Record, error)

func GetRecords

func GetRecords(owner string) ([]*Record, error)

func NewRecord

func NewRecord(ctx *context.Context) (*Record, error)

type RemoteApp

type RemoteApp struct {
	No            int    `json:"no"`
	RemoteAppName string `xorm:"varchar(100)" json:"remoteAppName"`
	RemoteAppDir  string `xorm:"varchar(100)" json:"remoteAppDir"`
	RemoteAppArgs string `xorm:"varchar(100)" json:"remoteAppArgs"`
}

type Response added in v1.47.0

type Response struct {
	Status string `json:"status"`
	Msg    string `json:"msg"`
}

type Service

type Service struct {
	No             int    `json:"no"`
	Name           string `json:"name"`
	Path           string `json:"path"`
	Port           int    `json:"port"`
	ProcessId      int    `json:"processId"`
	ExpectedStatus string `json:"expectedStatus"`
	Status         string `json:"status"`
	SubStatus      string `json:"subStatus"`
	Message        string `json:"message"`
}

type Session

type Session struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	StartTime string `xorm:"varchar(100)" json:"startTime"`
	EndTime   string `xorm:"varchar(100)" json:"endTime"`

	Protocol      string `xorm:"varchar(20)" json:"protocol"`
	ConnectionId  string `xorm:"varchar(50)" json:"connectionId"`
	Asset         string `xorm:"varchar(200) index" json:"asset"`
	Creator       string `xorm:"varchar(36) index" json:"creator"`
	ClientIp      string `xorm:"varchar(200)" json:"clientIp"`
	UserAgent     string `xorm:"varchar(200)" json:"userAgent"`
	ClientIpDesc  string `xorm:"varchar(100)" json:"clientIpDesc"`
	UserAgentDesc string `xorm:"varchar(100)" json:"userAgentDesc"`
	Width         int    `json:"width"`
	Height        int    `json:"height"`
	Status        string `xorm:"varchar(20) index" json:"status"`
	Recording     string `xorm:"varchar(1000)" json:"recording"`
	Code          int    `json:"code"`
	Message       string `json:"message"`

	Mode       string   `xorm:"varchar(10)" json:"mode"`
	Operations []string `xorm:"json varchar(1000)" json:"operations"`

	Reviewed     bool  `json:"reviewed"`
	CommandCount int64 `json:"commandCount"`
}

func CreateSession

func CreateSession(session *Session, machineId string, mode string) (*Session, error)

func GetConnSession

func GetConnSession(id string) (*Session, error)

func GetPaginationSessions

func GetPaginationSessions(owner, status string, offset, limit int, field, value, sortField, sortOrder string) ([]*Session, error)

func GetSessions

func GetSessions(owner string) ([]*Session, error)

func GetSessionsByStatus

func GetSessionsByStatus(statuses []string) ([]*Session, error)

func (*Session) GetId

func (s *Session) GetId() string

Jump to

Keyboard shortcuts

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