sigstore_protobuf_specs/generated/google.api.rs
1// This file is @generated by prost-build.
2/// An indicator of the behavior of a given field (for example, that a field
3/// is required in requests, or given as output but ignored as input).
4/// This **does not** change the behavior in protocol buffers itself; it only
5/// denotes the behavior and may affect how API tooling handles the field.
6///
7/// Note: This enum **may** receive new values in the future.
8#[derive(
9 sigstore_protobuf_specs_derive::Deserialize_proto,
10 sigstore_protobuf_specs_derive::Serialize_proto
11)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
13#[repr(i32)]
14pub enum FieldBehavior {
15 /// Conventional default for enums. Do not use this.
16 Unspecified = 0,
17 /// 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 Optional = 1,
21 /// Denotes a field as required.
22 /// This indicates that the field **must** be provided as part of the request,
23 /// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
24 Required = 2,
25 /// Denotes a field as output only.
26 /// This indicates that the field is provided in responses, but including the
27 /// field in a request does nothing (the server *must* ignore it and
28 /// *must not* throw an error as a result of the field's presence).
29 OutputOnly = 3,
30 /// Denotes a field as input only.
31 /// This indicates that the field is provided in requests, and the
32 /// corresponding field is not included in output.
33 InputOnly = 4,
34 /// Denotes a field as immutable.
35 /// This indicates that the field may be set once in a request to create a
36 /// resource, but may not be changed thereafter.
37 Immutable = 5,
38 /// Denotes that a (repeated) field is an unordered list.
39 /// This indicates that the service may provide the elements of the list
40 /// in any arbitrary order, rather than the order the user originally
41 /// provided. Additionally, the list's order may or may not be stable.
42 UnorderedList = 6,
43 /// Denotes that this field returns a non-empty default value if not set.
44 /// This indicates that if the user provides the empty value in a request,
45 /// a non-empty value will be returned. The user will not be aware of what
46 /// non-empty value to expect.
47 NonEmptyDefault = 7,
48 /// Denotes that the field in a resource (a message annotated with
49 /// google.api.resource) is used in the resource name to uniquely identify the
50 /// resource. For AIP-compliant APIs, this should only be applied to the
51 /// `name` field on the resource.
52 ///
53 /// This behavior should not be applied to references to other resources within
54 /// the message.
55 ///
56 /// The identifier field of resources often have different field behavior
57 /// depending on the request it is embedded in (e.g. for Create methods name
58 /// is optional and unused, while for Update methods it is required). Instead
59 /// of method-specific annotations, only `IDENTIFIER` is required.
60 Identifier = 8,
61}
62impl FieldBehavior {
63 /// String value of the enum field names used in the ProtoBuf definition.
64 ///
65 /// The values are not transformed in any way and thus are considered stable
66 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
67 pub fn as_str_name(&self) -> &'static str {
68 match self {
69 Self::Unspecified => "FIELD_BEHAVIOR_UNSPECIFIED",
70 Self::Optional => "OPTIONAL",
71 Self::Required => "REQUIRED",
72 Self::OutputOnly => "OUTPUT_ONLY",
73 Self::InputOnly => "INPUT_ONLY",
74 Self::Immutable => "IMMUTABLE",
75 Self::UnorderedList => "UNORDERED_LIST",
76 Self::NonEmptyDefault => "NON_EMPTY_DEFAULT",
77 Self::Identifier => "IDENTIFIER",
78 }
79 }
80 /// Creates an enum from field names used in the ProtoBuf definition.
81 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
82 match value {
83 "FIELD_BEHAVIOR_UNSPECIFIED" => Some(Self::Unspecified),
84 "OPTIONAL" => Some(Self::Optional),
85 "REQUIRED" => Some(Self::Required),
86 "OUTPUT_ONLY" => Some(Self::OutputOnly),
87 "INPUT_ONLY" => Some(Self::InputOnly),
88 "IMMUTABLE" => Some(Self::Immutable),
89 "UNORDERED_LIST" => Some(Self::UnorderedList),
90 "NON_EMPTY_DEFAULT" => Some(Self::NonEmptyDefault),
91 "IDENTIFIER" => Some(Self::Identifier),
92 _ => None,
93 }
94 }
95}