Skip to main content

google_cloud_iam_credentials_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate serde;
25extern crate serde_json;
26extern crate serde_with;
27extern crate std;
28extern crate tracing;
29extern crate wkt;
30
31mod debug;
32mod deserialize;
33mod serialize;
34
35#[derive(Clone, Default, PartialEq)]
36#[non_exhaustive]
37pub struct GenerateAccessTokenRequest {
38    /// Required. The resource name of the service account for which the credentials
39    /// are requested, in the following format:
40    /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
41    /// character is required; replacing it with a project ID is invalid.
42    pub name: std::string::String,
43
44    /// The sequence of service accounts in a delegation chain. Each service
45    /// account must be granted the `roles/iam.serviceAccountTokenCreator` role
46    /// on its next service account in the chain. The last service account in the
47    /// chain must be granted the `roles/iam.serviceAccountTokenCreator` role
48    /// on the service account that is specified in the `name` field of the
49    /// request.
50    ///
51    /// The delegates must have the following format:
52    /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
53    /// character is required; replacing it with a project ID is invalid.
54    pub delegates: std::vec::Vec<std::string::String>,
55
56    /// Required. Code to identify the scopes to be included in the OAuth 2.0 access token.
57    /// See <https://developers.google.com/identity/protocols/googlescopes> for more
58    /// information.
59    /// At least one value required.
60    pub scope: std::vec::Vec<std::string::String>,
61
62    /// The desired lifetime duration of the access token in seconds.
63    /// Must be set to a value less than or equal to 3600 (1 hour). If a value is
64    /// not specified, the token's lifetime will be set to a default value of one
65    /// hour.
66    pub lifetime: std::option::Option<wkt::Duration>,
67
68    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
69}
70
71impl GenerateAccessTokenRequest {
72    pub fn new() -> Self {
73        std::default::Default::default()
74    }
75
76    /// Sets the value of [name][crate::model::GenerateAccessTokenRequest::name].
77    ///
78    /// # Example
79    /// ```ignore,no_run
80    /// # use google_cloud_iam_credentials_v1::model::GenerateAccessTokenRequest;
81    /// let x = GenerateAccessTokenRequest::new().set_name("example");
82    /// ```
83    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
84        self.name = v.into();
85        self
86    }
87
88    /// Sets the value of [delegates][crate::model::GenerateAccessTokenRequest::delegates].
89    ///
90    /// # Example
91    /// ```ignore,no_run
92    /// # use google_cloud_iam_credentials_v1::model::GenerateAccessTokenRequest;
93    /// let x = GenerateAccessTokenRequest::new().set_delegates(["a", "b", "c"]);
94    /// ```
95    pub fn set_delegates<T, V>(mut self, v: T) -> Self
96    where
97        T: std::iter::IntoIterator<Item = V>,
98        V: std::convert::Into<std::string::String>,
99    {
100        use std::iter::Iterator;
101        self.delegates = v.into_iter().map(|i| i.into()).collect();
102        self
103    }
104
105    /// Sets the value of [scope][crate::model::GenerateAccessTokenRequest::scope].
106    ///
107    /// # Example
108    /// ```ignore,no_run
109    /// # use google_cloud_iam_credentials_v1::model::GenerateAccessTokenRequest;
110    /// let x = GenerateAccessTokenRequest::new().set_scope(["a", "b", "c"]);
111    /// ```
112    pub fn set_scope<T, V>(mut self, v: T) -> Self
113    where
114        T: std::iter::IntoIterator<Item = V>,
115        V: std::convert::Into<std::string::String>,
116    {
117        use std::iter::Iterator;
118        self.scope = v.into_iter().map(|i| i.into()).collect();
119        self
120    }
121
122    /// Sets the value of [lifetime][crate::model::GenerateAccessTokenRequest::lifetime].
123    ///
124    /// # Example
125    /// ```ignore,no_run
126    /// # use google_cloud_iam_credentials_v1::model::GenerateAccessTokenRequest;
127    /// use wkt::Duration;
128    /// let x = GenerateAccessTokenRequest::new().set_lifetime(Duration::default()/* use setters */);
129    /// ```
130    pub fn set_lifetime<T>(mut self, v: T) -> Self
131    where
132        T: std::convert::Into<wkt::Duration>,
133    {
134        self.lifetime = std::option::Option::Some(v.into());
135        self
136    }
137
138    /// Sets or clears the value of [lifetime][crate::model::GenerateAccessTokenRequest::lifetime].
139    ///
140    /// # Example
141    /// ```ignore,no_run
142    /// # use google_cloud_iam_credentials_v1::model::GenerateAccessTokenRequest;
143    /// use wkt::Duration;
144    /// let x = GenerateAccessTokenRequest::new().set_or_clear_lifetime(Some(Duration::default()/* use setters */));
145    /// let x = GenerateAccessTokenRequest::new().set_or_clear_lifetime(None::<Duration>);
146    /// ```
147    pub fn set_or_clear_lifetime<T>(mut self, v: std::option::Option<T>) -> Self
148    where
149        T: std::convert::Into<wkt::Duration>,
150    {
151        self.lifetime = v.map(|x| x.into());
152        self
153    }
154}
155
156impl wkt::message::Message for GenerateAccessTokenRequest {
157    fn typename() -> &'static str {
158        "type.googleapis.com/google.iam.credentials.v1.GenerateAccessTokenRequest"
159    }
160}
161
162#[derive(Clone, Default, PartialEq)]
163#[non_exhaustive]
164pub struct GenerateAccessTokenResponse {
165    /// The OAuth 2.0 access token.
166    pub access_token: std::string::String,
167
168    /// Token expiration time.
169    /// The expiration time is always set.
170    pub expire_time: std::option::Option<wkt::Timestamp>,
171
172    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
173}
174
175impl GenerateAccessTokenResponse {
176    pub fn new() -> Self {
177        std::default::Default::default()
178    }
179
180    /// Sets the value of [access_token][crate::model::GenerateAccessTokenResponse::access_token].
181    ///
182    /// # Example
183    /// ```ignore,no_run
184    /// # use google_cloud_iam_credentials_v1::model::GenerateAccessTokenResponse;
185    /// let x = GenerateAccessTokenResponse::new().set_access_token("example");
186    /// ```
187    pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
188        self.access_token = v.into();
189        self
190    }
191
192    /// Sets the value of [expire_time][crate::model::GenerateAccessTokenResponse::expire_time].
193    ///
194    /// # Example
195    /// ```ignore,no_run
196    /// # use google_cloud_iam_credentials_v1::model::GenerateAccessTokenResponse;
197    /// use wkt::Timestamp;
198    /// let x = GenerateAccessTokenResponse::new().set_expire_time(Timestamp::default()/* use setters */);
199    /// ```
200    pub fn set_expire_time<T>(mut self, v: T) -> Self
201    where
202        T: std::convert::Into<wkt::Timestamp>,
203    {
204        self.expire_time = std::option::Option::Some(v.into());
205        self
206    }
207
208    /// Sets or clears the value of [expire_time][crate::model::GenerateAccessTokenResponse::expire_time].
209    ///
210    /// # Example
211    /// ```ignore,no_run
212    /// # use google_cloud_iam_credentials_v1::model::GenerateAccessTokenResponse;
213    /// use wkt::Timestamp;
214    /// let x = GenerateAccessTokenResponse::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
215    /// let x = GenerateAccessTokenResponse::new().set_or_clear_expire_time(None::<Timestamp>);
216    /// ```
217    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
218    where
219        T: std::convert::Into<wkt::Timestamp>,
220    {
221        self.expire_time = v.map(|x| x.into());
222        self
223    }
224}
225
226impl wkt::message::Message for GenerateAccessTokenResponse {
227    fn typename() -> &'static str {
228        "type.googleapis.com/google.iam.credentials.v1.GenerateAccessTokenResponse"
229    }
230}
231
232#[derive(Clone, Default, PartialEq)]
233#[non_exhaustive]
234pub struct SignBlobRequest {
235    /// Required. The resource name of the service account for which the credentials
236    /// are requested, in the following format:
237    /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
238    /// character is required; replacing it with a project ID is invalid.
239    pub name: std::string::String,
240
241    /// The sequence of service accounts in a delegation chain. Each service
242    /// account must be granted the `roles/iam.serviceAccountTokenCreator` role
243    /// on its next service account in the chain. The last service account in the
244    /// chain must be granted the `roles/iam.serviceAccountTokenCreator` role
245    /// on the service account that is specified in the `name` field of the
246    /// request.
247    ///
248    /// The delegates must have the following format:
249    /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
250    /// character is required; replacing it with a project ID is invalid.
251    pub delegates: std::vec::Vec<std::string::String>,
252
253    /// Required. The bytes to sign.
254    pub payload: ::bytes::Bytes,
255
256    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
257}
258
259impl SignBlobRequest {
260    pub fn new() -> Self {
261        std::default::Default::default()
262    }
263
264    /// Sets the value of [name][crate::model::SignBlobRequest::name].
265    ///
266    /// # Example
267    /// ```ignore,no_run
268    /// # use google_cloud_iam_credentials_v1::model::SignBlobRequest;
269    /// let x = SignBlobRequest::new().set_name("example");
270    /// ```
271    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
272        self.name = v.into();
273        self
274    }
275
276    /// Sets the value of [delegates][crate::model::SignBlobRequest::delegates].
277    ///
278    /// # Example
279    /// ```ignore,no_run
280    /// # use google_cloud_iam_credentials_v1::model::SignBlobRequest;
281    /// let x = SignBlobRequest::new().set_delegates(["a", "b", "c"]);
282    /// ```
283    pub fn set_delegates<T, V>(mut self, v: T) -> Self
284    where
285        T: std::iter::IntoIterator<Item = V>,
286        V: std::convert::Into<std::string::String>,
287    {
288        use std::iter::Iterator;
289        self.delegates = v.into_iter().map(|i| i.into()).collect();
290        self
291    }
292
293    /// Sets the value of [payload][crate::model::SignBlobRequest::payload].
294    ///
295    /// # Example
296    /// ```ignore,no_run
297    /// # use google_cloud_iam_credentials_v1::model::SignBlobRequest;
298    /// let x = SignBlobRequest::new().set_payload(bytes::Bytes::from_static(b"example"));
299    /// ```
300    pub fn set_payload<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
301        self.payload = v.into();
302        self
303    }
304}
305
306impl wkt::message::Message for SignBlobRequest {
307    fn typename() -> &'static str {
308        "type.googleapis.com/google.iam.credentials.v1.SignBlobRequest"
309    }
310}
311
312#[derive(Clone, Default, PartialEq)]
313#[non_exhaustive]
314pub struct SignBlobResponse {
315    /// The ID of the key used to sign the blob.
316    pub key_id: std::string::String,
317
318    /// The signed blob.
319    pub signed_blob: ::bytes::Bytes,
320
321    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
322}
323
324impl SignBlobResponse {
325    pub fn new() -> Self {
326        std::default::Default::default()
327    }
328
329    /// Sets the value of [key_id][crate::model::SignBlobResponse::key_id].
330    ///
331    /// # Example
332    /// ```ignore,no_run
333    /// # use google_cloud_iam_credentials_v1::model::SignBlobResponse;
334    /// let x = SignBlobResponse::new().set_key_id("example");
335    /// ```
336    pub fn set_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
337        self.key_id = v.into();
338        self
339    }
340
341    /// Sets the value of [signed_blob][crate::model::SignBlobResponse::signed_blob].
342    ///
343    /// # Example
344    /// ```ignore,no_run
345    /// # use google_cloud_iam_credentials_v1::model::SignBlobResponse;
346    /// let x = SignBlobResponse::new().set_signed_blob(bytes::Bytes::from_static(b"example"));
347    /// ```
348    pub fn set_signed_blob<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
349        self.signed_blob = v.into();
350        self
351    }
352}
353
354impl wkt::message::Message for SignBlobResponse {
355    fn typename() -> &'static str {
356        "type.googleapis.com/google.iam.credentials.v1.SignBlobResponse"
357    }
358}
359
360#[derive(Clone, Default, PartialEq)]
361#[non_exhaustive]
362pub struct SignJwtRequest {
363    /// Required. The resource name of the service account for which the credentials
364    /// are requested, in the following format:
365    /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
366    /// character is required; replacing it with a project ID is invalid.
367    pub name: std::string::String,
368
369    /// The sequence of service accounts in a delegation chain. Each service
370    /// account must be granted the `roles/iam.serviceAccountTokenCreator` role
371    /// on its next service account in the chain. The last service account in the
372    /// chain must be granted the `roles/iam.serviceAccountTokenCreator` role
373    /// on the service account that is specified in the `name` field of the
374    /// request.
375    ///
376    /// The delegates must have the following format:
377    /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
378    /// character is required; replacing it with a project ID is invalid.
379    pub delegates: std::vec::Vec<std::string::String>,
380
381    /// Required. The JWT payload to sign: a JSON object that contains a JWT Claims Set.
382    pub payload: std::string::String,
383
384    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
385}
386
387impl SignJwtRequest {
388    pub fn new() -> Self {
389        std::default::Default::default()
390    }
391
392    /// Sets the value of [name][crate::model::SignJwtRequest::name].
393    ///
394    /// # Example
395    /// ```ignore,no_run
396    /// # use google_cloud_iam_credentials_v1::model::SignJwtRequest;
397    /// let x = SignJwtRequest::new().set_name("example");
398    /// ```
399    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
400        self.name = v.into();
401        self
402    }
403
404    /// Sets the value of [delegates][crate::model::SignJwtRequest::delegates].
405    ///
406    /// # Example
407    /// ```ignore,no_run
408    /// # use google_cloud_iam_credentials_v1::model::SignJwtRequest;
409    /// let x = SignJwtRequest::new().set_delegates(["a", "b", "c"]);
410    /// ```
411    pub fn set_delegates<T, V>(mut self, v: T) -> Self
412    where
413        T: std::iter::IntoIterator<Item = V>,
414        V: std::convert::Into<std::string::String>,
415    {
416        use std::iter::Iterator;
417        self.delegates = v.into_iter().map(|i| i.into()).collect();
418        self
419    }
420
421    /// Sets the value of [payload][crate::model::SignJwtRequest::payload].
422    ///
423    /// # Example
424    /// ```ignore,no_run
425    /// # use google_cloud_iam_credentials_v1::model::SignJwtRequest;
426    /// let x = SignJwtRequest::new().set_payload("example");
427    /// ```
428    pub fn set_payload<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
429        self.payload = v.into();
430        self
431    }
432}
433
434impl wkt::message::Message for SignJwtRequest {
435    fn typename() -> &'static str {
436        "type.googleapis.com/google.iam.credentials.v1.SignJwtRequest"
437    }
438}
439
440#[derive(Clone, Default, PartialEq)]
441#[non_exhaustive]
442pub struct SignJwtResponse {
443    /// The ID of the key used to sign the JWT.
444    pub key_id: std::string::String,
445
446    /// The signed JWT.
447    pub signed_jwt: std::string::String,
448
449    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
450}
451
452impl SignJwtResponse {
453    pub fn new() -> Self {
454        std::default::Default::default()
455    }
456
457    /// Sets the value of [key_id][crate::model::SignJwtResponse::key_id].
458    ///
459    /// # Example
460    /// ```ignore,no_run
461    /// # use google_cloud_iam_credentials_v1::model::SignJwtResponse;
462    /// let x = SignJwtResponse::new().set_key_id("example");
463    /// ```
464    pub fn set_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
465        self.key_id = v.into();
466        self
467    }
468
469    /// Sets the value of [signed_jwt][crate::model::SignJwtResponse::signed_jwt].
470    ///
471    /// # Example
472    /// ```ignore,no_run
473    /// # use google_cloud_iam_credentials_v1::model::SignJwtResponse;
474    /// let x = SignJwtResponse::new().set_signed_jwt("example");
475    /// ```
476    pub fn set_signed_jwt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
477        self.signed_jwt = v.into();
478        self
479    }
480}
481
482impl wkt::message::Message for SignJwtResponse {
483    fn typename() -> &'static str {
484        "type.googleapis.com/google.iam.credentials.v1.SignJwtResponse"
485    }
486}
487
488#[derive(Clone, Default, PartialEq)]
489#[non_exhaustive]
490pub struct GenerateIdTokenRequest {
491    /// Required. The resource name of the service account for which the credentials
492    /// are requested, in the following format:
493    /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
494    /// character is required; replacing it with a project ID is invalid.
495    pub name: std::string::String,
496
497    /// The sequence of service accounts in a delegation chain. Each service
498    /// account must be granted the `roles/iam.serviceAccountTokenCreator` role
499    /// on its next service account in the chain. The last service account in the
500    /// chain must be granted the `roles/iam.serviceAccountTokenCreator` role
501    /// on the service account that is specified in the `name` field of the
502    /// request.
503    ///
504    /// The delegates must have the following format:
505    /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
506    /// character is required; replacing it with a project ID is invalid.
507    pub delegates: std::vec::Vec<std::string::String>,
508
509    /// Required. The audience for the token, such as the API or account that this token
510    /// grants access to.
511    pub audience: std::string::String,
512
513    /// Include the service account email in the token. If set to `true`, the
514    /// token will contain `email` and `email_verified` claims.
515    pub include_email: bool,
516
517    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
518}
519
520impl GenerateIdTokenRequest {
521    pub fn new() -> Self {
522        std::default::Default::default()
523    }
524
525    /// Sets the value of [name][crate::model::GenerateIdTokenRequest::name].
526    ///
527    /// # Example
528    /// ```ignore,no_run
529    /// # use google_cloud_iam_credentials_v1::model::GenerateIdTokenRequest;
530    /// let x = GenerateIdTokenRequest::new().set_name("example");
531    /// ```
532    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
533        self.name = v.into();
534        self
535    }
536
537    /// Sets the value of [delegates][crate::model::GenerateIdTokenRequest::delegates].
538    ///
539    /// # Example
540    /// ```ignore,no_run
541    /// # use google_cloud_iam_credentials_v1::model::GenerateIdTokenRequest;
542    /// let x = GenerateIdTokenRequest::new().set_delegates(["a", "b", "c"]);
543    /// ```
544    pub fn set_delegates<T, V>(mut self, v: T) -> Self
545    where
546        T: std::iter::IntoIterator<Item = V>,
547        V: std::convert::Into<std::string::String>,
548    {
549        use std::iter::Iterator;
550        self.delegates = v.into_iter().map(|i| i.into()).collect();
551        self
552    }
553
554    /// Sets the value of [audience][crate::model::GenerateIdTokenRequest::audience].
555    ///
556    /// # Example
557    /// ```ignore,no_run
558    /// # use google_cloud_iam_credentials_v1::model::GenerateIdTokenRequest;
559    /// let x = GenerateIdTokenRequest::new().set_audience("example");
560    /// ```
561    pub fn set_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
562        self.audience = v.into();
563        self
564    }
565
566    /// Sets the value of [include_email][crate::model::GenerateIdTokenRequest::include_email].
567    ///
568    /// # Example
569    /// ```ignore,no_run
570    /// # use google_cloud_iam_credentials_v1::model::GenerateIdTokenRequest;
571    /// let x = GenerateIdTokenRequest::new().set_include_email(true);
572    /// ```
573    pub fn set_include_email<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
574        self.include_email = v.into();
575        self
576    }
577}
578
579impl wkt::message::Message for GenerateIdTokenRequest {
580    fn typename() -> &'static str {
581        "type.googleapis.com/google.iam.credentials.v1.GenerateIdTokenRequest"
582    }
583}
584
585#[derive(Clone, Default, PartialEq)]
586#[non_exhaustive]
587pub struct GenerateIdTokenResponse {
588    /// The OpenId Connect ID token.
589    pub token: std::string::String,
590
591    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
592}
593
594impl GenerateIdTokenResponse {
595    pub fn new() -> Self {
596        std::default::Default::default()
597    }
598
599    /// Sets the value of [token][crate::model::GenerateIdTokenResponse::token].
600    ///
601    /// # Example
602    /// ```ignore,no_run
603    /// # use google_cloud_iam_credentials_v1::model::GenerateIdTokenResponse;
604    /// let x = GenerateIdTokenResponse::new().set_token("example");
605    /// ```
606    pub fn set_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
607        self.token = v.into();
608        self
609    }
610}
611
612impl wkt::message::Message for GenerateIdTokenResponse {
613    fn typename() -> &'static str {
614        "type.googleapis.com/google.iam.credentials.v1.GenerateIdTokenResponse"
615    }
616}