billing.proto 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // Copyright 2016 Google Inc.
  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.api;
  16. import "google/api/annotations.proto";
  17. import "google/api/metric.proto";
  18. option java_multiple_files = true;
  19. option java_outer_classname = "BillingProto";
  20. option java_package = "com.google.api";
  21. // Billing related configuration of the service.
  22. //
  23. // The following example shows how to configure metrics for billing:
  24. //
  25. // metrics:
  26. // - name: library.googleapis.com/read_calls
  27. // metric_kind: DELTA
  28. // value_type: INT64
  29. // - name: library.googleapis.com/write_calls
  30. // metric_kind: DELTA
  31. // value_type: INT64
  32. // billing:
  33. // metrics:
  34. // - library.googleapis.com/read_calls
  35. // - library.googleapis.com/write_calls
  36. //
  37. // The next example shows how to enable billing status check and customize the
  38. // check behavior. It makes sure billing status check is included in the `Check`
  39. // method of [Service Control API](https://cloud.google.com/service-control/).
  40. // In the example, "google.storage.Get" method can be served when the billing
  41. // status is either `current` or `delinquent`, while "google.storage.Write"
  42. // method can only be served when the billing status is `current`:
  43. //
  44. // billing:
  45. // rules:
  46. // - selector: google.storage.Get
  47. // allowed_statuses:
  48. // - current
  49. // - delinquent
  50. // - selector: google.storage.Write
  51. // allowed_statuses: current
  52. //
  53. // Mostly services should only allow `current` status when serving requests.
  54. // In addition, services can choose to allow both `current` and `delinquent`
  55. // statuses when serving read-only requests to resources. If there's no
  56. // matching selector for operation, no billing status check will be performed.
  57. //
  58. message Billing {
  59. // Names of the metrics to report to billing. Each name must
  60. // be defined in [Service.metrics][google.api.Service.metrics] section.
  61. repeated string metrics = 1;
  62. // A list of billing status rules for configuring billing status check.
  63. repeated BillingStatusRule rules = 5;
  64. }
  65. // Defines the billing status requirements for operations.
  66. //
  67. // When used with
  68. // [Service Control API](https://cloud.google.com/service-control/), the
  69. // following statuses are supported:
  70. //
  71. // - **current**: the associated billing account is up to date and capable of
  72. // paying for resource usages.
  73. // - **delinquent**: the associated billing account has a correctable problem,
  74. // such as late payment.
  75. //
  76. // Mostly services should only allow `current` status when serving requests.
  77. // In addition, services can choose to allow both `current` and `delinquent`
  78. // statuses when serving read-only requests to resources. If the list of
  79. // allowed_statuses is empty, it means no billing requirement.
  80. //
  81. message BillingStatusRule {
  82. // Selects the operation names to which this rule applies.
  83. // Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
  84. string selector = 1;
  85. // Allowed billing statuses. The billing status check passes if the actual
  86. // billing status matches any of the provided values here.
  87. repeated string allowed_statuses = 2;
  88. }