Documentation ¶
Index ¶
- Constants
- func HandleBadRequest(response *restful.Response, req *restful.Request, err error)
- func HandleConflict(response *restful.Response, req *restful.Request, err error)
- func HandleError(response *restful.Response, req *restful.Request, err error)
- func HandleForbidden(response *restful.Response, req *restful.Request, err error)
- func HandleInternalError(response *restful.Response, req *restful.Request, err error)
- func HandleNotFound(response *restful.Response, req *restful.Request, err error)
- func HandleTooManyRequests(response *restful.Response, req *restful.Request, err error)
- func HandleUnauthorized(response *restful.Response, req *restful.Request, err error)
- type ClientType
- type CommonListResult
- type CommonSingleResult
- type FakeQuerier
- type GitCredential
- type ListResult
- type NamespacedResourceQuota
- type Querier
- type RegistryCredential
- type ResourceQuota
- type Result
- func (r *Result[T]) WithError(err error) *Result[T]
- func (r *Result[T]) WithList(list []T) *Result[T]
- func (r *Result[T]) WithListAndFilter(list []T, querier Querier) *Result[T]
- func (r *Result[T]) WithObject(obj T) *Result[T]
- func (r *Result[T]) WithObjectAsJSONString(obj interface{}) *Result[T]
- func (r *Result[T]) WriteTo(resp *restful.Response)
- type ResultPage
- type Router
- type WebSocketHandler
- type Workloads
Constants ¶
const ( WorkspaceNone = "" ClusterNone = "" )
List of all resource kinds supported by the UI.
Variables ¶
This section is empty.
Functions ¶
func HandleBadRequest ¶
func HandleBadRequest(response *restful.Response, req *restful.Request, err error)
HandleBadRequest writes http.StatusBadRequest and log error
func HandleConflict ¶
func HandleConflict(response *restful.Response, req *restful.Request, err error)
func HandleError ¶
func HandleError(response *restful.Response, req *restful.Request, err error)
func HandleForbidden ¶
func HandleForbidden(response *restful.Response, req *restful.Request, err error)
func HandleInternalError ¶
func HandleInternalError(response *restful.Response, req *restful.Request, err error)
func HandleNotFound ¶
func HandleNotFound(response *restful.Response, req *restful.Request, err error)
func HandleTooManyRequests ¶
func HandleTooManyRequests(response *restful.Response, req *restful.Request, err error)
func HandleUnauthorized ¶
func HandleUnauthorized(response *restful.Response, req *restful.Request, err error)
Types ¶
type ClientType ¶
type ClientType string
const ( ClientKubernetes ClientType = "Kubernetes" ClientApplication ClientType = "Application" StatusOK = "ok" )
type CommonListResult ¶
type CommonListResult[T interface{}] struct { Result[T] `json:"inline"` Data []T `json:"data"` }
CommonListResult is the sub-result of the common one. This struct aims to get list items.
func ParseListResult ¶
func ParseListResult[T interface{}](data []byte) (result *CommonListResult[T], err error)
ParseListResult parses the data to result object
func (*CommonListResult[T]) GetList ¶
func (r *CommonListResult[T]) GetList() (items []T)
GetList returns the all items.
type CommonSingleResult ¶
type CommonSingleResult[T interface{}] struct { Result[T] `json:"inline"` Data T `json:"data"` }
CommonSingleResultis the sub-result of the common one. This struct aims to get the single object.
func ParseResult ¶
func ParseResult[T interface{}](data []byte) (result *CommonSingleResult[T], err error)
ParseResult parses the result with a single object
func (*CommonSingleResult[T]) GetData ¶
func (r *CommonSingleResult[T]) GetData() T
GetData returns the data
type FakeQuerier ¶
type FakeQuerier struct {
// contains filtered or unexported fields
}
FakeQuerier is a fake querier that exists for unit test purpose
func NewFakeQuerier ¶
func NewFakeQuerier(data map[string]string) *FakeQuerier
NewFakeQuerier returns the instance of FakeQuerier
func (*FakeQuerier) QueryParameter ¶
func (q *FakeQuerier) QueryParameter(key string) string
QueryParameter is a fake function, return the pair value directly
type GitCredential ¶
type GitCredential struct { RemoteUrl string `json:"remoteUrl" description:"git server url"` SecretRef *corev1.SecretReference `json:"secretRef,omitempty" description:"auth secret reference"` }
type ListResult ¶
type ListResult struct { Items []interface{} `json:"items"` TotalItems int `json:"totalItems"` }
type NamespacedResourceQuota ¶
type NamespacedResourceQuota struct { Namespace string `json:"namespace,omitempty"` Data struct { corev1.ResourceQuotaStatus // quota left status, do the math on the side, cause it's // a lot easier with go-client library Left corev1.ResourceList `json:"left,omitempty"` } `json:"data,omitempty"` }
type RegistryCredential ¶
type ResourceQuota ¶
type ResourceQuota struct { Namespace string `json:"namespace" description:"namespace"` Data corev1.ResourceQuotaStatus `json:"data" description:"resource quota status"` }
type Result ¶
type Result[T interface{}] struct { // Message is the hunman readable message for the front-end. // This message is 'OK' when code is '0', or is the error message. Message string `json:"message"` // Code represents the result, 0 means success, others mean failure Code int `json:"code"` // Data is the response from HTTP server. // Data could be slice or a single object. Data interface{} `json:"data,omitempty"` // Page carries the pagination of a list result Page *ResultPage `json:"page,omitempty"` // contains filtered or unexported fields }
Result represents a HTTP response to front-end
func NewEmptyResult ¶
NewEmptyResult creates a non-data result
func NewStringResult ¶
NewStringResult creates a string result
func (*Result[T]) WithListAndFilter ¶
WithListAndFilter set and filter the list
func (*Result[T]) WithObject ¶
WithObject puts a single object into result
func (*Result[T]) WithObjectAsJSONString ¶
type ResultPage ¶
ResultPage is the result pagination object
type WebSocketHandler ¶
type WebSocketHandler interface { WithRequest(*http.Request, http.ResponseWriter) WebSocketHandler WithWatchInterface(func() (watch.Interface, error)) WebSocketHandler WithUpgrader(websocket.Upgrader) WebSocketHandler Handle(<-chan struct{}) (bool, error) }
func NewDefaultWebSocketHandler ¶
func NewDefaultWebSocketHandler() WebSocketHandler
Directories ¶
Path | Synopsis |
---|---|
core.ai.io
|
|
v1
Package v1 contains API Schema definitions for the v1 API group +kubebuilder:object:generate=true +groupName=core.ai.io +k8s:openapi-gen=true
|
Package v1 contains API Schema definitions for the v1 API group +kubebuilder:object:generate=true +groupName=core.ai.io +k8s:openapi-gen=true |
iam.ai.io
|
|
v1
Package v1 contains API Schema definitions for the v1 API group +kubebuilder:object:generate=true +groupName=iam.ai.io +k8s:openapi-gen=true
|
Package v1 contains API Schema definitions for the v1 API group +kubebuilder:object:generate=true +groupName=iam.ai.io +k8s:openapi-gen=true |