usage.proto 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // Copyright 2016 Google Inc.
  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. syntax = "proto3";
  15. package google.api;
  16. import "google/api/annotations.proto";
  17. option java_multiple_files = true;
  18. option java_outer_classname = "UsageProto";
  19. option java_package = "com.google.api";
  20. option objc_class_prefix = "GAPI";
  21. // Configuration controlling usage of a service.
  22. message Usage {
  23. // Requirements that must be satisfied before a consumer project can use the
  24. // service. Each requirement is of the form <service.name>/<requirement-id>;
  25. // for example 'serviceusage.googleapis.com/billing-enabled'.
  26. repeated string requirements = 1;
  27. // A list of usage rules that apply to individual API methods.
  28. //
  29. // **NOTE:** All service configuration rules follow "last one wins" order.
  30. repeated UsageRule rules = 6;
  31. }
  32. // Usage configuration rules for the service.
  33. //
  34. // NOTE: Under development.
  35. //
  36. //
  37. // Use this rule to configure unregistered calls for the service. Unregistered
  38. // calls are calls that do not contain consumer project identity.
  39. // (Example: calls that do not contain an API key).
  40. // By default, API methods do not allow unregistered calls, and each method call
  41. // must be identified by a consumer project identity. Use this rule to
  42. // allow/disallow unregistered calls.
  43. //
  44. // Example of an API that wants to allow unregistered calls for entire service.
  45. //
  46. // usage:
  47. // rules:
  48. // - selector: "*"
  49. // allow_unregistered_calls: true
  50. //
  51. // Example of a method that wants to allow unregistered calls.
  52. //
  53. // usage:
  54. // rules:
  55. // - selector: "google.example.library.v1.LibraryService.CreateBook"
  56. // allow_unregistered_calls: true
  57. message UsageRule {
  58. // Selects the methods to which this rule applies. Use '*' to indicate all
  59. // methods in all APIs.
  60. //
  61. // Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
  62. string selector = 1;
  63. // True, if the method allows unregistered calls; false otherwise.
  64. bool allow_unregistered_calls = 2;
  65. }