Documentation ¶
Index ¶
- Constants
- Variables
- func AppContextToken(ctx context.Context) mcclient.TokenCredential
- func Base64UrlDecode(str string) ([]byte, error)
- func Base64UrlEncode(data []byte) string
- func FetchAuthToken(f func(context.Context, http.ResponseWriter, *http.Request)) func(context.Context, http.ResponseWriter, *http.Request)
- func FetchRegion(req *http.Request) string
- func FetchSession(ctx context.Context, r *http.Request) *mcclient.ClientSession
- func GetUploaderWorker() *appsrv.SWorkerManager
- func NewMethodHandlerFactory(method string, mf appsrv.MiddlewareFunc, prefix string) func(handleFunc, ...string) SHandler
- func RpcHandler(ctx context.Context, w http.ResponseWriter, req *http.Request)
- func UploadHandlerInfo(method, prefix string, ...) *appsrv.SHandlerInfo
- type AuthHandlers
- type CSRFResourceHandler
- type HandlerPath
- type IHandler
- type InfluxdbProxyHandler
- type K8sResourceHandler
- func (h *K8sResourceHandler) Bind(app *appsrv.Application)
- func (h *K8sResourceHandler) Delete(ctx context.Context, w http.ResponseWriter, req *http.Request)
- func (h *K8sResourceHandler) Get(ctx context.Context, w http.ResponseWriter, req *http.Request)
- func (h *K8sResourceHandler) GetYAML(ctx context.Context, w http.ResponseWriter, req *http.Request)
- func (h *K8sResourceHandler) Put(ctx context.Context, w http.ResponseWriter, req *http.Request)
- type Message
- type MiscHandler
- func (h *MiscHandler) Bind(app *appsrv.Application)
- func (mh *MiscHandler) DoBatchHostRegister(ctx context.Context, w http.ResponseWriter, req *http.Request)
- func (mh *MiscHandler) DoBatchUserRegister(ctx context.Context, w http.ResponseWriter, req *http.Request)
- func (h *MiscHandler) GetPrefix() string
- func (mh *MiscHandler) PostUploads(ctx context.Context, w http.ResponseWriter, req *http.Request)
- type PreLoginFunc
- type RPCHandlers
- type Request
- func (req *Request) Action() string
- func (req *Request) Body() jsonutils.JSONObject
- func (req *Request) Error() error
- func (req *Request) Mod1() modulebase.Manager
- func (req *Request) Mod2() modulebase.Manager
- func (req *Request) Mod3() modulebase.Manager
- func (req *Request) Params() map[string]string
- func (req *Request) Query() jsonutils.JSONObject
- func (req *Request) ResID() string
- func (req *Request) ResID2() string
- func (req *Request) ResID3() string
- func (req *Request) ResName() string
- func (req *Request) ResName2() string
- func (req *Request) ResName3() string
- func (req *Request) Session() *mcclient.ClientSession
- func (req *Request) Spec() string
- func (req *Request) WithMod1() *Request
- func (req *Request) WithMod2() *Request
- func (req *Request) WithMod3() *Request
- type ResourceHandlers
- func (f *ResourceHandlers) AddDelete(mf appsrv.MiddlewareFunc) *ResourceHandlers
- func (f *ResourceHandlers) AddGet(mf appsrv.MiddlewareFunc) *ResourceHandlers
- func (f *ResourceHandlers) AddPatch(mf appsrv.MiddlewareFunc) *ResourceHandlers
- func (f *ResourceHandlers) AddPost(mf appsrv.MiddlewareFunc) *ResourceHandlers
- func (f *ResourceHandlers) AddPut(mf appsrv.MiddlewareFunc) *ResourceHandlers
- type SActionLog
- type SBackendServiceProxyHandler
- type SHandler
- type SHandlers
- type SOIDCClientInfo
- type SOIDCClientToken
- type SOIDCRPInitLogoutRequest
Constants ¶
View Source
const ( HOST_MAC = "*MAC地址" HOST_NAME = "*名称" HOST_IPMI_ADDR = "*IPMI地址" HOST_IPMI_USERNAME = "*IPMI用户名" HOST_IPMI_PASSWORD = "*IPMI密码" HOST_MNG_IP_ADDR = "*管理口IP地址" HOST_IPMI_ADDR_OPTIONAL = "IPMI地址" HOST_IPMI_USERNAME_OPTIONAL = "IPMI用户名" HOST_IPMI_PASSWORD_OPTIONAL = "IPMI密码" HOST_MNG_IP_ADDR_OPTIONAL = "管理口IP地址" HOST_MNG_MAC_ADDR_OPTIONAL = "管理口MAC地址" )
View Source
const ( BATCH_USER_REGISTER_QUANTITY_LIMITATION = 1000 BATCH_HOST_REGISTER_QUANTITY_LIMITATION = 1000 )
View Source
const ( // OIDC code expires in 5 minutes OIDC_CODE_EXPIRE_SECONDS = 300 // OIDC token expires in 2 hours OIDC_TOKEN_EXPIRE_SECONDS = 7200 )
View Source
const ( APIVer = "<apiver>" ResName = "<resname>" ResID = "<resid>" ResName2 = "<resname2>" ResID2 = "<resid2>" ResName3 = "<resname3>" ResID3 = "<resid3>" Spec = "<spec>" Action = "<action>" GET = "GET" PUT = "PUT" POST = "POST" DELETE = "DELETE" PATCH = "PATCH" )
Variables ¶
View Source
var ( BatchHostRegisterTemplate = []string{HOST_MAC, HOST_NAME, HOST_IPMI_ADDR_OPTIONAL, HOST_IPMI_USERNAME_OPTIONAL, HOST_IPMI_PASSWORD_OPTIONAL} BatchHostISORegisterTemplate = []string{HOST_NAME, HOST_IPMI_ADDR, HOST_IPMI_USERNAME, HOST_IPMI_PASSWORD, HOST_MNG_IP_ADDR} BatchHostPXERegisterTemplate = []string{HOST_NAME, HOST_IPMI_ADDR, HOST_IPMI_USERNAME, HOST_IPMI_PASSWORD, HOST_MNG_MAC_ADDR_OPTIONAL, HOST_MNG_IP_ADDR_OPTIONAL} )
View Source
var IMAGE_DOWNLOAD_PUBLIC_KEY = stringutils.UUID4()
Functions ¶
func AppContextToken ¶
func AppContextToken(ctx context.Context) mcclient.TokenCredential
func Base64UrlDecode ¶
func Base64UrlEncode ¶
func FetchAuthToken ¶
func FetchRegion ¶
func FetchSession ¶
func GetUploaderWorker ¶
func GetUploaderWorker() *appsrv.SWorkerManager
func NewMethodHandlerFactory ¶
func RpcHandler ¶
func UploadHandlerInfo ¶
func UploadHandlerInfo(method, prefix string, handler func(context.Context, http.ResponseWriter, *http.Request)) *appsrv.SHandlerInfo
Types ¶
type AuthHandlers ¶
type AuthHandlers struct { *SHandlers // contains filtered or unexported fields }
func NewAuthHandlers ¶
func NewAuthHandlers(prefix string, preLoginHook PreLoginFunc) *AuthHandlers
func (*AuthHandlers) AddMethods ¶
func (h *AuthHandlers) AddMethods()
func (*AuthHandlers) Bind ¶
func (h *AuthHandlers) Bind(app *appsrv.Application)
func (*AuthHandlers) GetRegionsResponse ¶
func (h *AuthHandlers) GetRegionsResponse(ctx context.Context, w http.ResponseWriter, req *http.Request) (*agapi.SRegionsReponse, error)
type CSRFResourceHandler ¶
type CSRFResourceHandler struct {
*SHandlers
}
func NewCSRFResourceHandler ¶
func NewCSRFResourceHandler(prefix string) *CSRFResourceHandler
func (*CSRFResourceHandler) Bind ¶
func (h *CSRFResourceHandler) Bind(app *appsrv.Application)
type HandlerPath ¶
type HandlerPath struct {
// contains filtered or unexported fields
}
func NewHP ¶
func NewHP(f handleFunc, paths ...string) HandlerPath
type IHandler ¶
type IHandler interface {
Bind(*appsrv.Application)
}
type InfluxdbProxyHandler ¶
type InfluxdbProxyHandler struct {
// contains filtered or unexported fields
}
func NewInfluxdbProxyHandler ¶
func NewInfluxdbProxyHandler(prefix string) *InfluxdbProxyHandler
func NewProxyHandlerWithService ¶
func NewProxyHandlerWithService(prefix string, serviceName string) *InfluxdbProxyHandler
func (*InfluxdbProxyHandler) Bind ¶
func (h *InfluxdbProxyHandler) Bind(app *appsrv.Application)
type K8sResourceHandler ¶
type K8sResourceHandler struct {
// contains filtered or unexported fields
}
func NewK8sResourceHandler ¶
func NewK8sResourceHandler(prefix string) *K8sResourceHandler
func (*K8sResourceHandler) Bind ¶
func (h *K8sResourceHandler) Bind(app *appsrv.Application)
func (*K8sResourceHandler) Delete ¶
func (h *K8sResourceHandler) Delete(ctx context.Context, w http.ResponseWriter, req *http.Request)
func (*K8sResourceHandler) Get ¶
func (h *K8sResourceHandler) Get(ctx context.Context, w http.ResponseWriter, req *http.Request)
func (*K8sResourceHandler) GetYAML ¶
func (h *K8sResourceHandler) GetYAML(ctx context.Context, w http.ResponseWriter, req *http.Request)
func (*K8sResourceHandler) Put ¶
func (h *K8sResourceHandler) Put(ctx context.Context, w http.ResponseWriter, req *http.Request)
type Message ¶
type Message struct { RiskLevel int `json:"riskLevel"` SendIP string `json:"sendIP"` ManufacturerCode string `json:"manufacturerCode"` EventId string `json:"eventId"` Username string `json:"username"` ModuleType string `json:"moduleType"` EventDate string `json:"eventDate"` EventType string `json:"eventType"` EventResult string `json:"eventResult"` EventDesc string `json:"eventDesc"` BehaviorType int `json:"behaviorType"` }
type MiscHandler ¶
type MiscHandler struct {
// contains filtered or unexported fields
}
func NewMiscHandler ¶
func NewMiscHandler(prefix string) *MiscHandler
func (*MiscHandler) Bind ¶
func (h *MiscHandler) Bind(app *appsrv.Application)
func (*MiscHandler) DoBatchHostRegister ¶
func (mh *MiscHandler) DoBatchHostRegister(ctx context.Context, w http.ResponseWriter, req *http.Request)
func (*MiscHandler) DoBatchUserRegister ¶
func (mh *MiscHandler) DoBatchUserRegister(ctx context.Context, w http.ResponseWriter, req *http.Request)
func (*MiscHandler) GetPrefix ¶
func (h *MiscHandler) GetPrefix() string
func (*MiscHandler) PostUploads ¶
func (mh *MiscHandler) PostUploads(ctx context.Context, w http.ResponseWriter, req *http.Request)
type PreLoginFunc ¶
type RPCHandlers ¶
type RPCHandlers struct {
*SHandlers
}
func NewRPCHandlers ¶
func NewRPCHandlers(prefix string) *RPCHandlers
func (*RPCHandlers) AddGet ¶
func (h *RPCHandlers) AddGet(mf appsrv.MiddlewareFunc) *RPCHandlers
func (*RPCHandlers) AddPost ¶
func (h *RPCHandlers) AddPost(mf appsrv.MiddlewareFunc) *RPCHandlers
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) Body ¶
func (req *Request) Body() jsonutils.JSONObject
func (*Request) Mod1 ¶
func (req *Request) Mod1() modulebase.Manager
func (*Request) Mod2 ¶
func (req *Request) Mod2() modulebase.Manager
func (*Request) Mod3 ¶
func (req *Request) Mod3() modulebase.Manager
func (*Request) Query ¶
func (req *Request) Query() jsonutils.JSONObject
func (*Request) Session ¶
func (req *Request) Session() *mcclient.ClientSession
type ResourceHandlers ¶
type ResourceHandlers struct {
*SHandlers
}
func NewResourceHandlers ¶
func NewResourceHandlers(prefix string) *ResourceHandlers
func (*ResourceHandlers) AddDelete ¶
func (f *ResourceHandlers) AddDelete(mf appsrv.MiddlewareFunc) *ResourceHandlers
func (*ResourceHandlers) AddGet ¶
func (f *ResourceHandlers) AddGet(mf appsrv.MiddlewareFunc) *ResourceHandlers
func (*ResourceHandlers) AddPatch ¶
func (f *ResourceHandlers) AddPatch(mf appsrv.MiddlewareFunc) *ResourceHandlers
func (*ResourceHandlers) AddPost ¶
func (f *ResourceHandlers) AddPost(mf appsrv.MiddlewareFunc) *ResourceHandlers
func (*ResourceHandlers) AddPut ¶
func (f *ResourceHandlers) AddPut(mf appsrv.MiddlewareFunc) *ResourceHandlers
type SActionLog ¶
type SBackendServiceProxyHandler ¶
type SBackendServiceProxyHandler struct {
// contains filtered or unexported fields
}
func NewBackendServiceProxyHandler ¶
func NewBackendServiceProxyHandler(prefix string) *SBackendServiceProxyHandler
func (*SBackendServiceProxyHandler) Bind ¶
func (h *SBackendServiceProxyHandler) Bind(app *appsrv.Application)
type SHandler ¶
type SHandler struct { Method string Prefix string MiddlewareFunc appsrv.MiddlewareFunc HandleFunc handleFunc }
func NewHandler ¶
func NewHandler(method string, mf appsrv.MiddlewareFunc, hf handleFunc, paths ...string) SHandler
func (SHandler) Bind ¶
func (h SHandler) Bind(app *appsrv.Application)
type SHandlers ¶
type SHandlers struct {
// contains filtered or unexported fields
}
func NewHandlers ¶
func (*SHandlers) AddByMethod ¶
func (f *SHandlers) AddByMethod(method string, mf appsrv.MiddlewareFunc, hs ...HandlerPath) *SHandlers
func (*SHandlers) Bind ¶
func (f *SHandlers) Bind(app *appsrv.Application)
type SOIDCClientInfo ¶
type SOIDCClientToken ¶
type SOIDCClientToken struct {
Info SOIDCClientInfo
}
type SOIDCRPInitLogoutRequest ¶
type SOIDCRPInitLogoutRequest struct { // RECOMMENDED. ID Token previously issued by the OP to the RP passed to the Logout Endpoint // as a hint about the End-User's current authenticated session with the Client. This is used // as an indication of the identity of the End-User that the RP is requesting be logged out by the OP. IdTokenHint string `json:"id_token_hint"` // OPTIONAL. Hint to the Authorization Server about the End-User that is logging out. The value // and meaning of this parameter is left up to the OP's discretion. For instance, the value might // contain an email address, phone number, username, or session identifier pertaining to the RP's // session with the OP for the End-User. (This parameter is intended to be analogous to the // login_hint parameter defined in Section 3.1.2.1 of OpenID Connect Core 1.0 [OpenID.Core] that // is used in Authentication Requests; whereas, logout_hint is used in RP-Initiated Logout Requests.) LogoutHint string `json:"logout_hint"` // OPTIONAL. OAuth 2.0 Client Identifier valid at the Authorization Server. When both client_id and // id_token_hint are present, the OP MUST verify that the Client Identifier matches the one used when // issuing the ID Token. The most common use case for this parameter is to specify the Client Identifier // when post_logout_redirect_uri is used but id_token_hint is not. Another use is for symmetrically // encrypted ID Tokens used as id_token_hint values that require the Client Identifier to be specified // by other means, so that the ID Tokens can be decrypted by the OP. ClientId string `json:"client_id"` // OPTIONAL. URI to which the RP is requesting that the End-User's User Agent be redirected after a // logout has been performed. This URI SHOULD use the https scheme and MAY contain port, path, and // query parameter components; however, it MAY use the http scheme, provided that the Client Type is // confidential, as defined in Section 2.1 of OAuth 2.0 [RFC6749], and provided the OP allows the use // of http RP URIs. The URI MAY use an alternate scheme, such as one that is intended to identify a // callback into a native application. The value MUST have been previously registered with the OP, // either using the post_logout_redirect_uris Registration parameter or via another mechanism. An // id_token_hint is also RECOMMENDED when this parameter is included. PostLogoutRedirectUri string `json:"post_logout_redirect_uri"` // OPTIONAL. Opaque value used by the RP to maintain state between the logout request and the callback // to the endpoint specified by the post_logout_redirect_uri parameter. If included in the logout request, // the OP passes this value back to the RP using the state parameter when redirecting the User Agent back to the RP. State string `json:"state"` // OPTIONAL. End-User's preferred languages and scripts for the user interface, represented as a // space-separated list of BCP47 [RFC5646] language tag values, ordered by preference. For instance, // the value "fr-CA fr en" represents a preference for French as spoken in Canada, then French (without // a region designation), followed by English (without a region designation). An error SHOULD NOT result // if some or all of the requested locales are not supported by the OpenID Provider. UiLocales string `json:"ui_locales"` }
Click to show internal directories.
Click to hide internal directories.