visibility.proto 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // Copyright 2024 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. syntax = "proto3";
  15. package google.api;
  16. import "google/protobuf/descriptor.proto";
  17. option cc_enable_arenas = true;
  18. option go_package = "google.golang.org/genproto/googleapis/api/visibility;visibility";
  19. option java_multiple_files = true;
  20. option java_outer_classname = "VisibilityProto";
  21. option java_package = "com.google.api";
  22. option objc_class_prefix = "GAPI";
  23. extend google.protobuf.EnumOptions {
  24. // See `VisibilityRule`.
  25. google.api.VisibilityRule enum_visibility = 72295727;
  26. }
  27. extend google.protobuf.EnumValueOptions {
  28. // See `VisibilityRule`.
  29. google.api.VisibilityRule value_visibility = 72295727;
  30. }
  31. extend google.protobuf.FieldOptions {
  32. // See `VisibilityRule`.
  33. google.api.VisibilityRule field_visibility = 72295727;
  34. }
  35. extend google.protobuf.MessageOptions {
  36. // See `VisibilityRule`.
  37. google.api.VisibilityRule message_visibility = 72295727;
  38. }
  39. extend google.protobuf.MethodOptions {
  40. // See `VisibilityRule`.
  41. google.api.VisibilityRule method_visibility = 72295727;
  42. }
  43. extend google.protobuf.ServiceOptions {
  44. // See `VisibilityRule`.
  45. google.api.VisibilityRule api_visibility = 72295727;
  46. }
  47. // `Visibility` restricts service consumer's access to service elements,
  48. // such as whether an application can call a visibility-restricted method.
  49. // The restriction is expressed by applying visibility labels on service
  50. // elements. The visibility labels are elsewhere linked to service consumers.
  51. //
  52. // A service can define multiple visibility labels, but a service consumer
  53. // should be granted at most one visibility label. Multiple visibility
  54. // labels for a single service consumer are not supported.
  55. //
  56. // If an element and all its parents have no visibility label, its visibility
  57. // is unconditionally granted.
  58. //
  59. // Example:
  60. //
  61. // visibility:
  62. // rules:
  63. // - selector: google.calendar.Calendar.EnhancedSearch
  64. // restriction: PREVIEW
  65. // - selector: google.calendar.Calendar.Delegate
  66. // restriction: INTERNAL
  67. //
  68. // Here, all methods are publicly visible except for the restricted methods
  69. // EnhancedSearch and Delegate.
  70. message Visibility {
  71. // A list of visibility rules that apply to individual API elements.
  72. //
  73. // **NOTE:** All service configuration rules follow "last one wins" order.
  74. repeated VisibilityRule rules = 1;
  75. }
  76. // A visibility rule provides visibility configuration for an individual API
  77. // element.
  78. message VisibilityRule {
  79. // Selects methods, messages, fields, enums, etc. to which this rule applies.
  80. //
  81. // Refer to [selector][google.api.DocumentationRule.selector] for syntax
  82. // details.
  83. string selector = 1;
  84. // A comma-separated list of visibility labels that apply to the `selector`.
  85. // Any of the listed labels can be used to grant the visibility.
  86. //
  87. // If a rule has multiple labels, removing one of the labels but not all of
  88. // them can break clients.
  89. //
  90. // Example:
  91. //
  92. // visibility:
  93. // rules:
  94. // - selector: google.calendar.Calendar.EnhancedSearch
  95. // restriction: INTERNAL, PREVIEW
  96. //
  97. // Removing INTERNAL from this restriction will break clients that rely on
  98. // this method and only had access to it through INTERNAL.
  99. string restriction = 2;
  100. }