Documentation
¶
Index ¶
- Constants
- func CleanList(list *unstructured.UnstructuredList) []map[string]any
- func CleanObject(obj *unstructured.Unstructured) map[string]any
- func CreateObject(ctx context.Context, cli ctrlclient.Client, group, kind, namespace string, ...) (*unstructured.Unstructured, error)
- func DeleteObject(ctx context.Context, cli ctrlclient.Client, ...) error
- func FetchAllItems(ctx context.Context, cli ctrlclient.Client, group, kind, namespace string) ([]unstructured.Unstructured, error)
- func FetchList(ctx context.Context, cli ctrlclient.Client, group, kind, namespace string, ...) (*unstructured.UnstructuredList, error)
- func FetchObject(ctx context.Context, cli ctrlclient.Client, ...) (*unstructured.Unstructured, error)
- func GetResourceDefinition(ctx context.Context, project, group, version, kind string, structureOnly bool, ...) error
- func ListResourceDefinitions(ctx context.Context, project string, out any) error
- func NewOrgControlPlaneClient(ctx context.Context, org string) (ctrlclient.Client, error)
- func NewProjectControlPlaneClient(ctx context.Context, project string) (ctrlclient.Client, error)
- func NewProjectHTTPClient(ctx context.Context, project string) (*http.Client, string, error)
- func NewProjectRESTConfig(ctx context.Context, project string) (*rest.Config, error)
- func NewProjectTypedClient(ctx context.Context, project string, scheme *runtime.Scheme) (ctrlclient.Client, error)
- func NewUserControlPlaneClient(ctx context.Context, userID string) (ctrlclient.Client, error)
- func UpdateObjectSpec(ctx context.Context, cli ctrlclient.Client, ...) (*unstructured.Unstructured, error)
- type ConflictError
- type ListOptions
- type WriteOptions
Constants ¶
const ( // DefaultListLimit is applied when a caller doesn't specify one. DefaultListLimit = 100 // MaxListLimit bounds every list call regardless of what a caller asks // for, so a single tool call can't dump an unbounded collection into // model context. Callers that want more follow the continue token. MaxListLimit = 500 )
Variables ¶
This section is empty.
Functions ¶
func CleanList ¶
func CleanList(list *unstructured.UnstructuredList) []map[string]any
CleanList returns cleaned copies of every item in list, in order.
func CleanObject ¶
func CleanObject(obj *unstructured.Unstructured) map[string]any
CleanObject returns a shallow copy of obj's fields with internal-only Kubernetes metadata stripped. spec, status, name, namespace, labels, and annotations are preserved in full.
func CreateObject ¶
func CreateObject(ctx context.Context, cli ctrlclient.Client, group, kind, namespace string, in any, opts WriteOptions) (*unstructured.Unstructured, error)
func DeleteObject ¶
func DeleteObject(ctx context.Context, cli ctrlclient.Client, group, kind, namespace, name string, opts WriteOptions) error
func FetchAllItems ¶
func FetchAllItems(ctx context.Context, cli ctrlclient.Client, group, kind, namespace string) ([]unstructured.Unstructured, error)
FetchAllItems fetches every item of a kind across all pages, following the continuation token until the server reports none remain. Use this only where correctness requires seeing the complete set regardless of size (e.g. membership verification) — everywhere else, prefer FetchList with caller-controlled pagination so a single tool call can't be made to pull an unbounded collection into model context.
func FetchList ¶
func FetchList(ctx context.Context, cli ctrlclient.Client, group, kind, namespace string, opts ListOptions) (*unstructured.UnstructuredList, error)
func FetchObject ¶
func FetchObject(ctx context.Context, cli ctrlclient.Client, group, kind, namespace, name string) (*unstructured.Unstructured, error)
Generic unstructured helpers using the shared RESTMapper
func GetResourceDefinition ¶
func GetResourceDefinition(ctx context.Context, project, group, version, kind string, structureOnly bool, out any) error
Discovery: CRD schema via OpenAPI v3 direct path: /openapi/v3/apis/<group>/<version>[/<kind>] When structureOnly is true, the schema is reduced to its structural shape (types, properties, required, items, additionalProperties, oneOf/anyOf/allOf) to save context; descriptions, formats, and examples are dropped.
func ListResourceDefinitions ¶
List CRDs under the project control-plane
func NewProjectHTTPClient ¶
NewProjectHTTPClient returns an HTTP client whose transport injects Authorization and the project control-plane base path prefix. Use with absolute URLs like "https://host" + path.
func NewProjectRESTConfig ¶ added in v0.2.3
NewProjectRESTConfig returns the rest.Config a project control-plane client is built from, for code that issues its own requests against that control plane's other APIs (e.g. the project logs API).
func NewProjectTypedClient ¶ added in v0.2.3
func NewProjectTypedClient(ctx context.Context, project string, scheme *runtime.Scheme) (ctrlclient.Client, error)
NewProjectTypedClient is NewProjectControlPlaneClient decoding into the typed objects scheme registers, for code that reads typed objects rather than unstructured ones (e.g. the alb toolset).
func UpdateObjectSpec ¶
func UpdateObjectSpec(ctx context.Context, cli ctrlclient.Client, group, kind, namespace, name string, in any, opts WriteOptions) (*unstructured.Unstructured, error)
Types ¶
type ConflictError ¶
ConflictError is returned by UpdateObjectSpec when a caller supplies ExpectedResourceVersion and the resource has since changed.
func (*ConflictError) Error ¶
func (e *ConflictError) Error() string
type ListOptions ¶
ListOptions bounds and filters a FetchList call. LabelSelector and FieldSelector use the same string syntax as kubectl (e.g. "team=edge", "metadata.name=foo").
type WriteOptions ¶
type WriteOptions struct {
// DryRun asks the server to validate and run admission without
// persisting the change. Standard Kubernetes apiserver behavior; not
// guaranteed for every custom controller's reconciliation path.
DryRun bool
// ExpectedResourceVersion, for update/delete only: when non-empty, the
// operation fails with a *ConflictError instead of proceeding if the
// resource's current resourceVersion doesn't match. Empty means no
// check (last-write-wins), which is the pre-existing behavior.
ExpectedResourceVersion string
}
WriteOptions controls create/update/delete behavior.