platform

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 AccessControlConfig

type AccessControlConfig struct {
	MaxSecuredRoutes int `json:"maxSecuredRoutes"`
}

AccessControlConfig holds the configuration of the access control section of the offer config.

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) FetchTopology added in v0.8.0

func (c *Client) FetchTopology(ctx context.Context) (topology.Reference, error)

FetchTopology fetches the topology.

func (*Client) GetConfig

func (c *Client) GetConfig(ctx context.Context) (Config, error)

GetConfig returns the agent configuration.

func (c *Client) Link(ctx context.Context) (clusterID string, err error)

Link links the agent to the Hub platform.

func (*Client) PatchTopology added in v0.8.0

func (c *Client) PatchTopology(ctx context.Context, patch []byte, lastKnownVersion int64) (int64, error)

PatchTopology submits a JSON Merge Patch to the platform containing the difference in the topology since its last synchronization. The last known topology version must be provided. This version can be obtained by calling the FetchTopology method.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping sends a ping to the platform to inform that the agent is alive.

func (*Client) SetVersionStatus added in v0.9.0

func (c *Client) SetVersionStatus(ctx context.Context, status version.Status) error

SetVersionStatus sends the current version status to the platform.

type Config

type Config struct {
	Metrics       MetricsConfig       `json:"metrics"`
	Topology      TopologyConfig      `json:"topology"`
	AccessControl AccessControlConfig `json:"accessControl"`
}

Config holds the configuration of the agent.

type ConfigWatcher

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

ConfigWatcher watches hub agent configuration.

func NewConfigWatcher

func NewConfigWatcher(interval time.Duration, c *Client) *ConfigWatcher

NewConfigWatcher return a new ConfigWatcher.

func (*ConfigWatcher) AddListener

func (w *ConfigWatcher) AddListener(listener func(cfg Config))

AddListener adds a listeners to the ConfigWatcher.

func (*ConfigWatcher) Run

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

Run runs ConfigWatcher.

type MetricsConfig

type MetricsConfig struct {
	Interval time.Duration `json:"interval"`
	Tables   []string      `json:"tables"`
}

MetricsConfig holds the metrics part of the agent config.

type TopologyConfig

type TopologyConfig struct {
	GitProxyHost string `json:"gitProxyHost,omitempty"`
	GitOrgName   string `json:"gitOrgName,omitempty"`
	GitRepoName  string `json:"gitRepoName,omitempty"`
}

TopologyConfig holds the topology part of the agent config.

Jump to

Keyboard shortcuts

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