Documentation
¶
Index ¶
- Constants
- func IndexCheck(length int, indexes ...*int)
- func KeyFunc(obj runtime.Object) string
- func KeyFuncObj(obj runtime.Object) (string, error)
- func KeyFuncReq(ctx context.Context, _ string) (string, error)
- func KeyRootFunc(ctx context.Context) string
- func MsgToApplications(msg model.Message) (map[string]Application, error)
- func ParseKey(key string) (gvr schema.GroupVersionResource, namespace string, name string)
- func ToBytes(i interface{}) (bytes []byte)
- type Application
- func (a *Application) Add()
- func (a *Application) Cancel()
- func (a *Application) Close()
- func (a *Application) GVR() schema.GroupVersionResource
- func (a *Application) GetStatus() ApplicationStatus
- func (a *Application) Identifier() string
- func (a *Application) LastCloseTime() time.Time
- func (a *Application) Namespace() string
- func (a *Application) OptionTo(i interface{}) error
- func (a *Application) ReqBodyTo(i interface{}) error
- func (a *Application) ReqContent() interface{}
- func (a *Application) Reset()
- func (a *Application) RespBodyTo(i interface{}) error
- func (a *Application) RespContent() interface{}
- func (a *Application) String() string
- func (a *Application) Wait()
- type ApplicationStatus
- type ApplicationVerb
- type PatchInfo
Constants ¶
const ( MetaServerSource = "metaserver" ApplicationResource = "Application" ApplicationResp = "applicationResponse" Ignore = "ignore" )
used to set Message.Route
const WatchAppSync = "watchapp/sync"
Variables ¶
This section is empty.
Functions ¶
func KeyFuncObj ¶
KeyFuncObj generated key from obj
func KeyFuncReq ¶
KeyFuncReq generate key from req context
func KeyRootFunc ¶
func MsgToApplications ¶ added in v1.13.0
func MsgToApplications(msg model.Message) (map[string]Application, error)
MsgToApplications extract applications in message's Content
func ParseKey ¶
func ParseKey(key string) (gvr schema.GroupVersionResource, namespace string, name string)
ParseKey parse key to group/version/resource, namespace, name Now key format is like below: 0/1 /2 /3 /4 /5
/core/v1/pods/{namespaces}/{name}
0/1 /2/3
/app/v1/deployments
0/1 /2 /3
/core/v1/endpoints
Remember that ParseKey is not responsible for verifying the validity of the content, for example, gvr in key /app/v1111/endpoint will be parsed as {Group:"app", Version:"v1111", Resource:"endpoint"}
Types ¶
type Application ¶ added in v1.13.0
type Application struct { // ID is the SHA256 checksum generated from request information ID string // The following field defines the Application request information // Key format: group version resource namespaces name Key string Verb ApplicationVerb Nodename string Option []byte ReqBody []byte Subresource string // The following field defines the Application response result RespBody []byte Status ApplicationStatus Reason string // why in this status Error apierrors.StatusError // Timestamp record the last closing time of application, only make sense when count == 0 Timestamp time.Time // contains filtered or unexported fields }
Application record the resources that are in applying for requesting to be transferred down from the cloud, please: 0.use Agent.Generate to generate application 1.use Agent.Apply to apply application( generate msg and send it to cloud dynamiccontroller)
func MsgToApplication ¶ added in v1.13.0
func MsgToApplication(msg model.Message) (*Application, error)
extract application in message's Content
func NewApplication ¶ added in v1.13.0
func NewApplication(ctx context.Context, key string, verb ApplicationVerb, nodename, subresource string, option interface{}, reqBody interface{}) (*Application, error)
func (*Application) Add ¶ added in v1.13.0
func (a *Application) Add()
func (*Application) Cancel ¶ added in v1.13.0
func (a *Application) Cancel()
func (*Application) Close ¶ added in v1.13.0
func (a *Application) Close()
Close must be called when applicant no longer using application
func (*Application) GVR ¶ added in v1.13.0
func (a *Application) GVR() schema.GroupVersionResource
func (*Application) GetStatus ¶ added in v1.13.0
func (a *Application) GetStatus() ApplicationStatus
func (*Application) Identifier ¶ added in v1.13.0
func (a *Application) Identifier() string
func (*Application) LastCloseTime ¶ added in v1.13.0
func (a *Application) LastCloseTime() time.Time
func (*Application) Namespace ¶ added in v1.13.0
func (a *Application) Namespace() string
func (*Application) OptionTo ¶ added in v1.13.0
func (a *Application) OptionTo(i interface{}) error
OptionTo convert application option. Remember `i` must be a pointer to the initialized variable
func (*Application) ReqBodyTo ¶ added in v1.13.0
func (a *Application) ReqBodyTo(i interface{}) error
func (*Application) ReqContent ¶ added in v1.13.0
func (a *Application) ReqContent() interface{}
func (*Application) Reset ¶ added in v1.13.0
func (a *Application) Reset()
func (*Application) RespBodyTo ¶ added in v1.13.0
func (a *Application) RespBodyTo(i interface{}) error
func (*Application) RespContent ¶ added in v1.13.0
func (a *Application) RespContent() interface{}
func (*Application) String ¶ added in v1.13.0
func (a *Application) String() string
func (*Application) Wait ¶ added in v1.13.0
func (a *Application) Wait()
Wait the result of application after it is applied by application agent
type ApplicationStatus ¶ added in v1.13.0
type ApplicationStatus string
const ( // set by agent PreApplying ApplicationStatus = "PreApplying" // application is waiting to be sent to cloud InApplying ApplicationStatus = "InApplying" // application is sending to cloud // set by center InProcessing ApplicationStatus = "InProcessing" // application is in processing by cloud Approved ApplicationStatus = "Approved" // application is approved by cloud Rejected ApplicationStatus = "Rejected" // application is rejected by cloud // both Failed ApplicationStatus = "Failed" // failed to get application resp from cloud Completed ApplicationStatus = "Completed" // application is completed and waiting to be recycled )
type ApplicationVerb ¶ added in v1.13.0
type ApplicationVerb string
const ( Get ApplicationVerb = "get" List ApplicationVerb = "list" Watch ApplicationVerb = "watch" Create ApplicationVerb = "create" Delete ApplicationVerb = "delete" Update ApplicationVerb = "update" UpdateStatus ApplicationVerb = "updatestatus" Patch ApplicationVerb = "patch" )