xref: /aosp_15_r20/external/googleapis/google/api/billing.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker// Copyright 2023 Google LLC
2*d5c09012SAndroid Build Coastguard Worker//
3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*d5c09012SAndroid Build Coastguard Worker//
7*d5c09012SAndroid Build Coastguard Worker//     http://www.apache.org/licenses/LICENSE-2.0
8*d5c09012SAndroid Build Coastguard Worker//
9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*d5c09012SAndroid Build Coastguard Worker// limitations under the License.
14*d5c09012SAndroid Build Coastguard Worker
15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3";
16*d5c09012SAndroid Build Coastguard Worker
17*d5c09012SAndroid Build Coastguard Workerpackage google.api;
18*d5c09012SAndroid Build Coastguard Worker
19*d5c09012SAndroid Build Coastguard Workeroption go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
20*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true;
21*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "BillingProto";
22*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.api";
23*d5c09012SAndroid Build Coastguard Workeroption objc_class_prefix = "GAPI";
24*d5c09012SAndroid Build Coastguard Worker
25*d5c09012SAndroid Build Coastguard Worker// Billing related configuration of the service.
26*d5c09012SAndroid Build Coastguard Worker//
27*d5c09012SAndroid Build Coastguard Worker// The following example shows how to configure monitored resources and metrics
28*d5c09012SAndroid Build Coastguard Worker// for billing, `consumer_destinations` is the only supported destination and
29*d5c09012SAndroid Build Coastguard Worker// the monitored resources need at least one label key
30*d5c09012SAndroid Build Coastguard Worker// `cloud.googleapis.com/location` to indicate the location of the billing
31*d5c09012SAndroid Build Coastguard Worker// usage, using different monitored resources between monitoring and billing is
32*d5c09012SAndroid Build Coastguard Worker// recommended so they can be evolved independently:
33*d5c09012SAndroid Build Coastguard Worker//
34*d5c09012SAndroid Build Coastguard Worker//
35*d5c09012SAndroid Build Coastguard Worker//     monitored_resources:
36*d5c09012SAndroid Build Coastguard Worker//     - type: library.googleapis.com/billing_branch
37*d5c09012SAndroid Build Coastguard Worker//       labels:
38*d5c09012SAndroid Build Coastguard Worker//       - key: cloud.googleapis.com/location
39*d5c09012SAndroid Build Coastguard Worker//         description: |
40*d5c09012SAndroid Build Coastguard Worker//           Predefined label to support billing location restriction.
41*d5c09012SAndroid Build Coastguard Worker//       - key: city
42*d5c09012SAndroid Build Coastguard Worker//         description: |
43*d5c09012SAndroid Build Coastguard Worker//           Custom label to define the city where the library branch is located
44*d5c09012SAndroid Build Coastguard Worker//           in.
45*d5c09012SAndroid Build Coastguard Worker//       - key: name
46*d5c09012SAndroid Build Coastguard Worker//         description: Custom label to define the name of the library branch.
47*d5c09012SAndroid Build Coastguard Worker//     metrics:
48*d5c09012SAndroid Build Coastguard Worker//     - name: library.googleapis.com/book/borrowed_count
49*d5c09012SAndroid Build Coastguard Worker//       metric_kind: DELTA
50*d5c09012SAndroid Build Coastguard Worker//       value_type: INT64
51*d5c09012SAndroid Build Coastguard Worker//       unit: "1"
52*d5c09012SAndroid Build Coastguard Worker//     billing:
53*d5c09012SAndroid Build Coastguard Worker//       consumer_destinations:
54*d5c09012SAndroid Build Coastguard Worker//       - monitored_resource: library.googleapis.com/billing_branch
55*d5c09012SAndroid Build Coastguard Worker//         metrics:
56*d5c09012SAndroid Build Coastguard Worker//         - library.googleapis.com/book/borrowed_count
57*d5c09012SAndroid Build Coastguard Workermessage Billing {
58*d5c09012SAndroid Build Coastguard Worker  // Configuration of a specific billing destination (Currently only support
59*d5c09012SAndroid Build Coastguard Worker  // bill against consumer project).
60*d5c09012SAndroid Build Coastguard Worker  message BillingDestination {
61*d5c09012SAndroid Build Coastguard Worker    // The monitored resource type. The type must be defined in
62*d5c09012SAndroid Build Coastguard Worker    // [Service.monitored_resources][google.api.Service.monitored_resources]
63*d5c09012SAndroid Build Coastguard Worker    // section.
64*d5c09012SAndroid Build Coastguard Worker    string monitored_resource = 1;
65*d5c09012SAndroid Build Coastguard Worker
66*d5c09012SAndroid Build Coastguard Worker    // Names of the metrics to report to this billing destination.
67*d5c09012SAndroid Build Coastguard Worker    // Each name must be defined in
68*d5c09012SAndroid Build Coastguard Worker    // [Service.metrics][google.api.Service.metrics] section.
69*d5c09012SAndroid Build Coastguard Worker    repeated string metrics = 2;
70*d5c09012SAndroid Build Coastguard Worker  }
71*d5c09012SAndroid Build Coastguard Worker
72*d5c09012SAndroid Build Coastguard Worker  // Billing configurations for sending metrics to the consumer project.
73*d5c09012SAndroid Build Coastguard Worker  // There can be multiple consumer destinations per service, each one must have
74*d5c09012SAndroid Build Coastguard Worker  // a different monitored resource type. A metric can be used in at most
75*d5c09012SAndroid Build Coastguard Worker  // one consumer destination.
76*d5c09012SAndroid Build Coastguard Worker  repeated BillingDestination consumer_destinations = 8;
77*d5c09012SAndroid Build Coastguard Worker}
78