client

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package client provides an HTTP client for interacting with the txlog server API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	MachineID       string `json:"machine_id"`
	Hostname        string `json:"hostname"`
	OS              string `json:"os"`
	AgentVersion    string `json:"agent_version"`
	NeedsRestarting bool   `json:"needs_restarting"`
	CreatedAt       string `json:"created_at"`
	UpdatedAt       string `json:"updated_at"`
}

Asset represents a server/machine registered in the txlog system.

type Client

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

Client is the HTTP client for the txlog server API.

func New

func New() *Client

New creates a new txlog server API client.

func (*Client) GetAssetByHostname

func (c *Client) GetAssetByHostname(hostname string) (*Asset, error)

GetAssetByHostname finds an asset by its hostname.

func (*Client) GetAssetsRequiringRestart

func (c *Client) GetAssetsRequiringRestart() ([]Asset, error)

GetAssetsRequiringRestart retrieves assets that need to be restarted.

func (*Client) GetExecutions

func (c *Client) GetExecutions(machineID string, limit int) ([]Execution, error)

GetExecutions retrieves execution history for a machine.

func (*Client) GetMonthlyReport

func (c *Client) GetMonthlyReport(month, year int) (*MonthlyReportResponse, error)

GetMonthlyReport retrieves the monthly package update report for a specific month/year.

func (*Client) GetServerVersion

func (c *Client) GetServerVersion() (string, error)

GetServerVersion retrieves the server version.

func (*Client) GetTransactionItems

func (c *Client) GetTransactionItems(transactionID int) ([]TransactionItem, error)

GetTransactionItems retrieves items for a specific transaction.

func (*Client) GetTransactions

func (c *Client) GetTransactions(machineID string, limit int) ([]Transaction, error)

GetTransactions retrieves transactions for a specific machine.

func (*Client) ListAssets

func (c *Client) ListAssets() ([]Asset, error)

ListAssets retrieves all assets from the server.

func (*Client) SearchPackageAssets

func (c *Client) SearchPackageAssets(name, version, release string) ([]Asset, error)

SearchPackageAssets finds assets using a specific package.

type Execution

type Execution struct {
	ID              int    `json:"id"`
	MachineID       string `json:"machine_id"`
	Hostname        string `json:"hostname"`
	OS              string `json:"os"`
	AgentVersion    string `json:"agent_version"`
	NeedsRestarting bool   `json:"needs_restarting"`
	ExecutedAt      string `json:"executed_at"`
}

Execution represents an agent execution record.

type MonthlyReportPackage

type MonthlyReportPackage struct {
	OSVersion      string `json:"os_version"`
	PackageRPM     string `json:"package_rpm"`
	AssetsAffected int    `json:"assets_affected"`
}

MonthlyReportPackage represents a package update in the monthly report.

type MonthlyReportResponse

type MonthlyReportResponse struct {
	AssetCount int                    `json:"asset_count"`
	Month      int                    `json:"month"`
	Year       int                    `json:"year"`
	Packages   []MonthlyReportPackage `json:"packages"`
}

MonthlyReportResponse represents the response from the monthly report endpoint.

type PackageInfo

type PackageInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Release string `json:"release"`
	Arch    string `json:"arch"`
	Count   int    `json:"count"`
}

PackageInfo represents package information across assets.

type Transaction

type Transaction struct {
	ID         int    `json:"id"`
	ExternalID int    `json:"external_id"`
	MachineID  string `json:"machine_id"`
	Username   string `json:"username"`
	Cmdline    string `json:"cmdline"`
	ExecutedAt string `json:"executed_at"`
	ItemsCount int    `json:"items_count"`
}

Transaction represents a package transaction on an asset.

type TransactionItem

type TransactionItem struct {
	ID            int    `json:"id"`
	TransactionID int    `json:"transaction_id"`
	Action        string `json:"action"`
	Package       string `json:"package"`
	Version       string `json:"version"`
	Release       string `json:"release"`
	Epoch         string `json:"epoch"`
	Arch          string `json:"arch"`
}

TransactionItem represents an individual package change within a transaction.

Jump to

Keyboard shortcuts

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