visibility.proto 3.7 KB

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