forked from TheThingsNetwork/lorawan-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathidentifiers.proto
195 lines (178 loc) · 8.55 KB
/
identifiers.proto
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
// 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/TheThingsIndustries/protoc-gen-go-flags/annotations.proto";
import "github.com/TheThingsIndustries/protoc-gen-go-json/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
package ttn.lorawan.v3;
option go_package = "go.thethings.network/lorawan-stack/v3/pkg/ttnpb";
message ApplicationIdentifiers {
option (thethings.flags.message) = { select: true, set: true };
string application_id = 1 [(validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}];
}
message ClientIdentifiers {
option (thethings.flags.message) = { select: true, set: true };
string client_id = 1 [(validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}];
}
message EndDeviceIdentifiers {
option (thethings.flags.message) = { select: true, set: true };
string device_id = 1 [(validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}];
ApplicationIdentifiers application_ids = 2 [(validate.rules).message.required = true];
// The LoRaWAN DevEUI.
bytes dev_eui = 4 [
(validate.rules).bytes = { len: 8, ignore_empty: true },
(thethings.json.field) = {
marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",
unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"
},
(thethings.flags.field) = {
set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New8BytesFlag",
set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"
},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
type: STRING, format: "string", example: "\"70B3D57ED000ABCD\""
}
];
// The LoRaWAN JoinEUI (AppEUI until LoRaWAN 1.0.3 end devices).
bytes join_eui = 5 [
(validate.rules).bytes = { len: 8, ignore_empty: true },
(thethings.json.field) = {
marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",
unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"
},
(thethings.flags.field) = {
set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New8BytesFlag",
set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"
},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
type: STRING, format: "string", example: "\"70B3D57ED000ABCD\""
}
];
// The LoRaWAN DevAddr.
bytes dev_addr = 6 [
(validate.rules).bytes = { len: 4, ignore_empty: true },
(thethings.json.field) = {
marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",
unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal4Bytes"
},
(thethings.flags.field) = {
set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New4BytesFlag",
set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"
},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
type: STRING, format: "string", example: "\"2600ABCD\""
}
];
}
message GatewayIdentifiers {
option (thethings.flags.message) = { select: true, set: true };
string gateway_id = 1 [(validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}];
// Secondary identifier, which can only be used in specific requests.
bytes eui = 2 [
(validate.rules).bytes = { len: 8, ignore_empty: true },
(thethings.json.field) = {
marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",
unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal8Bytes"
},
(thethings.flags.field) = {
set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New8BytesFlag",
set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"
},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
type: STRING, format: "string", example: "\"70B3D57ED000ABCD\""
}
];
}
message OrganizationIdentifiers {
option (thethings.flags.message) = { select: true, set: true };
// This ID shares namespace with user IDs.
string organization_id = 1 [(validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" , max_len: 36}];
}
message UserIdentifiers {
option (thethings.flags.message) = { select: true, set: true };
// This ID shares namespace with organization IDs.
string user_id = 1 [
(validate.rules).string = {
pattern: "^[a-z0-9](?:[-]?[a-z0-9]){1,}$", // NOTE: User IDs allow a shorter minimum length than other IDs.
max_len: 36
}
];
// Secondary identifier, which can only be used in specific requests.
string email = 2 [(thethings.flags.field).hidden = true];
}
// OrganizationOrUserIdentifiers contains either organization or user identifiers.
message OrganizationOrUserIdentifiers {
option (thethings.flags.message) = { select: true, set: true };
oneof ids {
option (validate.required) = true;
OrganizationIdentifiers organization_ids = 1;
UserIdentifiers user_ids = 2;
}
}
// EntityIdentifiers contains one of the possible entity identifiers.
message EntityIdentifiers {
oneof ids {
option (validate.required) = true;
ApplicationIdentifiers application_ids = 1;
ClientIdentifiers client_ids = 2;
EndDeviceIdentifiers device_ids = 3;
GatewayIdentifiers gateway_ids = 4;
OrganizationIdentifiers organization_ids = 5;
UserIdentifiers user_ids = 6;
}
}
// Identifies an end device model with version information.
message EndDeviceVersionIdentifiers {
option (thethings.flags.message) = { select: true, set: true };
string brand_id = 1 [(validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$", max_len: 36, ignore_empty: true}];
string model_id = 2 [(validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$", max_len: 36, ignore_empty: true}];
string hardware_version = 3 [(validate.rules).string.max_len = 32];
string firmware_version = 4 [(validate.rules).string.max_len = 32];
string band_id = 5 [(validate.rules).string.max_len = 32];
reserved 6, 7, 8; // vendor_id, vendor_profile_id, serial_number
}
// Identifies a Network Server.
message NetworkIdentifiers {
option (thethings.flags.message) = { select: true, set: false };
// LoRa Alliance NetID.
bytes net_id = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
type: STRING, format: "string", example: "\"000013\""
},
(validate.rules).bytes = { len: 3, ignore_empty: true },
(thethings.json.field) = {
marshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.MarshalHEXBytes",
unmarshaler_func: "go.thethings.network/lorawan-stack/v3/pkg/types.Unmarshal3Bytes"
},
(thethings.flags.field) = {
set_flag_new_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.New3BytesFlag",
set_flag_getter_func: "go.thethings.network/lorawan-stack/v3/cmd/ttn-lw-cli/customflags.GetExactBytes"
}
];
// Optional tenant identifier for multi-tenant deployments.
string tenant_id = 2 [(validate.rules).string = {pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$", max_len: 36}];
// Cluster identifier of the Network Server.
string cluster_id = 3 [(validate.rules).string.max_len = 64];
// Cluster address of the Network Server.
string cluster_address = 4 [(validate.rules).string.max_len = 256];
// Optional tenant address for multi-tenant deployments.
string tenant_address = 5 [(validate.rules).string.max_len = 256];
}
message LoRaAllianceProfileIdentifiers {
// VendorID managed by the LoRa Alliance, as defined in TR005.
uint32 vendor_id = 1;
// ID of the LoRaWAN end device profile assigned by the vendor.
uint32 vendor_profile_id = 2;
}