syntax = "proto3";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "google/api/field_behavior.proto";
option go_package = "azimuth/grpc/proto";
option java_package = "com.azimuth.dataingestion";
service DataIngestionService {
// Define the schema of the data you want to ingest by declaring a list of flows with the configuration of the channels
rpc CreateIngestionConfig (CreateIngestionConfigRequest) returns (CreateIngestionConfigResponse);
// This endpoint allows adding new flows to an existing ingestion config
rpc AmendIngestionConfig(AmendIngestionConfigRequest) returns (google.protobuf.Empty);
rpc GetIngestionConfig (GetIngestionConfigRequest) returns (GetIngestionConfigResponse);
// Use the ingestion config to send one flow of structured data. This endpoint will time out if it doesn't receive a message in 60 seconds.
rpc IngestData (stream IngestDataRequest) returns (google.protobuf.Empty);
rpc IngestProtobuf (stream IngestProtobufRequest) returns (google.protobuf.Empty);
rpc CreateRun (CreateRunRequest) returns (CreateRunResponse);
rpc UpdateRun (UpdateRunRequest) returns (UpdateRunResponse);
rpc StopRun (StopRunRequest) returns (StopRunResponse);
rpc CreateAutomaticRunAssociationForAssets (CreateAutomaticRunAssociationForAssetsRequest) returns (CreateAutomaticRunAssociationForAssetsResponse);
// Deprecated. Use `AddProtobufDescriptor` and `DeleteProtobufDescriptors` in `azimuth.protobuf_descriptors.v1`
rpc SaveProtobufDescriptor(SaveProtobufDescriptorRequest) returns (google.protobuf.Empty);
}
message CreateIngestionConfigRequest {
string asset_name = 1;
repeated FlowConfig flows = 2;
string organization_id = 3;
// client_key is a user-defined string you can supply to uniquely identify
// an ingestion config (and retrieve it via GetIngestionConfig).
// An error is returned if you try to create an ingestion config with a
// client_key that already exists.
string client_key = 4;
}
message CreateIngestionConfigResponse {
string ingestion_config_id = 1;
// The returned asset will be created if one didn't exist with a matching name.
string asset_id = 2;
}
message AmendIngestionConfigRequest {
string ingestion_config_id = 1;
// These flows must have unique names. If you try to send a flow with a name that already exists for an ingestion config, it will return an error.
repeated FlowConfig flows = 2;
// If client_key is not empty, it will amend the ingestion config with the matching client_key.
// It is an error to supply both client_key and ingestion_config_id.
string client_key = 3;
}
message GetIngestionConfigRequest {
string ingestion_config_id = 1;
// If client_key is supplied, it will return the ingestion config with the matching client_key.
// It is an error to supply both client_key and ingestion_config_id.
string client_key = 2;
}
message GetIngestionConfigResponse {
string asset_name = 1;
string asset_id = 2;
repeated FlowConfig flows = 3;
string ingestion_config_id = 4;
string client_key = 5;
}
// A flow lets a consumer configure groupings of channels that will be ingested together. A list of flows
// can be provided when creating the ingestion config, and then when ingesting data, you provide one flow per request.
message FlowConfig {
string name = 1;
repeated ChannelConfig channels = 2;
}
message ChannelConfig {
string name = 1;
string component = 2;
string units = 3;
string description = 4;
ChannelDataType data_type = 5;
repeated ChannelEnumType enum_types = 6;
repeated ChannelBitFieldElement bit_field_elements = 7;
}
enum ChannelDataType {
// Unused, see https://protobuf.dev/programming-guides/style/#enums
UNSPECIFIED = 0 [deprecated=true];
DOUBLE = 1;
STRING = 2;
ENUM = 3;
BIT_FIELD = 4;
BOOL = 5;
FLOAT = 6;
INT_32 = 7;
UINT_32 = 8;
INT_64 = 9;
UINT_64 = 10;
}
message ChannelEnumType {
string name = 1;
uint32 key = 2;
}
message ChannelBitFieldElement {
string name = 1;
// The index of this element's first bit in the logical bit field array.
int32 index = 2;
uint32 bit_count = 3;
}
message IngestDataRequest {
string ingestion_config_id = 1;
string flow = 2;
google.protobuf.Timestamp timestamp = 3;
repeated ChannelValue channel_values = 4;
// The run_id MUST be included if this data is part of a run.
string run_id = 5;
// By default, if this request contains any channel values that do not match
// the supplied ingestion config, the request is stored in an error queue and
// the stream continues to accept data. This ensures all data is saved, but
// only valid data is fully ingested. If this is set to `true`, any validation
// errors end the stream and return the error to the client.
bool end_stream_on_validation_error = 6;
string organization_id = 7;
}
message ChannelValue {
oneof type {
string string = 1;
double double = 2;
float float = 3;
bool bool = 4;
int32 int32 = 5;
uint32 uint32 = 6;
int64 int64 = 7;
uint64 uint64 = 8;
bytes bit_field = 9;
uint32 enum = 10;
// If there's not a new data point for a channel at the given timestamp, pass empty to skip it
google.protobuf.Empty empty = 11;
}
}
message RunAsset {
// Runs are automatically associated with assets, based on the data that's ingested with the run_id.
option deprecated = true;
string asset_id = 1;
optional string ingestion_config_id = 2;
}
message Run {
string run_id = 1;
// Runs are automatically associated with assets, based on the data that's ingested with the run_id.
repeated RunAsset assets = 2 [deprecated=true];
// Start times are automatically calculated based on the data that's ingested with the run_id.
google.protobuf.Timestamp start_time = 3 [deprecated=true];
// Stop times are automatically calculated based on the data that's ingested with the run_id.
optional google.protobuf.Timestamp stop_time = 4 [deprecated=true];
string name = 5;
string description = 6;
repeated string tags = 7;
optional uint32 retention_period_override_in_days = 8;
}
message RunAssetRequest {
string asset_name = 1;
optional string ingestion_config_id = 2;
}
message CreateRunRequest {
// Runs are automatically associated with assets, based on the data that's ingested with the run_id.
repeated RunAssetRequest assets = 1 [deprecated=true];
// Start times are automatically calculated based on the timestamp of the data that's ingested with
// the run_id otherwise it is the time the run was created.
google.protobuf.Timestamp start_time = 2 [deprecated=true];
// Stop times are automatically calculated based on the timestamp of the data that's ingested with
// the run_id otherwise it is the time the run was stopped.
optional google.protobuf.Timestamp stop_time = 3 [deprecated=true];
string name = 4;
string description = 5;
repeated string tags = 6;
optional uint32 retention_period_override_in_days = 7;
// If asset_names are provided, any new data recieved for those assets will automatically
// be associated with this run. This applies even if the run is stopped and new data with
// timestamps within the run start and stop time.
repeated string asset_names = 8;
// organization_id is only required if the user has access to multiple organizations.
string organization_id = 9;
}
message CreateRunResponse {
Run run = 1;
}
message UpdateRunRequest {
string run_id = 1;
// Start times are automatically calculated based on the data that's ingested with the run_id.
optional google.protobuf.Timestamp start_time = 2 [deprecated=true];
// Stop times are automatically calculated based on the data that's ingested with the run_id.
optional google.protobuf.Timestamp stop_time = 3 [deprecated=true];
optional string description = 4;
repeated string tags = 5;
// Runs are automatically associated with assets, based on the data that's ingested with the run_id.
repeated RunAssetRequest assets = 6 [deprecated=true];
optional uint32 retention_period_override_in_days = 7;
}
message UpdateRunResponse {
Run run = 1;
}
message StopRunRequest {
string run_id = 1;
google.protobuf.Timestamp stop_time = 2;
}
message CreateAutomaticRunAssociationForAssetsRequest {
// The ID of the run to associate the asset with.
string run_id = 1 [(google.api.field_behavior) = REQUIRED];
// A list of asset names to automatically associate with the run.
// Any data that is received for these assets will automatically added to the run.
// This applies even if the run has concluded, so long as the new data contains
// timestamps that are between the `start_time` and `stop_time`.
//
// If any of the assets are already associated with a different run whose run
// period (the period between `start_time` and `end_time`) overlaps with the
// requested run period, an error will be returned.
repeated string asset_names = 2 [(google.api.field_behavior) = REQUIRED];
}
message CreateAutomaticRunAssociationForAssetsResponse {
}
message StopRunResponse {
Run run = 1;
}
message IngestProtobufRequest {
string message_type_identifier = 1;
optional string message_type_display_name = 2;
string asset_name = 3;
google.protobuf.Timestamp timestamp = 4;
bytes value = 5;
string run_id = 6;
string namespace = 7;
string organization_id = 8;
// By default, if this request fails to parse for any reason, the request is
// stored in an error queue and the stream continues to accept data. This
// ensures all data is saved, but only valid data is fully ingested. If this
// is set to `true`, any validation errors end the stream and return the error to the client.
bool end_stream_on_validation_error = 9;
}
message SaveProtobufDescriptorRequest {
string message_type_full_name = 1;
string message_type_name = 2;
bytes file_descriptor_set = 3;
string proto_file_name = 4;
string organization_id = 5;
}