edge

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACP

type ACP struct {
	ID          string `json:"id"`
	WorkspaceID string `json:"workspaceId"`
	ClusterID   string `json:"clusterId"`

	Version string `json:"version"`

	Name      string              `json:"name"`
	JWT       *ACPJWTConfig       `json:"jwt"`
	BasicAuth *ACPBasicAuthConfig `json:"basicAuth"`

	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

ACP is an Access Control Policy definition.

type ACPBasicAuthConfig

type ACPBasicAuthConfig struct {
	Users                    []string `json:"users"`
	Realm                    string   `json:"realm"`
	StripAuthorizationHeader bool     `json:"stripAuthorizationHeader"`
	ForwardUsernameHeader    string   `json:"forwardUsernameHeader"`
}

ACPBasicAuthConfig configures a basic auth ACP handler.

type ACPInfo

type ACPInfo struct {
	Name string `json:"name"`
}

ACPInfo represents an ACP for an Ingress.

type ACPJWTConfig

type ACPJWTConfig struct {
	SigningSecret              string            `json:"signingSecret"`
	SigningSecretBase64Encoded bool              `json:"signingSecretBase64Encoded"`
	PublicKey                  string            `json:"publicKey"`
	JWKsFile                   FileOrContent     `json:"jwksFile"`
	JWKsURL                    string            `json:"jwksUrl"`
	StripAuthorizationHeader   bool              `json:"stripAuthorizationHeader"`
	ForwardHeaders             map[string]string `json:"forwardHeaders"`
	TokenQueryKey              string            `json:"tokenQueryKey"`
	Claims                     string            `json:"claims"`
}

ACPJWTConfig configures a JWT ACP handler.

type APIError

type APIError struct {
	StatusCode int
	Message    string `json:"error"`
}

APIError represents an error returned by the API.

func (APIError) Error

func (a APIError) Error() string

type Client

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

Client allows interacting with the cluster service.

func NewClient

func NewClient(baseURL, token string) (*Client, error)

NewClient creates a new client for the cluster service.

func (*Client) GetACPs

func (c *Client) GetACPs(ctx context.Context) ([]ACP, error)

GetACPs returns the ACPs related to the agent.

func (*Client) GetEdgeIngresses

func (c *Client) GetEdgeIngresses(ctx context.Context) ([]Ingress, error)

GetEdgeIngresses returns the EdgeIngresses related to the agent.

type FileOrContent

type FileOrContent string

FileOrContent hold a file path or content.

func (FileOrContent) IsPath

func (f FileOrContent) IsPath() bool

IsPath returns true if the FileOrContent is a file path, otherwise returns false.

func (FileOrContent) Read

func (f FileOrContent) Read() ([]byte, error)

func (FileOrContent) String

func (f FileOrContent) String() string

type Ingress

type Ingress struct {
	ID string `json:"id"`

	WorkspaceID string `json:"workspaceId"`
	ClusterID   string `json:"clusterId"`
	Namespace   string `json:"namespace"`
	Name        string `json:"name"`

	Domain  string   `json:"domain"`
	Service Service  `json:"service"`
	ACP     *ACPInfo `json:"acp,omitempty"`

	Version   string    `json:"version"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Ingress represents an edge ingress configuration on a cluster.

type Listener

type Listener func(context.Context, []Ingress, []ACP) error

Listener listens the changes of the edge related elements.

type Service

type Service struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Network string `json:"network"`
	Port    int    `json:"port"`
}

Service represents an endpoint for an Ingress.

type Watcher

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

Watcher watches hub agent configuration.

func NewWatcher

func NewWatcher(c *Client, interval time.Duration) *Watcher

NewWatcher return a new Watcher.

func (*Watcher) AddListener

func (w *Watcher) AddListener(listener Listener)

AddListener adds a listener.

func (*Watcher) Run

func (w *Watcher) Run(ctx context.Context)

Run runs ConfigWatcher.

Jump to

Keyboard shortcuts

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