Documentation ¶
Overview ¶
Package api implements the HTTP API of Easegress.
Package api implements the HTTP API of Easegress.
Index ¶
- Constants
- func ClusterPanic(err error)
- func HandleAPIError(w http.ResponseWriter, r *http.Request, code int, err error)
- func RegisterAPIs(apiGroup *Group)
- func RegisterObject(r *APIResource)
- func RegisterValidateHook()
- func UnregisterAPIs(group string)
- func WriteBody(w http.ResponseWriter, r *http.Request, body interface{})
- type APIResource
- type ChangeRequest
- type Entry
- type Err
- type Group
- type ListMembersResp
- type OperationType
- type ProfileStatusResponse
- type Server
- type StartProfilingRequest
- type ValidateHookFunc
Constants ¶
View Source
const ( // APIPrefixV1 is the prefix of v1 api, deprecated, will be removed soon. APIPrefixV1 = "/apis/v1" // APIPrefixV2 is the prefix of v2 api. APIPrefixV2 = "/apis/v2" // ConfigVersionKey is the key of header for config version. ConfigVersionKey = "X-Config-Version" )
View Source
const ( // CustomDataKindPrefix is the URL prefix of APIs for custom data kind CustomDataKindPrefix = "/customdatakinds" // CustomDataPrefix is the URL prefix of APIs for custom data CustomDataPrefix = "/customdata/{kind}" )
View Source
const ( // MetadataPrefix is the metadata prefix. MetadataPrefix = "/metadata" // ObjectMetadataPrefix is the object metadata prefix. ObjectMetadataPrefix = "/metadata/objects" // FilterMetaPrefix is the filter of Pipeline metadata prefix. FilterMetaPrefix = "/metadata/objects/pipeline/filters" )
View Source
const ( // ObjectPrefix is the object prefix. ObjectPrefix = "/objects" // ObjectKindsPrefix is the object-kinds prefix. ObjectKindsPrefix = "/object-kinds" // ObjectTemplatePrefix is the object-template prefix. ObjectTemplatePrefix = "/objects-yaml" // StatusObjectPrefix is the prefix of object status. StatusObjectPrefix = "/status/objects" // ObjectAPIResourcesPrefix is the prefix of object api resources. ObjectAPIResourcesPrefix = "/object-api-resources" )
View Source
const ( // ProfilePrefix is the URL prefix of profile APIs ProfilePrefix = "/profile" // StartAction is the URL for starting profiling StartAction = "start" // StopAction is the URL for stopping profiling StopAction = "stop" )
View Source
const DefaultNamespace = "default"
View Source
const (
// PrometheusMetricsPrefix is the prefix of Prometheus metrics exporter
PrometheusMetricsPrefix = "/metrics"
)
Variables ¶
This section is empty.
Functions ¶
func ClusterPanic ¶
func ClusterPanic(err error)
ClusterPanic panics because of the cluster-level fault.
func HandleAPIError ¶
HandleAPIError handles api error.
func RegisterObject ¶
func RegisterObject(r *APIResource)
func RegisterValidateHook ¶ added in v2.7.0
func RegisterValidateHook()
Types ¶
type APIResource ¶
type APIResource struct { Category string Kind string Name string Aliases []string // ValiateHook is optional, if set, will be called before create/update/delete object. // If it returns an error, the operation will be rejected. ValiateHook ValidateHookFunc `json:"-"` }
func ObjectAPIResources ¶
func ObjectAPIResources() []*APIResource
type ChangeRequest ¶
type ChangeRequest struct { Rebuild bool `json:"rebuild"` Delete []string `json:"delete"` List []customdata.Data `json:"list"` }
ChangeRequest represents a change request to custom data
type Entry ¶
type Entry struct { Path string `json:"path"` Method string `json:"method"` Handler http.HandlerFunc `json:"-"` }
Entry is the entry of API.
type ListMembersResp ¶
type ListMembersResp []cluster.MemberStatus
ListMembersResp is the response of list member.
func (ListMembersResp) Len ¶
func (r ListMembersResp) Len() int
func (ListMembersResp) Less ¶
func (r ListMembersResp) Less(i, j int) bool
func (ListMembersResp) Swap ¶
func (r ListMembersResp) Swap(i, j int)
type OperationType ¶ added in v2.7.0
type OperationType string
const ( OperationTypeCreate OperationType = "create" OperationTypeUpdate OperationType = "update" OperationTypeDelete OperationType = "delete" )
type ProfileStatusResponse ¶
type ProfileStatusResponse struct { CPUPath string `json:"cpuPath"` MemoryPath string `json:"memoryPath"` }
ProfileStatusResponse contains cpu and memory profile file paths
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the api server.
func MustNewServer ¶
func MustNewServer(opt *option.Options, cls cluster.Cluster, super *supervisor.Supervisor, profile pprof.Profile) *Server
MustNewServer creates an api server.
type StartProfilingRequest ¶
type StartProfilingRequest struct {
Path string `json:"path"`
}
StartProfilingRequest contains file path to profile file
type ValidateHookFunc ¶ added in v2.7.0
type ValidateHookFunc func(operationType OperationType, spec *supervisor.Spec) error
Click to show internal directories.
Click to hide internal directories.