Documentation
¶
Index ¶
- Constants
- Variables
- func NewID() (string, error)
- func SendNotFound(w http.ResponseWriter, r *http.Request)
- func SendPanic(w http.ResponseWriter, r *http.Request)
- func SendUnauthorized(w http.ResponseWriter, r *http.Request, message string)
- type AdapterCondition
- type AdapterConditionStatus
- type AdapterStatus
- type AdapterStatusIndex
- type AdapterStatusList
- type AdapterStatusMetadata
- type Cluster
- type ClusterIndex
- type ClusterList
- type ClusterPatchRequest
- type Meta
- type Metadata
- type NodePool
- type NodePoolIndex
- type NodePoolList
- type NodePoolPatchRequest
- type PagingMeta
- type Resource
- type ResourceCondition
- type ResourceConditionStatus
- type ResourceList
- type ResourcePatchRequest
Constants ¶
const ( ResourceTypeCluster = "Cluster" ResourceTypeNodePool = "NodePool" )
Resource type constants
const ( AdapterConditionTypeAvailable = "Available" AdapterConditionTypeApplied = "Applied" AdapterConditionTypeHealth = "Health" AdapterConditionTypeReconciled = "Reconciled" AdapterConditionTypeFinalized = "Finalized" )
Adapter condition type constants (used in adapter.conditions reported by adapters)
const ( ResourceConditionTypeAvailable = "Available" ResourceConditionTypeHealth = "Health" ResourceConditionTypeReconciled = "Reconciled" ResourceConditionTypeFinalized = "Finalized" ResourceConditionTypeLastKnownReconciled = "LastKnownReconciled" )
Resource condition type constants (used in resource.status.conditions aggregated from adapters)
Variables ¶
var BuildTime = "unknown"
BuildTime is the time when the binary was built, set at compile time via ldflags
var Commit = "unknown"
Commit is the git commit SHA set at compile time via ldflags
var Version = "0.0.0-dev"
Version is the application version set at compile time via ldflags
Functions ¶
func NewID ¶
NewID generates a new RFC4122 UUID v7 identifier in lowercase format. UUID v7 embeds a Unix timestamp (millisecond precision) in the first 48 bits, providing time-ordering and improved database index performance. The resulting 36-character string (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) is suitable for use in REST APIs, database storage, and Kubernetes resource names.
The lowercase UUID format is DNS-1123 compliant (contains only a-f, 0-9, and hyphens; starts and ends with alphanumeric; 36 chars < 253 char subdomain limit).
Returns an error if UUID generation fails (extremely unlikely in practice).
func SendNotFound ¶
func SendNotFound(w http.ResponseWriter, r *http.Request)
SendNotFound sends a 404 response in RFC 9457 Problem Details format.
func SendPanic ¶
func SendPanic(w http.ResponseWriter, r *http.Request)
SendPanic sends a panic error response in RFC 9457 Problem Details format. It attempts to include trace_id and timestamp dynamically, falling back to a pre-computed body if marshaling fails.
func SendUnauthorized ¶
func SendUnauthorized(w http.ResponseWriter, r *http.Request, message string)
SendUnauthorized sends a 401 response in RFC 9457 Problem Details format.
Types ¶
type AdapterCondition ¶
type AdapterCondition struct {
LastTransitionTime time.Time `json:"last_transition_time"`
Reason *string `json:"reason,omitempty"`
Message *string `json:"message,omitempty"`
Type string `json:"type"`
Status AdapterConditionStatus `json:"status"`
}
AdapterCondition represents a condition of an adapter Domain equivalent of openapi.AdapterCondition JSON tags match database JSONB structure
type AdapterConditionStatus ¶
type AdapterConditionStatus string
AdapterConditionStatus represents the status of an adapter condition (includes Unknown) Domain equivalent of openapi.AdapterConditionStatus
const ( AdapterConditionTrue AdapterConditionStatus = "True" AdapterConditionFalse AdapterConditionStatus = "False" AdapterConditionUnknown AdapterConditionStatus = "Unknown" )
func (AdapterConditionStatus) IsValid ¶ added in v0.3.0
func (s AdapterConditionStatus) IsValid() bool
IsValid returns true if the status is one of the accepted enum values (True, False, Unknown).
type AdapterStatus ¶
type AdapterStatus struct {
LastReportTime time.Time `json:"last_report_time" gorm:"not null"`
CreatedTime time.Time `json:"created_time" gorm:"not null"`
Meta
ResourceType string `json:"resource_type" gorm:"size:20;index:idx_resource;not null"`
ResourceID string `json:"resource_id" gorm:"size:255;index:idx_resource;not null"`
Adapter string `json:"adapter" gorm:"size:255;not null;uniqueIndex:idx_resource_adapter"`
Conditions datatypes.JSON `json:"conditions" gorm:"type:jsonb;not null"`
Data datatypes.JSON `json:"data,omitempty" gorm:"type:jsonb"`
Metadata datatypes.JSON `json:"metadata,omitempty" gorm:"type:jsonb"`
ObservedGeneration int32 `json:"observed_generation" gorm:"not null"`
}
AdapterStatus database model
func (*AdapterStatus) BeforeCreate ¶
func (as *AdapterStatus) BeforeCreate(tx *gorm.DB) error
func (*AdapterStatus) IsFinalized ¶ added in v0.3.0
func (as *AdapterStatus) IsFinalized() bool
type AdapterStatusIndex ¶
type AdapterStatusIndex map[string]*AdapterStatus
type AdapterStatusList ¶
type AdapterStatusList []*AdapterStatus
func (AdapterStatusList) Index ¶
func (l AdapterStatusList) Index() AdapterStatusIndex
type AdapterStatusMetadata ¶
type AdapterStatusMetadata struct {
Attempt *int32 `json:"attempt,omitempty"`
CompletedTime *time.Time `json:"completed_time,omitempty"`
Duration *string `json:"duration,omitempty"`
JobName *string `json:"job_name,omitempty"`
JobNamespace *string `json:"job_namespace,omitempty"`
StartedTime *time.Time `json:"started_time,omitempty"`
}
type Cluster ¶
type Cluster struct {
Meta
Kind string `json:"kind" gorm:"default:'Cluster'"`
Name string `json:"name" gorm:"uniqueIndex;size:53;not null"`
Href string `json:"href,omitempty" gorm:"size:500"`
CreatedBy string `json:"created_by" gorm:"size:255;not null"`
UpdatedBy string `json:"updated_by" gorm:"size:255;not null"`
DeletedBy *string `json:"deleted_by,omitempty" gorm:"size:255"`
DeletedTime *time.Time `json:"deleted_time,omitempty"`
Spec datatypes.JSON `json:"spec" gorm:"type:jsonb;not null"`
Labels datatypes.JSON `json:"labels,omitempty" gorm:"type:jsonb"`
StatusConditions datatypes.JSON `json:"status_conditions" gorm:"type:jsonb"`
Generation int32 `json:"generation" gorm:"default:1;not null"`
}
Cluster database model
func (*Cluster) IncrementGeneration ¶ added in v0.3.0
func (c *Cluster) IncrementGeneration()
type ClusterIndex ¶
type ClusterList ¶
type ClusterList []*Cluster
func (ClusterList) Index ¶
func (l ClusterList) Index() ClusterIndex
type ClusterPatchRequest ¶
type Metadata ¶
type Metadata struct {
ID string `json:"id"`
HREF string `json:"href"`
Kind string `json:"kind"`
Version string `json:"version"`
BuildTime string `json:"build_time"`
}
Metadata api metadata.
type NodePool ¶
type NodePool struct {
Cluster *Cluster `gorm:"foreignKey:OwnerID;references:ID"`
Meta
Kind string `json:"kind" gorm:"default:'NodePool'"`
Name string `json:"name" gorm:"size:15;not null"`
UpdatedBy string `json:"updated_by" gorm:"size:255;not null"`
DeletedBy *string `json:"deleted_by,omitempty" gorm:"size:255"`
DeletedTime *time.Time `json:"deleted_time,omitempty"`
Href string `json:"href,omitempty" gorm:"size:500"`
CreatedBy string `json:"created_by" gorm:"size:255;not null"`
OwnerID string `json:"owner_id" gorm:"size:255;not null;index"`
OwnerKind string `json:"owner_kind" gorm:"size:50;not null"`
OwnerHref string `json:"owner_href,omitempty" gorm:"size:500"`
Spec datatypes.JSON `json:"spec" gorm:"type:jsonb;not null"`
StatusConditions datatypes.JSON `json:"status_conditions" gorm:"type:jsonb"`
Labels datatypes.JSON `json:"labels,omitempty" gorm:"type:jsonb"`
Generation int32 `json:"generation" gorm:"default:1;not null"`
}
NodePool database model
func (*NodePool) IncrementGeneration ¶ added in v0.3.0
func (np *NodePool) IncrementGeneration()
type NodePoolIndex ¶
type NodePoolList ¶
type NodePoolList []*NodePool
func (NodePoolList) Index ¶
func (l NodePoolList) Index() NodePoolIndex
type NodePoolPatchRequest ¶
type PagingMeta ¶
PagingMeta List Paging metadata
type Resource ¶ added in v0.3.0
type Resource struct {
Meta
Kind string `json:"kind" gorm:"size:100;not null"`
Name string `json:"name" gorm:"size:100;not null"`
Href string `json:"href,omitempty" gorm:"size:500"`
CreatedBy string `json:"created_by" gorm:"size:255;not null"`
UpdatedBy string `json:"updated_by" gorm:"size:255;not null"`
DeletedBy *string `json:"deleted_by,omitempty" gorm:"size:255"`
DeletedTime *time.Time `json:"deleted_time,omitempty"`
OwnerID *string `json:"owner_id,omitempty" gorm:"size:255"`
OwnerKind *string `json:"owner_kind,omitempty" gorm:"size:100"`
OwnerHref *string `json:"owner_href,omitempty" gorm:"size:500"`
Spec datatypes.JSON `json:"spec" gorm:"type:jsonb;not null"`
Labels datatypes.JSON `json:"labels,omitempty" gorm:"type:jsonb"`
Generation int32 `json:"generation" gorm:"default:1;not null"`
}
Resource is the generic GORM model for entity types managed by the entity registry (Channel, Version, WIF Config, etc.). Entity kinds are differentiated by the Kind field. Existing Cluster and NodePool types are NOT migrated to this model.
func (*Resource) IncrementGeneration ¶ added in v0.3.0
func (r *Resource) IncrementGeneration()
func (*Resource) MarkDeleted ¶ added in v0.3.0
type ResourceCondition ¶
type ResourceCondition struct {
CreatedTime time.Time `json:"created_time"`
LastUpdatedTime time.Time `json:"last_updated_time"`
LastTransitionTime time.Time `json:"last_transition_time"`
Reason *string `json:"reason,omitempty"`
Message *string `json:"message,omitempty"`
Type string `json:"type"`
Status ResourceConditionStatus `json:"status"`
ObservedGeneration int32 `json:"observed_generation"`
}
ResourceCondition represents a condition of a resource Domain equivalent of openapi.ResourceCondition JSON tags match database JSONB structure
type ResourceConditionStatus ¶
type ResourceConditionStatus string
ResourceConditionStatus represents the status of a resource condition (True/False only) Domain equivalent of openapi.ResourceConditionStatus
const ( ConditionTrue ResourceConditionStatus = "True" // String value matches openapi.TRUE ConditionFalse ResourceConditionStatus = "False" // String value matches openapi.FALSE )
type ResourceList ¶ added in v0.3.0
type ResourceList []*Resource