Files
homelab-frontend/internal/serviceadapter/types.go
T
Admin Bot 9c5fb0ce84
CI / Vet, test, build (push) Canceled after 2m10s
CI / Build and push image (push) Canceled after 0s
feat: load service adapters from ConfigMap, remove k8s API dependency
Adapters defined in config.yaml alongside routes and models.
Parsed by existing config loader, populated into registry at startup.
Removed: client-go deps, REST loader, informer, nginx proxy,
CiliumNetworkPolicy, apis/gateway/v1/ (duplicate types).
Kept: merged CI pipeline, imagePullPolicy Always, CA certs in Dockerfile.
2026-08-26 16:39:30 -07:00

60 lines
1.8 KiB
Go

package serviceadapter
import (
"time"
)
// Upstream defines an upstream target.
type Upstream struct {
URL string `json:"url" yaml:"url"`
TimeoutSeconds int32 `json:"timeoutSeconds" yaml:"timeoutSeconds"`
}
// Auth defines authentication requirements.
type Auth struct {
Required bool `json:"required" yaml:"required"`
Capability string `json:"capability,omitempty" yaml:"capability,omitempty"`
}
// Method defines an HTTP method endpoint.
type Method struct {
Verb string `json:"verb" yaml:"verb"`
UpstreamPath string `json:"upstreamPath" yaml:"upstreamPath"`
RequestSchema string `json:"requestSchema,omitempty" yaml:"requestSchema,omitempty"`
ResponseSchema string `json:"responseSchema,omitempty" yaml:"responseSchema,omitempty"`
Auth *Auth `json:"auth,omitempty" yaml:"auth,omitempty"`
}
// Resource defines a resource with multiple methods.
type Resource struct {
Name string `json:"name" yaml:"name"`
Methods []Method `json:"methods" yaml:"methods"`
Auth *Auth `json:"auth,omitempty" yaml:"auth,omitempty"`
}
// Spec is the ServiceAdapter spec.
type Spec struct {
ServiceName string `json:"serviceName" yaml:"serviceName"`
Upstream Upstream `json:"upstream" yaml:"upstream"`
Auth Auth `json:"auth" yaml:"auth"`
Retryable bool `json:"retryable,omitempty" yaml:"retryable,omitempty"`
Resources []Resource `json:"resources" yaml:"resources"`
}
// Status is the ServiceAdapter status.
type Status struct {
Ready bool `json:"ready,omitempty"`
Error string `json:"error,omitempty"`
LastSyncTime *time.Time `json:"lastSyncTime,omitempty"`
}
// ServiceAdapter is a gateway service adapter.
type ServiceAdapter struct {
Name string // namespace/name
Namespace string
ServiceName string
Spec Spec
Status Status
CreatedAt time.Time
}