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 = "UsageProto"; 22option java_package = "com.google.api"; 23option objc_class_prefix = "GAPI"; 24 25// Configuration controlling usage of a service. 26message Usage { 27 // Requirements that must be satisfied before a consumer project can use the 28 // service. Each requirement is of the form <service.name>/<requirement-id>; 29 // for example 'serviceusage.googleapis.com/billing-enabled'. 30 // 31 // For Google APIs, a Terms of Service requirement must be included here. 32 // Google Cloud APIs must include "serviceusage.googleapis.com/tos/cloud". 33 // Other Google APIs should include 34 // "serviceusage.googleapis.com/tos/universal". Additional ToS can be 35 // included based on the business needs. 36 repeated string requirements = 1; 37 38 // A list of usage rules that apply to individual API methods. 39 // 40 // **NOTE:** All service configuration rules follow "last one wins" order. 41 repeated UsageRule rules = 6; 42 43 // The full resource name of a channel used for sending notifications to the 44 // service producer. 45 // 46 // Google Service Management currently only supports 47 // [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification 48 // channel. To use Google Cloud Pub/Sub as the channel, this must be the name 49 // of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format 50 // documented in https://cloud.google.com/pubsub/docs/overview. 51 string producer_notification_channel = 7; 52} 53 54// Usage configuration rules for the service. 55// 56// NOTE: Under development. 57// 58// 59// Use this rule to configure unregistered calls for the service. Unregistered 60// calls are calls that do not contain consumer project identity. 61// (Example: calls that do not contain an API key). 62// By default, API methods do not allow unregistered calls, and each method call 63// must be identified by a consumer project identity. Use this rule to 64// allow/disallow unregistered calls. 65// 66// Example of an API that wants to allow unregistered calls for entire service. 67// 68// usage: 69// rules: 70// - selector: "*" 71// allow_unregistered_calls: true 72// 73// Example of a method that wants to allow unregistered calls. 74// 75// usage: 76// rules: 77// - selector: "google.example.library.v1.LibraryService.CreateBook" 78// allow_unregistered_calls: true 79message UsageRule { 80 // Selects the methods to which this rule applies. Use '*' to indicate all 81 // methods in all APIs. 82 // 83 // Refer to [selector][google.api.DocumentationRule.selector] for syntax 84 // details. 85 string selector = 1; 86 87 // If true, the selected method allows unregistered calls, e.g. calls 88 // that don't identify any user or application. 89 bool allow_unregistered_calls = 2; 90 91 // If true, the selected method should skip service control and the control 92 // plane features, such as quota and billing, will not be available. 93 // This flag is used by Google Cloud Endpoints to bypass checks for internal 94 // methods, such as service health check methods. 95 bool skip_service_control = 3; 96} 97