zitadel-with-serde 0.1.1-alpha.6

An implementation of ZITADEL API access and authentication in Rust. Now with support for serde for easy JSON serialization and deserialization.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
// @generated
// This file is @generated by prost-build.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Administrator {
    /// CreationDate is the timestamp when the administrator role was granted.
    #[prost(message, optional, tag="1")]
    pub creation_date: ::core::option::Option<::pbjson_types::Timestamp>,
    /// ChangeDate is the timestamp when the administrator role was last updated.
    /// In case the administrator role was not updated, this field is equal to the creation date.
    #[prost(message, optional, tag="2")]
    pub change_date: ::core::option::Option<::pbjson_types::Timestamp>,
    /// User is the user who was granted the administrator role.
    #[prost(message, optional, tag="3")]
    pub user: ::core::option::Option<User>,
    /// Roles are the roles that were granted to the user for the specified resource.
    #[prost(string, repeated, tag="8")]
    pub roles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// Resource is the type of the resource the administrator roles were granted for.
    #[prost(oneof="administrator::Resource", tags="4, 5, 6, 7")]
    pub resource: ::core::option::Option<administrator::Resource>,
}
/// Nested message and enum types in `Administrator`.
pub mod administrator {
    /// Resource is the type of the resource the administrator roles were granted for.
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(crate = "serde", rename_all = "snake_case")]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Resource {
        /// Instance is returned if the administrator roles were granted on the instance level.
        #[prost(bool, tag="4")]
        Instance(bool),
        /// Organization provides information about the organization the administrator roles were granted for.
        #[prost(message, tag="5")]
        Organization(super::Organization),
        /// Project provides information about the project the administrator roles were granted for.
        #[prost(message, tag="6")]
        Project(super::Project),
        /// ProjectGrant provides information about the project grant the administrator roles were granted for.
        #[prost(message, tag="7")]
        ProjectGrant(super::ProjectGrant),
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct User {
    /// ID is the unique identifier of the user.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
    /// PreferredLoginName is the preferred login name of the user. This value is unique across the whole instance.
    #[prost(string, tag="2")]
    pub preferred_login_name: ::prost::alloc::string::String,
    /// DisplayName is the public display name of the user.
    /// By default it's the user's given name and family name, their username or their email address.
    #[prost(string, tag="3")]
    pub display_name: ::prost::alloc::string::String,
    /// The organization the user belong to.
    #[prost(string, tag="4")]
    pub organization_id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Organization {
    /// ID is the unique identifier of the organization the user was granted the administrator role for.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
    /// Name is the name of the organization the user was granted the administrator role for.
    #[prost(string, tag="2")]
    pub name: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Project {
    /// ID is the unique identifier of the project the user was granted the administrator role for.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
    /// Name is the name of the project the user was granted the administrator role for.
    #[prost(string, tag="2")]
    pub name: ::prost::alloc::string::String,
    /// OrganizationID is the ID of the organization the project belongs to.
    #[prost(string, tag="3")]
    pub organization_id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProjectGrant {
    /// ID is the unique identifier of the project grant the user was granted the administrator role for.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
    /// ProjectID is the ID of the project the project grant belongs to.
    #[prost(string, tag="2")]
    pub project_id: ::prost::alloc::string::String,
    /// ProjectName is the name of the project the project grant belongs to.
    #[prost(string, tag="3")]
    pub project_name: ::prost::alloc::string::String,
    /// OrganizationID is the ID of the organization the project grant belongs to.
    #[prost(string, tag="4")]
    pub organization_id: ::prost::alloc::string::String,
    /// OrganizationID is the ID of the organization the project grant belongs to.
    #[prost(string, tag="5")]
    pub granted_organization_id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AdministratorSearchFilter {
    #[prost(oneof="administrator_search_filter::Filter", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11")]
    pub filter: ::core::option::Option<administrator_search_filter::Filter>,
}
/// Nested message and enum types in `AdministratorSearchFilter`.
pub mod administrator_search_filter {
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(crate = "serde", rename_all = "snake_case")]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Filter {
        /// Search for administrator roles by their creation date.
        #[prost(message, tag="1")]
        CreationDate(super::super::super::filter::v2beta::TimestampFilter),
        /// Search for administrator roles by their change date.
        #[prost(message, tag="2")]
        ChangeDate(super::super::super::filter::v2beta::TimestampFilter),
        /// Search for administrators roles by the IDs of the users who was granted the administrator role.
        #[prost(message, tag="3")]
        InUserIdsFilter(super::super::super::filter::v2beta::InIDsFilter),
        /// Search for administrators roles by the ID of the organization the user is part of.
        #[prost(message, tag="4")]
        UserOrganizationId(super::super::super::filter::v2beta::IdFilter),
        /// Search for administrators roles by the preferred login name of the user.
        #[prost(message, tag="5")]
        UserPreferredLoginName(super::UserPreferredLoginNameFilter),
        /// Search for administrators roles by the display name of the user.
        #[prost(message, tag="6")]
        UserDisplayName(super::UserDisplayNameFilter),
        /// Search for administrators roles granted for a specific resource.
        #[prost(message, tag="7")]
        Resource(super::ResourceFilter),
        /// Search for administrators roles granted with a specific role.
        #[prost(message, tag="8")]
        Role(super::RoleFilter),
        /// Combine multiple authorization queries with an AND operation.
        #[prost(message, tag="9")]
        And(super::AndFilter),
        /// Combine multiple authorization queries with an OR operation.
        /// For example, to search for authorizations of multiple OrganizationIDs.
        #[prost(message, tag="10")]
        Or(super::OrFilter),
        /// Negate an authorization query.
        #[prost(message, tag="11")]
        Not(::prost::alloc::boxed::Box<super::NotFilter>),
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserPreferredLoginNameFilter {
    /// Search for administrators by the preferred login name of the user.
    #[prost(string, tag="1")]
    pub preferred_login_name: ::prost::alloc::string::String,
    /// Specify the method to search for the preferred login name. Default is EQUAL.
    /// For example, to search for all administrator roles of a user with a preferred login name
    /// containing a specific string, use CONTAINS or CONTAINS_IGNORE_CASE.
    #[prost(enumeration="super::super::filter::v2beta::TextFilterMethod", tag="2")]
    pub method: i32,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserDisplayNameFilter {
    /// Search for administrators by the display name of the user.
    #[prost(string, tag="1")]
    pub display_name: ::prost::alloc::string::String,
    /// Specify the method to search for the display name. Default is EQUAL.
    /// For example, to search for all administrator roles of a user with a display name
    /// containing a specific string, use CONTAINS or CONTAINS_IGNORE_CASE.
    #[prost(enumeration="super::super::filter::v2beta::TextFilterMethod", tag="2")]
    pub method: i32,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResourceFilter {
    /// Search for administrators by the granted resource.
    #[prost(oneof="resource_filter::Resource", tags="1, 2, 3, 4")]
    pub resource: ::core::option::Option<resource_filter::Resource>,
}
/// Nested message and enum types in `ResourceFilter`.
pub mod resource_filter {
    /// Search for administrators by the granted resource.
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(crate = "serde", rename_all = "snake_case")]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Resource {
        /// Search for administrators granted on the instance level.
        #[prost(bool, tag="1")]
        Instance(bool),
        /// Search for administrators granted on a specific organization.
        #[prost(string, tag="2")]
        OrganizationId(::prost::alloc::string::String),
        /// Search for administrators granted on a specific project.
        #[prost(string, tag="3")]
        ProjectId(::prost::alloc::string::String),
        /// Search for administrators granted on a specific project grant.
        #[prost(string, tag="4")]
        ProjectGrantId(::prost::alloc::string::String),
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RoleFilter {
    /// Search for administrators by the granted role.
    #[prost(string, tag="1")]
    pub role_key: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AndFilter {
    #[prost(message, repeated, tag="1")]
    pub queries: ::prost::alloc::vec::Vec<AdministratorSearchFilter>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrFilter {
    #[prost(message, repeated, tag="1")]
    pub queries: ::prost::alloc::vec::Vec<AdministratorSearchFilter>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NotFilter {
    #[prost(message, optional, boxed, tag="1")]
    pub query: ::core::option::Option<::prost::alloc::boxed::Box<AdministratorSearchFilter>>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum AdministratorFieldName {
    Unspecified = 0,
    UserId = 1,
    CreationDate = 2,
    ChangeDate = 3,
}
impl AdministratorFieldName {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "ADMINISTRATOR_FIELD_NAME_UNSPECIFIED",
            Self::UserId => "ADMINISTRATOR_FIELD_NAME_USER_ID",
            Self::CreationDate => "ADMINISTRATOR_FIELD_NAME_CREATION_DATE",
            Self::ChangeDate => "ADMINISTRATOR_FIELD_NAME_CHANGE_DATE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ADMINISTRATOR_FIELD_NAME_UNSPECIFIED" => Some(Self::Unspecified),
            "ADMINISTRATOR_FIELD_NAME_USER_ID" => Some(Self::UserId),
            "ADMINISTRATOR_FIELD_NAME_CREATION_DATE" => Some(Self::CreationDate),
            "ADMINISTRATOR_FIELD_NAME_CHANGE_DATE" => Some(Self::ChangeDate),
            _ => None,
        }
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAdministratorsRequest {
    /// List limitations and ordering.
    #[prost(message, optional, tag="1")]
    pub pagination: ::core::option::Option<super::super::filter::v2beta::PaginationRequest>,
    /// The field the result is sorted by. The default is the creation date. Beware that if you change this, your result pagination might be inconsistent.
    #[prost(enumeration="AdministratorFieldName", optional, tag="2")]
    pub sorting_column: ::core::option::Option<i32>,
    /// Filter the administrator roles to be returned.
    #[prost(message, repeated, tag="3")]
    pub filters: ::prost::alloc::vec::Vec<AdministratorSearchFilter>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAdministratorsResponse {
    #[prost(message, optional, tag="1")]
    pub pagination: ::core::option::Option<super::super::filter::v2beta::PaginationResponse>,
    #[prost(message, repeated, tag="2")]
    pub administrators: ::prost::alloc::vec::Vec<Administrator>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetAdministratorRequest {
    /// ID is the unique identifier of the administrator.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetAdministratorResponse {
    #[prost(message, optional, tag="1")]
    pub administrator: ::core::option::Option<Administrator>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateAdministratorRequest {
    /// UserID is the ID of the user who should be granted the administrator role.
    #[prost(string, tag="1")]
    pub user_id: ::prost::alloc::string::String,
    /// Resource is the type of the resource the administrator roles should be granted for.
    #[prost(message, optional, tag="2")]
    pub resource: ::core::option::Option<ResourceType>,
    /// Roles are the roles that should be granted to the user for the specified resource.
    /// Note that roles are currently specific to the resource type.
    /// This means that if you want to grant a user the administrator role for an organization and a project,
    /// you need to create two administrator roles.
    #[prost(string, repeated, tag="3")]
    pub roles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResourceType {
    /// Resource is the type of the resource the administrator roles should be granted for.
    #[prost(oneof="resource_type::Resource", tags="1, 2, 3, 4")]
    pub resource: ::core::option::Option<resource_type::Resource>,
}
/// Nested message and enum types in `ResourceType`.
pub mod resource_type {
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(crate = "serde", rename_all = "snake_case")]
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct ProjectGrant {
        /// ProjectID is required to grant administrator privileges for a specific project.
        #[prost(string, tag="1")]
        pub project_id: ::prost::alloc::string::String,
        /// ProjectGrantID is required to grant administrator privileges for a specific project grant.
        #[prost(string, tag="2")]
        pub project_grant_id: ::prost::alloc::string::String,
    }
    /// Resource is the type of the resource the administrator roles should be granted for.
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(crate = "serde", rename_all = "snake_case")]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Resource {
        /// Instance is the resource type for granting administrator privileges on the instance level.
        #[prost(bool, tag="1")]
        Instance(bool),
        /// OrganizationID is required to grant administrator privileges for a specific organization.
        #[prost(string, tag="2")]
        OrganizationId(::prost::alloc::string::String),
        /// ProjectID is required to grant administrator privileges for a specific project.
        #[prost(string, tag="3")]
        ProjectId(::prost::alloc::string::String),
        /// ProjectGrantID is required to grant administrator privileges for a specific project grant.
        #[prost(message, tag="4")]
        ProjectGrant(ProjectGrant),
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CreateAdministratorResponse {
    /// CreationDate is the timestamp when the administrator role was created.
    #[prost(message, optional, tag="1")]
    pub creation_date: ::core::option::Option<::pbjson_types::Timestamp>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateAdministratorRequest {
    /// UserID is the ID of the user who should have his administrator roles update.
    #[prost(string, tag="1")]
    pub user_id: ::prost::alloc::string::String,
    /// Resource is the type of the resource the administrator roles should be granted for.
    #[prost(message, optional, tag="2")]
    pub resource: ::core::option::Option<ResourceType>,
    /// Roles are the roles that the user should be granted.
    /// Note that any role previously granted to the user and not present in the list will be revoked.
    #[prost(string, repeated, tag="3")]
    pub roles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UpdateAdministratorResponse {
    /// ChangeDate is the timestamp when the administrator role was last updated.
    #[prost(message, optional, tag="1")]
    pub change_date: ::core::option::Option<::pbjson_types::Timestamp>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteAdministratorRequest {
    /// UserID is the ID of the user who should have his administrator roles removed.
    #[prost(string, tag="1")]
    pub user_id: ::prost::alloc::string::String,
    /// Resource is the type of the resource the administrator roles should be removed for.
    #[prost(message, optional, tag="2")]
    pub resource: ::core::option::Option<ResourceType>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DeleteAdministratorResponse {
    /// DeletionDate is the timestamp when the administrator role was deleted.
    /// Note that the deletion date is only guaranteed to be set if the deletion was successful during the request.
    /// In case the deletion occurred in a previous request, the deletion date might not be set.
    #[prost(message, optional, tag="1")]
    pub deletion_date: ::core::option::Option<::pbjson_types::Timestamp>,
}
include!("zitadel.internal_permission.v2beta.tonic.rs");
// @@protoc_insertion_point(module)