messages.proto 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. syntax = "proto3";
  2. package customcost.messages;
  3. import "google/protobuf/timestamp.proto";
  4. import "google/protobuf/duration.proto";
  5. // Sets the golang package for the protobuf generated code
  6. option go_package = "github.com/opencost/opencost/core/pkg/model/pb";
  7. // see design at https://link.excalidraw.com/l/ABLQ24dkKai/CBEQtjH6Mr
  8. // for additional details on how these objects work in the context of
  9. // opencost's plugin system
  10. message CustomCostRequest {
  11. // the window of the returned objects
  12. google.protobuf.Timestamp start = 1;
  13. google.protobuf.Timestamp end = 2;
  14. // resolution of steps to return
  15. google.protobuf.Duration resolution = 3;
  16. }
  17. message CustomCostResponseSet {
  18. repeated CustomCostResponse resps = 1;
  19. }
  20. message CustomCostResponse {
  21. // provides metadata on the Custom CostResponse
  22. // deliberately left unstructured
  23. map<string, string> metadata = 1;
  24. // declared by plugin
  25. // eg snowflake == "data management",
  26. // datadog == "observability" etc
  27. // intended for top level agg
  28. string cost_source = 2;
  29. // the name of the custom cost source
  30. // e.g., "datadog"
  31. string domain = 3;
  32. // the version of the Custom Cost response
  33. // is set by the plugin, will vary between
  34. // different plugins
  35. string version = 4;
  36. // FOCUS billing currency
  37. string currency = 5;
  38. // the window of the returned objects
  39. google.protobuf.Timestamp start = 6;
  40. google.protobuf.Timestamp end = 7;
  41. // array of CustomCosts
  42. repeated CustomCost costs = 8;
  43. // any errors in processing
  44. repeated string errors = 9;
  45. }
  46. message CustomCost {
  47. // provides metadata on the Custom CostResponse
  48. // deliberately left unstructured
  49. map<string, string> metadata = 1;
  50. // the region that the resource was incurred
  51. // corresponds to 'availability zone' of FOCUS
  52. string zone = 2;
  53. // FOCUS billing account name
  54. string account_name = 3;
  55. // FOCUS charge category
  56. string charge_category = 4;
  57. // FOCUS charge description
  58. string description = 5;
  59. // FOCUS Resource Name
  60. string resource_name = 6;
  61. // FOCUS Resource type
  62. // if not set, assumed to be domain
  63. string resource_type = 7;
  64. // ID of the individual cost. should be globally
  65. // unique. Assigned by plugin on read
  66. string id = 8;
  67. // the provider's ID for the cost, if
  68. // available
  69. // FOCUS resource ID
  70. string provider_id = 9;
  71. // FOCUS billed Cost
  72. float billed_cost = 10;
  73. // FOCUS List Cost
  74. float list_cost = 11;
  75. // FOCUS List Unit Price
  76. float list_unit_price = 12;
  77. // FOCUS usage quantity
  78. float usage_quantity = 13;
  79. // FOCUS usage Unit
  80. string usage_unit = 14;
  81. // Returns key/value sets of labels
  82. // equivalent to Tags in focus spec
  83. map<string, string> labels = 15;
  84. // Optional struct to implement other focus
  85. // spec attributes
  86. optional CustomCostExtendedAttributes extended_attributes = 16;
  87. }
  88. message CustomCostExtendedAttributes {
  89. // FOCUS billing period start
  90. optional google.protobuf.Timestamp billing_period_start = 1;
  91. // FOCUS billing period end
  92. optional google.protobuf.Timestamp billing_period_end = 2;
  93. // FOCUS Billing Account ID
  94. optional string account_id = 3;
  95. // FOCUS Charge Frequency
  96. optional string charge_frequency = 4;
  97. // FOCUS Charge Subcategory
  98. optional string subcategory = 5;
  99. // FOCUS Commitment Discount Category
  100. optional string commitment_discount_category = 6;
  101. // FOCUS Commitment Discount ID
  102. optional string commitment_discount_id = 7;
  103. // FOCUS Commitment Discount Name
  104. optional string commitment_discount_name = 8;
  105. // FOCUS Commitment Discount Type
  106. optional string commitment_discount_type = 9;
  107. // FOCUS Effective Cost
  108. optional float effective_cost = 10;
  109. // FOCUS Invoice Issuer
  110. optional string invoice_issuer = 11;
  111. // FOCUS Provider
  112. // if unset, assumed to be domain
  113. optional string provider = 12;
  114. // FOCUS Publisher
  115. // if unset, assumed to be domain
  116. optional string publisher = 13;
  117. // FOCUS Service Category
  118. // if unset, assumed to be cost source
  119. optional string service_category = 14;
  120. // FOCUS Service Name
  121. // if unset, assumed to be cost source
  122. optional string service_name = 15;
  123. // FOCUS SKU ID
  124. optional string sku_id = 16;
  125. // FOCUS SKU Price ID
  126. optional string sku_price_id = 17;
  127. // FOCUS Sub Account ID
  128. optional string sub_account_id = 18;
  129. // FOCUS Sub Account Name
  130. optional string sub_account_name = 19;
  131. // FOCUS Pricing Quantity
  132. optional float pricing_quantity = 20;
  133. // FOCUS Pricing Unit
  134. optional string pricing_unit = 21;
  135. // FOCUS Pricing Category
  136. optional string pricing_category = 22;
  137. }
  138. service CustomCostsSource {
  139. rpc GetCustomCosts(CustomCostRequest) returns (CustomCostResponseSet);
  140. }