Documentation ¶
Index ¶
- Constants
- Variables
- func GetAPIV1Action() []*httpserver.Action
- func InitActionsFunc() error
- func MasterRequired(f restful.RouteFunction) func(req *restful.Request, resp *restful.Response)
- func NoLimit(f restful.RouteFunction) func(req *restful.Request, resp *restful.Response)
- func RegisterInitFunc(f func() error)
- func RegisterV1Action(action Action)
- func ReturnRest(resp *RestResponse)
- func WithBasicGroup(basic map[string]bool, extra map[string]bool) map[string]bool
- type Action
- type DistCCServerAPIResource
- type DistTaskServerAPIResource
- type FBServerAPIResource
- type ProcessType
- type RestResponse
- type XNAPISServerAPIResource
Constants ¶
View Source
const ( // multiSeparator is used for split keys from string MultiSeparator = "," QueryTaskIDKey = "task_id" QueryProjectIDKey = "project_id" QueryBuildIDKey = "build_id" QueryStatusKey = "status" QueryPriorityKey = "priority" QueryCreateTimeLeftKey = "create_time_left" QueryCreateTimeRightKey = "create_time_right" QueryCreateTimeKey = "create_time" QueryStartTimeLeftKey = "start_time_left" QueryStartTimeRightKey = "start_time_right" QueryStartTimeKey = "start_time" QueryEndTimeLeftKey = "end_time_left" QueryEndTimeRightKey = "end_time_right" QueryEndTimeKey = "end_time" QueryProjectNameKey = "project_name" QueryIPKey = "ip" QueryStageTimeout = "stage_timeout" QueryReleased = "released" QueryOffsetKey = "offset" QueryLimitKey = "limit" QuerySelectorKey = "selector" QueryOrderKey = "order" )
View Source
const (
// PathV1 describe the prefix of version 1 http action.
PathV1 = prefix + versionV1
)
Variables ¶
View Source
var ( // GroupListTaskInKey implements the keys that can be filtered with "In" during task list GroupListTaskInKey = map[string]bool{ QueryTaskIDKey: true, QueryProjectIDKey: true, QueryBuildIDKey: true, QueryStatusKey: true, QueryPriorityKey: true, QueryReleased: true, } // GroupListTaskGtKey implements the keys that can be filtered with "Gt" during task list GroupListTaskGtKey = map[string]bool{ QueryCreateTimeLeftKey: true, QueryStartTimeLeftKey: true, QueryEndTimeLeftKey: true, } // GroupListTaskLtKey implements the keys that can be filtered with "Lt" during task list GroupListTaskLtKey = map[string]bool{ QueryStartTimeRightKey: true, QueryCreateTimeRightKey: true, QueryEndTimeRightKey: true, } // GroupListProjectInKey implements the keys that can be filtered with "In" during project list GroupListProjectInKey = map[string]bool{ QueryProjectIDKey: true, QueryProjectNameKey: true, QueryPriorityKey: true, QueryStageTimeout: true, } // GroupListWhitelistInKey implements the keys that can be filtered with "In" during whitelist list GroupListWhitelistInKey = map[string]bool{ QueryProjectIDKey: true, QueryIPKey: true, } // GroupIntKey implements the int keys GroupIntKey = map[string]bool{ QueryPriorityKey: true, QueryStageTimeout: true, } // GroupInt64Key implements the int64 keys GroupInt64Key = map[string]bool{ QueryCreateTimeLeftKey: true, QueryStartTimeLeftKey: true, QueryEndTimeLeftKey: true, QueryStartTimeRightKey: true, QueryCreateTimeRightKey: true, QueryEndTimeRightKey: true, } // GroupBoolKey implements the bool keys GroupBoolKey = map[string]bool{ QueryReleased: true, } // GroupFloat64Key implements the float64 keys GroupFloat64Key = map[string]bool{} // OriginKey implements the lt and gt origin key OriginKey = map[string]string{ QueryCreateTimeLeftKey: QueryCreateTimeKey, QueryCreateTimeRightKey: QueryCreateTimeKey, QueryStartTimeLeftKey: QueryStartTimeKey, QueryStartTimeRightKey: QueryStartTimeKey, QueryEndTimeLeftKey: QueryEndTimeKey, QueryEndTimeRightKey: QueryEndTimeKey, } )
View Source
var Rd register_discover.RegisterDiscover
Functions ¶
func InitActionsFunc ¶
func InitActionsFunc() error
InitActionsFunc will call all the functions in initFunc
func MasterRequired ¶
func MasterRequired(f restful.RouteFunction) func(req *restful.Request, resp *restful.Response)
MasterRequired wrap the api handler and make it only available for master node.
func NoLimit ¶
func NoLimit(f restful.RouteFunction) func(req *restful.Request, resp *restful.Response)
NoLimit wrap the api handler and will process all requests.
func RegisterInitFunc ¶
func RegisterInitFunc(f func() error)
RegisterInitFunc called by actions for registering some daemon functions and these functions will be called after flag-init and server-start
func RegisterV1Action ¶
func RegisterV1Action(action Action)
RegisterV1Action register a handler into v1 actions means all the URL of these handlers are start with PathV1
func ReturnRest ¶
func ReturnRest(resp *RestResponse)
ReturnRest do the return work according to a RestResponse
Types ¶
type DistCCServerAPIResource ¶
type DistCCServerAPIResource struct { ActionsV1 []*httpserver.Action MySQL distcc.MySQL Conf *config.GatewayConfig }
DistCCServerAPIResource describe all the server api resources
func GetDistCCServerAPIResource ¶
func GetDistCCServerAPIResource() *DistCCServerAPIResource
func (*DistCCServerAPIResource) InitActions ¶
func (a *DistCCServerAPIResource) InitActions()
type DistTaskServerAPIResource ¶
type DistTaskServerAPIResource struct { ActionsV1 []*httpserver.Action MySQL disttask.MySQL Conf *config.GatewayConfig }
func GetDistTaskServerAPIResource ¶
func GetDistTaskServerAPIResource() *DistTaskServerAPIResource
func (*DistTaskServerAPIResource) InitActions ¶
func (a *DistTaskServerAPIResource) InitActions()
type FBServerAPIResource ¶
type FBServerAPIResource struct { ActionsV1 []*httpserver.Action MySQL fastbuild.MySQL Conf *config.GatewayConfig }
func GetFBServerAPIResource ¶
func GetFBServerAPIResource() *FBServerAPIResource
func (*FBServerAPIResource) InitActions ¶
func (a *FBServerAPIResource) InitActions()
type ProcessType ¶
type ProcessType string
const ( ProcessMasterOnly ProcessType = "master_only" ProcessNoLimit ProcessType = "no_limit" )
type RestResponse ¶
type RestResponse struct { Resp *restful.Response HTTPCode int Data interface{} ErrCode commonTypes.ServerErrCode Message string Extra map[string]interface{} WrapFunc func([]byte) []byte }
RestResponse contains all response information need by a http handler
type XNAPISServerAPIResource ¶
type XNAPISServerAPIResource struct { ActionsV1 []*httpserver.Action MySQL apisjob.MySQL Conf *config.GatewayConfig }
func GetXNAPISServerAPIResource ¶
func GetXNAPISServerAPIResource() *XNAPISServerAPIResource
func (*XNAPISServerAPIResource) InitActions ¶
func (a *XNAPISServerAPIResource) InitActions()
Click to show internal directories.
Click to hide internal directories.