-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
77 changed files
with
28,938 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
syntax = "proto3"; | ||
|
||
package hiber.device; | ||
|
||
import "google/protobuf/struct.proto"; | ||
|
||
import "base.proto"; | ||
import "health.proto"; | ||
import "modem.proto"; | ||
import "tag.proto"; | ||
|
||
option java_multiple_files = false; | ||
option java_package = "global.hiber.api.grpc.device"; | ||
option java_outer_classname = "DeviceApi"; | ||
option go_package = "hiber"; | ||
|
||
/* Information about a device. | ||
* A device is anything in the Hiber network that can send data to our systems. | ||
* They have a unique device number in our system, used to identify them. | ||
*/ | ||
message Device { | ||
/* An 8-character hexadecimal string, formatted for human readability. System ignores spaces. */ | ||
string number = 1; | ||
/* The organization that owns this device */ | ||
string organization = 2; | ||
|
||
/* A descriptor given to the device, defaults to it's number. */ | ||
string name = 3; | ||
|
||
hiber.Location location = 4; | ||
|
||
/* The amount of time since the last message from this modem was received on the server. */ | ||
optional hiber.Duration inactivity = 5; | ||
|
||
/* Health level based on the modem alarm and some always-present alarms. */ | ||
health.HealthLevel health_level = 6; | ||
|
||
/* The current lifecycle the modem is in. */ | ||
hiber.modem.Modem.Lifecycle lifecycle = 7; | ||
|
||
// additional information | ||
map<string, string> peripherals = 8; | ||
|
||
/* Notes field that can be used to add additional information to a modem. */ | ||
string notes = 9; | ||
|
||
/* Secure notes field that can be used to add additional information to a modem, with limited accessibility. */ | ||
optional string secure_notes = 10; | ||
|
||
repeated hiber.tag.Tag tags = 11; | ||
|
||
/* Optional information about what other devices this devices is linked to.*/ | ||
optional Links link = 12; | ||
|
||
/* Modem metadata, typically extracted from messages. */ | ||
google.protobuf.Struct metadata = 13; | ||
|
||
/* The timezone configured for the modem. */ | ||
optional string time_zone = 14; | ||
|
||
/* The transmission interval for this modem, if configured. */ | ||
optional hiber.Duration transmission_interval = 15; | ||
|
||
/* Collection of data about the devices it is connected to. */ | ||
message Links { | ||
/* Other identifiers for this devices. Could include data like its MAC-address or otherwise unique identifier. */ | ||
repeated string identifiers = 1; | ||
|
||
/* The device directly downstream from this device. | ||
* Usually a gateway of some sorts. This device sends its data directly to its parent. | ||
* The parent will relay the data to our systems. */ | ||
optional string parent = 2; | ||
|
||
// /* The devices that are directly upstream form this device if any. | ||
// * The upstream devices use this device to relay messages for them. */ | ||
// TODO(WEB-6273) Implement list of children | ||
// repeated string children = 3; | ||
} | ||
} | ||
|
||
/* Selection object for devices. | ||
* Filter devices by device number, tags, etc. | ||
*/ | ||
message DeviceSelection { | ||
string free_text_search = 1; | ||
|
||
Filter.Modems modems = 2; | ||
Filter.ModemIdentifiers identifiers = 3; | ||
Filter.HealthLevels health_level = 4; | ||
ModemFilter.Lifecycles lifecycles = 5; | ||
Filter.Modems with_parents = 6; | ||
Filter.Properties peripherals = 7; | ||
|
||
hiber.tag.TagSelection filter_by_tags = 8; | ||
|
||
TimeRange with_last_message_in = 9; | ||
} | ||
|
||
/* Sorting options for the results. */ | ||
enum Sort { | ||
/* Sort alphabetically on the name of the device. | ||
* De default name of the device is its HEX number, in ascending order. */ | ||
DEVICE_NAME_ASC = 0; | ||
/* Sort alphabetically on the name of the device. | ||
* De default name of the device is its HEX number, in descending order. */ | ||
DEVICE_NAME_DESC = 1; | ||
|
||
/* Sort numerically on the number of the device, in ascending order. */ | ||
DEVICE_NUMBER_ASC = 2; | ||
/* Sort numerically on the number of the device, in descending order. */ | ||
DEVICE_NUMBER_DESC = 3; | ||
|
||
/* Sort devices on most recent activity first (e.g. newest message received). */ | ||
ACTIVITY = 4; | ||
/* Sort devices on least recent activity first (e.g. longest no message received). */ | ||
INACTIVITY = 5; | ||
|
||
/* Sort device on its lifecycle state. */ | ||
LIFECYCLE_ASC = 6; | ||
/* Sort device on its lifecycle state in reverse order. */ | ||
LIFECYCLE_DESC = 7; | ||
/* Sort device on lifecycle name, alphabetically. */ | ||
LIFECYCLE_ALPHABETICAL_ASC = 8; | ||
/* Sort device on lifecycle name, alphabetically in reverse order. */ | ||
LIFECYCLE_ALPHABETICAL_DESC = 9; | ||
|
||
/* Sort alphabetically on the name of the organization that owns the device, in ascending order. */ | ||
ORGANIZATION_ASC = 10; | ||
/* Sort alphabetically on the name of the organization that owns the device, in descending order. */ | ||
ORGANIZATION_DESC = 11; | ||
|
||
/* Health sorted from least to most severe (i.e. OK, WARNING, ERROR). */ | ||
HEALTH_ASC = 12; | ||
/* Health sorted from most to least severe (i.e. ERROR, WARNING, OK). */ | ||
HEALTH_DESC = 13; | ||
/* Health sorted alphabetically by health level name. */ | ||
HEALTH_ALPHABETICAL_ASC = 14; | ||
/* Health sorted alphabetically by health level name, descending order. */ | ||
HEALTH_ALPHABETICAL_DESC = 15; | ||
} | ||
|
||
|
||
message ModemFilter { | ||
message Lifecycles { | ||
repeated hiber.modem.Modem.Lifecycle include = 1; | ||
repeated hiber.modem.Modem.Lifecycle exclude = 2; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
/* Device management. | ||
* | ||
* Devices are anything capable of sending messages to the system. | ||
* They have a unique device (previously modem) number, used to identify them. | ||
*/ | ||
syntax = "proto3"; | ||
|
||
package hiber.device; | ||
|
||
import "base.proto"; | ||
import "device.proto"; | ||
import "modem.proto"; | ||
|
||
option java_multiple_files = false; | ||
option java_package = "global.hiber.api.grpc.device"; | ||
option java_outer_classname = "DeviceServiceApi"; | ||
option go_package = "hiber"; | ||
|
||
/* At the core of the Hiber system, devices are the network nodes that send information and user data. | ||
* This service contains calls to list and manage devices. | ||
*/ | ||
service DeviceService { | ||
/* List the devices in your organization, and, optionally, its child organizations. */ | ||
rpc List (ListDevice.Request) returns (ListDevice.Response); | ||
|
||
/* Update a device. */ | ||
rpc Update(UpdateDevice.Request) returns (UpdateDevice.Response); | ||
} | ||
|
||
message UpdateDevice { | ||
|
||
hiber.device.DeviceSelection selection = 1; | ||
|
||
/* Change the name for the selected devices. | ||
* To prevent confusion, the selection can only effectively target 1 device when changing the name. | ||
* Unless you specifically set `allow_bulk_rename`. | ||
* You'd be left with multiple devices with the same name (technically allowed), | ||
* but probably something you don't want. | ||
*/ | ||
optional string name = 2; | ||
/* Allow a rename that results in multiple devices with the same name. | ||
* Could be useful if you have different sites with devices that fulfill | ||
* a similar job but are located at different sites. | ||
* It is advised to make sure those devices have different tags/groups. | ||
*/ | ||
bool allow_bulk_rename = 3; | ||
|
||
/* Change the notes for the selected devices. */ | ||
optional string notes = 4; | ||
/* Allow changing notes in bulk if the notes are different. | ||
* Must set this explicitly to prevent accidental loss of notes. | ||
*/ | ||
bool allow_bulk_notes = 5; | ||
|
||
/* Change the notes for the selected devices. */ | ||
optional string secure_notes = 6; | ||
/* Allow changing notes in bulk if the notes are different. | ||
* Must set this explicitly to prevent accidental loss of notes. | ||
*/ | ||
bool allow_bulk_secure_notes = 7; | ||
|
||
/* Updates the devices peripherals, by adding, removing or replacing. */ | ||
optional UpdatePeripherals peripherals = 8; | ||
/* Set the timezone the device is located in. */ | ||
optional string time_zone = 9; | ||
/* Update the lifecycle for this device. */ | ||
optional hiber.modem.Modem.Lifecycle lifecycle = 10; | ||
/* Sets the interval this devices is transmitting on. | ||
* Mainly useful for devices that have a regular interval for transmissions. */ | ||
optional Duration transmission_interval = 11; | ||
|
||
/* When updating peripherals, you can choose to add and delete peripherals, | ||
* or to do a wholesome replace of all peripherals. | ||
*/ | ||
message UpdatePeripherals { | ||
message Partial { | ||
/* Removes peripherals by name in this list. Leaves other peripherals untouched. */ | ||
repeated string remove_peripherals = 1; | ||
/* Adds peripherals by name-value from this mapping. Leaves other peripherals untouched. */ | ||
map<string, string> add_peripherals = 2; | ||
} | ||
message Replace { | ||
/* Replaces the entire set of peripherals. All peripherals not named in this map will be removed. */ | ||
map<string, string> replace_peripherals = 1; | ||
} | ||
oneof replace { | ||
Partial partial_update = 1; | ||
Replace full_replace = 2; | ||
} | ||
} | ||
|
||
message Request { | ||
/* Pick the organization to use (/impersonate). If unset, your default organization is used. */ | ||
string organization = 1; | ||
/* Multiple different updates can be made. | ||
* Every update contains a device selection (historically modem selection) | ||
* which targets the devices that should be updated. | ||
*/ | ||
repeated UpdateDevice devices = 2; | ||
} | ||
message Response { | ||
repeated Device devices = 1; | ||
Request request = 2; | ||
} | ||
} | ||
|
||
message ListDevice { | ||
message Request { | ||
/* Pick the organization to use (/impersonate). If unset, your default organization is used. */ | ||
string organization = 1; | ||
|
||
/* Select which devices to return. Uses ModemSelection, which is the historical name for device. */ | ||
hiber.device.DeviceSelection selection = 2; | ||
|
||
/* Paginate through results. */ | ||
Pagination pagination = 3; | ||
|
||
/* Sort the devices with the given sort options. */ | ||
repeated hiber.device.Sort sort_by = 4; | ||
|
||
/* Filter devices by location. */ | ||
LocationSelection location_selection = 5; | ||
|
||
/* Set this to true to populate the parents field in the response. | ||
* This will be populated with missing parents (e.g. gateways) for the the devices on this page. | ||
* Any parent that is on the current page is not included in this list to avoid duplicate data. | ||
*/ | ||
bool include_missing_parents = 6; | ||
} | ||
message Response { | ||
repeated Device devices = 1; | ||
ListDevice.Request request = 2; | ||
Pagination.Result pagination = 3; | ||
repeated Sort sorted_by = 4; | ||
|
||
/* This will be populated with missing parents (e.g. gateways) for the the devices on this page. | ||
* Any parent that is on the current page is not included in this list to avoid duplicate data. | ||
* Only set when include_missing_parents is true in the request. | ||
*/ | ||
repeated Device parents = 5; | ||
} | ||
} |
Oops, something went wrong.