api

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package api provides types for Preflight reports and some common helpers.

Index

Constants

View Source
const TimeFormat = time.RFC3339

TimeFormat defines the format used for timestamps across all this API.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentMetadata added in v0.1.17

type AgentMetadata struct {
	Version string `json:"version"`
	// ClusterID is the name of the cluster or host where the agent is running.
	// It may send data for other clusters in its datareadings.
	ClusterID string `json:"cluster_id"`
}

AgentMetadata is metadata about the agent.

type DataReading

type DataReading struct {
	// ClusterID is optional as it can be inferred from the agent
	// token when using basic authentication.
	ClusterID     string      `json:"cluster_id,omitempty"`
	DataGatherer  string      `json:"data-gatherer"`
	Timestamp     Time        `json:"timestamp"`
	Data          interface{} `json:"data"`
	SchemaVersion string      `json:"schema_version"`
}

DataReading is the output of a DataGatherer.

func (*DataReading) UnmarshalJSON added in v1.7.0

func (o *DataReading) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for DataReading. The function attempts to decode the Data field into known types in a prioritized order. Empty data is considered an error, because there is no way to discriminate between data types. TODO(wallrj): Add a discriminator field to DataReading to avoid this complex logic. E.g. "data_type": "discovery"|"dynamic"

type DataReadingsPost added in v0.1.17

type DataReadingsPost struct {
	AgentMetadata *AgentMetadata `json:"agent_metadata"`
	// DataGatherTime represents the time that the data readings were gathered
	DataGatherTime time.Time      `json:"data_gather_time"`
	DataReadings   []*DataReading `json:"data_readings"`
}

DataReadingsPost is the payload in the upload request.

type DiscoveryData added in v1.7.0

type DiscoveryData struct {
	// ClusterID is the unique ID of the Kubernetes cluster which this snapshot was taken from.
	// This is sourced from the kube-system namespace UID,
	// which is assumed to be stable for the lifetime of the cluster.
	// - https://github.com/kubernetes/kubernetes/issues/77487#issuecomment-489786023
	ClusterID string `json:"cluster_id"`
	// ServerVersion is the version information of the k8s apiserver
	// See https://godoc.org/k8s.io/apimachinery/pkg/version#Info
	ServerVersion *version.Info `json:"server_version"`
}

DiscoveryData is the DataReading.Data returned by the k8s.ConfigDiscovery gatherer

type DynamicData added in v1.7.0

type DynamicData struct {
	// Items is a list of GatheredResource
	Items []*GatheredResource `json:"items"`
}

DynamicData is the DataReading.Data returned by the k8s.DataGathererDynamic gatherer

type GatheredResource added in v0.1.29

type GatheredResource struct {
	// Resource is a reference to a k8s object that was found by the informer
	// should be of type unstructured.Unstructured, raw Object
	Resource  interface{} `json:"resource"`
	DeletedAt Time        `json:"deleted_at,omitempty"`
}

GatheredResource wraps the raw k8s resource that is sent to the jetstack secure backend

func (GatheredResource) MarshalJSON added in v0.1.29

func (v GatheredResource) MarshalJSON() ([]byte, error)

func (*GatheredResource) UnmarshalJSON added in v1.7.0

func (v *GatheredResource) UnmarshalJSON(data []byte) error

type Time

type Time struct {
	time.Time
}

Time is a wrapper around time.Time that overrides how it is marshaled into JSON

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON marshals the timestamp with RFC3339 format

func (Time) String

func (t Time) String() string

String returns a string representation of the timestamp

Jump to

Keyboard shortcuts

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