handler

package
v0.0.0-...-9be0976 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func In

func In(list []string, item string) bool

Types

type APIType

type APIType uint8
const (

	/*
		/{service}/api/v1/namespaces/{namespace_name}
		eg: /workload/api/v1/namespaces
	*/
	LIST_ALL_RESOURCE APIType = iota

	/*
		/{service}/api/v1/namespaces/{namespace_name}
		eg: /workload/api/v1/namespaces/im-ops
	*/
	LIST_NAMESPACE_RESOURCE

	WATCH_NAMESPACE_RESOURCE

	WATCH_ALL_NAMESPACES_RESOURCE

	/*
		/api/metrics?start=1608184020&end=1608187620&step=60&kubernetes_namespace=im-ops
	*/
	METRICS
)

type Authorization

type Authorization struct {
	// contains filtered or unexported fields
}

func NewAuthorization

func NewAuthorization() *Authorization

func (*Authorization) Auth

func (auth *Authorization) Auth(username, password string) ([]byte, error)

func (*Authorization) Config

func (auth *Authorization) Config(tokenStr string) ([]byte, error)

type LoginHandle

type LoginHandle struct {
	*Authorization
}

func (*LoginHandle) Check

func (h *LoginHandle) Check(username string, w http.ResponseWriter, r *http.Request) bool

func (*LoginHandle) ServeHTTP

func (h *LoginHandle) ServeHTTP(w http.ResponseWriter, r *http.Request)

type OpType

type OpType string
const (
	POST   OpType = "POST"
	GET    OpType = "GET"
	PUT    OpType = "PUT"
	DELELE OpType = "DELELE"
)

type Resource

type Resource struct {
	Op   OpType // eg: http restful[POST,GET,PUT,DELELE]
	Path string // eg: /workload/apis/nuwa.nip.io/v1/stones &&  /workload/apis/nuwa.nip.io/v1/namespaces/:namespace/stones/:name
}

type Role

type Role struct {
	Name      string   `json:"name"`
	Namespace []string `json:"namespace"`
	PermValue uint32   `json:"permValue"`
	// contains filtered or unexported fields
}

func NewRole

func NewRole(name string, permValue uint32) *Role

type Roles

type Roles []*Role

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL