2022-08-24 09:52:40 +02:00

69 lines
1.9 KiB
Protocol Buffer

syntax = "proto3";
package usage.v1;
option go_package = "github.com/gitpod-io/gitpod/usage-api/v1";
import "google/protobuf/timestamp.proto";
service UsageService {
// ListBilledUsage retrieves all usage for the specified attributionId
rpc ListBilledUsage(ListBilledUsageRequest) returns (ListBilledUsageResponse) {}
// ReconcileUsage collects usage for the specified time period, and stores the usage records in the database, returning the records.
rpc ReconcileUsage(ReconcileUsageRequest) returns (ReconcileUsageResponse) {}
}
message ListBilledUsageRequest {
string attribution_id = 1;
// from specifies the starting time range for this request.
// All instances which existed starting at from will be returned.
google.protobuf.Timestamp from = 2;
// to specifies the end time range for this request.
// All instances which existed ending at to will be returned.
google.protobuf.Timestamp to = 3;
enum Ordering {
ORDERING_DESCENDING = 0;
ORDERING_ASCENDING = 1;
}
Ordering order = 4;
}
message ListBilledUsageResponse {
repeated BilledSession sessions = 1;
}
message BilledSession {
string attribution_id = 1;
string user_id = 2;
string team_id = 3;
string workspace_id = 4;
string workspace_type = 5;
string project_id = 6;
string instance_id = 7;
string workspace_class = 8;
google.protobuf.Timestamp start_time = 9;
google.protobuf.Timestamp end_time = 10;
int64 credits_deprecated = 11 [deprecated=true]; // insufficient precision to represent credits for workspace time
double credits = 12;
}
message ReconcileUsageRequest {
google.protobuf.Timestamp start_time = 1;
google.protobuf.Timestamp end_time = 2;
}
message ReconcileUsageResponse {
repeated BilledSession sessions = 1;
// ID of the UsageReport generated for this reconcile run.
string report_id = 2;
}