k8s

package
v0.0.0-...-94e4715 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHelmDispatcher

func AddHelmDispatcher(prefix string, app *appsrv.Application)

const (

DefaultTillerImage = "yunion/tiller:v2.9.0"

)

func AddMiscDispatcher

func AddMiscDispatcher(prefix string, app *appsrv.Application)

func AddRawResourceDispatcher

func AddRawResourceDispatcher(prefix string, app *appsrv.Application)

func AddResourceDispatcher

func AddResourceDispatcher(prefix string, app *appsrv.Application, handler IK8sResourceHandler)

func GetConfig

func GetConfig(kubeConfigFile string) (*rest.Config, error)

func NewCloudK8sRequest

func NewCloudK8sRequest(ctx context.Context, query, data *jsonutils.JSONDict) (*common.Request, error)

func NewCommonRequest

func NewCommonRequest(ctx context.Context, w http.ResponseWriter, r *http.Request) (*common.Request, error)

func SendJSON

func SendJSON(w http.ResponseWriter, obj interface{})

func SendYAML

func SendYAML(w http.ResponseWriter, obj runtime.Object)

Types

type IK8sResourceHandler

type IK8sResourceHandler interface {
	dispatcher.IMiddlewareFilter

	Keyword() string
	KeywordPlural() string

	List(ctx context.Context, query *jsonutils.JSONDict) (common.ListResource, error)

	Get(ctx context.Context, id string, query *jsonutils.JSONDict) (interface{}, error)

	GetSpecific(ctx context.Context, id, spec string, query *jsonutils.JSONDict) (interface{}, error)

	Create(ctx context.Context, query *jsonutils.JSONDict, data *jsonutils.JSONDict) (interface{}, error)

	PerformClassAction(ctx context.Context, action string, query, data *jsonutils.JSONDict) (interface{}, error)

	PerformAction(ctx context.Context, id, action string, query, data *jsonutils.JSONDict) (interface{}, error)

	Update(ctx context.Context, id string, query *jsonutils.JSONDict, data *jsonutils.JSONDict) (interface{}, error)

	Delete(ctx context.Context, id string, query *jsonutils.JSONDict, data *jsonutils.JSONDict) error
}

type IK8sResourceManager

type IK8sResourceManager interface {
	Keyword() string
	KeywordPlural() string

	InNamespace() bool

	// list hooks
	AllowListItems(req *common.Request) bool
	List(req *common.Request) (common.ListResource, error)

	// get hooks
	AllowGetItem(req *common.Request, id string) bool
	Get(req *common.Request, id string) (interface{}, error)

	// create hooks
	AllowCreateItem(req *common.Request) bool
	ValidateCreateData(req *common.Request) error
	Create(req *common.Request) (interface{}, error)

	// update hooks
	AllowUpdateItem(req *common.Request, id string) bool
	Update(req *common.Request, id string) (interface{}, error)

	// delete hooks
	AllowDeleteItem(req *common.Request, id string) bool
	Delete(req *common.Request, id string) error

	IsRawResource() bool
}

type K8sResourceHandler

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

func NewK8sResourceHandler

func NewK8sResourceHandler(man IK8sResourceManager) *K8sResourceHandler

func (*K8sResourceHandler) Create

func (h *K8sResourceHandler) Create(ctx context.Context, query, data *jsonutils.JSONDict) (interface{}, error)

func (*K8sResourceHandler) Delete

func (h *K8sResourceHandler) Delete(ctx context.Context, id string, query, data *jsonutils.JSONDict) error

func (*K8sResourceHandler) Filter

func (*K8sResourceHandler) Get

func (h *K8sResourceHandler) Get(ctx context.Context, id string, query *jsonutils.JSONDict) (interface{}, error)

func (*K8sResourceHandler) GetSpecific

func (h *K8sResourceHandler) GetSpecific(ctx context.Context, id, spec string, query *jsonutils.JSONDict) (interface{}, error)

func (*K8sResourceHandler) Keyword

func (h *K8sResourceHandler) Keyword() string

func (*K8sResourceHandler) KeywordPlural

func (h *K8sResourceHandler) KeywordPlural() string

func (*K8sResourceHandler) List

func (*K8sResourceHandler) PerformAction

func (h *K8sResourceHandler) PerformAction(ctx context.Context, id, action string, query, data *jsonutils.JSONDict) (interface{}, error)

func (*K8sResourceHandler) PerformClassAction

func (h *K8sResourceHandler) PerformClassAction(ctx context.Context, action string, query, data *jsonutils.JSONDict) (interface{}, error)

func (*K8sResourceHandler) Update

func (h *K8sResourceHandler) Update(ctx context.Context, id string, query, data *jsonutils.JSONDict) (interface{}, error)

Directories

Path Synopsis
api
cmd
common

Jump to

Keyboard shortcuts

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