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