forked from TheThingsNetwork/lorawan-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplicationserver.proto
More file actions
161 lines (145 loc) · 7.13 KB
/
applicationserver.proto
File metadata and controls
161 lines (145 loc) · 7.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
import "github.com/envoyproxy/protoc-gen-validate/validate/validate.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "lorawan-stack/api/end_device.proto";
import "lorawan-stack/api/identifiers.proto";
import "lorawan-stack/api/messages.proto";
import "lorawan-stack/api/mqtt.proto";
package ttn.lorawan.v3;
option go_package = "go.thethings.network/lorawan-stack/pkg/ttnpb";
message ApplicationLink {
// The address of the external Network Server where to link to.
// The typical format of the address is "host:port". If the port is omitted,
// the normal port inference (with DNS lookup, otherwise defaults) is used.
// Leave empty when linking to a cluster Network Server.
string network_server_address = 1 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];
string api_key = 2 [(gogoproto.customname) = "APIKey", (validate.rules).string.min_len = 1];
MessagePayloadFormatters default_formatters = 3;
// Enable TLS for linking to the external Network Server.
// For cluster-local Network Servers, the cluster's TLS setting is used.
bool tls = 4 [(gogoproto.customname) = "TLS"];
}
message GetApplicationLinkRequest {
ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true];
google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false];
}
message SetApplicationLinkRequest {
ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true];
ApplicationLink link = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true];
google.protobuf.FieldMask field_mask = 3 [(gogoproto.nullable) = false];
}
// Link stats as monitored by the Application Server.
message ApplicationLinkStats {
google.protobuf.Timestamp linked_at = 1 [(gogoproto.stdtime) = true];
string network_server_address = 2 [(validate.rules).string.pattern = "^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])(?::[0-9]{1,5})?$|^$"];
// Timestamp when the last upstream message has been received from a Network Server.
// This can be a join-accept, uplink message or downlink message event.
google.protobuf.Timestamp last_up_received_at = 3 [(gogoproto.stdtime) = true];
// Number of upstream messages received.
uint64 up_count = 4;
// Timestamp when the last downlink message has been forwarded to a Network Server.
google.protobuf.Timestamp last_downlink_forwarded_at = 5 [(gogoproto.stdtime) = true];
// Number of downlink messages forwarded.
uint64 downlink_count = 6;
}
// The As service manages the Application Server.
service As {
rpc GetLink(GetApplicationLinkRequest) returns (ApplicationLink) {
option (google.api.http) = {
get: "/as/applications/{application_ids.application_id}/link"
};
};
// Set a link configuration from the Application Server a Network Server.
// This call returns immediately after setting the link configuration; it does not wait for a link to establish.
// To get link statistics or errors, use the `GetLinkStats` call.
rpc SetLink(SetApplicationLinkRequest) returns (ApplicationLink) {
option (google.api.http) = {
put: "/as/applications/{application_ids.application_id}/link",
body: "*"
};
};
rpc DeleteLink(ApplicationIdentifiers) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/as/applications/{application_id}/link",
};
};
// GetLinkStats returns the link statistics.
// This call returns a NotFound error code if there is no link for the given application identifiers.
// This call returns the error code of the link error if linking to a Network Server failed.
rpc GetLinkStats(ApplicationIdentifiers) returns (ApplicationLinkStats) {
option (google.api.http) = {
get: "/as/applications/{application_id}/link/stats"
};
};
}
// The AppAs service connects an application or integration to an Application Server.
service AppAs {
rpc Subscribe(ApplicationIdentifiers) returns (stream ApplicationUp);
rpc DownlinkQueuePush(DownlinkQueueRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}/down/push",
body: "*"
};
};
rpc DownlinkQueueReplace(DownlinkQueueRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}/down/replace",
body: "*"
};
};
rpc DownlinkQueueList(EndDeviceIdentifiers) returns (ApplicationDownlinks) {
option (google.api.http) = {
get: "/as/applications/{application_ids.application_id}/devices/{device_id}/down"
};
};
rpc GetMQTTConnectionInfo(ApplicationIdentifiers) returns (MQTTConnectionInfo) {
option (google.api.http) = {
get: "/as/applications/{application_id}/mqtt-connection-info"
};
};
}
// The AsEndDeviceRegistry service allows clients to manage their end devices on the Application Server.
service AsEndDeviceRegistry {
// Get returns the device that matches the given identifiers.
// If there are multiple matches, an error will be returned.
rpc Get(GetEndDeviceRequest) returns (EndDevice) {
option (google.api.http) = {
get: "/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}"
};
};
// Set creates or updates the device.
rpc Set(SetEndDeviceRequest) returns (EndDevice) {
option (google.api.http) = {
put: "/as/applications/{end_device.ids.application_ids.application_id}/devices/{end_device.ids.device_id}"
body: "*"
additional_bindings {
post: "/as/applications/{end_device.ids.application_ids.application_id}/devices"
body: "*"
};
};
};
// Delete deletes the device that matches the given identifiers.
// If there are multiple matches, an error will be returned.
rpc Delete(EndDeviceIdentifiers) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/as/applications/{application_ids.application_id}/devices/{device_id}"
};
};
}