api

package
v0.0.0-...-28c0fd5 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(c *gin.Context)

Types

type Action

type Action struct {
	Type     string         `json:"type"`
	Forward  ForwardAction  `json:"forward,omitempty" gorm:"embedded;embeddedPrefix:forward_"`
	Redirect RedirectAction `json:"redirect,omitempty" gorm:"embedded;embeddedPrefix:redirect_"`
}

type Api

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

func New

func New(svc *Service, snapshotCache cache.SnapshotCache) *Api

func (*Api) Run

func (a *Api) Run(bindAddress string) error

type Base

type Base struct {
	ID uuid.UUID `json:"id" gorm:"type:uuid;primaryKey;"`

	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `sql:"index" json:"deleted_at"`
}

func (*Base) BeforeCreate

func (base *Base) BeforeCreate(tx *gorm.DB) error

type Certificate

type Certificate struct {
	Base
	Name      string `json:"name"`
	Cert      string `json:"cert"`
	Key       string `json:"key"`
	ManagedBy string `json:"managed_by,omitempty"`
}

type Condition

type Condition struct {
	HostHeader        []string `json:"host_header,omitempty"`
	HttpHeader        []string `json:"http_header,omitempty"`
	HttpRequestMethod []string `json:"http_request_method,omitempty"`
	PathPattern       []string `json:"path_pattern,omitempty"`
	SourceIp          []string `json:"source_ip,omitempty"`
}

type ForwardAction

type ForwardAction struct {
	TargetGroup TargetGroupForwardAction `json:"target_group" gorm:"embedded;embedddedPrefix:target_group_"`
	Stickiness  Stickiness               `json:"stickiness,omitempty" gorm:"embedded;embeddedPrefix:stickiness_"`
}

type Listener

type Listener struct {
	Base
	Name      string `json:"name"`
	IpAddress string `json:"ip_address" gorm:"index:hostname,unique"`
	Port      uint16 `json:"port" gorm:"index:hostname,unique"`
	Protocol  string `json:"protocol,omitempty"`
	Type      string `json:"type"`
	Enabled   bool   `json:"enabled,omitempty"`

	SslCertificateID string       `json:"ssl_certificate_id,omitempty"`
	SslCertificate   *Certificate `json:"ssl_certificate,omitempty"`

	Rules []Rule `json:"rules"`
}

type Options

type Options struct {
}

type RedirectAction

type RedirectAction struct {
	Host       string `json:"host"`
	Port       string `json:"port,omitempty"`
	Path       string `json:"path,omitempty"`
	Protocol   string `json:"protocol,omitempty"`
	Query      string `json:"query,omitempty"`
	StatusCode string `json:"status_code,omitempty"`
}

type Rule

type Rule struct {
	Base
	ListenerID string
	Priority   uint16      `json:"priority"`
	Action     Action      `json:"action" gorm:"embedded"`
	Condition  []Condition `json:"conditions,omitempty" gorm:"serializer:json"`
}

type Service

type Service struct {
	Db *gorm.DB
	// contains filtered or unexported fields
}

func (*Service) AddListenerRule

func (s *Service) AddListenerRule(listenerId string, rule *Rule) error

func (*Service) AddTargetGroupAttachment

func (s *Service) AddTargetGroupAttachment(targetGroupId string, attachment *TargetGroupAttachment) error

func (*Service) CreateCertificate

func (s *Service) CreateCertificate(certificate *Certificate) (*Certificate, error)

func (*Service) CreateListener

func (s *Service) CreateListener(listener *Listener) (*Listener, error)

func (*Service) CreateTargetGroup

func (s *Service) CreateTargetGroup(group *TargetGroup) (*TargetGroup, error)

func (*Service) DeleteCertificate

func (s *Service) DeleteCertificate(certificateId string) error

func (*Service) DestroyListener

func (s *Service) DestroyListener(listenerId string) error

func (*Service) DestroyTargetGroup

func (s *Service) DestroyTargetGroup(targetGroupId string) error

func (*Service) GetCertificate

func (s *Service) GetCertificate(certificateId string) (*Certificate, error)

func (*Service) GetListener

func (s *Service) GetListener(listenerId string) (*Listener, error)

func (*Service) GetTargetGroup

func (s *Service) GetTargetGroup(targetGroupId string) (*TargetGroup, error)

func (*Service) Init

func (s *Service) Init() error

func (*Service) ListCertificates

func (s *Service) ListCertificates() ([]*Certificate, error)

func (*Service) ListListeners

func (s *Service) ListListeners() ([]*Listener, error)

func (*Service) ListTargetGroups

func (s *Service) ListTargetGroups() ([]*TargetGroup, error)

func (*Service) RemoveTargetGroupAttachment

func (s *Service) RemoveTargetGroupAttachment(targetGroupId string, attachmentId string) error

func (*Service) SetChannel

func (s *Service) SetChannel(channel chan struct{})

SetChannel configures the event channel to emit create / update /delete events onto

func (*Service) UpdateCertificate

func (s *Service) UpdateCertificate(certificate *Certificate) (*Certificate, error)

func (*Service) UpdateListener

func (s *Service) UpdateListener(listener *Listener) (*Listener, error)

func (*Service) UpdateTargetGroup

func (s *Service) UpdateTargetGroup(group *TargetGroup) (*TargetGroup, error)

type Stickiness

type Stickiness struct {
	Enabled  bool          `json:"enabled"`
	Duration time.Duration `json:"duration"`
}

type TargetGroup

type TargetGroup struct {
	Base
	Name        string                  `json:"name"`
	Enabled     bool                    `json:"enabled,omitempty"`
	Attachments []TargetGroupAttachment `json:"attachments"`
}

type TargetGroupAttachment

type TargetGroupAttachment struct {
	Base
	IpAddress     string `json:"ip_address" gorm:"index:attachment_hostname,unique"`
	Port          uint16 `json:"port" gorm:"index:attachment_hostname,unique"`
	TargetGroupID string
}

type TargetGroupForwardAction

type TargetGroupForwardAction struct {
	TargetGroupId string `json:"id"`
	Weight        uint8  `json:"weight,omitempty"`
}

Jump to

Keyboard shortcuts

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