1// Copyright 2019 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//
15
16syntax = "proto3";
17
18package google.api;
19
20import "google/api/metric.proto";
21
22option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
23option java_multiple_files = true;
24option java_outer_classname = "BillingProto";
25option java_package = "com.google.api";
26option objc_class_prefix = "GAPI";
27
28// Billing related configuration of the service.
29//
30// The following example shows how to configure monitored resources and metrics
31// for billing:
32//
33//     monitored_resources:
34//     - type: library.googleapis.com/branch
35//       labels:
36//       - key: /city
37//         description: The city where the library branch is located in.
38//       - key: /name
39//         description: The name of the branch.
40//     metrics:
41//     - name: library.googleapis.com/book/borrowed_count
42//       metric_kind: DELTA
43//       value_type: INT64
44//     billing:
45//       consumer_destinations:
46//       - monitored_resource: library.googleapis.com/branch
47//         metrics:
48//         - library.googleapis.com/book/borrowed_count
49message Billing {
50  // Configuration of a specific billing destination (Currently only support
51  // bill against consumer project).
52  message BillingDestination {
53    // The monitored resource type. The type must be defined in
54    // [Service.monitored_resources][google.api.Service.monitored_resources] section.
55    string monitored_resource = 1;
56
57    // Names of the metrics to report to this billing destination.
58    // Each name must be defined in [Service.metrics][google.api.Service.metrics] section.
59    repeated string metrics = 2;
60  }
61
62  // Billing configurations for sending metrics to the consumer project.
63  // There can be multiple consumer destinations per service, each one must have
64  // a different monitored resource type. A metric can be used in at most
65  // one consumer destination.
66  repeated BillingDestination consumer_destinations = 8;
67}
68