forked from TheThingsNetwork/lorawan-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplicationserver_web.proto
More file actions
208 lines (173 loc) · 8.55 KB
/
applicationserver_web.proto
File metadata and controls
208 lines (173 loc) · 8.55 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
// 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/identifiers.proto";
package ttn.lorawan.v3;
option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";
message ApplicationWebhookIdentifiers {
ApplicationIdentifiers application_ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true];
string webhook_id = 2 [(gogoproto.customname) = "WebhookID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}];
}
message ApplicationWebhookTemplateIdentifiers {
string template_id = 1 [(gogoproto.customname) = "TemplateID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}];
}
// ApplicationWebhookTemplateField represents a custom field that needs to be filled by the user in order to use the template.
// A field can be an API key, an username or password, or any custom platform specific field (such as region).
// The fields are meant to be replaced inside the URLs and headers when the webhook is created.
message ApplicationWebhookTemplateField {
string id = 1 [(gogoproto.customname) = "ID", (validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}];
string name = 2 [(validate.rules).string.max_len = 20];
string description = 3 [(validate.rules).string.max_len = 100];
// Secret decides if the field should be shown in plain-text or should stay hidden.
bool secret = 4;
string default_value = 5 [(validate.rules).string.max_len = 100];
}
message ApplicationWebhookTemplate {
ApplicationWebhookTemplateIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true];
string name = 2 [(validate.rules).string.max_len = 20];
string description = 3 [(validate.rules).string.max_len = 100];
string logo_url = 4 [(gogoproto.customname) = "LogoURL", (validate.rules).string.uri = true];
string info_url = 5 [(gogoproto.customname) = "InfoURL", (validate.rules).string.uri = true];
string documentation_url = 6 [(gogoproto.customname) = "DocumentationURL", (validate.rules).string.uri = true];
// The base URL of the template. Can contain template fields, in RFC 6570 format.
string base_url = 7 [(gogoproto.customname) = "BaseURL", (validate.rules).string.uri = true];
// The HTTP headers used by the template. Both the key and the value can contain template fields.
map<string,string> headers = 8;
string format = 9 [(validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 20}];
repeated ApplicationWebhookTemplateField fields = 10;
// Control the creation of the downlink queue operations API key.
bool create_downlink_api_key = 19 [(gogoproto.customname) = "CreateDownlinkAPIKey"];
message Message {
// Path to append to the base URL. Can contain template fields, in RFC 6570 format.
string path = 1;
}
Message uplink_message = 11;
Message join_accept = 12;
Message downlink_ack = 13;
Message downlink_nack = 14;
Message downlink_sent = 15;
Message downlink_failed = 16;
Message downlink_queued = 17;
Message location_solved = 18;
Message service_data = 20;
}
message ApplicationWebhookTemplates {
repeated ApplicationWebhookTemplate templates = 1;
}
message ApplicationWebhook {
ApplicationWebhookIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true];
google.protobuf.Timestamp created_at = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
google.protobuf.Timestamp updated_at = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
// Base URL to which the message's path is appended.
string base_url = 4 [(gogoproto.customname) = "BaseURL", (validate.rules).string.uri = true];
// HTTP headers to use.
map<string,string> headers = 5;
// The format to use for the body.
// Supported values depend on the Application Server configuration.
string format = 6 [(validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 20}];
// The ID of the template that was used to create the Webhook.
ApplicationWebhookTemplateIdentifiers template_ids = 15 [(gogoproto.embed) = true];
// The value of the fields used by the template. Maps field.id to the value.
map<string,string> template_fields = 16;
// The API key to be used for downlink queue operations.
// The field is provided for convenience reasons, and can contain API keys with additional rights (albeit this is discouraged).
string downlink_api_key = 17 [(gogoproto.customname) = "DownlinkAPIKey"];
message Message {
// Path to append to the base URL.
string path = 1;
}
Message uplink_message = 7;
Message join_accept = 8;
Message downlink_ack = 9;
Message downlink_nack = 10;
Message downlink_sent = 11;
Message downlink_failed = 12;
Message downlink_queued = 13;
Message location_solved = 14;
Message service_data = 18;
}
message ApplicationWebhooks {
repeated ApplicationWebhook webhooks = 1;
}
message ApplicationWebhookFormats {
// Format and description.
map<string, string> formats = 1;
}
message GetApplicationWebhookRequest {
ApplicationWebhookIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true];
google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false];
}
message ListApplicationWebhooksRequest {
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 SetApplicationWebhookRequest {
ApplicationWebhook webhook = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true];
google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false];
}
message GetApplicationWebhookTemplateRequest {
ApplicationWebhookTemplateIdentifiers ids = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false, (validate.rules).message.required = true];
google.protobuf.FieldMask field_mask = 2 [(gogoproto.nullable) = false];
}
message ListApplicationWebhookTemplatesRequest {
google.protobuf.FieldMask field_mask = 1 [(gogoproto.nullable) = false];
}
service ApplicationWebhookRegistry {
rpc GetFormats(google.protobuf.Empty) returns (ApplicationWebhookFormats) {
option (google.api.http) = {
get: "/as/webhook-formats"
};
};
rpc GetTemplate(GetApplicationWebhookTemplateRequest) returns (ApplicationWebhookTemplate) {
option (google.api.http) = {
get: "/as/webhook-templates/{ids.template_id}"
};
};
rpc ListTemplates(ListApplicationWebhookTemplatesRequest) returns (ApplicationWebhookTemplates) {
option (google.api.http) = {
get: "/as/webhook-templates"
};
};
rpc Get(GetApplicationWebhookRequest) returns (ApplicationWebhook) {
option (google.api.http) = {
get: "/as/webhooks/{ids.application_ids.application_id}/{ids.webhook_id}"
};
};
rpc List(ListApplicationWebhooksRequest) returns (ApplicationWebhooks) {
option (google.api.http) = {
get: "/as/webhooks/{application_ids.application_id}"
};
};
rpc Set(SetApplicationWebhookRequest) returns (ApplicationWebhook) {
option (google.api.http) = {
put: "/as/webhooks/{webhook.ids.application_ids.application_id}/{webhook.ids.webhook_id}"
body: "*"
additional_bindings {
post: "/as/webhooks/{webhook.ids.application_ids.application_id}"
body: "*"
}
};
};
rpc Delete(ApplicationWebhookIdentifiers) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/as/webhooks/{application_ids.application_id}/{webhook_id}",
};
};
}