Compare commits
5
Commits
489b6463fc
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6eb36d63e | ||
|
|
c99fe43dfc | ||
|
|
7649a4795f | ||
|
|
c9a11b135b | ||
|
|
f3aa93406c |
No files matched your search
+11
-2
@@ -71,6 +71,7 @@ type Message struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||
Type RequestType `protobuf:"varint,2,opt,name=type,proto3,enum=proto.RequestType" json:"type,omitempty"`
|
||||
ClientId string `protobuf:"bytes,3,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -119,15 +120,23 @@ func (x *Message) GetType() RequestType {
|
||||
return RequestType_PING
|
||||
}
|
||||
|
||||
func (x *Message) GetClientId() string {
|
||||
if x != nil {
|
||||
return x.ClientId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_operation_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_operation_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x0foperation.proto\x12\x05proto\"P\n" +
|
||||
"\x0foperation.proto\x12\x05proto\"m\n" +
|
||||
"\aMessage\x12\x1d\n" +
|
||||
"\n" +
|
||||
"request_id\x18\x01 \x01(\tR\trequestId\x12&\n" +
|
||||
"\x04type\x18\x02 \x01(\x0e2\x12.proto.RequestTypeR\x04type*'\n" +
|
||||
"\x04type\x18\x02 \x01(\x0e2\x12.proto.RequestTypeR\x04type\x12\x1b\n" +
|
||||
"\tclient_id\x18\x03 \x01(\tR\bclientId*'\n" +
|
||||
"\vRequestType\x12\b\n" +
|
||||
"\x04PING\x10\x00\x12\x0e\n" +
|
||||
"\n" +
|
||||
|
||||
@@ -11,4 +11,5 @@ enum RequestType {
|
||||
message Message {
|
||||
string request_id = 1;
|
||||
RequestType type = 2;
|
||||
string client_id = 3;
|
||||
}
|
||||
+11
-2
@@ -75,6 +75,7 @@ type Deployment struct {
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Action DeploymentAction `protobuf:"varint,2,opt,name=action,proto3,enum=proto.DeploymentAction" json:"action,omitempty"`
|
||||
Hcl []byte `protobuf:"bytes,3,opt,name=hcl,proto3" json:"hcl,omitempty"`
|
||||
ClientId string `protobuf:"bytes,4,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -130,16 +131,24 @@ func (x *Deployment) GetHcl() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Deployment) GetClientId() string {
|
||||
if x != nil {
|
||||
return x.ClientId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_deployment_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_deployment_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x10deployment.proto\x12\x05proto\"_\n" +
|
||||
"\x10deployment.proto\x12\x05proto\"|\n" +
|
||||
"\n" +
|
||||
"Deployment\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\tR\x02id\x12/\n" +
|
||||
"\x06action\x18\x02 \x01(\x0e2\x17.proto.DeploymentActionR\x06action\x12\x10\n" +
|
||||
"\x03hcl\x18\x03 \x01(\fR\x03hcl*4\n" +
|
||||
"\x03hcl\x18\x03 \x01(\fR\x03hcl\x12\x1b\n" +
|
||||
"\tclient_id\x18\x04 \x01(\tR\bclientId*4\n" +
|
||||
"\x10DeploymentAction\x12\b\n" +
|
||||
"\x04STOP\x10\x00\x12\t\n" +
|
||||
"\x05START\x10\x01\x12\v\n" +
|
||||
|
||||
@@ -13,4 +13,5 @@ message Deployment {
|
||||
string id = 1;
|
||||
DeploymentAction action = 2;
|
||||
bytes hcl = 3;
|
||||
string client_id = 4;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package model
|
||||
|
||||
const (
|
||||
topicOperation = "op"
|
||||
topicDeployment = "deployment"
|
||||
)
|
||||
|
||||
// QOS is the predefined Quality of Service level for MQTT messages.
|
||||
//
|
||||
//goland:noinspection GoUnusedConst
|
||||
const QOS = 2
|
||||
|
||||
// OperationTopic returns the topic for operation messages for a given client ID.
|
||||
//
|
||||
//goland:noinspection GoUnusedExportedFunction
|
||||
func OperationTopic(clientId string) string {
|
||||
return makeTopic(clientId, topicOperation)
|
||||
}
|
||||
|
||||
// DeploymentTopic returns the topic for deployment messages for a given client ID.
|
||||
//
|
||||
//goland:noinspection GoUnusedExportedFunction
|
||||
func DeploymentTopic(clientId string) string {
|
||||
return makeTopic(clientId, topicDeployment)
|
||||
}
|
||||
|
||||
func makeTopic(clientId, topic string) string {
|
||||
if clientId != "" {
|
||||
clientId += "/"
|
||||
}
|
||||
|
||||
return clientId + topic
|
||||
}
|
||||
Reference in new issue
Block a user