1*d5c09012SAndroid Build Coastguard Worker// Copyright 2023 Google LLC 2*d5c09012SAndroid Build Coastguard Worker// 3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License"); 4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License. 5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at 6*d5c09012SAndroid Build Coastguard Worker// 7*d5c09012SAndroid Build Coastguard Worker// http://www.apache.org/licenses/LICENSE-2.0 8*d5c09012SAndroid Build Coastguard Worker// 9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software 10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS, 11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and 13*d5c09012SAndroid Build Coastguard Worker// limitations under the License. 14*d5c09012SAndroid Build Coastguard Worker 15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3"; 16*d5c09012SAndroid Build Coastguard Worker 17*d5c09012SAndroid Build Coastguard Workerpackage google.api; 18*d5c09012SAndroid Build Coastguard Worker 19*d5c09012SAndroid Build Coastguard Workerimport "google/protobuf/descriptor.proto"; 20*d5c09012SAndroid Build Coastguard Worker 21*d5c09012SAndroid Build Coastguard Workeroption go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; 22*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true; 23*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "FieldBehaviorProto"; 24*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.api"; 25*d5c09012SAndroid Build Coastguard Workeroption objc_class_prefix = "GAPI"; 26*d5c09012SAndroid Build Coastguard Worker 27*d5c09012SAndroid Build Coastguard Workerextend google.protobuf.FieldOptions { 28*d5c09012SAndroid Build Coastguard Worker // A designation of a specific field behavior (required, output only, etc.) 29*d5c09012SAndroid Build Coastguard Worker // in protobuf messages. 30*d5c09012SAndroid Build Coastguard Worker // 31*d5c09012SAndroid Build Coastguard Worker // Examples: 32*d5c09012SAndroid Build Coastguard Worker // 33*d5c09012SAndroid Build Coastguard Worker // string name = 1 [(google.api.field_behavior) = REQUIRED]; 34*d5c09012SAndroid Build Coastguard Worker // State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 35*d5c09012SAndroid Build Coastguard Worker // google.protobuf.Duration ttl = 1 36*d5c09012SAndroid Build Coastguard Worker // [(google.api.field_behavior) = INPUT_ONLY]; 37*d5c09012SAndroid Build Coastguard Worker // google.protobuf.Timestamp expire_time = 1 38*d5c09012SAndroid Build Coastguard Worker // [(google.api.field_behavior) = OUTPUT_ONLY, 39*d5c09012SAndroid Build Coastguard Worker // (google.api.field_behavior) = IMMUTABLE]; 40*d5c09012SAndroid Build Coastguard Worker repeated google.api.FieldBehavior field_behavior = 1052 [packed = false]; 41*d5c09012SAndroid Build Coastguard Worker} 42*d5c09012SAndroid Build Coastguard Worker 43*d5c09012SAndroid Build Coastguard Worker// An indicator of the behavior of a given field (for example, that a field 44*d5c09012SAndroid Build Coastguard Worker// is required in requests, or given as output but ignored as input). 45*d5c09012SAndroid Build Coastguard Worker// This **does not** change the behavior in protocol buffers itself; it only 46*d5c09012SAndroid Build Coastguard Worker// denotes the behavior and may affect how API tooling handles the field. 47*d5c09012SAndroid Build Coastguard Worker// 48*d5c09012SAndroid Build Coastguard Worker// Note: This enum **may** receive new values in the future. 49*d5c09012SAndroid Build Coastguard Workerenum FieldBehavior { 50*d5c09012SAndroid Build Coastguard Worker // Conventional default for enums. Do not use this. 51*d5c09012SAndroid Build Coastguard Worker FIELD_BEHAVIOR_UNSPECIFIED = 0; 52*d5c09012SAndroid Build Coastguard Worker 53*d5c09012SAndroid Build Coastguard Worker // Specifically denotes a field as optional. 54*d5c09012SAndroid Build Coastguard Worker // While all fields in protocol buffers are optional, this may be specified 55*d5c09012SAndroid Build Coastguard Worker // for emphasis if appropriate. 56*d5c09012SAndroid Build Coastguard Worker OPTIONAL = 1; 57*d5c09012SAndroid Build Coastguard Worker 58*d5c09012SAndroid Build Coastguard Worker // Denotes a field as required. 59*d5c09012SAndroid Build Coastguard Worker // This indicates that the field **must** be provided as part of the request, 60*d5c09012SAndroid Build Coastguard Worker // and failure to do so will cause an error (usually `INVALID_ARGUMENT`). 61*d5c09012SAndroid Build Coastguard Worker REQUIRED = 2; 62*d5c09012SAndroid Build Coastguard Worker 63*d5c09012SAndroid Build Coastguard Worker // Denotes a field as output only. 64*d5c09012SAndroid Build Coastguard Worker // This indicates that the field is provided in responses, but including the 65*d5c09012SAndroid Build Coastguard Worker // field in a request does nothing (the server *must* ignore it and 66*d5c09012SAndroid Build Coastguard Worker // *must not* throw an error as a result of the field's presence). 67*d5c09012SAndroid Build Coastguard Worker OUTPUT_ONLY = 3; 68*d5c09012SAndroid Build Coastguard Worker 69*d5c09012SAndroid Build Coastguard Worker // Denotes a field as input only. 70*d5c09012SAndroid Build Coastguard Worker // This indicates that the field is provided in requests, and the 71*d5c09012SAndroid Build Coastguard Worker // corresponding field is not included in output. 72*d5c09012SAndroid Build Coastguard Worker INPUT_ONLY = 4; 73*d5c09012SAndroid Build Coastguard Worker 74*d5c09012SAndroid Build Coastguard Worker // Denotes a field as immutable. 75*d5c09012SAndroid Build Coastguard Worker // This indicates that the field may be set once in a request to create a 76*d5c09012SAndroid Build Coastguard Worker // resource, but may not be changed thereafter. 77*d5c09012SAndroid Build Coastguard Worker IMMUTABLE = 5; 78*d5c09012SAndroid Build Coastguard Worker 79*d5c09012SAndroid Build Coastguard Worker // Denotes that a (repeated) field is an unordered list. 80*d5c09012SAndroid Build Coastguard Worker // This indicates that the service may provide the elements of the list 81*d5c09012SAndroid Build Coastguard Worker // in any arbitrary order, rather than the order the user originally 82*d5c09012SAndroid Build Coastguard Worker // provided. Additionally, the list's order may or may not be stable. 83*d5c09012SAndroid Build Coastguard Worker UNORDERED_LIST = 6; 84*d5c09012SAndroid Build Coastguard Worker 85*d5c09012SAndroid Build Coastguard Worker // Denotes that this field returns a non-empty default value if not set. 86*d5c09012SAndroid Build Coastguard Worker // This indicates that if the user provides the empty value in a request, 87*d5c09012SAndroid Build Coastguard Worker // a non-empty value will be returned. The user will not be aware of what 88*d5c09012SAndroid Build Coastguard Worker // non-empty value to expect. 89*d5c09012SAndroid Build Coastguard Worker NON_EMPTY_DEFAULT = 7; 90*d5c09012SAndroid Build Coastguard Worker 91*d5c09012SAndroid Build Coastguard Worker // Denotes that the field in a resource (a message annotated with 92*d5c09012SAndroid Build Coastguard Worker // google.api.resource) is used in the resource name to uniquely identify the 93*d5c09012SAndroid Build Coastguard Worker // resource. For AIP-compliant APIs, this should only be applied to the 94*d5c09012SAndroid Build Coastguard Worker // `name` field on the resource. 95*d5c09012SAndroid Build Coastguard Worker // 96*d5c09012SAndroid Build Coastguard Worker // This behavior should not be applied to references to other resources within 97*d5c09012SAndroid Build Coastguard Worker // the message. 98*d5c09012SAndroid Build Coastguard Worker // 99*d5c09012SAndroid Build Coastguard Worker // The identifier field of resources often have different field behavior 100*d5c09012SAndroid Build Coastguard Worker // depending on the request it is embedded in (e.g. for Create methods name 101*d5c09012SAndroid Build Coastguard Worker // is optional and unused, while for Update methods it is required). Instead 102*d5c09012SAndroid Build Coastguard Worker // of method-specific annotations, only `IDENTIFIER` is required. 103*d5c09012SAndroid Build Coastguard Worker IDENTIFIER = 8; 104*d5c09012SAndroid Build Coastguard Worker} 105