xref: /aosp_15_r20/external/googleapis/google/api/billing.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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.api;
18
19option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
20option java_multiple_files = true;
21option java_outer_classname = "BillingProto";
22option java_package = "com.google.api";
23option objc_class_prefix = "GAPI";
24
25// Billing related configuration of the service.
26//
27// The following example shows how to configure monitored resources and metrics
28// for billing, `consumer_destinations` is the only supported destination and
29// the monitored resources need at least one label key
30// `cloud.googleapis.com/location` to indicate the location of the billing
31// usage, using different monitored resources between monitoring and billing is
32// recommended so they can be evolved independently:
33//
34//
35//     monitored_resources:
36//     - type: library.googleapis.com/billing_branch
37//       labels:
38//       - key: cloud.googleapis.com/location
39//         description: |
40//           Predefined label to support billing location restriction.
41//       - key: city
42//         description: |
43//           Custom label to define the city where the library branch is located
44//           in.
45//       - key: name
46//         description: Custom label to define the name of the library branch.
47//     metrics:
48//     - name: library.googleapis.com/book/borrowed_count
49//       metric_kind: DELTA
50//       value_type: INT64
51//       unit: "1"
52//     billing:
53//       consumer_destinations:
54//       - monitored_resource: library.googleapis.com/billing_branch
55//         metrics:
56//         - library.googleapis.com/book/borrowed_count
57message Billing {
58  // Configuration of a specific billing destination (Currently only support
59  // bill against consumer project).
60  message BillingDestination {
61    // The monitored resource type. The type must be defined in
62    // [Service.monitored_resources][google.api.Service.monitored_resources]
63    // section.
64    string monitored_resource = 1;
65
66    // Names of the metrics to report to this billing destination.
67    // Each name must be defined in
68    // [Service.metrics][google.api.Service.metrics] section.
69    repeated string metrics = 2;
70  }
71
72  // Billing configurations for sending metrics to the consumer project.
73  // There can be multiple consumer destinations per service, each one must have
74  // a different monitored resource type. A metric can be used in at most
75  // one consumer destination.
76  repeated BillingDestination consumer_destinations = 8;
77}
78