cloud_catalog.proto 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.billing.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/protobuf/timestamp.proto";
  21. import "google/type/money.proto";
  22. option csharp_namespace = "Google.Cloud.Billing.V1";
  23. option go_package = "google.golang.org/genproto/googleapis/cloud/billing/v1;billing";
  24. option java_multiple_files = true;
  25. option java_outer_classname = "CloudCatalogProto";
  26. option java_package = "com.google.cloud.billing.v1";
  27. option objc_class_prefix = "CLDCTLG";
  28. // A catalog of Google Cloud Platform services and SKUs.
  29. // Provides pricing information and metadata on Google Cloud Platform services
  30. // and SKUs.
  31. service CloudCatalog {
  32. option (google.api.default_host) = "cloudbilling.googleapis.com";
  33. option (google.api.oauth_scopes) =
  34. "https://www.googleapis.com/auth/cloud-billing,"
  35. "https://www.googleapis.com/auth/cloud-billing.readonly,"
  36. "https://www.googleapis.com/auth/cloud-platform";
  37. // Lists all public cloud services.
  38. rpc ListServices(ListServicesRequest) returns (ListServicesResponse) {
  39. option (google.api.http) = {
  40. get: "/v1/services"
  41. };
  42. option (google.api.method_signature) = "";
  43. }
  44. // Lists all publicly available SKUs for a given cloud service.
  45. rpc ListSkus(ListSkusRequest) returns (ListSkusResponse) {
  46. option (google.api.http) = {
  47. get: "/v1/{parent=services/*}/skus"
  48. };
  49. option (google.api.method_signature) = "parent";
  50. }
  51. }
  52. // Encapsulates a single service in Google Cloud Platform.
  53. message Service {
  54. option (google.api.resource) = {
  55. type: "cloudbilling.googleapis.com/Service"
  56. pattern: "services/{service}"
  57. };
  58. // The resource name for the service.
  59. // Example: "services/DA34-426B-A397"
  60. string name = 1;
  61. // The identifier for the service.
  62. // Example: "DA34-426B-A397"
  63. string service_id = 2;
  64. // A human readable display name for this service.
  65. string display_name = 3;
  66. // The business under which the service is offered.
  67. // Ex. "businessEntities/GCP", "businessEntities/Maps"
  68. string business_entity_name = 4;
  69. }
  70. // Encapsulates a single SKU in Google Cloud Platform
  71. message Sku {
  72. option (google.api.resource) = {
  73. type: "cloudbilling.googleapis.com/Sku"
  74. pattern: "services/{service}/skus/{sku}"
  75. };
  76. // The resource name for the SKU.
  77. // Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE"
  78. string name = 1;
  79. // The identifier for the SKU.
  80. // Example: "AA95-CD31-42FE"
  81. string sku_id = 2;
  82. // A human readable description of the SKU, has a maximum length of 256
  83. // characters.
  84. string description = 3;
  85. // The category hierarchy of this SKU, purely for organizational purpose.
  86. Category category = 4;
  87. // List of service regions this SKU is offered at.
  88. // Example: "asia-east1"
  89. // Service regions can be found at https://cloud.google.com/about/locations/
  90. repeated string service_regions = 5;
  91. // A timeline of pricing info for this SKU in chronological order.
  92. repeated PricingInfo pricing_info = 6;
  93. // Identifies the service provider.
  94. // This is 'Google' for first party services in Google Cloud Platform.
  95. string service_provider_name = 7;
  96. // The geographic taxonomy for this sku.
  97. GeoTaxonomy geo_taxonomy = 8;
  98. }
  99. // Represents the category hierarchy of a SKU.
  100. message Category {
  101. // The display name of the service this SKU belongs to.
  102. string service_display_name = 1;
  103. // The type of product the SKU refers to.
  104. // Example: "Compute", "Storage", "Network", "ApplicationServices" etc.
  105. string resource_family = 2;
  106. // A group classification for related SKUs.
  107. // Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc.
  108. string resource_group = 3;
  109. // Represents how the SKU is consumed.
  110. // Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc.
  111. string usage_type = 4;
  112. }
  113. // Represents the pricing information for a SKU at a single point of time.
  114. message PricingInfo {
  115. // The timestamp from which this pricing was effective within the requested
  116. // time range. This is guaranteed to be greater than or equal to the
  117. // start_time field in the request and less than the end_time field in the
  118. // request. If a time range was not specified in the request this field will
  119. // be equivalent to a time within the last 12 hours, indicating the latest
  120. // pricing info.
  121. google.protobuf.Timestamp effective_time = 1;
  122. // An optional human readable summary of the pricing information, has a
  123. // maximum length of 256 characters.
  124. string summary = 2;
  125. // Expresses the pricing formula. See `PricingExpression` for an example.
  126. PricingExpression pricing_expression = 3;
  127. // Aggregation Info. This can be left unspecified if the pricing expression
  128. // doesn't require aggregation.
  129. AggregationInfo aggregation_info = 4;
  130. // Conversion rate used for currency conversion, from USD to the currency
  131. // specified in the request. This includes any surcharge collected for billing
  132. // in non USD currency. If a currency is not specified in the request this
  133. // defaults to 1.0.
  134. // Example: USD * currency_conversion_rate = JPY
  135. double currency_conversion_rate = 5;
  136. }
  137. // Expresses a mathematical pricing formula. For Example:-
  138. //
  139. // `usage_unit: GBy`
  140. // `tiered_rates:`
  141. // `[start_usage_amount: 20, unit_price: $10]`
  142. // `[start_usage_amount: 100, unit_price: $5]`
  143. //
  144. // The above expresses a pricing formula where the first 20GB is free, the
  145. // next 80GB is priced at $10 per GB followed by $5 per GB for additional
  146. // usage.
  147. message PricingExpression {
  148. // The price rate indicating starting usage and its corresponding price.
  149. message TierRate {
  150. // Usage is priced at this rate only after this amount.
  151. // Example: start_usage_amount of 10 indicates that the usage will be priced
  152. // at the unit_price after the first 10 usage_units.
  153. double start_usage_amount = 1;
  154. // The price per unit of usage.
  155. // Example: unit_price of amount $10 indicates that each unit will cost $10.
  156. google.type.Money unit_price = 2;
  157. }
  158. // The short hand for unit of usage this pricing is specified in.
  159. // Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte".
  160. string usage_unit = 1;
  161. // The recommended quantity of units for displaying pricing info. When
  162. // displaying pricing info it is recommended to display:
  163. // (unit_price * display_quantity) per display_quantity usage_unit.
  164. // This field does not affect the pricing formula and is for display purposes
  165. // only.
  166. // Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and
  167. // the display_quantity is "1000" then the recommended way of displaying the
  168. // pricing info is "0.10 USD per 1000 GB"
  169. double display_quantity = 2;
  170. // The list of tiered rates for this pricing. The total cost is computed by
  171. // applying each of the tiered rates on usage. This repeated list is sorted
  172. // by ascending order of start_usage_amount.
  173. repeated TierRate tiered_rates = 3;
  174. // The unit of usage in human readable form.
  175. // Example: "gibi byte".
  176. string usage_unit_description = 4;
  177. // The base unit for the SKU which is the unit used in usage exports.
  178. // Example: "By"
  179. string base_unit = 5;
  180. // The base unit in human readable form.
  181. // Example: "byte".
  182. string base_unit_description = 6;
  183. // Conversion factor for converting from price per usage_unit to price per
  184. // base_unit, and start_usage_amount to start_usage_amount in base_unit.
  185. // unit_price / base_unit_conversion_factor = price per base_unit.
  186. // start_usage_amount * base_unit_conversion_factor = start_usage_amount in
  187. // base_unit.
  188. double base_unit_conversion_factor = 7;
  189. }
  190. // Represents the aggregation level and interval for pricing of a single SKU.
  191. message AggregationInfo {
  192. // The level at which usage is aggregated to compute cost.
  193. // Example: "ACCOUNT" aggregation level indicates that usage for tiered
  194. // pricing is aggregated across all projects in a single account.
  195. enum AggregationLevel {
  196. AGGREGATION_LEVEL_UNSPECIFIED = 0;
  197. ACCOUNT = 1;
  198. PROJECT = 2;
  199. }
  200. // The interval at which usage is aggregated to compute cost.
  201. // Example: "MONTHLY" aggregation interval indicates that usage for tiered
  202. // pricing is aggregated every month.
  203. enum AggregationInterval {
  204. AGGREGATION_INTERVAL_UNSPECIFIED = 0;
  205. DAILY = 1;
  206. MONTHLY = 2;
  207. }
  208. AggregationLevel aggregation_level = 1;
  209. AggregationInterval aggregation_interval = 2;
  210. // The number of intervals to aggregate over.
  211. // Example: If aggregation_level is "DAILY" and aggregation_count is 14,
  212. // aggregation will be over 14 days.
  213. int32 aggregation_count = 3;
  214. }
  215. // Encapsulates the geographic taxonomy data for a sku.
  216. message GeoTaxonomy {
  217. // The type of Geo Taxonomy: GLOBAL, REGIONAL, or MULTI_REGIONAL.
  218. enum Type {
  219. // The type is not specified.
  220. TYPE_UNSPECIFIED = 0;
  221. // The sku is global in nature, e.g. a license sku. Global skus are
  222. // available in all regions, and so have an empty region list.
  223. GLOBAL = 1;
  224. // The sku is available in a specific region, e.g. "us-west2".
  225. REGIONAL = 2;
  226. // The sku is associated with multiple regions, e.g. "us-west2" and
  227. // "us-east1".
  228. MULTI_REGIONAL = 3;
  229. }
  230. // The type of Geo Taxonomy: GLOBAL, REGIONAL, or MULTI_REGIONAL.
  231. Type type = 1;
  232. // The list of regions associated with a sku. Empty for Global skus, which are
  233. // associated with all Google Cloud regions.
  234. repeated string regions = 2;
  235. }
  236. // Request message for `ListServices`.
  237. message ListServicesRequest {
  238. // Requested page size. Defaults to 5000.
  239. int32 page_size = 1;
  240. // A token identifying a page of results to return. This should be a
  241. // `next_page_token` value returned from a previous `ListServices`
  242. // call. If unspecified, the first page of results is returned.
  243. string page_token = 2;
  244. }
  245. // Response message for `ListServices`.
  246. message ListServicesResponse {
  247. // A list of services.
  248. repeated Service services = 1;
  249. // A token to retrieve the next page of results. To retrieve the next page,
  250. // call `ListServices` again with the `page_token` field set to this
  251. // value. This field is empty if there are no more results to retrieve.
  252. string next_page_token = 2;
  253. }
  254. // Request message for `ListSkus`.
  255. message ListSkusRequest {
  256. // Required. The name of the service.
  257. // Example: "services/DA34-426B-A397"
  258. string parent = 1 [
  259. (google.api.field_behavior) = REQUIRED,
  260. (google.api.resource_reference) = {
  261. type: "cloudbilling.googleapis.com/Service"
  262. }
  263. ];
  264. // Optional inclusive start time of the time range for which the pricing
  265. // versions will be returned. Timestamps in the future are not allowed.
  266. // The time range has to be within a single calendar month in
  267. // America/Los_Angeles timezone. Time range as a whole is optional. If not
  268. // specified, the latest pricing will be returned (up to 12 hours old at
  269. // most).
  270. google.protobuf.Timestamp start_time = 2;
  271. // Optional exclusive end time of the time range for which the pricing
  272. // versions will be returned. Timestamps in the future are not allowed.
  273. // The time range has to be within a single calendar month in
  274. // America/Los_Angeles timezone. Time range as a whole is optional. If not
  275. // specified, the latest pricing will be returned (up to 12 hours old at
  276. // most).
  277. google.protobuf.Timestamp end_time = 3;
  278. // The ISO 4217 currency code for the pricing info in the response proto.
  279. // Will use the conversion rate as of start_time.
  280. // Optional. If not specified USD will be used.
  281. string currency_code = 4;
  282. // Requested page size. Defaults to 5000.
  283. int32 page_size = 5;
  284. // A token identifying a page of results to return. This should be a
  285. // `next_page_token` value returned from a previous `ListSkus`
  286. // call. If unspecified, the first page of results is returned.
  287. string page_token = 6;
  288. }
  289. // Response message for `ListSkus`.
  290. message ListSkusResponse {
  291. // The list of public SKUs of the given service.
  292. repeated Sku skus = 1;
  293. // A token to retrieve the next page of results. To retrieve the next page,
  294. // call `ListSkus` again with the `page_token` field set to this
  295. // value. This field is empty if there are no more results to retrieve.
  296. string next_page_token = 2;
  297. }