go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/milo/ui/src/proto/google/api/field_behavior.pb.ts (about) 1 /* eslint-disable */ 2 3 export const protobufPackage = "google.api"; 4 5 /** 6 * An indicator of the behavior of a given field (for example, that a field 7 * is required in requests, or given as output but ignored as input). 8 * This **does not** change the behavior in protocol buffers itself; it only 9 * denotes the behavior and may affect how API tooling handles the field. 10 * 11 * Note: This enum **may** receive new values in the future. 12 */ 13 export enum FieldBehavior { 14 /** UNSPECIFIED - Conventional default for enums. Do not use this. */ 15 UNSPECIFIED = 0, 16 /** 17 * OPTIONAL - Specifically denotes a field as optional. 18 * While all fields in protocol buffers are optional, this may be specified 19 * for emphasis if appropriate. 20 */ 21 OPTIONAL = 1, 22 /** 23 * REQUIRED - Denotes a field as required. 24 * This indicates that the field **must** be provided as part of the request, 25 * and failure to do so will cause an error (usually `INVALID_ARGUMENT`). 26 */ 27 REQUIRED = 2, 28 /** 29 * OUTPUT_ONLY - Denotes a field as output only. 30 * This indicates that the field is provided in responses, but including the 31 * field in a request does nothing (the server *must* ignore it and 32 * *must not* throw an error as a result of the field's presence). 33 */ 34 OUTPUT_ONLY = 3, 35 /** 36 * INPUT_ONLY - Denotes a field as input only. 37 * This indicates that the field is provided in requests, and the 38 * corresponding field is not included in output. 39 */ 40 INPUT_ONLY = 4, 41 /** 42 * IMMUTABLE - Denotes a field as immutable. 43 * This indicates that the field may be set once in a request to create a 44 * resource, but may not be changed thereafter. 45 */ 46 IMMUTABLE = 5, 47 /** 48 * UNORDERED_LIST - Denotes that a (repeated) field is an unordered list. 49 * This indicates that the service may provide the elements of the list 50 * in any arbitrary order, rather than the order the user originally 51 * provided. Additionally, the list's order may or may not be stable. 52 */ 53 UNORDERED_LIST = 6, 54 /** 55 * NON_EMPTY_DEFAULT - Denotes that this field returns a non-empty default value if not set. 56 * This indicates that if the user provides the empty value in a request, 57 * a non-empty value will be returned. The user will not be aware of what 58 * non-empty value to expect. 59 */ 60 NON_EMPTY_DEFAULT = 7, 61 /** 62 * IDENTIFIER - Denotes that the field in a resource (a message annotated with 63 * google.api.resource) is used in the resource name to uniquely identify the 64 * resource. For AIP-compliant APIs, this should only be applied to the 65 * `name` field on the resource. 66 * 67 * This behavior should not be applied to references to other resources within 68 * the message. 69 * 70 * The identifier field of resources often have different field behavior 71 * depending on the request it is embedded in (e.g. for Create methods name 72 * is optional and unused, while for Update methods it is required). Instead 73 * of method-specific annotations, only `IDENTIFIER` is required. 74 */ 75 IDENTIFIER = 8, 76 } 77 78 export function fieldBehaviorFromJSON(object: any): FieldBehavior { 79 switch (object) { 80 case 0: 81 case "FIELD_BEHAVIOR_UNSPECIFIED": 82 return FieldBehavior.UNSPECIFIED; 83 case 1: 84 case "OPTIONAL": 85 return FieldBehavior.OPTIONAL; 86 case 2: 87 case "REQUIRED": 88 return FieldBehavior.REQUIRED; 89 case 3: 90 case "OUTPUT_ONLY": 91 return FieldBehavior.OUTPUT_ONLY; 92 case 4: 93 case "INPUT_ONLY": 94 return FieldBehavior.INPUT_ONLY; 95 case 5: 96 case "IMMUTABLE": 97 return FieldBehavior.IMMUTABLE; 98 case 6: 99 case "UNORDERED_LIST": 100 return FieldBehavior.UNORDERED_LIST; 101 case 7: 102 case "NON_EMPTY_DEFAULT": 103 return FieldBehavior.NON_EMPTY_DEFAULT; 104 case 8: 105 case "IDENTIFIER": 106 return FieldBehavior.IDENTIFIER; 107 default: 108 throw new globalThis.Error("Unrecognized enum value " + object + " for enum FieldBehavior"); 109 } 110 } 111 112 export function fieldBehaviorToJSON(object: FieldBehavior): string { 113 switch (object) { 114 case FieldBehavior.UNSPECIFIED: 115 return "FIELD_BEHAVIOR_UNSPECIFIED"; 116 case FieldBehavior.OPTIONAL: 117 return "OPTIONAL"; 118 case FieldBehavior.REQUIRED: 119 return "REQUIRED"; 120 case FieldBehavior.OUTPUT_ONLY: 121 return "OUTPUT_ONLY"; 122 case FieldBehavior.INPUT_ONLY: 123 return "INPUT_ONLY"; 124 case FieldBehavior.IMMUTABLE: 125 return "IMMUTABLE"; 126 case FieldBehavior.UNORDERED_LIST: 127 return "UNORDERED_LIST"; 128 case FieldBehavior.NON_EMPTY_DEFAULT: 129 return "NON_EMPTY_DEFAULT"; 130 case FieldBehavior.IDENTIFIER: 131 return "IDENTIFIER"; 132 default: 133 throw new globalThis.Error("Unrecognized enum value " + object + " for enum FieldBehavior"); 134 } 135 }