portal

package module
v0.0.0-...-20ca142 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: MIT Imports: 7 Imported by: 0

README

golang-portal-client

a portal client in golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertBundle

type CertBundle struct {
	Cert string `json:"cert"`
	Key  string `json:"key"`
}

type PortalClient

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

func New

func New(host, token string) PortalClient

func (PortalClient) CreateCert

func (self PortalClient) CreateCert(cert CertBundle) error

func (PortalClient) CreateRoute

func (self PortalClient) CreateRoute(route Route) error

func (PortalClient) CreateServer

func (self PortalClient) CreateServer(id string, server Server) error

func (PortalClient) CreateService

func (self PortalClient) CreateService(service Service) error

func (PortalClient) DeleteCert

func (self PortalClient) DeleteCert(cert CertBundle) error

func (PortalClient) DeleteRoute

func (self PortalClient) DeleteRoute(route Route) error

func (PortalClient) DeleteServer

func (self PortalClient) DeleteServer(serviceId, id string) error

func (PortalClient) DeleteService

func (self PortalClient) DeleteService(id string) error

func (PortalClient) GetCert

func (self PortalClient) GetCert() ([]CertBundle, error)

func (PortalClient) GetRoutes

func (self PortalClient) GetRoutes() ([]Route, error)

func (PortalClient) GetServer

func (self PortalClient) GetServer(id string) ([]Server, error)

func (PortalClient) GetService

func (self PortalClient) GetService(id string) (*Service, error)

func (PortalClient) GetServices

func (self PortalClient) GetServices() ([]Service, error)

func (PortalClient) UpdateCert

func (self PortalClient) UpdateCert(certs []CertBundle) error

func (PortalClient) UpdateRoutes

func (self PortalClient) UpdateRoutes(routes []Route) error

func (PortalClient) UpdateServer

func (self PortalClient) UpdateServer(serviceId, id string, server Server) error

func (PortalClient) UpdateServers

func (self PortalClient) UpdateServers(id string, servers []Server) error

func (PortalClient) UpdateService

func (self PortalClient) UpdateService(id string, service Service) error

func (PortalClient) UpdateServices

func (self PortalClient) UpdateServices(services []Service) error

type Route

type Route struct {
	// defines match characteristics
	SubDomain string `json:"subdomain"` // subdomain to match on - "admin"
	Domain    string `json:"domain"`    // domain to match on - "myapp.com"
	Path      string `json:"path"`      // route to match on - "/admin"
	// defines actions
	Targets []string `json:"targets"` // ips of servers - ["http://127.0.0.1:8080/app1","http://127.0.0.2"] (optional)
	FwdPath string   `json:"fwdpath"` // path to forward to targets - "/goadmin" incoming req: test.com/admin -> 127.0.0.1/goadmin (optional)
	Page    string   `json:"page"`    // page to serve instead of routing to targets - "<HTML>We are fixing it</HTML>" (optional)
}

type Server

type Server struct {
	// todo: change "Id" to "name" (for clarity)
	Id             string `json:"id,omitempty"`
	Host           string `json:"host"`
	Port           int    `json:"port"`
	Forwarder      string `json:"forwarder"`
	Weight         int    `json:"weight"`
	UpperThreshold int    `json:"upper_threshold"`
	LowerThreshold int    `json:"lower_threshold"`
}

type Service

type Service struct {
	Id          string   `json:"id,omitempty"`
	Host        string   `json:"host"`
	Interface   string   `json:"interface,omitempty"`
	Port        int      `json:"port"`
	Type        string   `json:"type"`
	Scheduler   string   `json:"scheduler"`
	Persistence int      `json:"persistence"`
	Netmask     string   `json:"netmask"`
	Servers     []Server `json:"servers,omitempty"`
}

Jump to

Keyboard shortcuts

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