Documentation
¶
Index ¶
- Constants
- Variables
- func GetTyped[T v1alpha1.Object](ctx context.Context, c *Client, kind, namespace, name, tag string, ...) (T, error)
- func ListAllTyped[T v1alpha1.Object](ctx context.Context, c *Client, kind string, opts ListOpts, newObj func() T) ([]T, error)
- func ListTagsOfName[T v1alpha1.Object](ctx context.Context, c *Client, kind, namespace, name string, newObj func() T) ([]T, error)
- func ListTyped[T v1alpha1.Object](ctx context.Context, c *Client, kind string, opts ListOpts, newObj func() T) ([]T, string, error)
- type ApplyOpts
- type Client
- func (c *Client) Apply(ctx context.Context, body []byte, opts ApplyOpts) ([]arv0.ApplyResult, error)
- func (c *Client) Close() error
- func (c *Client) Delete(ctx context.Context, kind, namespace, name, tag string) error
- func (c *Client) DeleteViaApply(ctx context.Context, body []byte) ([]arv0.ApplyResult, error)
- func (c *Client) Get(ctx context.Context, kind, namespace, name, tag string) (*v1alpha1.RawObject, error)
- func (c *Client) GetLatest(ctx context.Context, kind, namespace, name string) (*v1alpha1.RawObject, error)
- func (c *Client) GetVersion() (*VersionBody, error)
- func (c *Client) List(ctx context.Context, kind string, opts ListOpts) ([]v1alpha1.RawObject, string, error)
- func (c *Client) ListTags(ctx context.Context, kind, namespace, name string) ([]v1alpha1.RawObject, error)
- func (c *Client) Ping() error
- type ListOpts
- type VersionBody
Constants ¶
const DefaultBaseURL = "http://localhost:12121/v0"
DefaultBaseURL is used when NewClient sees an empty base URL. Includes the `/v0` API prefix.
Variables ¶
var ErrNotFound = errors.New("resource not found")
ErrNotFound is returned by Get / GetLatest / Delete / PatchStatus when the server responds with 404. Callers can errors.Is(err, ErrNotFound) to branch cleanly.
Functions ¶
func GetTyped ¶ added in v0.4.0
func GetTyped[T v1alpha1.Object]( ctx context.Context, c *Client, kind, namespace, name, tag string, newObj func() T, ) (T, error)
GetTyped fetches one resource and materializes its typed v1alpha1 envelope. Empty tag resolves the latest tag for taggable resources.
func ListAllTyped ¶ added in v0.4.0
func ListAllTyped[T v1alpha1.Object]( ctx context.Context, c *Client, kind string, opts ListOpts, newObj func() T, ) ([]T, error)
ListAllTyped follows NextCursor until the full result set has been loaded.
func ListTagsOfName ¶ added in v0.4.0
func ListTagsOfName[T v1alpha1.Object]( ctx context.Context, c *Client, kind, namespace, name string, newObj func() T, ) ([]T, error)
ListTagsOfName returns every tag of one named resource with the latest tag first. Wraps GET /v0/{plural}/{name}/tags and materializes each row into a typed envelope.
Types ¶
type ApplyOpts ¶ added in v0.4.0
type ApplyOpts struct {
DryRun bool
}
ApplyOpts carries cross-cutting batch options for the POST /v0/apply endpoint.
type Client ¶
type Client struct {
BaseURL string
// contains filtered or unexported fields
}
Client is a lightweight API client for the agentregistry HTTP surface. Resource methods speak v1alpha1 at /v0/{plural}/{name} plus /v0/{plural}/{name}/{tag} for taggable artifacts, with ?namespace=<ns> as an optional query param (namespace is hidden from the user-facing API; empty / "default" are elided).
func NewClient ¶
NewClient constructs a client with explicit baseURL and token. The baseURL can be provided with or without the /v0 API prefix; if missing, /v0 is appended automatically.
func NewClientWithConfig ¶ added in v0.1.14
NewClientWithConfig constructs a client from explicit inputs (flag/env), applies defaults, and verifies connectivity.
func (*Client) Apply ¶ added in v0.4.0
func (c *Client) Apply(ctx context.Context, body []byte, opts ApplyOpts) ([]arv0.ApplyResult, error)
Apply sends a multi-doc YAML body to POST /v0/apply and returns per-resource results. Returns an error only on request-level failures (network, 4xx from server). Per-resource errors are encoded in the returned results.
func (*Client) Delete ¶ added in v0.4.0
Delete soft-deletes a row. When tag is empty it uses the name-only mutable-object route; otherwise it deletes the exact tag route. Returns ErrNotFound when the row doesn't exist. See Store.Delete for the soft-delete semantics (the row stays visible with DeletionTimestamp set until the GC pass purges it).
func (*Client) DeleteViaApply ¶ added in v0.4.0
DeleteViaApply sends a DELETE /v0/apply with a YAML body and returns per-resource results. Mirrors Apply but uses the DELETE HTTP method.
func (*Client) Get ¶ added in v0.4.0
func (c *Client) Get(ctx context.Context, kind, namespace, name, tag string) (*v1alpha1.RawObject, error)
Get returns the tagged-artifact resource at (kind, namespace, name, tag). Mutable objects should use GetLatest/name-only semantics.
func (*Client) GetLatest ¶ added in v0.4.0
func (c *Client) GetLatest(ctx context.Context, kind, namespace, name string) (*v1alpha1.RawObject, error)
GetLatest returns the literal latest tag for taggable resources and the current live row for mutable objects.
func (*Client) GetVersion ¶
func (c *Client) GetVersion() (*VersionBody, error)
GetVersion returns the server's version metadata.
func (*Client) List ¶ added in v0.4.0
func (c *Client) List(ctx context.Context, kind string, opts ListOpts) ([]v1alpha1.RawObject, string, error)
List returns rows of kind, paginated. opts.Namespace="" (empty) lists the default namespace; opts.Namespace="all" widens to every namespace. The returned string is the nextCursor; empty means no more pages.
func (*Client) ListTags ¶ added in v0.4.0
func (c *Client) ListTags(ctx context.Context, kind, namespace, name string) ([]v1alpha1.RawObject, error)
ListTags returns every non-deleted tag row for (kind, namespace, name) by GET'ing /v0/{plural}/{name}/tags. Mutable-object kinds do not expose this endpoint; callers should branch on that. The endpoint is unpaginated server-side and returns rows with the latest tag first.
type ListOpts ¶ added in v0.4.0
type ListOpts struct {
Namespace string
Labels string
Limit int
Cursor string
// Origin, when set, forwards the Deployment origin filter
// ("managed" or "discovered"). Empty leaves the server default intact.
Origin string
// Tag, when set, restricts results to one tag value on tagged-artifact
// kinds. Empty means "every tag of every name".
Tag string
// LatestOnly is equivalent to Tag = "latest" for tagged kinds and also
// covers the mutable-object latest-row case.
LatestOnly bool
IncludeTerminating bool
}
ListOpts controls the query parameters on List. Namespace "" (empty) scopes to the default namespace; "all" widens to every namespace. Any other value scopes to that exact namespace.
type VersionBody ¶ added in v0.3.0
type VersionBody = arv0.VersionBody