client

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: BSD-3-Clause-Clear Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgentPrefix = "fioup/"

	HeaderKeyTag    = "x-ats-tags"
	HeaderKeyApps   = "x-ats-dockerapps"
	HeaderKeyTarget = "x-ats-target"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppServiceState added in v1.0.0

type AppServiceState struct {
	Name     string `json:"name"`
	Hash     string `json:"hash"`
	State    string `json:"state"`
	Status   string `json:"status"`
	Health   string `json:"health,omitempty"`
	ImageUri string `json:"image"`
	Logs     string `json:"logs,omitempty"`
}

type AppState added in v1.0.0

type AppState struct {
	Services []AppServiceState `json:"services"`
	State    string            `json:"state"`
	Uri      string            `json:"uri"`
}

type AppStates added in v1.0.0

type AppStates struct {
	Ostree     string              `json:"ostree"`
	DeviceTime string              `json:"deviceTime"`
	Apps       map[string]AppState `json:"apps"`
}

type Device added in v0.9.0

type Device struct {
	Factory   string      `json:"factory"`
	RepoId    string      `json:"repo_id"`
	Uuid      string      `json:"uuid"`
	Name      string      `json:"name"`
	CreatedAt DgTimeStamp `json:"created_at"`
	LastSeen  DgTimeStamp `json:"last_seen"`
	PubKey    string      `json:"pubkey"`
	Tag       string      `json:"tag"`
}

type DgTimeStamp added in v0.9.0

type DgTimeStamp float32

func (DgTimeStamp) AsTime added in v0.9.0

func (ts DgTimeStamp) AsTime() time.Time

type GatewayClient

type GatewayClient struct {
	BaseURL    *url.URL
	HttpClient *http.Client
	Headers    map[string]string
	// contains filtered or unexported fields
}

func NewGatewayClient

func NewGatewayClient(cfg *config.Config, apps []string, targetID string, options ...GatewayClientOpt) (*GatewayClient, error)

func (*GatewayClient) Get

func (c *GatewayClient) Get(resourcePath string) (*transport.HttpRes, error)

func (*GatewayClient) Post

func (c *GatewayClient) Post(resourcePath string, data any) (*transport.HttpRes, error)

func (*GatewayClient) Put added in v0.9.0

func (c *GatewayClient) Put(resourcePath string, data any) (*transport.HttpRes, error)

func (*GatewayClient) PutSysInfo added in v0.9.0

func (c *GatewayClient) PutSysInfo() error

PutSysInfo sends the "system-info" API data to the gateway. It only sends each piece of data if it has changed since the last time this function was invoked.

func (*GatewayClient) ReportAppStates added in v1.0.0

func (c *GatewayClient) ReportAppStates(ctx context.Context, cfg *compose.Config) error

func (*GatewayClient) Self added in v0.9.0

func (c *GatewayClient) Self() (*Device, error)

func (*GatewayClient) UpdateHeaders

func (c *GatewayClient) UpdateHeaders(apps []string, targetID string)

type GatewayClientOpt added in v1.1.0

type GatewayClientOpt func(*GatewayClientOpts)

func WithHttpOperations added in v1.1.0

func WithHttpOperations(ops GwHttpOperations) GatewayClientOpt

type GatewayClientOpts added in v1.1.0

type GatewayClientOpts struct {
	HttpOperations GwHttpOperations
}

type GwHttpOperations added in v1.1.0

type GwHttpOperations interface {
	HttpGet(client *http.Client, url string, headers map[string]string) (*transport.HttpRes, error)
	HttpDo(client *http.Client, method, url string, headers map[string]string, data any) (*transport.HttpRes, error)
}

Jump to

Keyboard shortcuts

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