diff --git a/google/api/billing.proto b/google/api/billing.proto index 6ecffd54..efba179f 100644 --- a/google/api/billing.proto +++ b/google/api/billing.proto @@ -1,4 +1,4 @@ -// Copyright 2016 Google Inc. +// Copyright 2017 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -23,76 +23,45 @@ option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;ser option java_multiple_files = true; option java_outer_classname = "BillingProto"; option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; // Billing related configuration of the service. // -// The following example shows how to configure metrics for billing: -// +// The following example shows how to configure monitored resources and metrics +// for billing: +// monitored_resources: +// - type: library.googleapis.com/branch +// labels: +// - key: /city +// description: The city where the library branch is located in. +// - key: /name +// description: The name of the branch. // metrics: -// - name: library.googleapis.com/read_calls -// metric_kind: DELTA -// value_type: INT64 -// - name: library.googleapis.com/write_calls +// - name: library.googleapis.com/book/borrowed_count // metric_kind: DELTA // value_type: INT64 // billing: -// metrics: -// - library.googleapis.com/read_calls -// - library.googleapis.com/write_calls -// -// The next example shows how to enable billing status check and customize the -// check behavior. It makes sure billing status check is included in the `Check` -// method of [Service Control API](https://cloud.google.com/service-control/). -// In the example, "google.storage.Get" method can be served when the billing -// status is either `current` or `delinquent`, while "google.storage.Write" -// method can only be served when the billing status is `current`: -// -// billing: -// rules: -// - selector: google.storage.Get -// allowed_statuses: -// - current -// - delinquent -// - selector: google.storage.Write -// allowed_statuses: current -// -// Mostly services should only allow `current` status when serving requests. -// In addition, services can choose to allow both `current` and `delinquent` -// statuses when serving read-only requests to resources. If there's no -// matching selector for operation, no billing status check will be performed. -// +// consumer_destinations: +// - monitored_resource: library.googleapis.com/branch +// metrics: +// - library.googleapis.com/book/borrowed_count message Billing { - // Names of the metrics to report to billing. Each name must - // be defined in [Service.metrics][google.api.Service.metrics] section. - repeated string metrics = 1; + // Configuration of a specific billing destination (Currently only support + // bill against consumer project). + message BillingDestination { + // The monitored resource type. The type must be defined in + // [Service.monitored_resources][google.api.Service.monitored_resources] section. + string monitored_resource = 1; - // A list of billing status rules for configuring billing status check. - repeated BillingStatusRule rules = 5; -} - -// Defines the billing status requirements for operations. -// -// When used with -// [Service Control API](https://cloud.google.com/service-control/), the -// following statuses are supported: -// -// - **current**: the associated billing account is up to date and capable of -// paying for resource usages. -// - **delinquent**: the associated billing account has a correctable problem, -// such as late payment. -// -// Mostly services should only allow `current` status when serving requests. -// In addition, services can choose to allow both `current` and `delinquent` -// statuses when serving read-only requests to resources. If the list of -// allowed_statuses is empty, it means no billing requirement. -// -message BillingStatusRule { - // Selects the operation names to which this rule applies. - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // Allowed billing statuses. The billing status check passes if the actual - // billing status matches any of the provided values here. - repeated string allowed_statuses = 2; + // Names of the metrics to report to this billing destination. + // Each name must be defined in [Service.metrics][google.api.Service.metrics] section. + repeated string metrics = 2; + } + + // Billing configurations for sending metrics to the consumer project. + // There can be multiple consumer destinations per service, each one must have + // a different monitored resource type. A metric can be used in at most + // one consumer destination. + repeated BillingDestination consumer_destinations = 8; } diff --git a/google/api/service.proto b/google/api/service.proto index 04c7fd70..87fba7ba 100644 --- a/google/api/service.proto +++ b/google/api/service.proto @@ -19,6 +19,7 @@ package google.api; import "google/api/annotations.proto"; import "google/api/auth.proto"; import "google/api/backend.proto"; +import "google/api/billing.proto"; import "google/api/context.proto"; import "google/api/control.proto"; import "google/api/documentation.proto"; @@ -71,10 +72,10 @@ option objc_class_prefix = "GAPI"; // requirements: // provider_id: google_calendar_auth message Service { - // The version of the service configuration. The config version may - // influence interpretation of the configuration, for example, to - // determine defaults. This is documented together with applicable - // options. The current default for the config version itself is `3`. + // The semantic version of the service configuration. The config version + // affects the interpretation of the service configuration. For example, + // certain features are enabled by default for certain config versions. + // The latest config version is `3`. google.protobuf.UInt32Value config_version = 20; // The DNS address at which this service is available, @@ -86,12 +87,10 @@ message Service { // generate one instead. string id = 33; - // The product title associated with this service. + // The product title for this service. string title = 2; - // The id of the Google developer project that owns the service. - // Members of this project can manage the service configuration, - // manage consumption of the service, etc. + // The Google project that owns this service. string producer_project_id = 22; // A list of API interfaces exported by this service. Only the `name` field @@ -159,6 +158,9 @@ message Service { // by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations. repeated MonitoredResourceDescriptor monitored_resources = 25; + // Billing configuration. + Billing billing = 26; + // Logging configuration. Logging logging = 27;