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