Initial commit.

This commit is contained in:
Orne Brocaar
2022-04-06 21:18:32 +01:00
commit 96fe672fc7
709 changed files with 335482 additions and 0 deletions

View File

@ -0,0 +1,738 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "ApplicationProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
// ApplicationService is the service providing API methods for managing applications.
service ApplicationService {
// Create creates the given application.
rpc Create(CreateApplicationRequest) returns (CreateApplicationResponse) {}
// Get the application for the given ID.
rpc Get(GetApplicationRequest) returns (GetApplicationResponse) {}
// Update updates the given application.
rpc Update(UpdateApplicationRequest) returns (google.protobuf.Empty) {}
// Delete the application for the given ID.
rpc Delete(DeleteApplicationRequest) returns (google.protobuf.Empty) {}
// Get the list of applications.
rpc List(ListApplicationsRequest) returns (ListApplicationsResponse) {}
// List all configured integrations.
rpc ListIntegrations(ListIntegrationsRequest) returns (ListIntegrationsResponse) {}
// Create HTTP integration.
rpc CreateHttpIntegration(CreateHttpIntegrationRequest) returns (google.protobuf.Empty) {}
// Get the configured HTTP integration.
rpc GetHttpIntegration(GetHttpIntegrationRequest) returns (GetHttpIntegrationResponse) {}
// Update the HTTP integration.
rpc UpdateHttpIntegration(UpdateHttpIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete the HTTP integration.
rpc DeleteHttpIntegration(DeleteHttpIntegrationRequest) returns (google.protobuf.Empty) {}
// Create InfluxDb integration.
rpc CreateInfluxDbIntegration(CreateInfluxDbIntegrationRequest) returns (google.protobuf.Empty) {}
// Get InfluxDb integration.
rpc GetInfluxDbIntegration(GetInfluxDbIntegrationRequest) returns (GetInfluxDbIntegrationResponse) {}
// Update InfluxDb integration.
rpc UpdateInfluxDbIntegration(UpdateInfluxDbIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete InfluxDb integration.
rpc DeleteInfluxDbIntegration(DeleteInfluxDbIntegrationRequest) returns (google.protobuf.Empty) {}
// Create ThingsBoard integration.
rpc CreateThingsBoardIntegration(CreateThingsBoardIntegrationRequest) returns (google.protobuf.Empty) {}
// Get ThingsBoard integration.
rpc GetThingsBoardIntegration(GetThingsBoardIntegrationRequest) returns (GetThingsBoardIntegrationResponse) {}
// Update ThingsBoard integration.
rpc UpdateThingsBoardIntegration(UpdateThingsBoardIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete ThingsBoard integration.
rpc DeleteThingsBoardIntegration(DeleteThingsBoardIntegrationRequest) returns (google.protobuf.Empty) {}
// Create myDevices integration.
rpc CreateMyDevicesIntegration(CreateMyDevicesIntegrationRequest) returns (google.protobuf.Empty) {}
// Get myDevices integration.
rpc GetMyDevicesIntegration(GetMyDevicesIntegrationRequest) returns (GetMyDevicesIntegrationResponse) {}
// Update myDevices integration.
rpc UpdateMyDevicesIntegration(UpdateMyDevicesIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete myDevices integration.
rpc DeleteMyDevicesIntegration(DeleteMyDevicesIntegrationRequest) returns (google.protobuf.Empty) {}
// Create LoRaCloud integration.
rpc CreateLoraCloudIntegration(CreateLoraCloudIntegrationRequest) returns (google.protobuf.Empty) {}
// Get LoRaCloud integration.
rpc GetLoraCloudIntegration(GetLoraCloudIntegrationRequest) returns (GetLoraCloudIntegrationResponse) {}
// Update LoRaCloud integration.
rpc UpdateLoraCloudIntegration(UpdateLoraCloudIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete LoRaCloud integration.
rpc DeleteLoraCloudIntegration(DeleteLoraCloudIntegrationRequest) returns (google.protobuf.Empty) {}
// Create GCP Pub/Sub integration.
rpc CreateGcpPubSubIntegration(CreateGcpPubSubIntegrationRequest) returns (google.protobuf.Empty) {}
// Get GCP Pub/Sub integration.
rpc GetGcpPubSubIntegration(GetGcpPubSubIntegrationRequest) returns (GetGcpPubSubIntegrationResponse) {}
// Update GCP Pub/Sub integration.
rpc UpdateGcpPubSubIntegration(UpdateGcpPubSubIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete GCP Pub/Sub integration.
rpc DeleteGcpPubSubIntegration(DeleteGcpPubSubIntegrationRequest) returns (google.protobuf.Empty) {}
// Create AWS SNS integration.
rpc CreateAwsSnsIntegration(CreateAwsSnsIntegrationRequest) returns (google.protobuf.Empty) {}
// Get AWS SNS integration.
rpc GetAwsSnsIntegration(GetAwsSnsIntegrationRequest) returns (GetAwsSnsIntegrationResponse) {}
// Update AWS SNS integration.
rpc UpdateAwsSnsIntegration(UpdateAwsSnsIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete AWS SNS integration.
rpc DeleteAwsSnsIntegration(DeleteAwsSnsIntegrationRequest) returns (google.protobuf.Empty) {}
// Create Azure Service-Bus integration.
rpc CreateAzureServiceBusIntegration(CreateAzureServiceBusIntegrationRequest) returns (google.protobuf.Empty) {}
// Get Azure Service-Bus integration.
rpc GetAzureServiceBusIntegration(GetAzureServiceBusIntegrationRequest) returns (GetAzureServiceBusIntegrationResponse) {}
// Update Azure Service-Bus integration.
rpc UpdateAzureServiceBusIntegration(UpdateAzureServiceBusIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete Azure Service-Bus integration.
rpc DeleteAzureServiceBusIntegration(DeleteAzureServiceBusIntegrationRequest) returns (google.protobuf.Empty) {}
// Create Pilot Things integration.
rpc CreatePilotThingsIntegration(CreatePilotThingsIntegrationRequest) returns (google.protobuf.Empty) {}
// Get Pilot Things integration.
rpc GetPilotThingsIntegration(GetPilotThingsIntegrationRequest) returns (GetPilotThingsIntegrationResponse) {}
// Update Pilot Things integration.
rpc UpdatePilotThingsIntegration(UpdatePilotThingsIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete Pilot Things integration.
rpc DeletePilotThingsIntegration(DeletePilotThingsIntegrationRequest) returns (google.protobuf.Empty) {}
// Generates application ID specific client-certificate.
rpc GenerateMqttIntegrationClientCertificate(GenerateMqttIntegrationClientCertificateRequest) returns (GenerateMqttIntegrationClientCertificateResponse) {}
}
enum Encoding {
JSON = 0;
PROTOBUF = 1;
}
enum IntegrationKind {
HTTP = 0;
INFLUX_DB = 1;
THINGS_BOARD = 2;
MY_DEVICES = 3;
LORA_CLOUD = 4;
GCP_PUB_SUB = 5;
AWS_SNS = 6;
AZURE_SERVICE_BUS = 7;
PILOT_THINGS = 8;
MQTT_GLOBAL = 9;
}
message Application {
// Application ID (UUID).
// Note: on create this will be automatically generated.
string id = 1;
// Application name.
string name = 2;
// Application description.
string description = 3;
// Tenant ID (UUID).
string tenant_id = 4;
}
message ApplicationListItem {
// Application ID (UUID).
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Application name.
string name = 4;
// Application description.
string description = 5;
}
message CreateApplicationRequest {
// Application object to create.
Application application = 1;
}
message CreateApplicationResponse {
// Application ID (UUID).
string id = 1;
}
message GetApplicationRequest {
// Application ID (UUID).
string id = 1;
}
message GetApplicationResponse {
// Application object.
Application application = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateApplicationRequest {
// Application object.
Application application = 1;
}
message DeleteApplicationRequest {
// Application ID (UUID).
string id = 1;
}
message ListApplicationsRequest {
// Max number of applications to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name (optional).
string search = 3;
// Tenant ID to list the applications for.
string tenant_id = 4;
}
message ListApplicationsResponse {
// Total number of applications.
uint32 total_count = 1;
// Result-set.
repeated ApplicationListItem result = 2;
}
message ListIntegrationsRequest {
// Application ID (UUID).
string application_id = 1;
}
message IntegrationListItem {
// Integration kind.
IntegrationKind kind = 1;
}
message ListIntegrationsResponse {
// Total number of integrations available within the result-set.
uint32 total_count = 1;
// Integrations within result-set.
repeated IntegrationListItem result = 2;
}
message HttpIntegration {
// Application ID (UUIO).
string application_id = 1;
// HTTP headers to set when making requests.
map<string, string> headers = 2;
// Payload encoding.
Encoding encoding = 3;
// Event endpoint URL.
// The HTTP integration will POST all events to this enpoint. The request
// will contain a query parameters "event" containing the type of the
// event.
string event_endpoint_url = 4;
}
message CreateHttpIntegrationRequest {
// Integration object to create.
HttpIntegration integration = 1;
}
message GetHttpIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message GetHttpIntegrationResponse {
// Integration object.
HttpIntegration integration = 1;
}
message UpdateHttpIntegrationRequest {
// Integration object to update.
HttpIntegration integration = 1;
}
message DeleteHttpIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
enum InfluxDbPrecision {
NS = 0;
U = 1;
MS = 2;
S = 3;
M = 4;
H = 5;
}
enum InfluxDbVersion {
INFLUXDB_1 = 0;
INFLUXDB_2 = 1;
}
message InfluxDbIntegration {
// Application ID (UUIO).
string application_id = 1;
// InfluxDb API write endpoint (e.g. http://localhost:8086/write).
string endpoint = 2;
// InfluxDb database name. (InfluxDb v1)
string db = 3;
// InfluxDb username. (InfluxDb v1)
string username = 4;
// InfluxDb password. (InfluxDb v1)
string password = 5;
// InfluxDb retention policy name. (InfluxDb v1)
string retention_policy_name = 6;
// InfluxDb timestamp precision (InfluxDb v1).
InfluxDbPrecision precision = 7;
// InfluxDb version.
InfluxDbVersion version = 8;
// Token. (InfluxDb v2)
string token = 9;
// Organization. (InfluxDb v2)
string organization = 10;
// Bucket. (InfluxDb v2)
string bucket = 11;
}
message CreateInfluxDbIntegrationRequest {
// Integration object to create.
InfluxDbIntegration integration = 1;
}
message GetInfluxDbIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message GetInfluxDbIntegrationResponse {
// Integration object.
InfluxDbIntegration integration = 1;
}
message UpdateInfluxDbIntegrationRequest {
// Integration object to update.
InfluxDbIntegration integration = 1;
}
message DeleteInfluxDbIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message ThingsBoardIntegration {
// Application ID (UUIO).
string application_id = 1;
// ThingsBoard server endpoint, e.g. https://example.com
string server = 2;
}
message CreateThingsBoardIntegrationRequest {
// Integration object to create.
ThingsBoardIntegration integration = 1;
}
message GetThingsBoardIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message GetThingsBoardIntegrationResponse {
// Integration object.
ThingsBoardIntegration integration = 1;
}
message UpdateThingsBoardIntegrationRequest {
// Integration object to update.
ThingsBoardIntegration integration = 1;
}
message DeleteThingsBoardIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message MyDevicesIntegration {
// Application ID (UUIO).
string application_id = 1;
// myDevices API endpoint.
string endpoint = 2;
}
message CreateMyDevicesIntegrationRequest {
// Integration object to create.
MyDevicesIntegration integration = 1;
}
message GetMyDevicesIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message GetMyDevicesIntegrationResponse {
// Integration object.
MyDevicesIntegration integration = 1;
}
message UpdateMyDevicesIntegrationRequest {
// Integration object to update.
MyDevicesIntegration integration = 1;
}
message DeleteMyDevicesIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message LoraCloudIntegration {
// Application ID (UUID).
string application_id = 1;
// Modem & Geolocation Services configuration.
LoraCloudModemGeolocationServices modem_geolocation_services = 2;
}
message LoraCloudModemGeolocationServices {
// API token.
string token = 1;
// Device implements Modem / Modem-E stack.
bool modem_enabled = 2;
// Modem port (fPort).
// ChirpStack will only forward the FrmPayload to the MGS if the port
// is equal to the configured value.
uint32 modem_port = 3;
// GNSS port (fPort).
// ChirpStack will forward the FrmPayload to MGS as GNSS payload if the
// port is equal to the configured value.
uint32 gnss_port = 4;
// Use rx time for GNSS resolving.
// In case this is set to true, the MGS resolver will use the RX time of the
// network instead of the timestamp included in the LR1110 payload.
bool gnss_use_rx_time = 5;
// Parse TLV records.
// If enabled, stream records (expected in TLV format) are scanned for GNSS
// data (0x06 or 0x07). If found, ChirpStack will make an additional
// geolocation call to the MGS API for resolving the location of the detected
// payload.
bool parse_tlv = 6;
// Geolocation buffer TTL (in seconds).
// If > 0, uplink RX meta-data will be stored in a buffer so that
// the meta-data of multiple uplinks can be used for geolocation.
uint32 geolocation_buffer_ttl = 7;
// Geolocation minimum buffer size.
// If > 0, geolocation will only be performed when the buffer has
// at least the given size.
uint32 geolocation_min_buffer_size = 8;
// TDOA based geolocation is enabled.
bool geolocation_tdoa = 9;
// RSSI based geolocation is enabled.
bool geolocation_rssi = 10;
// GNSS based geolocation is enabled (LR1110).
bool geolocation_gnss = 11;
// GNSS payload field.
// This holds the name of the field in the decoded payload object which
// contains the GNSS payload bytes (as HEX string).
string geolocation_gnss_payload_field = 12;
// GNSS use RX time.
// In case this is set to true, the resolver will use the RX time of the
// network instead of the timestamp included in the LR1110 payload.
bool geolocation_gnss_use_rx_time = 13;
// Wifi based geolocation is enabled.
bool geolocation_wifi = 14;
// Wifi payload field.
// This holds the name of the field in the decoded payload object which
// contains an array of objects with the following fields:
// * macAddress - e.g. 01:23:45:67:89:ab
// * signalStrength - e.g. -51 (optional)
string geolocation_wifi_payload_field = 15;
}
message CreateLoraCloudIntegrationRequest {
// Integration object to create.
LoraCloudIntegration integration = 1;
}
message GetLoraCloudIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GetLoraCloudIntegrationResponse {
// Integration object.
LoraCloudIntegration integration = 1;
}
message UpdateLoraCloudIntegrationRequest {
// Integration object to update.
LoraCloudIntegration integration = 1;
}
message DeleteLoraCloudIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GcpPubSubIntegration {
// Application ID (UUID).
string application_id = 1;
// Encoding.
Encoding encoding = 2;
// Credentials file.
// This IAM service-account credentials file (JSON) must have the following Pub/Sub roles:
// * Pub/Sub Publisher
string credentials_file = 3;
// Project ID.
string project_id = 4;
// Topic name.
// This is the name of the Pub/Sub topic.
string topic_name = 5;
}
message CreateGcpPubSubIntegrationRequest {
// Integration object to create.
GcpPubSubIntegration integration = 1;
}
message GetGcpPubSubIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GetGcpPubSubIntegrationResponse {
// Integration object.
GcpPubSubIntegration integration = 1;
}
message UpdateGcpPubSubIntegrationRequest {
// Integration object to update.
GcpPubSubIntegration integration = 1;
}
message DeleteGcpPubSubIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message AwsSnsIntegration {
// Application ID (UUID).
string application_id = 1;
// Encoding.
Encoding encoding = 2;
// AWS region.
string region = 3;
// AWS Access Key ID.
string access_key_id = 4;
// AWS Secret Access Key.
string secret_access_key = 5;
// Topic ARN.
string topic_arn = 6;
}
message CreateAwsSnsIntegrationRequest {
// Integration object to create.
AwsSnsIntegration integration = 1;
}
message GetAwsSnsIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GetAwsSnsIntegrationResponse {
// Integration object.
AwsSnsIntegration integration = 1;
}
message UpdateAwsSnsIntegrationRequest {
// Integration object to update.
AwsSnsIntegration integration = 1;
}
message DeleteAwsSnsIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message AzureServiceBusIntegration {
// Application ID (UUID).
string application_id = 1;
// Encoding.
Encoding encoding = 2;
// Connection string.
string connection_string = 3;
// Publish name.
// This is the name of the topic or queue.
string publish_name = 4;
}
message CreateAzureServiceBusIntegrationRequest {
// Integration object to create.
AzureServiceBusIntegration integration = 1;
}
message GetAzureServiceBusIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GetAzureServiceBusIntegrationResponse {
// Integration object.
AzureServiceBusIntegration integration = 1;
}
message UpdateAzureServiceBusIntegrationRequest {
// Integration object to create.
AzureServiceBusIntegration integration = 1;
}
message DeleteAzureServiceBusIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message PilotThingsIntegration {
// Application ID (UUID).
string application_id = 1;
// Server URL.
string server = 2;
// Authentication token.
string token = 3;
}
message CreatePilotThingsIntegrationRequest {
// Integration object to create.
PilotThingsIntegration integration = 1;
}
message GetPilotThingsIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GetPilotThingsIntegrationResponse {
// Integration object.
PilotThingsIntegration integration = 1;
}
message UpdatePilotThingsIntegrationRequest {
// Integration object to update.
PilotThingsIntegration integration = 1;
}
message DeletePilotThingsIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GenerateMqttIntegrationClientCertificateRequest {
// Application ID (UUID).
string application_id = 1;
}
message GenerateMqttIntegrationClientCertificateResponse {
// TLS certificate.
string tls_cert = 1;
// TLS key.
string tls_key = 2;
// CA certificate.
string ca_cert = 3;
// Expires at defines the expiration date of the certificate.
google.protobuf.Timestamp expires_at = 4;
}

414
api/proto/api/device.proto Normal file
View File

@ -0,0 +1,414 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/empty.proto";
// DeviceService is the service providing API methods for managing devices.
service DeviceService {
// Create the given device.
rpc Create(CreateDeviceRequest) returns (google.protobuf.Empty) {}
// Get returns the device for the given DevEUI.
rpc Get(GetDeviceRequest) returns (GetDeviceResponse) {}
// Update the given device.
rpc Update(UpdateDeviceRequest) returns (google.protobuf.Empty) {}
// Delete the device with the given DevEUI.
rpc Delete(DeleteDeviceRequest) returns (google.protobuf.Empty) {}
// Get the list of devices.
rpc List(ListDevicesRequest) returns (ListDevicesResponse) {}
// Create the given device-keys.
rpc CreateKeys(CreateDeviceKeysRequest) returns (google.protobuf.Empty) {}
// Get the device-keys for the given DevEUI.
rpc GetKeys(GetDeviceKeysRequest) returns (GetDeviceKeysResponse) {}
// Update the given device-keys.
rpc UpdateKeys(UpdateDeviceKeysRequest) returns (google.protobuf.Empty) {}
// Delete the device-keys for the given DevEUI.
rpc DeleteKeys(DeleteDeviceKeysRequest) returns (google.protobuf.Empty) {}
// FlushDevNonces flushes the OTAA device nonces.
rpc FlushDevNonces(FlushDevNoncesRequest) returns (google.protobuf.Empty) {}
// Activate (re)activates the device with the given parameters (for ABP or for importing OTAA activations).
rpc Activate(ActivateDeviceRequest) returns (google.protobuf.Empty) {}
// Deactivate de-activates the device.
rpc Deactivate(DeactivateDeviceRequest) returns (google.protobuf.Empty) {}
// GetActivation returns the current activation details of the device (OTAA or ABP).
rpc GetActivation(GetDeviceActivationRequest) returns (GetDeviceActivationResponse) {}
// GetRandomDevAddr returns a random DevAddr taking the NwkID prefix into account.
rpc GetRandomDevAddr(GetRandomDevAddrRequest) returns (GetRandomDevAddrResponse) {}
// GetStats returns the device stats.
rpc GetStats(GetDeviceStatsRequest) returns (GetDeviceStatsResponse) {}
// Enqueue adds the given item to the downlink queue.
rpc Enqueue(EnqueueDeviceQueueItemRequest) returns (EnqueueDeviceQueueItemResponse) {}
// FlushQueue flushes the downlink device-queue.
rpc FlushQueue(FlushDeviceQueueRequest) returns (google.protobuf.Empty) {}
// GetQueue returns the downlink device-queue.
rpc GetQueue(GetDeviceQueueItemsRequest) returns (GetDeviceQueueItemsResponse) {}
}
message Device {
// DevEUI (EUI64).
string dev_eui = 1;
// Name.
string name = 2;
// Description.
string description = 3;
// Application ID (UUID).
string application_id = 4;
// Device-profile ID (UUID).
string device_profile_id = 5;
// Skip frame-counter checks (this is insecure, but could be helpful for debugging).
bool skip_fcnt_check = 6;
// Device is disabled.
bool is_disabled = 7;
// Variables (user defined).
// These variables can be used together with integrations to store tokens /
// secrets that must be configured per device. These variables are not
// exposed in the event payloads.
map<string, string> variables = 8;
// Tags (user defined).
// These tags are exposed in the event payloads or to integration. Tags are
// intended for aggregation and filtering.
map<string, string> tags = 9;
}
message DeviceStatus {
// The device margin status
// -32..32: The demodulation SNR ration in dB
int32 margin = 1;
// Device is connected to an external power source.
bool external_power_source = 2;
// Device battery level as a percentage.
// -1 when the battery level is not available.
float battery_level = 3;
}
message DeviceListItem {
// DevEUI (EUI64).
string dev_eui = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Last seen at timestamp.
google.protobuf.Timestamp last_seen_at = 4;
// Name.
string name = 5;
// Description.
string description = 6;
// Device-profile ID (UUID).
string device_profile_id = 7;
// Device-profile name.
string device_profile_name = 8;
// Device status.
DeviceStatus device_status = 9;
}
message DeviceKeys {
// DevEUI (EUI64).
string dev_eui = 1;
// Network root key (128 bit).
// Note: For LoRaWAN 1.0.x, use this field for the LoRaWAN 1.0.x 'AppKey`!
string nwk_key = 2;
// Application root key (128 bit).
// Note: This field only needs to be set for LoRaWAN 1.1.x devices!
string app_key = 3;
}
message CreateDeviceRequest {
// Device object.
Device device = 1;
}
message GetDeviceRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetDeviceResponse {
// Device object.
Device device = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Last seen at timestamp.
google.protobuf.Timestamp last_seen_at = 4;
// Device status.
DeviceStatus device_status = 5;
}
message UpdateDeviceRequest {
// Device object.
Device device = 1;
}
message DeleteDeviceRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message ListDevicesRequest {
// Max number of devices to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name (optional).
string search = 3;
// Application ID (UUID) to filter devices on.
string application_id = 4;
// Multicst-group ID (UUID) to filter devices on.
string multicast_group_id = 5;
}
message ListDevicesResponse {
// Total number of devices.
uint32 total_count = 1;
// Result-set.
repeated DeviceListItem result = 2;
}
message CreateDeviceKeysRequest {
// Device-keys object.
DeviceKeys device_keys = 1;
}
message GetDeviceKeysRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetDeviceKeysResponse {
// Device-keys object.
DeviceKeys device_keys = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateDeviceKeysRequest {
// Device-keys object.
DeviceKeys device_keys = 1;
}
message DeleteDeviceKeysRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message DeviceActivation {
// Device EUI (EUI64).
string dev_eui = 1;
// Device address (HEX encoded).
string dev_addr = 2;
// Application session key (HEX encoded).
string app_s_key = 3;
// Network session encryption key (HEX encoded).
string nwk_s_enc_key = 4;
// Serving network session integrity key (HEX encoded).
string s_nwk_s_int_key = 8;
// Forwarding network session integrity key (HEX encoded).
string f_nwk_s_int_key = 9;
// Uplink frame-counter.
uint32 f_cnt_up = 5;
// Downlink network frame-counter.
uint32 n_f_cnt_down = 6;
// Downlink application frame-counter.
uint32 a_f_cnt_down = 10;
}
message ActivateDeviceRequest {
// Device activation object.
DeviceActivation device_activation = 1;
}
message DeactivateDeviceRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetDeviceActivationRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetDeviceActivationResponse {
// Device activation object.
DeviceActivation device_activation = 1;
}
message GetRandomDevAddrRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetRandomDevAddrResponse {
// DevAddr.
string dev_addr = 1;
}
message GetDeviceStatsRequest {
// DevEUI (EUI64).
string dev_eui = 1;
// Interval start timestamp.
google.protobuf.Timestamp start = 2;
// Interval end timestamp.
google.protobuf.Timestamp end = 3;
}
message GetDeviceStatsResponse {
repeated DeviceStats result = 1;
}
message DeviceStats {
// Timestamp of the (aggregated) measurement.
google.protobuf.Timestamp time = 1;
// Packets received from the device.
uint32 rx_packets = 2;
// Average RSSI (as reported by the gateway(s)).
float gw_rssi = 3;
// Average SNR (as reported by the gateway(s)).
float gw_snr = 4;
// Packets received by frequency.
map<uint32, uint32> rx_packets_per_frequency = 5;
// Packets received by DR.
map<uint32, uint32> rx_packets_per_dr = 6;
// Error count.
map<string, uint32> errors = 7;
}
message DeviceQueueItem {
// ID (UUID).
// This is automatically generated on enqueue.
string id = 1;
// Device EUI (EUI64).
string dev_eui = 2;
// Confirmed.
bool confirmed = 3;
// FPort (must be > 0).
uint32 f_port = 4;
// Data.
// Or use the json_object field when a codec has been configured.
bytes data = 5;
// Only use this when a codec has been configured that can encode this
// object to bytes.
google.protobuf.Struct object = 6;
// Is pending.
// This is set to true when the downlink is pending.
bool is_pending = 7;
// Downlink frame-counter.
// This is set when the payload has been sent as downlink.
uint32 f_cnt_down = 8;
}
message EnqueueDeviceQueueItemRequest {
DeviceQueueItem item = 1;
}
message EnqueueDeviceQueueItemResponse {
// ID (UUID).
string id = 1;
}
message FlushDeviceQueueRequest {
// Device EUI (EUI64).
string dev_eui = 1;
}
message GetDeviceQueueItemsRequest {
// Device EUI (EUI64).
string dev_eui = 1;
// Return only the count, not the result-set.
bool count_only = 2;
}
message GetDeviceQueueItemsResponse {
// Total number of queue items.
uint32 total_count = 1;
// Result-set.
repeated DeviceQueueItem result = 2;
}
message FlushDevNoncesRequest {
// Device EUI (EUI64).
string dev_eui = 1;
}

View File

@ -0,0 +1,235 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProfileProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "common/common.proto";
enum CodecRuntime {
// None.
NONE = 0;
// Cayenne LPP.
CAYENNE_LPP = 1;
// JavaScript.
JS = 2;
}
// DeviceProfileService is the service providing API methods for managing device-profiles.
service DeviceProfileService {
// Create the given device-profile.
rpc Create(CreateDeviceProfileRequest) returns (CreateDeviceProfileResponse) {}
// Get the device-profile for the given ID.
rpc Get(GetDeviceProfileRequest) returns (GetDeviceProfileResponse) {}
// Update the given device-profile.
rpc Update(UpdateDeviceProfileRequest) returns (google.protobuf.Empty) {}
// Delete the device-profile with the given ID.
rpc Delete(DeleteDeviceProfileRequest) returns (google.protobuf.Empty) {}
// List the available device-profiles.
rpc List(ListDeviceProfilesRequest) returns (ListDeviceProfilesResponse) {}
// List available ADR algorithms.
rpc ListAdrAlgorithms(google.protobuf.Empty) returns (ListDeviceProfileAdrAlgorithmsResponse) {}
}
message DeviceProfile {
// Device-profile ID (UUID).
// Note: on create this will be automatically generated.
string id = 1;
// Tenant ID (UUID).
string tenant_id = 2;
// Name.
string name = 3;
// Region.
common.Region region = 4;
// LoRaWAN mac-version.
common.MacVersion mac_version = 5;
// Regional parameters revision.
common.RegParamsRevision reg_params_revision = 6;
// ADR algorithm ID.
string adr_algorithm_id = 7;
// Payload codec runtime.
CodecRuntime payload_codec_runtime = 8;
// Payload codec encoder config.
string payload_encoder_config = 9;
// Payload codec decoder config.
string payload_decoder_config = 10;
// Uplink interval (seconds).
// This defines the expected uplink interval which the device uses for
// communication. When the uplink interval has expired and no uplink has
// been received, the device is considered inactive.
uint32 uplink_interval = 11;
// Device-status request interval (times / day).
// This defines the times per day that ChirpStack will request the device-status
// from the device.
uint32 device_status_req_interval = 12;
// Supports OTAA.
bool supports_otaa = 13;
// Supports Class B.
bool supports_class_b = 14;
// Supports Class-C.
bool supports_class_c = 15;
// Class-B timeout (seconds).
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
uint32 class_b_timeout = 16;
// Class-B ping-slot periodicity.
uint32 class_b_ping_slot_period = 17;
// Class-B ping-slot DR.
uint32 class_b_ping_slot_dr = 18;
// Class-B ping-slot freq (Hz).
uint32 class_b_ping_slot_freq = 19;
// Class-C timeout (seconds).
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
uint32 class_c_timeout = 20;
// RX1 delay (for ABP).
uint32 abp_rx1_delay = 21;
// RX1 DR offset (for ABP).
uint32 abp_rx1_dr_offset = 22;
// RX2 DR (for ABP).
uint32 abp_rx2_dr = 23;
// RX2 frequency (for ABP, Hz).
uint32 abp_rx2_freq = 24;
// User defined tags.
map<string, string> tags = 25;
}
message DeviceProfileListItem {
// Device-profile ID (UUID).
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Name.
string name = 4;
// Region.
common.Region region = 5;
// LoRaWAN mac-version.
common.MacVersion mac_version = 6;
// Regional parameters revision.
common.RegParamsRevision reg_params_revision = 7;
// Supports OTAA.
bool supports_otaa = 8;
// Supports Class-B.
bool supports_class_b = 9;
// Supports Class-C.
bool supports_class_c = 10;
}
message CreateDeviceProfileRequest {
// Object to create.
DeviceProfile device_profile = 1;
}
message CreateDeviceProfileResponse {
// ID (UUID).
string id = 1;
}
message GetDeviceProfileRequest {
// ID (UUID).
string id = 1;
}
message GetDeviceProfileResponse {
// Device-profile object.
DeviceProfile device_profile = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateDeviceProfileRequest {
// Device-profile object.
DeviceProfile device_profile = 1;
}
message DeleteDeviceProfileRequest {
// ID (UUID).
string id = 1;
}
message ListDeviceProfilesRequest {
// Max number of device-profiles to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name.
string search = 3;
// Tenant ID to list the device-profiles for.
string tenant_id = 4;
}
message ListDeviceProfilesResponse {
// Total number of device-profiles.
uint32 total_count = 1;
// Result-set.
repeated DeviceProfileListItem result = 2;
}
message ListDeviceProfileAdrAlgorithmsResponse {
// Total number of algorithms.
uint32 total_count = 1;
// Result-set.
repeated AdrAlgorithmListItem result = 2;
}
message AdrAlgorithmListItem {
// Algorithm ID.
string id = 1;
// Algorithm name.
string name = 2;
}

View File

@ -0,0 +1,61 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "FrameLogProto";
import "google/protobuf/timestamp.proto";
import "common/common.proto";
import "gw/gw.proto";
message UplinkFrameLog {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data.
gw.UplinkTXInfo tx_info = 2;
// RX meta-data.
repeated gw.UplinkRXInfo rx_info = 3;
// Message type.
common.MType m_type = 4;
// Device address (optional).
string dev_addr = 5;
// Device EUI (optional).
string dev_eui = 6;
// Time.
google.protobuf.Timestamp time = 7;
}
message DownlinkFrameLog {
// Time.
google.protobuf.Timestamp time = 1;
// PHYPayload.
bytes phy_payload = 2;
// TX meta-data.
gw.DownlinkTXInfo tx_info = 3;
// Downlink ID (UUID).
string downlink_id = 4;
// Gateway ID (EUI64).
string gateway_id = 5;
// Message type.
common.MType m_type = 6;
// Device address (optional).
string dev_addr = 7;
// Device EUI (optional).
string dev_eui = 8;
}

205
api/proto/api/gateway.proto Normal file
View File

@ -0,0 +1,205 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "GatewayProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "common/common.proto";
// GatewayService is the service providing API methods for managing gateways.
service GatewayService {
// Create creates the given gateway.
rpc Create(CreateGatewayRequest) returns (google.protobuf.Empty) {}
// Get returns the gateway for the given Gateway ID.
rpc Get(GetGatewayRequest) returns (GetGatewayResponse) {}
// Update updates the given gateway.
rpc Update(UpdateGatewayRequest) returns (google.protobuf.Empty) {}
// Delete deletes the gateway matching the given Gateway ID.
rpc Delete(DeleteGatewayRequest) returns (google.protobuf.Empty) {}
// Get the list of gateways.
rpc List(ListGatewaysRequest) returns (ListGatewaysResponse) {}
// Generate client-certificate for the gateway.
rpc GenerateClientCertificate(GenerateGatewayClientCertificateRequest) returns (GenerateGatewayClientCertificateResponse) {}
// GetStats returns the gateway stats.
rpc GetStats(GetGatewayStatsRequest) returns (GetGatewayStatsResponse) {}
}
message Gateway {
// Gateway ID (EUI64).
string gateway_id = 1;
// Name.
string name = 2;
// Description.
string description = 3;
// Gateway location.
common.Location location = 4;
// Tenant ID (UUID).
string tenant_id = 5;
// Tags.
map<string, string> tags = 6;
// Properties (provided by the gateway).
map<string, string> properties = 7;
}
message GatewayListItem {
// Tenant ID.
string tenant_id = 1;
// Gateway ID (EUI64).
string gateway_id = 2;
// Name.
string name = 3;
// Description.
string description = 4;
// Location.
common.Location location = 5;
// Gateway properties.
map<string, string> properties = 6;
// Created at timestamp.
google.protobuf.Timestamp created_at = 7;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 8;
// Last seen at timestamp.
google.protobuf.Timestamp last_seen_at = 9;
}
message CreateGatewayRequest {
// Gateway object.
Gateway gateway = 1;
}
message GetGatewayRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
}
message GetGatewayResponse {
// Gateway object.
Gateway gateway = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Last seen at timestamp.
google.protobuf.Timestamp last_seen_at = 4;
}
message UpdateGatewayRequest {
// Gateway object.
Gateway gateway = 1;
}
message DeleteGatewayRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
}
message ListGatewaysRequest {
// Max number of gateways to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name (optional).
string search = 3;
// Tenant ID (UUID) to filter gateways on.
// To list all gateways as a global admin user, this field can be left blank.
string tenant_id = 4;
}
message ListGatewaysResponse {
// Total number of gateways.
uint32 total_count = 1;
// Result-set.
repeated GatewayListItem result = 2;
}
message GenerateGatewayClientCertificateRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
}
message GenerateGatewayClientCertificateResponse {
// TLS certificate.
string tls_cert = 1;
// TLS key.
string tls_key = 2;
// CA certificate.
string ca_cert = 3;
// Expires at defines the expiration date of the certificate.
google.protobuf.Timestamp expires_at = 4;
}
message GetGatewayStatsRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
// Interval start timestamp.
google.protobuf.Timestamp start = 2;
// Interval end timestamp.
google.protobuf.Timestamp end = 3;
}
message GetGatewayStatsResponse {
repeated GatewayStats result = 1;
}
message GatewayStats {
// Timestamp of the (aggregated) measurement.
google.protobuf.Timestamp time = 1;
// Packets received.
uint32 rx_packets = 2;
// Packets emitted.
uint32 tx_packets = 3;
// Tx packets per frequency.
map<uint32, uint32> tx_packets_per_frequency = 4;
// Rx packets per frequency.
map<uint32, uint32> rx_packets_per_frequency = 5;
// Tx packets per DR.
map<uint32, uint32> tx_packets_per_dr = 6;
// Rx packets per DR.
map<uint32, uint32> rx_packets_per_dr = 7;
// Tx packets per status.
map<string, uint32> tx_packets_per_status = 8;
}

View File

@ -0,0 +1,300 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "InternalProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "api/user.proto";
// InternalService is the service providing API endpoints for internal usage.
service InternalService {
// Log in a user
rpc Login(LoginRequest) returns (LoginResponse) {}
// Get the current user's profile
rpc Profile(google.protobuf.Empty) returns (ProfileResponse) {}
// Perform a global search.
rpc GlobalSearch(GlobalSearchRequest) returns (GlobalSearchResponse) {}
// CreateApiKey creates the given API key.
rpc CreateApiKey(CreateApiKeyRequest) returns (CreateApiKeyResponse) {}
// DeleteApiKey deletes the API key.
rpc DeleteApiKey(DeleteApiKeyRequest) returns (google.protobuf.Empty) {}
// ListApiKeys lists the available API keys.
rpc ListApiKeys(ListApiKeysRequest) returns (ListApiKeysResponse) {}
// Get the global settings.
rpc Settings(google.protobuf.Empty) returns (SettingsResponse) {}
// OpenId Connect login.
rpc OpenIdConnectLogin(OpenIdConnectLoginRequest) returns (OpenIdConnectLoginResponse) {}
// GetDevicesSummary returns an aggregated summary of the devices.
rpc GetDevicesSummary(GetDevicesSummaryRequest) returns (GetDevicesSummaryResponse) {}
// GetGatewaysSummary returns an aggregated summary of the gateways.
rpc GetGatewaysSummary(GetGatewaysSummaryRequest) returns (GetGatewaysSummaryResponse) {}
// Stream frame for the given Gateway ID.
rpc StreamGatewayFrames(StreamGatewayFramesRequest) returns (stream LogItem) {}
// Stream frames for the given Device EUI.
rpc StreamDeviceFrames(StreamDeviceFramesRequest) returns (stream LogItem) {}
// Stream events for the given Device EUI.
rpc StreamDeviceEvents(StreamDeviceEventsRequest) returns (stream LogItem) {}
}
message ApiKey {
// API key ID.
// This value will be automatically generated on create.
string id = 1;
// Name.
string name = 2;
// Is global admin key.
bool is_admin = 3;
// Tenant ID.
// In case the API key is intended to manage resources under a single tenant.
string tenant_id = 4;
}
message CreateApiKeyRequest {
// The API key to create.
ApiKey api_key = 1;
}
message CreateApiKeyResponse {
// API key ID.
string id = 1;
// API token for authentication API requests.
string token = 2;
}
message DeleteApiKeyRequest {
// API key ID.
string id = 1;
}
message ListApiKeysRequest {
// Max number of items to return.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// Return only admin keys.
bool is_admin = 3;
// Filter on tenant ID.
string tenant_id = 4;
}
message ListApiKeysResponse {
// Total number of API keys.
uint32 total_count = 1;
repeated ApiKey result = 2;
}
// Defines a tenant to which the user is associated.
message UserTenantLink {
// Created at timestamp.
google.protobuf.Timestamp created_at = 1;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 2;
// Tenant ID.
string tenant_id = 3;
// User is admin within the context of this tenant.
// There is no need to set the is_device_admin and is_gateway_admin flags.
bool is_admin = 4;
// User is able to modify device related resources (applications,
// device-profiles, devices, multicast-groups).
bool is_device_admin = 5;
// User is able to modify gateways.
bool is_gateway_admin = 6;
}
message LoginRequest {
// Email of the user.
string email = 1;
// Password of the user.
string password = 2;
}
message LoginResponse {
// The JWT tag to be used to access chirpstack-application-server interfaces.
string jwt = 1;
}
message ProfileResponse {
// User object.
User user = 1;
// Tenants to which the user is associated.
repeated UserTenantLink tenants = 3;
}
message GlobalSearchRequest {
// Search query.
string search = 1;
// Max number of results to return.
int64 limit = 2;
// Offset offset of the result-set (for pagination).
int64 offset = 3;
}
message GlobalSearchResponse {
repeated GlobalSearchResult result = 1;
}
message GlobalSearchResult {
// Record kind.
string kind = 1;
// Search score.
float score = 2;
// Organization id.
string tenant_id = 3;
// Organization name.
string tenant_name = 4;
// Application id.
string application_id = 5;
// Application name.
string application_name = 6;
// Device DevEUI (hex encoded).
string device_dev_eui = 7;
// Device name.
string device_name = 8;
// Gateway MAC (hex encoded).
string gateway_id = 9;
// Gateway name.
string gateway_name = 10;
}
message SettingsResponse {
// OpenId Connect settings.
OpenIdConnect openid_connect = 1;
}
message OpenIdConnect {
// Enable OpenId Connect authentication.
bool enabled = 1;
// Login url.
string login_url = 2 [json_name = "loginURL"];
// Login label.
string login_label = 3;
// Logout url.
string logout_url = 4 [json_name = "logoutURL"];
}
message OpenIdConnectLoginRequest {
// OpenId Connect callback code.
string code = 1;
// OpenId Connect callback state.
string state = 2;
}
message OpenIdConnectLoginResponse {
// Token to use for authentication.
string token = 1;
}
message GetDevicesSummaryRequest {
// Tenant ID (UUID).
string tenant_id = 1;
}
message GetDevicesSummaryResponse {
// Active count.
uint32 active_count = 1;
// Inactive count.
uint32 inactive_count = 2;
// per data-rate count.
// Devices that have never been seen are excluded.
map<uint32, uint32> dr_count = 3;
// Never seen count.
uint32 never_seen_count = 4;
}
message GetGatewaysSummaryRequest {
// Tenant ID (UUID).
string tenant_id = 1;
}
message GetGatewaysSummaryResponse {
// Active count.
uint32 active_count = 1;
// Inactive count.
uint32 inactive_count = 2;
// Never seen count.
uint32 never_seen_count = 3;
}
message LogItem {
// ID.
string id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Message.
string description = 3;
// Body.
string body = 4;
// Properties.
map<string, string> properties = 5;
}
message StreamGatewayFramesRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
}
message StreamDeviceFramesRequest {
// Device EUI.
string dev_eui = 1;
}
message StreamDeviceEventsRequest {
// Device EUI.
string dev_eui = 1;
}

View File

@ -0,0 +1,228 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "MulticastGroupProto";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "common/common.proto";
// MulticastGroupService is the service managing multicast-groups.
service MulticastGroupService {
// Create the given multicast group.
rpc Create(CreateMulticastGroupRequest) returns (CreateMulticastGroupResponse) {}
// Get returns the multicast group for the given ID.
rpc Get(GetMulticastGroupRequest) returns (GetMulticastGroupResponse) {}
// Update the given multicast group.
rpc Update(UpdateMulticastGroupRequest) returns (google.protobuf.Empty) {}
// Delete the multicast-group with the given ID.
rpc Delete(DeleteMulticastGroupRequest) returns (google.protobuf.Empty) {}
// List the available multicast groups.
rpc List(ListMulticastGroupsRequest) returns (ListMulticastGroupsResponse) {}
// Add a device to the multicast group.
rpc AddDevice(AddDeviceToMulticastGroupRequest) returns (google.protobuf.Empty) {}
// Remove a device from the multicast group.
rpc RemoveDevice(RemoveDeviceFromMulticastGroupRequest) returns (google.protobuf.Empty) {}
// Add the given item to the multcast group queue.
rpc Enqueue(EnqueueMulticastGroupQueueItemRequest) returns (EnqueueMulticastGroupQueueItemResponse) {}
// Flush the queue for the given multicast group.
rpc FlushQueue(FlushMulticastGroupQueueRequest) returns (google.protobuf.Empty) {}
// List the items in the multicast group queue.
rpc ListQueue(ListMulticastGroupQueueRequest) returns (ListMulticastGroupQueueResponse) {}
}
enum MulticastGroupType {
// Class C.
CLASS_C = 0;
// Class-B.
CLASS_B = 1;
}
message MulticastGroup {
// ID (UUID).
// This will be generated automatically on create.
string id = 1;
// Name.
string name = 2;
// Application ID.
// After creation, this can not be updated.
string application_id = 3;
// Region.
common.Region region = 4;
// Multicast address (HEX encoded DevAddr).
string mc_addr = 5;
// Multicast network session key (HEX encoded AES128 key).
string mc_nwk_s_key = 6;
// Multicast application session key (HEX encoded AES128 key).
string mc_app_s_key = 7;
// Frame-counter.
uint32 f_cnt = 8;
// Multicast group type.
MulticastGroupType group_type = 9;
// Data-rate.
uint32 dr = 10;
// Frequency (Hz).
uint32 frequency = 11;
// Ping-slot period (only for Class-B).
uint32 class_b_ping_slot_period = 12;
}
message MulticastGroupListItem {
// ID.
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Name.
string name = 4;
// Region.
common.Region region = 5;
// Multicast group type.
MulticastGroupType group_type = 6;
}
message CreateMulticastGroupRequest {
// Multicast group to create.
MulticastGroup multicast_group = 1;
}
message CreateMulticastGroupResponse {
// ID of created multicast group (UUID).
string id = 1;
}
message GetMulticastGroupRequest {
// Multicast group ID.
string id = 1;
}
message GetMulticastGroupResponse {
// Multicast group object.
MulticastGroup multicast_group = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateMulticastGroupRequest {
// Multicast group object to update.
MulticastGroup multicast_group = 1;
}
message DeleteMulticastGroupRequest {
// Multicast group iD.
string id = 1;
}
message ListMulticastGroupsRequest {
// Max number of multicast groups to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name.
string search = 3;
// Application ID to list the multicast groups for.
string application_id = 4;
}
message ListMulticastGroupsResponse {
// Total number of multicast groups.
uint32 total_count = 1;
// Result-test.
repeated MulticastGroupListItem result = 2;
}
message AddDeviceToMulticastGroupRequest {
// Multicast group ID.
string multicast_group_id = 1;
// Device EUI (HEX encoded).
string dev_eui = 2;
}
message RemoveDeviceFromMulticastGroupRequest {
// Multicast group ID.
string multicast_group_id = 1;
// Device EUI (HEX encoded).
string dev_eui = 2;
}
message MulticastGroupQueueItem {
// Multicast group ID.
string multicast_group_id = 1;
// Downlink frame-counter.
// This will be automatically set on enqueue.
uint32 f_cnt = 2;
// FPort (must be > 0).
uint32 f_port = 3;
// Payload.
bytes data = 4;
}
message EnqueueMulticastGroupQueueItemRequest {
// Multicast queue-item to enqueue.
MulticastGroupQueueItem multicast_group_queue_item = 1;
}
message EnqueueMulticastGroupQueueItemResponse {
// Frame-counter of the enqueued payload.
uint32 f_cnt = 1;
}
message FlushMulticastGroupQueueRequest {
// Multicast group ID.
string multicast_group_id = 1;
}
message ListMulticastGroupQueueRequest {
// Multicast group ID.
string multicast_group_id = 1;
}
message ListMulticastGroupQueueResponse {
repeated MulticastGroupQueueItem items = 1;
}

261
api/proto/api/tenant.proto Normal file
View File

@ -0,0 +1,261 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "InternalProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
// TenantService is the service providing API methods for managing tenants.
service TenantService {
// Create a new tenant.
rpc Create(CreateTenantRequest) returns (CreateTenantResponse) {}
// Get the tenant for the given ID.
rpc Get(GetTenantRequest) returns (GetTenantResponse) {}
// Update the given tenant.
rpc Update(UpdateTenantRequest) returns (google.protobuf.Empty) {}
// Delete the tenant with the given ID.
rpc Delete(DeleteTenantRequest) returns (google.protobuf.Empty) {}
// Get the list of tenants.
rpc List(ListTenantsRequest) returns (ListTenantsResponse) {}
// Add an user to the tenant.
// Note: the user must already exist.
rpc AddUser(AddTenantUserRequest) returns (google.protobuf.Empty) {}
// Get the the tenant user for the given tenant and user IDs.
rpc GetUser(GetTenantUserRequest) returns (GetTenantUserResponse) {}
// Update the given tenant user.
rpc UpdateUser(UpdateTenantUserRequest) returns (google.protobuf.Empty) {}
// Delete the given tenant user.
rpc DeleteUser(DeleteTenantUserRequest) returns (google.protobuf.Empty) {}
// Get the list of tenant users.
rpc ListUsers(ListTenantUsersRequest) returns (ListTenantUsersResponse) {}
}
message Tenant {
// Tenant ID (UUID).
// Note: this value will be automatically generated on create.
string id = 1;
// Tenant name,
string name = 2;
// Tenant description.
string description = 3;
// Can the tenant create and "own" Gateways?
bool can_have_gateways = 4;
// Max. gateway count for tenant.
// When set to 0, the tenant can have unlimited gateways.
uint32 max_gateway_count = 5;
// Max. device count for tenant.
// When set to 0, the tenant can have unlimited devices.
uint32 max_device_count = 6;
// Private gateways.
// Gateways under this tenant are private.
bool private_gateways = 7;
}
message TenantListItem {
// Tenant ID (UUID).
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Tenant name.
string name = 4;
// Can the tenant create and "own" Gateways?
bool can_have_gateways = 5;
// Gateways are private to tenant.
bool private_gateways = 6;
// Max gateway count.
// 0 = unlimited.
uint32 max_gateway_count = 7;
// Max device count.
// 0 = unlimited.
uint32 max_device_count = 8;
}
message CreateTenantRequest {
// Tenant object to create.
Tenant tenant = 1;
}
message CreateTenantResponse {
// Tenant ID.
string id = 1;
}
message GetTenantRequest {
// Tenant ID.
string id = 1;
}
message GetTenantResponse {
// Tenant object.
Tenant tenant = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateTenantRequest {
// Tenant object.
Tenant tenant = 1;
}
message DeleteTenantRequest {
// Tenant ID.
string id = 1;
}
message ListTenantsRequest {
// Max number of tenants to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name.
string search = 3;
}
message ListTenantsResponse {
// Total number of tenants.
uint32 total_count = 1;
// Result-set.
repeated TenantListItem result = 2;
}
message TenantUser {
// Tenant ID (UUID).
string tenant_id = 1;
// User ID (UUID).
string user_id = 2;
// User is admin within the context of the tenant.
// There is no need to set the is_device_admin and is_gateway_admin flags.
bool is_admin = 3;
// User is able to modify device related resources (applications,
// device-profiles, devices, multicast-groups).
bool is_device_admin = 4;
// User is able to modify gateways.
bool is_gateway_admin = 5;
// Email (only used on get and when adding a user to a tenant).
string email = 6;
}
message TenantUserListItem {
// Tenant ID (UUID).
string tenant_id = 1;
// User ID (UUID).
string user_id = 2;
// Created at timestamp.
google.protobuf.Timestamp created_at = 3;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 4;
// Email.
string email = 5;
// User is admin within the context of the tenant.
// There is no need to set the is_device_admin and is_gateway_admin flags.
bool is_admin = 6;
// User is able to modify device related resources (applications,
// device-profiles, devices, multicast-groups).
bool is_device_admin = 7;
// User is able to modify gateways.
bool is_gateway_admin = 8;
}
message AddTenantUserRequest {
// Tenant user object.
TenantUser tenant_user = 1;
}
message GetTenantUserRequest {
// Tenant ID (UUID).
string tenant_id = 1;
// User ID (UUID).
string user_id = 2;
}
message GetTenantUserResponse {
// Tenant user object.
TenantUser tenant_user = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateTenantUserRequest {
// Tenant user object.
TenantUser tenant_user = 1;
}
message DeleteTenantUserRequest {
// Tenant ID (UUID).
string tenant_id = 1;
// User ID (UUID).
string user_id = 2;
}
message ListTenantUsersRequest {
// Tenant ID (UUID).
string tenant_id = 1;
// Max number of tenants to return in the result-set.
uint32 limit = 2;
// Offset in the result-set (for pagination).
uint32 offset = 3;
}
message ListTenantUsersResponse {
// Total number of tenants.
uint32 total_count = 1;
// Result-set.
repeated TenantUserListItem result = 2;
}

153
api/proto/api/user.proto Normal file
View File

@ -0,0 +1,153 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "UserProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
// UserService is the service providing API methods for managing users.
service UserService {
// Create a new user.
rpc Create(CreateUserRequest) returns (CreateUserResponse) {}
// Get the user for the given ID.
rpc Get(GetUserRequest) returns (GetUserResponse) {}
// Update the given user.
rpc Update(UpdateUserRequest) returns (google.protobuf.Empty) {}
// Delete the user with the given ID.
rpc Delete(DeleteUserRequest) returns (google.protobuf.Empty) {}
// Get the list of users.
rpc List(ListUsersRequest) returns (ListUsersResponse) {}
// Update the password for the given user.
rpc UpdatePassword(UpdateUserPasswordRequest) returns (google.protobuf.Empty) {}
}
message User {
// User ID (UUID).
// Will be set automatically on create.
string id = 1;
// Set to true to make the user a global administrator.
bool is_admin = 4;
// Set to false to disable the user.
bool is_active = 5;
// E-mail of the user.
string email = 6;
// Optional note to store with the user.
string note = 7;
}
message UserListItem {
// User ID (UUID).
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Email of the user.
string email = 4;
// Set to true to make the user a global administrator.
bool is_admin = 5;
// Set to false to disable the user.
bool is_active = 6;
}
message UserTenant {
// Tenant ID.
string tenant_id = 1;
// User is admin within the context of the tenant.
// There is no need to set the is_device_admin and is_gateway_admin flags.
bool is_admin = 2;
// User is able to modify device related resources (applications,
// device-profiles, devices, multicast-groups).
bool is_device_admin = 3;
// User is able to modify gateways.
bool is_gateway_admin = 4;
}
message CreateUserRequest {
// User object to create.
User user = 1;
// Password to set for the user.
string password = 2;
// Add the user to the following tenants.
repeated UserTenant tenants = 3;
}
message CreateUserResponse {
// User ID.
string id = 1;
}
message GetUserRequest {
// User ID.
string id = 1;
}
message GetUserResponse {
// User object.
User user = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateUserRequest {
// User object.
User user = 1;
}
message DeleteUserRequest {
// User ID.
string id = 1;
}
message ListUsersRequest {
// Max number of tenants to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
}
message ListUsersResponse {
// Total number of users.
uint32 total_count = 1;
// Result-set.
repeated UserListItem result = 2;
}
message UpdateUserPasswordRequest {
// User ID.
string user_id = 1;
// Password to set.
string password = 2;
}