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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::de::{value, Deserializer, IntoDeserializer};
use serde::{Deserialize, Serialize, Serializer};
use std::str::FromStr;
#[doc = "Represents a session token used to access Azure DevOps resources"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct SessionToken {
    #[serde(rename = "accessId", default, skip_serializing_if = "Option::is_none")]
    pub access_id: Option<String>,
    #[doc = "This is populated when user requests a compact token. The alternate token value is self describing token."]
    #[serde(
        rename = "alternateToken",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub alternate_token: Option<String>,
    #[serde(
        rename = "authorizationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub authorization_id: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub claims: Option<serde_json::Value>,
    #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")]
    pub client_id: Option<String>,
    #[serde(
        rename = "displayName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub display_name: Option<String>,
    #[serde(
        rename = "hostAuthorizationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub host_authorization_id: Option<String>,
    #[serde(rename = "isPublic", default, skip_serializing_if = "Option::is_none")]
    pub is_public: Option<bool>,
    #[serde(rename = "isValid", default, skip_serializing_if = "Option::is_none")]
    pub is_valid: Option<bool>,
    #[serde(
        rename = "publicData",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub public_data: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub scope: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub source: Option<String>,
    #[serde(
        rename = "targetAccounts",
        default,
        skip_serializing_if = "Vec::is_empty",
        deserialize_with = "crate::serde::deserialize_null_default"
    )]
    pub target_accounts: Vec<String>,
    #[doc = "This is computed and not returned in Get queries"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub token: Option<String>,
    #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")]
    pub user_id: Option<String>,
    #[serde(
        rename = "validFrom",
        default,
        skip_serializing_if = "Option::is_none",
        with = "crate::date_time::rfc3339::option"
    )]
    pub valid_from: Option<time::OffsetDateTime>,
    #[serde(
        rename = "validTo",
        default,
        skip_serializing_if = "Option::is_none",
        with = "crate::date_time::rfc3339::option"
    )]
    pub valid_to: Option<time::OffsetDateTime>,
}
impl SessionToken {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = ""]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct SessionTokenResult {
    #[serde(rename = "hasError", default, skip_serializing_if = "Option::is_none")]
    pub has_error: Option<bool>,
    #[doc = "Represents a session token used to access Azure DevOps resources"]
    #[serde(
        rename = "sessionToken",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub session_token: Option<SessionToken>,
    #[serde(
        rename = "sessionTokenError",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub session_token_error: Option<session_token_result::SessionTokenError>,
}
impl SessionTokenResult {
    pub fn new() -> Self {
        Self::default()
    }
}
pub mod session_token_result {
    use super::*;
    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
    pub enum SessionTokenError {
        #[serde(rename = "none")]
        None,
        #[serde(rename = "displayNameRequired")]
        DisplayNameRequired,
        #[serde(rename = "invalidDisplayName")]
        InvalidDisplayName,
        #[serde(rename = "invalidValidTo")]
        InvalidValidTo,
        #[serde(rename = "invalidScope")]
        InvalidScope,
        #[serde(rename = "userIdRequired")]
        UserIdRequired,
        #[serde(rename = "invalidUserId")]
        InvalidUserId,
        #[serde(rename = "invalidUserType")]
        InvalidUserType,
        #[serde(rename = "accessDenied")]
        AccessDenied,
        #[serde(rename = "failedToIssueAccessToken")]
        FailedToIssueAccessToken,
        #[serde(rename = "invalidClient")]
        InvalidClient,
        #[serde(rename = "invalidClientType")]
        InvalidClientType,
        #[serde(rename = "invalidClientId")]
        InvalidClientId,
        #[serde(rename = "invalidTargetAccounts")]
        InvalidTargetAccounts,
        #[serde(rename = "hostAuthorizationNotFound")]
        HostAuthorizationNotFound,
        #[serde(rename = "authorizationNotFound")]
        AuthorizationNotFound,
        #[serde(rename = "failedToUpdateAccessToken")]
        FailedToUpdateAccessToken,
        #[serde(rename = "sourceNotSupported")]
        SourceNotSupported,
        #[serde(rename = "invalidSourceIP")]
        InvalidSourceIp,
        #[serde(rename = "invalidSource")]
        InvalidSource,
        #[serde(rename = "duplicateHash")]
        DuplicateHash,
        #[serde(rename = "sshPolicyDisabled")]
        SshPolicyDisabled,
        #[serde(rename = "invalidToken")]
        InvalidToken,
        #[serde(rename = "tokenNotFound")]
        TokenNotFound,
        #[serde(rename = "invalidAuthorizationId")]
        InvalidAuthorizationId,
        #[serde(rename = "failedToReadTenantPolicy")]
        FailedToReadTenantPolicy,
        #[serde(rename = "globalPatPolicyViolation")]
        GlobalPatPolicyViolation,
        #[serde(rename = "fullScopePatPolicyViolation")]
        FullScopePatPolicyViolation,
        #[serde(rename = "patLifespanPolicyViolation")]
        PatLifespanPolicyViolation,
        #[serde(rename = "invalidTokenType")]
        InvalidTokenType,
        #[serde(rename = "invalidAudience")]
        InvalidAudience,
        #[serde(rename = "invalidSubject")]
        InvalidSubject,
        #[serde(rename = "deploymentHostNotSupported")]
        DeploymentHostNotSupported,
    }
}
#[doc = "A paginated list of session tokens. Session tokens correspond to OAuth credentials such as personal access tokens (PATs) and other OAuth authorizations."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct TokenAdminPagedSessionTokens {
    #[doc = "The continuation token that can be used to retrieve the next page of session tokens, or <code>null</code> if there is no next page."]
    #[serde(
        rename = "continuationToken",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub continuation_token: Option<String>,
    #[doc = "The list of all session tokens in the current page."]
    #[serde(
        default,
        skip_serializing_if = "Vec::is_empty",
        deserialize_with = "crate::serde::deserialize_null_default"
    )]
    pub value: Vec<SessionToken>,
}
impl TokenAdminPagedSessionTokens {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = "A request to revoke a particular delegated authorization."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct TokenAdminRevocation {
    #[doc = "The authorization ID of the OAuth authorization to revoke."]
    #[serde(
        rename = "authorizationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub authorization_id: Option<String>,
}
impl TokenAdminRevocation {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = "A rule which is applied to disable any incoming delegated authorization which matches the given properties."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct TokenAdminRevocationRule {
    #[doc = "A datetime cutoff. Tokens created before this time will be rejected. This is an optional parameter. If omitted, defaults to the time at which the rule was created."]
    #[serde(
        rename = "createdBefore",
        default,
        skip_serializing_if = "Option::is_none",
        with = "crate::date_time::rfc3339::option"
    )]
    pub created_before: Option<time::OffsetDateTime>,
    #[doc = "A string containing a space-delimited list of OAuth scopes. A token matching any one of the scopes will be rejected. For a list of all OAuth scopes supported by Azure DevOps, see:<https://docs>.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/oauth?view=azure-devops#scopes This is a mandatory parameter."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub scopes: Option<String>,
}
impl TokenAdminRevocationRule {
    pub fn new() -> Self {
        Self::default()
    }
}