package resources

import "github.com/purpleidea/mgmt/etcd/client/resources"

Index

Functions

func DelResources

func DelResources(ctx context.Context, client interfaces.Client, hostname string, resourceDeletes []*engine.ResDelete) (bool, error)

DelResources deletes some exported resource data from etcd. It returns an error if anything goes wrong. If it didn't need to make a changes because the data was already correct in the database, it returns (true, nil). Otherwise it returns (false, nil).

func GetResources

func GetResources(ctx context.Context, client interfaces.Client, hostname string, filters []*engine.ResFilter) ([]*engine.ResOutput, error)

GetResources reads the resources sent to the input hostname, and also applies the filters to ensure we get a limited selection. XXX: We'd much rather filter server side if etcd had better filtering API's. See: https://github.com/etcd-io/etcd/issues/19667

func SetResources

func SetResources(ctx context.Context, client interfaces.Client, hostname string, resourceExports []*engine.ResExport) (bool, error)

SetResources stores some resource data for export in etcd. It returns an error if anything goes wrong. If it didn't need to make a changes because the data was already correct in the database, it returns (true, nil). Otherwise it returns (false, nil).

func WatchResources

func WatchResources(ctx context.Context, client interfaces.Client, hostname, kind string) (chan error, error)

WatchResources returns a channel that outputs events when exported resources change. TODO: Filter our watch (on the server side if possible) based on the collection prefixes and filters that we care about... XXX: filter based on kind as well, we don't do that currently... See: https://github.com/etcd-io/etcd/issues/19667 TODO: do the star (*) hostname matching catch-all if we have WithStar option.

Source Files

resources.go

Version
v0.0.0-20250405210053-9c1c587f7bc2 (latest)
Published
Apr 5, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
6 hours ago

Tools for package owners.