github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/edge/pkg/devicetwin/dttype/message.go (about)

     1  package dttype
     2  
     3  import (
     4  	"github.com/kubeedge/beehive/pkg/core/model"
     5  )
     6  
     7  //MsgSubPub the struct of message for subscribe or publish
     8  type MsgSubPub struct {
     9  	Action  string `json:"action"`
    10  	Payload string `json:"payload"`
    11  	Qos     int    `json:"qos"`
    12  }
    13  
    14  //DTMessage the struct of message for commutinating between cloud and edge
    15  type DTMessage struct {
    16  	Msg      *model.Message
    17  	Identity string
    18  	Action   string
    19  	Type     string
    20  }
    21  
    22  //GetDetailNode the info existed in req body
    23  type GetDetailNode struct {
    24  	EventType string `json:"event_type,omitempty"`
    25  	EventID   string `json:"event_id,omitempty"`
    26  	GroupID   string `json:"group_id,omitempty"`
    27  	Operation string `json:"operation,omitempty"`
    28  	TimeStamp int64  `json:"timestamp,omitempty"`
    29  }
    30  
    31  //BuildDTMessage build devicetwin message
    32  func BuildDTMessage(identity string, action string, actionType string, msg *model.Message) *DTMessage {
    33  	return &DTMessage{
    34  		Msg:      msg,
    35  		Identity: identity,
    36  		Action:   action,
    37  		Type:     actionType}
    38  }