Traefik_Control/backend/internal/models/traefik.go

134 lines
No EOL
4.5 KiB
Go

package models
import "time"
type Router struct {
Name string `json:"name"`
Provider string `json:"provider"`
Rule string `json:"rule"`
EntryPoints []string `json:"entry_points"`
Service string `json:"service"`
Middlewares []string `json:"middlewares"`
Priority int `json:"priority"`
TLS *RouterTLSConfig `json:"tls,omitempty"`
Status string `json:"status"`
Using []string `json:"using,omitempty"`
}
type RouterTLSConfig struct {
Options string `json:"options,omitempty"`
CertResolver string `json:"cert_resolver,omitempty"`
Domains []Domain `json:"domains,omitempty"`
}
type Domain struct {
Main string `json:"main"`
SANs []string `json:"sans,omitempty"`
}
type Service struct {
Name string `json:"name"`
Provider string `json:"provider"`
Type string `json:"type"`
LoadBalancer *LoadBalancer `json:"load_balancer,omitempty"`
ServerStatus map[string]string `json:"server_status,omitempty"`
Status string `json:"status"`
// v3.7: service-level middlewares (HTTP services can declare middlewares directly)
Middlewares []string `json:"middlewares,omitempty"`
// Compatibility: some API responses use camelCase
}
type LoadBalancer struct {
Servers []Server `json:"servers,omitempty"`
Strategy string `json:"strategy,omitempty"`
PassHostHeader *bool `json:"pass_host_header,omitempty"`
HealthCheck *HealthCheck `json:"health_check,omitempty"`
}
type Server struct {
URL string `json:"url"`
Weight *int `json:"weight,omitempty"`
PreservePath bool `json:"preserve_path,omitempty"`
}
type HealthCheck struct {
Scheme string `json:"scheme,omitempty"`
Path string `json:"path,omitempty"`
Method string `json:"method,omitempty"`
Status int `json:"status,omitempty"`
Port int `json:"port,omitempty"`
Interval string `json:"interval,omitempty"`
Timeout string `json:"timeout,omitempty"`
Hostname string `json:"hostname,omitempty"`
FollowRedirects *bool `json:"follow_redirects,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
}
type Middleware struct {
Name string `json:"name"`
Provider string `json:"provider"`
Type string `json:"type"`
Spec map[string]interface{} `json:"spec,omitempty"`
Status string `json:"status"`
}
type Certificate struct {
Name string `json:"name"`
CommonName string `json:"common_name"`
SANs []string `json:"sans"`
IssuerOrg string `json:"issuer_org"`
IssuerCN string `json:"issuer_cn"`
NotBefore time.Time `json:"not_before"`
NotAfter time.Time `json:"not_after"`
Status string `json:"status"`
Provider string `json:"provider"`
}
type EntryPoint struct {
Name string `json:"name"`
Address string `json:"address"`
HTTP *EntryPointHTTP `json:"http,omitempty"`
ForwardedHeaders *ForwardedHeaders `json:"forwarded_headers,omitempty"`
}
type EntryPointHTTP struct {
TLS *EntryPointTLS `json:"tls,omitempty"`
Middlewares []string `json:"middlewares,omitempty"`
RedirectToHTTPS bool `json:"redirect_to_https,omitempty"`
}
type EntryPointTLS struct {
CertResolver string `json:"cert_resolver,omitempty"`
Domains []Domain `json:"domains,omitempty"`
Options string `json:"options,omitempty"`
}
type ForwardedHeaders struct {
InsecureSkipVerify bool `json:"insecure_skip_verify,omitempty"`
TrustedIPs []string `json:"trusted_ips,omitempty"`
}
type Overview struct {
HTTP struct {
Routers Section `json:"routers"`
Services Section `json:"services"`
Middlewares Section `json:"middlewares"`
} `json:"http"`
TCP struct {
Routers Section `json:"routers"`
Services Section `json:"services"`
Middlewares Section `json:"middlewares"`
} `json:"tcp"`
UDP struct {
Routers Section `json:"routers"`
Services Section `json:"services"`
} `json:"udp"`
Certificates *Section `json:"certificates,omitempty"`
Providers []string `json:"providers,omitempty"`
}
type Section struct {
Total int `json:"total"`
Warnings int `json:"warnings"`
Errors int `json:"errors"`
}