Skip to main content

azure_devops_rust_api/audit/
models.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3#![allow(non_camel_case_types)]
4#![allow(unused_imports)]
5use serde::de::{value, Deserializer, IntoDeserializer};
6use serde::{Deserialize, Serialize, Serializer};
7use std::str::FromStr;
8#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
9pub struct AuditActionInfo {
10    #[doc = "The action id for the event, i.e Git.CreateRepo, Project.RenameProject"]
11    #[serde(rename = "actionId", default, skip_serializing_if = "Option::is_none")]
12    pub action_id: Option<String>,
13    #[doc = "Area of Azure DevOps the action occurred"]
14    #[serde(default, skip_serializing_if = "Option::is_none")]
15    pub area: Option<String>,
16    #[doc = "Type of action executed"]
17    #[serde(default, skip_serializing_if = "Option::is_none")]
18    pub category: Option<audit_action_info::Category>,
19}
20impl AuditActionInfo {
21    pub fn new() -> Self {
22        Self::default()
23    }
24}
25pub mod audit_action_info {
26    use super::*;
27    #[doc = "Type of action executed"]
28    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
29    pub enum Category {
30        #[serde(rename = "unknown")]
31        Unknown,
32        #[serde(rename = "modify")]
33        Modify,
34        #[serde(rename = "remove")]
35        Remove,
36        #[serde(rename = "create")]
37        Create,
38        #[serde(rename = "access")]
39        Access,
40        #[serde(rename = "execute")]
41        Execute,
42    }
43}
44#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
45pub struct AuditActionInfoList {
46    #[serde(default, skip_serializing_if = "Option::is_none")]
47    pub count: Option<i32>,
48    #[serde(
49        default,
50        deserialize_with = "crate::serde::deserialize_null_as_default",
51        skip_serializing_if = "Vec::is_empty"
52    )]
53    pub value: Vec<AuditActionInfo>,
54}
55impl AuditActionInfoList {
56    pub fn new() -> Self {
57        Self::default()
58    }
59}
60#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
61pub struct AuditLogEntry {
62    #[doc = "The action if for the event, i.e Git.CreateRepo, Project.RenameProject"]
63    #[serde(rename = "actionId", default, skip_serializing_if = "Option::is_none")]
64    pub action_id: Option<String>,
65    #[doc = "ActivityId"]
66    #[serde(
67        rename = "activityId",
68        default,
69        skip_serializing_if = "Option::is_none"
70    )]
71    pub activity_id: Option<String>,
72    #[doc = "The Actor's Client Id (if actor is a service principal)"]
73    #[serde(
74        rename = "actorClientId",
75        default,
76        skip_serializing_if = "Option::is_none"
77    )]
78    pub actor_client_id: Option<String>,
79    #[doc = "The Actor's CUID"]
80    #[serde(rename = "actorCUID", default, skip_serializing_if = "Option::is_none")]
81    pub actor_cuid: Option<String>,
82    #[doc = "The Actor's UPN"]
83    #[serde(rename = "actorUPN", default, skip_serializing_if = "Option::is_none")]
84    pub actor_upn: Option<String>,
85    #[doc = "The Actor's User Id (if actor is a user)"]
86    #[serde(
87        rename = "actorUserId",
88        default,
89        skip_serializing_if = "Option::is_none"
90    )]
91    pub actor_user_id: Option<String>,
92    #[doc = "Type of authentication used by the author"]
93    #[serde(
94        rename = "authenticationMechanism",
95        default,
96        skip_serializing_if = "Option::is_none"
97    )]
98    pub authentication_mechanism: Option<String>,
99    #[doc = "This allows us to group things together, like one user action that caused a cascade of event entries (project creation)."]
100    #[serde(
101        rename = "correlationId",
102        default,
103        skip_serializing_if = "Option::is_none"
104    )]
105    pub correlation_id: Option<String>,
106    #[doc = "External data such as CUIDs, item names, etc."]
107    #[serde(default, skip_serializing_if = "Option::is_none")]
108    pub data: Option<serde_json::Value>,
109    #[doc = "EventId, should be unique"]
110    #[serde(default, skip_serializing_if = "Option::is_none")]
111    pub id: Option<String>,
112    #[doc = "IP Address where the event was originated"]
113    #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")]
114    pub ip_address: Option<String>,
115    #[doc = "When specified, the id of the project this event is associated to"]
116    #[serde(rename = "projectId", default, skip_serializing_if = "Option::is_none")]
117    pub project_id: Option<String>,
118    #[doc = "The organization Id (Organization is the only scope currently supported)"]
119    #[serde(rename = "scopeId", default, skip_serializing_if = "Option::is_none")]
120    pub scope_id: Option<String>,
121    #[doc = "The type of the scope (Organization is only scope currently supported)"]
122    #[serde(rename = "scopeType", default, skip_serializing_if = "Option::is_none")]
123    pub scope_type: Option<audit_log_entry::ScopeType>,
124    #[doc = "The time when the event occurred in UTC"]
125    #[serde(
126        default,
127        skip_serializing_if = "Option::is_none",
128        with = "crate::date_time::rfc3339::option"
129    )]
130    pub timestamp: Option<time::OffsetDateTime>,
131    #[doc = "The user agent from the request"]
132    #[serde(rename = "userAgent", default, skip_serializing_if = "Option::is_none")]
133    pub user_agent: Option<String>,
134}
135impl AuditLogEntry {
136    pub fn new() -> Self {
137        Self::default()
138    }
139}
140pub mod audit_log_entry {
141    use super::*;
142    #[doc = "The type of the scope (Organization is only scope currently supported)"]
143    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
144    pub enum ScopeType {
145        #[serde(rename = "unknown")]
146        Unknown,
147        #[serde(rename = "deployment")]
148        Deployment,
149        #[serde(rename = "enterprise")]
150        Enterprise,
151        #[serde(rename = "organization")]
152        Organization,
153        #[serde(rename = "project")]
154        Project,
155    }
156}
157#[doc = "The object returned when the audit log is queried. It contains the log and the information needed to query more audit entries."]
158#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
159pub struct AuditLogQueryResult {
160    #[doc = "The continuation token to pass to get the next set of results"]
161    #[serde(
162        rename = "continuationToken",
163        default,
164        skip_serializing_if = "Option::is_none"
165    )]
166    pub continuation_token: Option<String>,
167    #[doc = "The list of audit log entries"]
168    #[serde(
169        rename = "decoratedAuditLogEntries",
170        default,
171        deserialize_with = "crate::serde::deserialize_null_as_default",
172        skip_serializing_if = "Vec::is_empty"
173    )]
174    pub decorated_audit_log_entries: Vec<DecoratedAuditLogEntry>,
175    #[doc = "True when there are more matching results to be fetched, false otherwise."]
176    #[serde(rename = "hasMore", default, skip_serializing_if = "Option::is_none")]
177    pub has_more: Option<bool>,
178}
179impl AuditLogQueryResult {
180    pub fn new() -> Self {
181        Self::default()
182    }
183}
184#[doc = "This class represents an audit stream"]
185#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
186pub struct AuditStream {
187    #[doc = "Inputs used to communicate with external service. Inputs could be url, a connection string, a token, etc."]
188    #[serde(
189        rename = "consumerInputs",
190        default,
191        skip_serializing_if = "Option::is_none"
192    )]
193    pub consumer_inputs: Option<serde_json::Value>,
194    #[doc = "Type of the consumer, i.e. splunk, azureEventHub, etc."]
195    #[serde(
196        rename = "consumerType",
197        default,
198        skip_serializing_if = "Option::is_none"
199    )]
200    pub consumer_type: Option<String>,
201    #[doc = "The time when the stream was created"]
202    #[serde(
203        rename = "createdTime",
204        default,
205        skip_serializing_if = "Option::is_none",
206        with = "crate::date_time::rfc3339::option"
207    )]
208    pub created_time: Option<time::OffsetDateTime>,
209    #[doc = "Used to identify individual streams"]
210    #[serde(
211        rename = "displayName",
212        default,
213        skip_serializing_if = "Option::is_none"
214    )]
215    pub display_name: Option<String>,
216    #[doc = "Unique stream identifier"]
217    #[serde(default, skip_serializing_if = "Option::is_none")]
218    pub id: Option<i32>,
219    #[doc = "Status of the stream, Enabled, Disabled"]
220    #[serde(default, skip_serializing_if = "Option::is_none")]
221    pub status: Option<audit_stream::Status>,
222    #[doc = "Reason for the current stream status, i.e. Disabled by the system, Invalid credentials, etc."]
223    #[serde(
224        rename = "statusReason",
225        default,
226        skip_serializing_if = "Option::is_none"
227    )]
228    pub status_reason: Option<String>,
229    #[doc = "The time when the stream was last updated"]
230    #[serde(
231        rename = "updatedTime",
232        default,
233        skip_serializing_if = "Option::is_none",
234        with = "crate::date_time::rfc3339::option"
235    )]
236    pub updated_time: Option<time::OffsetDateTime>,
237}
238impl AuditStream {
239    pub fn new() -> Self {
240        Self::default()
241    }
242}
243pub mod audit_stream {
244    use super::*;
245    #[doc = "Status of the stream, Enabled, Disabled"]
246    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
247    pub enum Status {
248        #[serde(rename = "unknown")]
249        Unknown,
250        #[serde(rename = "enabled")]
251        Enabled,
252        #[serde(rename = "disabledByUser")]
253        DisabledByUser,
254        #[serde(rename = "disabledBySystem")]
255        DisabledBySystem,
256        #[serde(rename = "deleted")]
257        Deleted,
258        #[serde(rename = "backfilling")]
259        Backfilling,
260    }
261}
262#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
263pub struct AuditStreamList {
264    #[serde(default, skip_serializing_if = "Option::is_none")]
265    pub count: Option<i32>,
266    #[serde(
267        default,
268        deserialize_with = "crate::serde::deserialize_null_as_default",
269        skip_serializing_if = "Vec::is_empty"
270    )]
271    pub value: Vec<AuditStream>,
272}
273impl AuditStreamList {
274    pub fn new() -> Self {
275        Self::default()
276    }
277}
278#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
279pub struct DecoratedAuditLogEntry {
280    #[doc = "The action id for the event, i.e Git.CreateRepo, Project.RenameProject"]
281    #[serde(rename = "actionId", default, skip_serializing_if = "Option::is_none")]
282    pub action_id: Option<String>,
283    #[doc = "ActivityId"]
284    #[serde(
285        rename = "activityId",
286        default,
287        skip_serializing_if = "Option::is_none"
288    )]
289    pub activity_id: Option<String>,
290    #[doc = "The Actor's Client Id (if actor is a service principal)"]
291    #[serde(
292        rename = "actorClientId",
293        default,
294        skip_serializing_if = "Option::is_none"
295    )]
296    pub actor_client_id: Option<String>,
297    #[doc = "The Actor's CUID"]
298    #[serde(rename = "actorCUID", default, skip_serializing_if = "Option::is_none")]
299    pub actor_cuid: Option<String>,
300    #[doc = "DisplayName of the user who initiated the action"]
301    #[serde(
302        rename = "actorDisplayName",
303        default,
304        skip_serializing_if = "Option::is_none"
305    )]
306    pub actor_display_name: Option<String>,
307    #[doc = "URL of Actor's Profile image"]
308    #[serde(
309        rename = "actorImageUrl",
310        default,
311        skip_serializing_if = "Option::is_none"
312    )]
313    pub actor_image_url: Option<String>,
314    #[doc = "The Actor's UPN"]
315    #[serde(rename = "actorUPN", default, skip_serializing_if = "Option::is_none")]
316    pub actor_upn: Option<String>,
317    #[doc = "The Actor's User Id (if actor is a user)"]
318    #[serde(
319        rename = "actorUserId",
320        default,
321        skip_serializing_if = "Option::is_none"
322    )]
323    pub actor_user_id: Option<String>,
324    #[doc = "Area of Azure DevOps the action occurred"]
325    #[serde(default, skip_serializing_if = "Option::is_none")]
326    pub area: Option<String>,
327    #[doc = "Type of authentication used by the actor"]
328    #[serde(
329        rename = "authenticationMechanism",
330        default,
331        skip_serializing_if = "Option::is_none"
332    )]
333    pub authentication_mechanism: Option<String>,
334    #[doc = "Type of action executed"]
335    #[serde(default, skip_serializing_if = "Option::is_none")]
336    pub category: Option<decorated_audit_log_entry::Category>,
337    #[doc = "DisplayName of the category"]
338    #[serde(
339        rename = "categoryDisplayName",
340        default,
341        skip_serializing_if = "Option::is_none"
342    )]
343    pub category_display_name: Option<String>,
344    #[doc = "This allows related audit entries to be grouped together. Generally this occurs when a single action causes a cascade of audit entries. For example, project creation."]
345    #[serde(
346        rename = "correlationId",
347        default,
348        skip_serializing_if = "Option::is_none"
349    )]
350    pub correlation_id: Option<String>,
351    #[doc = "External data such as CUIDs, item names, etc."]
352    #[serde(default, skip_serializing_if = "Option::is_none")]
353    pub data: Option<serde_json::Value>,
354    #[doc = "Decorated details"]
355    #[serde(default, skip_serializing_if = "Option::is_none")]
356    pub details: Option<String>,
357    #[doc = "EventId - Needs to be unique per service"]
358    #[serde(default, skip_serializing_if = "Option::is_none")]
359    pub id: Option<String>,
360    #[doc = "IP Address where the event was originated"]
361    #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")]
362    pub ip_address: Option<String>,
363    #[doc = "When specified, the id of the project this event is associated to"]
364    #[serde(rename = "projectId", default, skip_serializing_if = "Option::is_none")]
365    pub project_id: Option<String>,
366    #[doc = "When specified, the name of the project this event is associated to"]
367    #[serde(
368        rename = "projectName",
369        default,
370        skip_serializing_if = "Option::is_none"
371    )]
372    pub project_name: Option<String>,
373    #[doc = "DisplayName of the scope"]
374    #[serde(
375        rename = "scopeDisplayName",
376        default,
377        skip_serializing_if = "Option::is_none"
378    )]
379    pub scope_display_name: Option<String>,
380    #[doc = "The organization Id (Organization is the only scope currently supported)"]
381    #[serde(rename = "scopeId", default, skip_serializing_if = "Option::is_none")]
382    pub scope_id: Option<String>,
383    #[doc = "The type of the scope (Organization is only scope currently supported)"]
384    #[serde(rename = "scopeType", default, skip_serializing_if = "Option::is_none")]
385    pub scope_type: Option<decorated_audit_log_entry::ScopeType>,
386    #[doc = "The time when the event occurred in UTC"]
387    #[serde(
388        default,
389        skip_serializing_if = "Option::is_none",
390        with = "crate::date_time::rfc3339::option"
391    )]
392    pub timestamp: Option<time::OffsetDateTime>,
393    #[doc = "The user agent from the request"]
394    #[serde(rename = "userAgent", default, skip_serializing_if = "Option::is_none")]
395    pub user_agent: Option<String>,
396}
397impl DecoratedAuditLogEntry {
398    pub fn new() -> Self {
399        Self::default()
400    }
401}
402pub mod decorated_audit_log_entry {
403    use super::*;
404    #[doc = "Type of action executed"]
405    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
406    pub enum Category {
407        #[serde(rename = "unknown")]
408        Unknown,
409        #[serde(rename = "modify")]
410        Modify,
411        #[serde(rename = "remove")]
412        Remove,
413        #[serde(rename = "create")]
414        Create,
415        #[serde(rename = "access")]
416        Access,
417        #[serde(rename = "execute")]
418        Execute,
419    }
420    #[doc = "The type of the scope (Organization is only scope currently supported)"]
421    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
422    pub enum ScopeType {
423        #[serde(rename = "unknown")]
424        Unknown,
425        #[serde(rename = "deployment")]
426        Deployment,
427        #[serde(rename = "enterprise")]
428        Enterprise,
429        #[serde(rename = "organization")]
430        Organization,
431        #[serde(rename = "project")]
432        Project,
433    }
434}
435#[doc = "This class is used to serialize collections as a single JSON object on the wire."]
436#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
437pub struct VssJsonCollectionWrapper {
438    #[serde(flatten)]
439    pub vss_json_collection_wrapper_base: VssJsonCollectionWrapperBase,
440    #[doc = "The serialized item."]
441    #[serde(default, skip_serializing_if = "Option::is_none")]
442    pub value: Option<String>,
443}
444impl VssJsonCollectionWrapper {
445    pub fn new() -> Self {
446        Self::default()
447    }
448}
449#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
450pub struct VssJsonCollectionWrapperBase {
451    #[doc = "The number of serialized items."]
452    #[serde(default, skip_serializing_if = "Option::is_none")]
453    pub count: Option<i32>,
454}
455impl VssJsonCollectionWrapperBase {
456    pub fn new() -> Self {
457        Self::default()
458    }
459}