Documentation
¶
Index ¶
- func GetClusterDetailRaw(ac *client.AlpaconClient, clusterID string) ([]byte, error)
- func GetClusterIDByName(ac *client.AlpaconClient, clusterName string) (string, error)
- func ResolveGroupNames(ac *client.AlpaconClient, groupIDs []string) []string
- type ClusterAttributes
- type ClusterDetail
- type Optional
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClusterDetailRaw ¶
func GetClusterDetailRaw(ac *client.AlpaconClient, clusterID string) ([]byte, error)
GetClusterDetailRaw fetches one cluster by ID and returns the body as the server sent it.
func GetClusterIDByName ¶
func GetClusterIDByName(ac *client.AlpaconClient, clusterName string) (string, error)
GetClusterIDByName resolves a cluster name to its ID through the server's exact-match name filter.
func ResolveGroupNames ¶
func ResolveGroupNames(ac *client.AlpaconClient, groupIDs []string) []string
ResolveGroupNames maps group UUIDs to names in one batched lookup. A UUID with no match, or every UUID when the lookup fails, is shown as-is so the caller's output is never blocked on the group list.
Types ¶
type ClusterAttributes ¶
type ClusterAttributes struct {
Name string `json:"name"`
Provider string `json:"provider"`
KubeVersion Optional[string] `json:"kube_version" table:"Kube Version"`
NodeCount Optional[int] `json:"node_count" table:"Nodes"`
Connected bool `json:"connected"`
Enabled bool `json:"enabled"`
AgentVersion string `json:"agent_version" table:"Agent Version"`
}
ClusterAttributes is the 'kube ls' row. Its version and node count keep the server's names and types, so a script reading --output json sees node_count as a number and a value the agent has not reported yet as null; the table shows that as blank. Connected follows ServerAttributes, not is_connected.
func GetClusterList ¶
func GetClusterList(ac *client.AlpaconClient) ([]ClusterAttributes, error)
GetClusterList returns every cluster the caller can see, projected for 'kube ls'. A service token sees none: the server answers it with an empty list.
type ClusterDetail ¶
type ClusterDetail struct {
ID string `json:"id"`
Name string `json:"name"`
Provider string `json:"provider"`
KubeVersion *string `json:"kube_version"`
AgentVersion string `json:"agent_version"`
NodeCount *int `json:"node_count"`
Status json.RawMessage `json:"status"`
Enabled bool `json:"enabled"`
Groups []string `json:"groups"`
Tags json.RawMessage `json:"tags"`
IsConnected bool `json:"is_connected"`
LastConnectivity *time.Time `json:"last_connectivity"`
LastSyncedAt *time.Time `json:"last_synced_at"`
AddedAt time.Time `json:"added_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ClusterDetail decodes one entry of /api/kubernetes/clusters/. Status and Tags stay raw: the server stores both as free-form JSON, and status has no enum. KubeVersion and NodeCount are nil until the agent has measured them, which is not the same as an empty version or zero nodes.
func GetClusterDetail ¶
func GetClusterDetail(ac *client.AlpaconClient, clusterID string) (*ClusterDetail, error)
GetClusterDetail fetches one cluster by ID.
type Optional ¶
type Optional[T any] struct { Value *T }
Optional is a value the server may send as null. PrintTable formats a cell with %v, which would print a bare pointer's address, so the pointer is wrapped: String renders null as blank and MarshalJSON keeps it null.