openfga_sdk/models/
error_code.rs

1/**
2 * rust SDK for OpenFGA
3 *
4 * API version: 0.1
5 * Website: https://openfga.dev
6 * Documentation: https://openfga.dev/docs
7 * Support: https://discord.gg/8naAwJfWN6
8 * License: [Apache-2.0](https://github.com/openfga/rust-sdk/blob/main/LICENSE)
9 *
10 * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
11 */
12
13///
14#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
15pub enum ErrorCode {
16    #[serde(rename = "no_error")]
17    NoError,
18    #[serde(rename = "validation_error")]
19    ValidationError,
20    #[serde(rename = "authorization_model_not_found")]
21    AuthorizationModelNotFound,
22    #[serde(rename = "authorization_model_resolution_too_complex")]
23    AuthorizationModelResolutionTooComplex,
24    #[serde(rename = "invalid_write_input")]
25    InvalidWriteInput,
26    #[serde(rename = "cannot_allow_duplicate_tuples_in_one_request")]
27    CannotAllowDuplicateTuplesInOneRequest,
28    #[serde(rename = "cannot_allow_duplicate_types_in_one_request")]
29    CannotAllowDuplicateTypesInOneRequest,
30    #[serde(rename = "cannot_allow_multiple_references_to_one_relation")]
31    CannotAllowMultipleReferencesToOneRelation,
32    #[serde(rename = "invalid_continuation_token")]
33    InvalidContinuationToken,
34    #[serde(rename = "invalid_tuple_set")]
35    InvalidTupleSet,
36    #[serde(rename = "invalid_check_input")]
37    InvalidCheckInput,
38    #[serde(rename = "invalid_expand_input")]
39    InvalidExpandInput,
40    #[serde(rename = "unsupported_user_set")]
41    UnsupportedUserSet,
42    #[serde(rename = "invalid_object_format")]
43    InvalidObjectFormat,
44    #[serde(rename = "write_failed_due_to_invalid_input")]
45    WriteFailedDueToInvalidInput,
46    #[serde(rename = "authorization_model_assertions_not_found")]
47    AuthorizationModelAssertionsNotFound,
48    #[serde(rename = "latest_authorization_model_not_found")]
49    LatestAuthorizationModelNotFound,
50    #[serde(rename = "type_not_found")]
51    TypeNotFound,
52    #[serde(rename = "relation_not_found")]
53    RelationNotFound,
54    #[serde(rename = "empty_relation_definition")]
55    EmptyRelationDefinition,
56    #[serde(rename = "invalid_user")]
57    InvalidUser,
58    #[serde(rename = "invalid_tuple")]
59    InvalidTuple,
60    #[serde(rename = "unknown_relation")]
61    UnknownRelation,
62    #[serde(rename = "store_id_invalid_length")]
63    StoreIdInvalidLength,
64    #[serde(rename = "assertions_too_many_items")]
65    AssertionsTooManyItems,
66    #[serde(rename = "id_too_long")]
67    IdTooLong,
68    #[serde(rename = "authorization_model_id_too_long")]
69    AuthorizationModelIdTooLong,
70    #[serde(rename = "tuple_key_value_not_specified")]
71    TupleKeyValueNotSpecified,
72    #[serde(rename = "tuple_keys_too_many_or_too_few_items")]
73    TupleKeysTooManyOrTooFewItems,
74    #[serde(rename = "page_size_invalid")]
75    PageSizeInvalid,
76    #[serde(rename = "param_missing_value")]
77    ParamMissingValue,
78    #[serde(rename = "difference_base_missing_value")]
79    DifferenceBaseMissingValue,
80    #[serde(rename = "subtract_base_missing_value")]
81    SubtractBaseMissingValue,
82    #[serde(rename = "object_too_long")]
83    ObjectTooLong,
84    #[serde(rename = "relation_too_long")]
85    RelationTooLong,
86    #[serde(rename = "type_definitions_too_few_items")]
87    TypeDefinitionsTooFewItems,
88    #[serde(rename = "type_invalid_length")]
89    TypeInvalidLength,
90    #[serde(rename = "type_invalid_pattern")]
91    TypeInvalidPattern,
92    #[serde(rename = "relations_too_few_items")]
93    RelationsTooFewItems,
94    #[serde(rename = "relations_too_long")]
95    RelationsTooLong,
96    #[serde(rename = "relations_invalid_pattern")]
97    RelationsInvalidPattern,
98    #[serde(rename = "object_invalid_pattern")]
99    ObjectInvalidPattern,
100    #[serde(rename = "query_string_type_continuation_token_mismatch")]
101    QueryStringTypeContinuationTokenMismatch,
102    #[serde(rename = "exceeded_entity_limit")]
103    ExceededEntityLimit,
104    #[serde(rename = "invalid_contextual_tuple")]
105    InvalidContextualTuple,
106    #[serde(rename = "duplicate_contextual_tuple")]
107    DuplicateContextualTuple,
108    #[serde(rename = "invalid_authorization_model")]
109    InvalidAuthorizationModel,
110    #[serde(rename = "unsupported_schema_version")]
111    UnsupportedSchemaVersion,
112}
113
114impl ToString for ErrorCode {
115    fn to_string(&self) -> String {
116        match self {
117            Self::NoError => String::from("no_error"),
118            Self::ValidationError => String::from("validation_error"),
119            Self::AuthorizationModelNotFound => String::from("authorization_model_not_found"),
120            Self::AuthorizationModelResolutionTooComplex => {
121                String::from("authorization_model_resolution_too_complex")
122            }
123            Self::InvalidWriteInput => String::from("invalid_write_input"),
124            Self::CannotAllowDuplicateTuplesInOneRequest => {
125                String::from("cannot_allow_duplicate_tuples_in_one_request")
126            }
127            Self::CannotAllowDuplicateTypesInOneRequest => {
128                String::from("cannot_allow_duplicate_types_in_one_request")
129            }
130            Self::CannotAllowMultipleReferencesToOneRelation => {
131                String::from("cannot_allow_multiple_references_to_one_relation")
132            }
133            Self::InvalidContinuationToken => String::from("invalid_continuation_token"),
134            Self::InvalidTupleSet => String::from("invalid_tuple_set"),
135            Self::InvalidCheckInput => String::from("invalid_check_input"),
136            Self::InvalidExpandInput => String::from("invalid_expand_input"),
137            Self::UnsupportedUserSet => String::from("unsupported_user_set"),
138            Self::InvalidObjectFormat => String::from("invalid_object_format"),
139            Self::WriteFailedDueToInvalidInput => String::from("write_failed_due_to_invalid_input"),
140            Self::AuthorizationModelAssertionsNotFound => {
141                String::from("authorization_model_assertions_not_found")
142            }
143            Self::LatestAuthorizationModelNotFound => {
144                String::from("latest_authorization_model_not_found")
145            }
146            Self::TypeNotFound => String::from("type_not_found"),
147            Self::RelationNotFound => String::from("relation_not_found"),
148            Self::EmptyRelationDefinition => String::from("empty_relation_definition"),
149            Self::InvalidUser => String::from("invalid_user"),
150            Self::InvalidTuple => String::from("invalid_tuple"),
151            Self::UnknownRelation => String::from("unknown_relation"),
152            Self::StoreIdInvalidLength => String::from("store_id_invalid_length"),
153            Self::AssertionsTooManyItems => String::from("assertions_too_many_items"),
154            Self::IdTooLong => String::from("id_too_long"),
155            Self::AuthorizationModelIdTooLong => String::from("authorization_model_id_too_long"),
156            Self::TupleKeyValueNotSpecified => String::from("tuple_key_value_not_specified"),
157            Self::TupleKeysTooManyOrTooFewItems => {
158                String::from("tuple_keys_too_many_or_too_few_items")
159            }
160            Self::PageSizeInvalid => String::from("page_size_invalid"),
161            Self::ParamMissingValue => String::from("param_missing_value"),
162            Self::DifferenceBaseMissingValue => String::from("difference_base_missing_value"),
163            Self::SubtractBaseMissingValue => String::from("subtract_base_missing_value"),
164            Self::ObjectTooLong => String::from("object_too_long"),
165            Self::RelationTooLong => String::from("relation_too_long"),
166            Self::TypeDefinitionsTooFewItems => String::from("type_definitions_too_few_items"),
167            Self::TypeInvalidLength => String::from("type_invalid_length"),
168            Self::TypeInvalidPattern => String::from("type_invalid_pattern"),
169            Self::RelationsTooFewItems => String::from("relations_too_few_items"),
170            Self::RelationsTooLong => String::from("relations_too_long"),
171            Self::RelationsInvalidPattern => String::from("relations_invalid_pattern"),
172            Self::ObjectInvalidPattern => String::from("object_invalid_pattern"),
173            Self::QueryStringTypeContinuationTokenMismatch => {
174                String::from("query_string_type_continuation_token_mismatch")
175            }
176            Self::ExceededEntityLimit => String::from("exceeded_entity_limit"),
177            Self::InvalidContextualTuple => String::from("invalid_contextual_tuple"),
178            Self::DuplicateContextualTuple => String::from("duplicate_contextual_tuple"),
179            Self::InvalidAuthorizationModel => String::from("invalid_authorization_model"),
180            Self::UnsupportedSchemaVersion => String::from("unsupported_schema_version"),
181        }
182    }
183}
184
185impl Default for ErrorCode {
186    fn default() -> ErrorCode {
187        Self::NoError
188    }
189}