google_clouduseraccountsvm_beta/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// View and manage your data across Google Cloud Platform services
17 CloudPlatform,
18
19 /// View your data across Google Cloud Platform services
20 CloudPlatformReadOnly,
21
22 /// Manage your Google Cloud User Accounts
23 CloudUseraccount,
24
25 /// View your Google Cloud User Accounts
26 CloudUseraccountReadonly,
27}
28
29impl AsRef<str> for Scope {
30 fn as_ref(&self) -> &str {
31 match *self {
32 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
33 Scope::CloudPlatformReadOnly => {
34 "https://www.googleapis.com/auth/cloud-platform.read-only"
35 }
36 Scope::CloudUseraccount => "https://www.googleapis.com/auth/cloud.useraccounts",
37 Scope::CloudUseraccountReadonly => {
38 "https://www.googleapis.com/auth/cloud.useraccounts.readonly"
39 }
40 }
41 }
42}
43
44#[allow(clippy::derivable_impls)]
45impl Default for Scope {
46 fn default() -> Scope {
47 Scope::CloudUseraccountReadonly
48 }
49}
50
51// ########
52// HUB ###
53// ######
54
55/// Central instance to access all CloudUserAccounts related resource activities
56///
57/// # Examples
58///
59/// Instantiate a new hub
60///
61/// ```test_harness,no_run
62/// extern crate hyper;
63/// extern crate hyper_rustls;
64/// extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
65/// use clouduseraccountsvm_beta::api::GroupsAddMemberRequest;
66/// use clouduseraccountsvm_beta::{Result, Error};
67/// # async fn dox() {
68/// use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
69///
70/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
71/// // `client_secret`, among other things.
72/// let secret: yup_oauth2::ApplicationSecret = Default::default();
73/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
74/// // unless you replace `None` with the desired Flow.
75/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
76/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
77/// // retrieve them from storage.
78/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
79/// .with_native_roots()
80/// .unwrap()
81/// .https_only()
82/// .enable_http2()
83/// .build();
84///
85/// let executor = hyper_util::rt::TokioExecutor::new();
86/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
87/// secret,
88/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
89/// yup_oauth2::client::CustomHyperClientBuilder::from(
90/// hyper_util::client::legacy::Client::builder(executor).build(connector),
91/// ),
92/// ).build().await.unwrap();
93///
94/// let client = hyper_util::client::legacy::Client::builder(
95/// hyper_util::rt::TokioExecutor::new()
96/// )
97/// .build(
98/// hyper_rustls::HttpsConnectorBuilder::new()
99/// .with_native_roots()
100/// .unwrap()
101/// .https_or_http()
102/// .enable_http2()
103/// .build()
104/// );
105/// let mut hub = CloudUserAccounts::new(client, auth);
106/// // As the method needs a request, you would usually fill it with the desired information
107/// // into the respective structure. Some of the parts shown here might not be applicable !
108/// // Values shown here are possibly random and not representative !
109/// let mut req = GroupsAddMemberRequest::default();
110///
111/// // You can configure optional parameters by calling the respective setters at will, and
112/// // execute the final call using `doit()`.
113/// // Values shown here are possibly random and not representative !
114/// let result = hub.groups().add_member(req, "project", "groupName")
115/// .doit().await;
116///
117/// match result {
118/// Err(e) => match e {
119/// // The Error enum provides details about what exactly happened.
120/// // You can also just use its `Debug`, `Display` or `Error` traits
121/// Error::HttpError(_)
122/// |Error::Io(_)
123/// |Error::MissingAPIKey
124/// |Error::MissingToken(_)
125/// |Error::Cancelled
126/// |Error::UploadSizeLimitExceeded(_, _)
127/// |Error::Failure(_)
128/// |Error::BadRequest(_)
129/// |Error::FieldClash(_)
130/// |Error::JsonDecodeError(_, _) => println!("{}", e),
131/// },
132/// Ok(res) => println!("Success: {:?}", res),
133/// }
134/// # }
135/// ```
136#[derive(Clone)]
137pub struct CloudUserAccounts<C> {
138 pub client: common::Client<C>,
139 pub auth: Box<dyn common::GetToken>,
140 _user_agent: String,
141 _base_url: String,
142 _root_url: String,
143}
144
145impl<C> common::Hub for CloudUserAccounts<C> {}
146
147impl<'a, C> CloudUserAccounts<C> {
148 pub fn new<A: 'static + common::GetToken>(
149 client: common::Client<C>,
150 auth: A,
151 ) -> CloudUserAccounts<C> {
152 CloudUserAccounts {
153 client,
154 auth: Box::new(auth),
155 _user_agent: "google-api-rust-client/7.0.0".to_string(),
156 _base_url: "https://www.googleapis.com/clouduseraccounts/vm_beta/projects/".to_string(),
157 _root_url: "https://www.googleapis.com/".to_string(),
158 }
159 }
160
161 pub fn global_accounts_operations(&'a self) -> GlobalAccountsOperationMethods<'a, C> {
162 GlobalAccountsOperationMethods { hub: self }
163 }
164 pub fn groups(&'a self) -> GroupMethods<'a, C> {
165 GroupMethods { hub: self }
166 }
167 pub fn linux(&'a self) -> LinuxMethods<'a, C> {
168 LinuxMethods { hub: self }
169 }
170 pub fn users(&'a self) -> UserMethods<'a, C> {
171 UserMethods { hub: self }
172 }
173
174 /// Set the user-agent header field to use in all requests to the server.
175 /// It defaults to `google-api-rust-client/7.0.0`.
176 ///
177 /// Returns the previously set user-agent.
178 pub fn user_agent(&mut self, agent_name: String) -> String {
179 std::mem::replace(&mut self._user_agent, agent_name)
180 }
181
182 /// Set the base url to use in all requests to the server.
183 /// It defaults to `https://www.googleapis.com/clouduseraccounts/vm_beta/projects/`.
184 ///
185 /// Returns the previously set base url.
186 pub fn base_url(&mut self, new_base_url: String) -> String {
187 std::mem::replace(&mut self._base_url, new_base_url)
188 }
189
190 /// Set the root url to use in all requests to the server.
191 /// It defaults to `https://www.googleapis.com/`.
192 ///
193 /// Returns the previously set root url.
194 pub fn root_url(&mut self, new_root_url: String) -> String {
195 std::mem::replace(&mut self._root_url, new_root_url)
196 }
197}
198
199// ############
200// SCHEMAS ###
201// ##########
202/// A list of authorized public keys for a user account.
203///
204/// This type is not used in any activity, and only used as *part* of another schema.
205///
206#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
207#[serde_with::serde_as]
208#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
209pub struct AuthorizedKeysView {
210 /// [Output Only] The list of authorized public keys in SSH format.
211 pub keys: Option<Vec<String>>,
212 /// [Output Only] Whether the user has the ability to elevate on the instance that requested the authorized keys.
213 pub sudoer: Option<bool>,
214}
215
216impl common::Part for AuthorizedKeysView {}
217
218/// A Group resource.
219///
220/// # Activities
221///
222/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
223/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
224///
225/// * [add member groups](GroupAddMemberCall) (none)
226/// * [delete groups](GroupDeleteCall) (none)
227/// * [get groups](GroupGetCall) (response)
228/// * [insert groups](GroupInsertCall) (request)
229/// * [list groups](GroupListCall) (none)
230/// * [remove member groups](GroupRemoveMemberCall) (none)
231#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
232#[serde_with::serde_as]
233#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
234pub struct Group {
235 /// [Output Only] Creation timestamp in RFC3339 text format.
236 #[serde(rename = "creationTimestamp")]
237 pub creation_timestamp: Option<String>,
238 /// An optional textual description of the resource; provided by the client when the resource is created.
239 pub description: Option<String>,
240 /// [Output Only] Unique identifier for the resource; defined by the server.
241 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
242 pub id: Option<u64>,
243 /// [Output Only] Type of the resource. Always clouduseraccounts#group for groups.
244 pub kind: Option<String>,
245 /// [Output Only] A list of URLs to User resources who belong to the group. Users may only be members of groups in the same project.
246 pub members: Option<Vec<String>>,
247 /// Name of the resource; provided by the client when the resource is created.
248 pub name: Option<String>,
249 /// [Output Only] Server defined URL for the resource.
250 #[serde(rename = "selfLink")]
251 pub self_link: Option<String>,
252}
253
254impl common::RequestValue for Group {}
255impl common::Resource for Group {}
256impl common::ResponseResult for Group {}
257
258/// There is no detailed description.
259///
260/// # Activities
261///
262/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
263/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
264///
265/// * [list groups](GroupListCall) (response)
266#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
267#[serde_with::serde_as]
268#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
269pub struct GroupList {
270 /// [Output Only] Unique identifier for the resource; defined by the server.
271 pub id: Option<String>,
272 /// [Output Only] A list of Group resources.
273 pub items: Option<Vec<Group>>,
274 /// [Output Only] Type of resource. Always clouduseraccounts#groupList for lists of groups.
275 pub kind: Option<String>,
276 /// [Output Only] A token used to continue a truncated list request.
277 #[serde(rename = "nextPageToken")]
278 pub next_page_token: Option<String>,
279 /// [Output Only] Server defined URL for this resource.
280 #[serde(rename = "selfLink")]
281 pub self_link: Option<String>,
282}
283
284impl common::ResponseResult for GroupList {}
285
286/// There is no detailed description.
287///
288/// # Activities
289///
290/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
291/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
292///
293/// * [add member groups](GroupAddMemberCall) (request)
294#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
295#[serde_with::serde_as]
296#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
297pub struct GroupsAddMemberRequest {
298 /// Fully-qualified URLs of the User resources to add.
299 pub users: Option<Vec<String>>,
300}
301
302impl common::RequestValue for GroupsAddMemberRequest {}
303
304/// There is no detailed description.
305///
306/// # Activities
307///
308/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
309/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
310///
311/// * [remove member groups](GroupRemoveMemberCall) (request)
312#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
313#[serde_with::serde_as]
314#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
315pub struct GroupsRemoveMemberRequest {
316 /// Fully-qualified URLs of the User resources to remove.
317 pub users: Option<Vec<String>>,
318}
319
320impl common::RequestValue for GroupsRemoveMemberRequest {}
321
322/// A list of all Linux accounts for this project. This API is only used by Compute Engine virtual machines to get information about user accounts for a project or instance. Linux resources are read-only views into users and groups managed by the Compute Engine Accounts API.
323///
324/// This type is not used in any activity, and only used as *part* of another schema.
325///
326#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
327#[serde_with::serde_as]
328#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
329pub struct LinuxAccountViews {
330 /// [Output Only] A list of all groups within a project.
331 #[serde(rename = "groupViews")]
332 pub group_views: Option<Vec<LinuxGroupView>>,
333 /// [Output Only] Type of the resource. Always clouduseraccounts#linuxAccountViews for Linux resources.
334 pub kind: Option<String>,
335 /// [Output Only] A list of all users within a project.
336 #[serde(rename = "userViews")]
337 pub user_views: Option<Vec<LinuxUserView>>,
338}
339
340impl common::Part for LinuxAccountViews {}
341
342/// There is no detailed description.
343///
344/// # Activities
345///
346/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
347/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
348///
349/// * [get authorized keys view linux](LinuxGetAuthorizedKeysViewCall) (response)
350#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
351#[serde_with::serde_as]
352#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
353pub struct LinuxGetAuthorizedKeysViewResponse {
354 /// [Output Only] A list of authorized public keys for a user.
355 pub resource: Option<AuthorizedKeysView>,
356}
357
358impl common::ResponseResult for LinuxGetAuthorizedKeysViewResponse {}
359
360/// There is no detailed description.
361///
362/// # Activities
363///
364/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
365/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
366///
367/// * [get linux account views linux](LinuxGetLinuxAccountViewCall) (response)
368#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
369#[serde_with::serde_as]
370#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
371pub struct LinuxGetLinuxAccountViewsResponse {
372 /// [Output Only] A list of authorized user accounts and groups.
373 pub resource: Option<LinuxAccountViews>,
374}
375
376impl common::ResponseResult for LinuxGetLinuxAccountViewsResponse {}
377
378/// A detailed view of a Linux group.
379///
380/// This type is not used in any activity, and only used as *part* of another schema.
381///
382#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
383#[serde_with::serde_as]
384#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
385pub struct LinuxGroupView {
386 /// [Output Only] The Group ID.
387 pub gid: Option<u32>,
388 /// [Output Only] Group name.
389 #[serde(rename = "groupName")]
390 pub group_name: Option<String>,
391 /// [Output Only] List of user accounts that belong to the group.
392 pub members: Option<Vec<String>>,
393}
394
395impl common::Part for LinuxGroupView {}
396
397/// A detailed view of a Linux user account.
398///
399/// This type is not used in any activity, and only used as *part* of another schema.
400///
401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
402#[serde_with::serde_as]
403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
404pub struct LinuxUserView {
405 /// [Output Only] The GECOS (user information) entry for this account.
406 pub gecos: Option<String>,
407 /// [Output Only] User's default group ID.
408 pub gid: Option<u32>,
409 /// [Output Only] The path to the home directory for this account.
410 #[serde(rename = "homeDirectory")]
411 pub home_directory: Option<String>,
412 /// [Output Only] The path to the login shell for this account.
413 pub shell: Option<String>,
414 /// [Output Only] User ID.
415 pub uid: Option<u32>,
416 /// [Output Only] The username of the account.
417 pub username: Option<String>,
418}
419
420impl common::Part for LinuxUserView {}
421
422/// An Operation resource, used to manage asynchronous API requests.
423///
424/// # Activities
425///
426/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
427/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
428///
429/// * [get global accounts operations](GlobalAccountsOperationGetCall) (response)
430/// * [add member groups](GroupAddMemberCall) (response)
431/// * [delete groups](GroupDeleteCall) (response)
432/// * [insert groups](GroupInsertCall) (response)
433/// * [remove member groups](GroupRemoveMemberCall) (response)
434/// * [add public key users](UserAddPublicKeyCall) (response)
435/// * [delete users](UserDeleteCall) (response)
436/// * [insert users](UserInsertCall) (response)
437/// * [remove public key users](UserRemovePublicKeyCall) (response)
438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
439#[serde_with::serde_as]
440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
441pub struct Operation {
442 /// [Output Only] Reserved for future use.
443 #[serde(rename = "clientOperationId")]
444 pub client_operation_id: Option<String>,
445 /// [Output Only] Creation timestamp in RFC3339 text format.
446 #[serde(rename = "creationTimestamp")]
447 pub creation_timestamp: Option<String>,
448 /// [Output Only] A textual description of the operation, which is set when the operation is created.
449 pub description: Option<String>,
450 /// [Output Only] The time that this operation was completed. This value is in RFC3339 text format.
451 #[serde(rename = "endTime")]
452 pub end_time: Option<String>,
453 /// [Output Only] If errors are generated during processing of the operation, this field will be populated.
454 pub error: Option<OperationError>,
455 /// [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND.
456 #[serde(rename = "httpErrorMessage")]
457 pub http_error_message: Option<String>,
458 /// [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found.
459 #[serde(rename = "httpErrorStatusCode")]
460 pub http_error_status_code: Option<i32>,
461 /// [Output Only] The unique identifier for the resource. This identifier is defined by the server.
462 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
463 pub id: Option<u64>,
464 /// [Output Only] The time that this operation was requested. This value is in RFC3339 text format.
465 #[serde(rename = "insertTime")]
466 pub insert_time: Option<String>,
467 /// [Output Only] Type of the resource. Always compute#operation for Operation resources.
468 pub kind: Option<String>,
469 /// [Output Only] Name of the resource.
470 pub name: Option<String>,
471 /// [Output Only] The type of operation, such as insert, update, or delete, and so on.
472 #[serde(rename = "operationType")]
473 pub operation_type: Option<String>,
474 /// [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses.
475 pub progress: Option<i32>,
476 /// [Output Only] The URL of the region where the operation resides. Only available when performing regional operations.
477 pub region: Option<String>,
478 /// [Output Only] Server-defined URL for the resource.
479 #[serde(rename = "selfLink")]
480 pub self_link: Option<String>,
481 /// [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format.
482 #[serde(rename = "startTime")]
483 pub start_time: Option<String>,
484 /// [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE.
485 pub status: Option<String>,
486 /// [Output Only] An optional textual description of the current status of the operation.
487 #[serde(rename = "statusMessage")]
488 pub status_message: Option<String>,
489 /// [Output Only] The unique target ID, which identifies a specific incarnation of the target resource.
490 #[serde(rename = "targetId")]
491 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
492 pub target_id: Option<u64>,
493 /// [Output Only] The URL of the resource that the operation modifies.
494 #[serde(rename = "targetLink")]
495 pub target_link: Option<String>,
496 /// [Output Only] User who requested the operation, for example: user@example.com.
497 pub user: Option<String>,
498 /// [Output Only] If warning messages are generated during processing of the operation, this field will be populated.
499 pub warnings: Option<Vec<OperationWarnings>>,
500 /// [Output Only] The URL of the zone where the operation resides. Only available when performing per-zone operations.
501 pub zone: Option<String>,
502}
503
504impl common::ResponseResult for Operation {}
505
506/// Contains a list of Operation resources.
507///
508/// # Activities
509///
510/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
511/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
512///
513/// * [list global accounts operations](GlobalAccountsOperationListCall) (response)
514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
515#[serde_with::serde_as]
516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
517pub struct OperationList {
518 /// [Output Only] The unique identifier for the resource. This identifier is defined by the server.
519 pub id: Option<String>,
520 /// [Output Only] A list of Operation resources.
521 pub items: Option<Vec<Operation>>,
522 /// [Output Only] Type of resource. Always compute#operations for Operations resource.
523 pub kind: Option<String>,
524 /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results.
525 #[serde(rename = "nextPageToken")]
526 pub next_page_token: Option<String>,
527 /// [Output Only] Server-defined URL for this resource.
528 #[serde(rename = "selfLink")]
529 pub self_link: Option<String>,
530}
531
532impl common::ResponseResult for OperationList {}
533
534/// A public key for authenticating to guests.
535///
536/// # Activities
537///
538/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
539/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
540///
541/// * [add public key users](UserAddPublicKeyCall) (request)
542#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
543#[serde_with::serde_as]
544#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
545pub struct PublicKey {
546 /// [Output Only] Creation timestamp in RFC3339 text format.
547 #[serde(rename = "creationTimestamp")]
548 pub creation_timestamp: Option<String>,
549 /// An optional textual description of the resource; provided by the client when the resource is created.
550 pub description: Option<String>,
551 /// Optional expiration timestamp. If provided, the timestamp must be in RFC3339 text format. If not provided, the public key never expires.
552 #[serde(rename = "expirationTimestamp")]
553 pub expiration_timestamp: Option<String>,
554 /// [Output Only] The fingerprint of the key is defined by RFC4716 to be the MD5 digest of the public key.
555 pub fingerprint: Option<String>,
556 /// Public key text in SSH format, defined by RFC4253 section 6.6.
557 pub key: Option<String>,
558}
559
560impl common::RequestValue for PublicKey {}
561
562/// A User resource.
563///
564/// # Activities
565///
566/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
567/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
568///
569/// * [add public key users](UserAddPublicKeyCall) (none)
570/// * [delete users](UserDeleteCall) (none)
571/// * [get users](UserGetCall) (response)
572/// * [insert users](UserInsertCall) (request)
573/// * [list users](UserListCall) (none)
574/// * [remove public key users](UserRemovePublicKeyCall) (none)
575#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
576#[serde_with::serde_as]
577#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
578pub struct User {
579 /// [Output Only] Creation timestamp in RFC3339 text format.
580 #[serde(rename = "creationTimestamp")]
581 pub creation_timestamp: Option<String>,
582 /// An optional textual description of the resource; provided by the client when the resource is created.
583 pub description: Option<String>,
584 /// [Output Only] A list of URLs to Group resources who contain the user. Users are only members of groups in the same project.
585 pub groups: Option<Vec<String>>,
586 /// [Output Only] Unique identifier for the resource; defined by the server.
587 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
588 pub id: Option<u64>,
589 /// [Output Only] Type of the resource. Always clouduseraccounts#user for users.
590 pub kind: Option<String>,
591 /// Name of the resource; provided by the client when the resource is created.
592 pub name: Option<String>,
593 /// Email address of account's owner. This account will be validated to make sure it exists. The email can belong to any domain, but it must be tied to a Google account.
594 pub owner: Option<String>,
595 /// [Output Only] Public keys that this user may use to login.
596 #[serde(rename = "publicKeys")]
597 pub public_keys: Option<Vec<PublicKey>>,
598 /// [Output Only] Server defined URL for the resource.
599 #[serde(rename = "selfLink")]
600 pub self_link: Option<String>,
601}
602
603impl common::RequestValue for User {}
604impl common::Resource for User {}
605impl common::ResponseResult for User {}
606
607/// There is no detailed description.
608///
609/// # Activities
610///
611/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
612/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
613///
614/// * [list users](UserListCall) (response)
615#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
616#[serde_with::serde_as]
617#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
618pub struct UserList {
619 /// [Output Only] Unique identifier for the resource; defined by the server.
620 pub id: Option<String>,
621 /// [Output Only] A list of User resources.
622 pub items: Option<Vec<User>>,
623 /// [Output Only] Type of resource. Always clouduseraccounts#userList for lists of users.
624 pub kind: Option<String>,
625 /// [Output Only] A token used to continue a truncated list request.
626 #[serde(rename = "nextPageToken")]
627 pub next_page_token: Option<String>,
628 /// [Output Only] Server defined URL for this resource.
629 #[serde(rename = "selfLink")]
630 pub self_link: Option<String>,
631}
632
633impl common::ResponseResult for UserList {}
634
635/// [Output Only] If errors are generated during processing of the operation, this field will be populated.
636///
637/// This type is not used in any activity, and only used as *part* of another schema.
638///
639#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
640#[serde_with::serde_as]
641#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
642pub struct OperationError {
643 /// [Output Only] The array of errors encountered while processing this operation.
644 pub errors: Option<Vec<OperationErrorErrors>>,
645}
646
647impl common::NestedType for OperationError {}
648impl common::Part for OperationError {}
649
650/// [Output Only] The array of errors encountered while processing this operation.
651///
652/// This type is not used in any activity, and only used as *part* of another schema.
653///
654#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
655#[serde_with::serde_as]
656#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
657pub struct OperationErrorErrors {
658 /// [Output Only] The error type identifier for this error.
659 pub code: Option<String>,
660 /// [Output Only] Indicates the field in the request that caused the error. This property is optional.
661 pub location: Option<String>,
662 /// [Output Only] An optional, human-readable error message.
663 pub message: Option<String>,
664}
665
666impl common::NestedType for OperationErrorErrors {}
667impl common::Part for OperationErrorErrors {}
668
669/// [Output Only] If warning messages are generated during processing of the operation, this field will be populated.
670///
671/// This type is not used in any activity, and only used as *part* of another schema.
672///
673#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
674#[serde_with::serde_as]
675#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
676pub struct OperationWarnings {
677 /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response.
678 pub code: Option<String>,
679 /// [Output Only] Metadata about this warning in key: value format. For example:
680 /// "data": [ { "key": "scope", "value": "zones/us-east1-d" }
681 pub data: Option<Vec<OperationWarningsData>>,
682 /// [Output Only] A human-readable description of the warning code.
683 pub message: Option<String>,
684}
685
686impl common::NestedType for OperationWarnings {}
687impl common::Part for OperationWarnings {}
688
689/// [Output Only] Metadata about this warning in key: value format. For example:
690/// "data": [ { "key": "scope", "value": "zones/us-east1-d" }
691///
692/// This type is not used in any activity, and only used as *part* of another schema.
693///
694#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
695#[serde_with::serde_as]
696#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
697pub struct OperationWarningsData {
698 /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding).
699 pub key: Option<String>,
700 /// [Output Only] A warning data value corresponding to the key.
701 pub value: Option<String>,
702}
703
704impl common::NestedType for OperationWarningsData {}
705impl common::Part for OperationWarningsData {}
706
707// ###################
708// MethodBuilders ###
709// #################
710
711/// A builder providing access to all methods supported on *globalAccountsOperation* resources.
712/// It is not used directly, but through the [`CloudUserAccounts`] hub.
713///
714/// # Example
715///
716/// Instantiate a resource builder
717///
718/// ```test_harness,no_run
719/// extern crate hyper;
720/// extern crate hyper_rustls;
721/// extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
722///
723/// # async fn dox() {
724/// use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
725///
726/// let secret: yup_oauth2::ApplicationSecret = Default::default();
727/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
728/// .with_native_roots()
729/// .unwrap()
730/// .https_only()
731/// .enable_http2()
732/// .build();
733///
734/// let executor = hyper_util::rt::TokioExecutor::new();
735/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
736/// secret,
737/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
738/// yup_oauth2::client::CustomHyperClientBuilder::from(
739/// hyper_util::client::legacy::Client::builder(executor).build(connector),
740/// ),
741/// ).build().await.unwrap();
742///
743/// let client = hyper_util::client::legacy::Client::builder(
744/// hyper_util::rt::TokioExecutor::new()
745/// )
746/// .build(
747/// hyper_rustls::HttpsConnectorBuilder::new()
748/// .with_native_roots()
749/// .unwrap()
750/// .https_or_http()
751/// .enable_http2()
752/// .build()
753/// );
754/// let mut hub = CloudUserAccounts::new(client, auth);
755/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
756/// // like `delete(...)`, `get(...)` and `list(...)`
757/// // to build up your call.
758/// let rb = hub.global_accounts_operations();
759/// # }
760/// ```
761pub struct GlobalAccountsOperationMethods<'a, C>
762where
763 C: 'a,
764{
765 hub: &'a CloudUserAccounts<C>,
766}
767
768impl<'a, C> common::MethodsBuilder for GlobalAccountsOperationMethods<'a, C> {}
769
770impl<'a, C> GlobalAccountsOperationMethods<'a, C> {
771 /// Create a builder to help you perform the following task:
772 ///
773 /// Deletes the specified operation resource.
774 ///
775 /// # Arguments
776 ///
777 /// * `project` - Project ID for this request.
778 /// * `operation` - Name of the Operations resource to delete.
779 pub fn delete(
780 &self,
781 project: &str,
782 operation: &str,
783 ) -> GlobalAccountsOperationDeleteCall<'a, C> {
784 GlobalAccountsOperationDeleteCall {
785 hub: self.hub,
786 _project: project.to_string(),
787 _operation: operation.to_string(),
788 _delegate: Default::default(),
789 _additional_params: Default::default(),
790 _scopes: Default::default(),
791 }
792 }
793
794 /// Create a builder to help you perform the following task:
795 ///
796 /// Retrieves the specified operation resource.
797 ///
798 /// # Arguments
799 ///
800 /// * `project` - Project ID for this request.
801 /// * `operation` - Name of the Operations resource to return.
802 pub fn get(&self, project: &str, operation: &str) -> GlobalAccountsOperationGetCall<'a, C> {
803 GlobalAccountsOperationGetCall {
804 hub: self.hub,
805 _project: project.to_string(),
806 _operation: operation.to_string(),
807 _delegate: Default::default(),
808 _additional_params: Default::default(),
809 _scopes: Default::default(),
810 }
811 }
812
813 /// Create a builder to help you perform the following task:
814 ///
815 /// Retrieves the list of operation resources contained within the specified project.
816 ///
817 /// # Arguments
818 ///
819 /// * `project` - Project ID for this request.
820 pub fn list(&self, project: &str) -> GlobalAccountsOperationListCall<'a, C> {
821 GlobalAccountsOperationListCall {
822 hub: self.hub,
823 _project: project.to_string(),
824 _page_token: Default::default(),
825 _order_by: Default::default(),
826 _max_results: Default::default(),
827 _filter: Default::default(),
828 _delegate: Default::default(),
829 _additional_params: Default::default(),
830 _scopes: Default::default(),
831 }
832 }
833}
834
835/// A builder providing access to all methods supported on *group* resources.
836/// It is not used directly, but through the [`CloudUserAccounts`] hub.
837///
838/// # Example
839///
840/// Instantiate a resource builder
841///
842/// ```test_harness,no_run
843/// extern crate hyper;
844/// extern crate hyper_rustls;
845/// extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
846///
847/// # async fn dox() {
848/// use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
849///
850/// let secret: yup_oauth2::ApplicationSecret = Default::default();
851/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
852/// .with_native_roots()
853/// .unwrap()
854/// .https_only()
855/// .enable_http2()
856/// .build();
857///
858/// let executor = hyper_util::rt::TokioExecutor::new();
859/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
860/// secret,
861/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
862/// yup_oauth2::client::CustomHyperClientBuilder::from(
863/// hyper_util::client::legacy::Client::builder(executor).build(connector),
864/// ),
865/// ).build().await.unwrap();
866///
867/// let client = hyper_util::client::legacy::Client::builder(
868/// hyper_util::rt::TokioExecutor::new()
869/// )
870/// .build(
871/// hyper_rustls::HttpsConnectorBuilder::new()
872/// .with_native_roots()
873/// .unwrap()
874/// .https_or_http()
875/// .enable_http2()
876/// .build()
877/// );
878/// let mut hub = CloudUserAccounts::new(client, auth);
879/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
880/// // like `add_member(...)`, `delete(...)`, `get(...)`, `insert(...)`, `list(...)` and `remove_member(...)`
881/// // to build up your call.
882/// let rb = hub.groups();
883/// # }
884/// ```
885pub struct GroupMethods<'a, C>
886where
887 C: 'a,
888{
889 hub: &'a CloudUserAccounts<C>,
890}
891
892impl<'a, C> common::MethodsBuilder for GroupMethods<'a, C> {}
893
894impl<'a, C> GroupMethods<'a, C> {
895 /// Create a builder to help you perform the following task:
896 ///
897 /// Adds users to the specified group.
898 ///
899 /// # Arguments
900 ///
901 /// * `request` - No description provided.
902 /// * `project` - Project ID for this request.
903 /// * `groupName` - Name of the group for this request.
904 pub fn add_member(
905 &self,
906 request: GroupsAddMemberRequest,
907 project: &str,
908 group_name: &str,
909 ) -> GroupAddMemberCall<'a, C> {
910 GroupAddMemberCall {
911 hub: self.hub,
912 _request: request,
913 _project: project.to_string(),
914 _group_name: group_name.to_string(),
915 _delegate: Default::default(),
916 _additional_params: Default::default(),
917 _scopes: Default::default(),
918 }
919 }
920
921 /// Create a builder to help you perform the following task:
922 ///
923 /// Deletes the specified Group resource.
924 ///
925 /// # Arguments
926 ///
927 /// * `project` - Project ID for this request.
928 /// * `groupName` - Name of the Group resource to delete.
929 pub fn delete(&self, project: &str, group_name: &str) -> GroupDeleteCall<'a, C> {
930 GroupDeleteCall {
931 hub: self.hub,
932 _project: project.to_string(),
933 _group_name: group_name.to_string(),
934 _delegate: Default::default(),
935 _additional_params: Default::default(),
936 _scopes: Default::default(),
937 }
938 }
939
940 /// Create a builder to help you perform the following task:
941 ///
942 /// Returns the specified Group resource.
943 ///
944 /// # Arguments
945 ///
946 /// * `project` - Project ID for this request.
947 /// * `groupName` - Name of the Group resource to return.
948 pub fn get(&self, project: &str, group_name: &str) -> GroupGetCall<'a, C> {
949 GroupGetCall {
950 hub: self.hub,
951 _project: project.to_string(),
952 _group_name: group_name.to_string(),
953 _delegate: Default::default(),
954 _additional_params: Default::default(),
955 _scopes: Default::default(),
956 }
957 }
958
959 /// Create a builder to help you perform the following task:
960 ///
961 /// Creates a Group resource in the specified project using the data included in the request.
962 ///
963 /// # Arguments
964 ///
965 /// * `request` - No description provided.
966 /// * `project` - Project ID for this request.
967 pub fn insert(&self, request: Group, project: &str) -> GroupInsertCall<'a, C> {
968 GroupInsertCall {
969 hub: self.hub,
970 _request: request,
971 _project: project.to_string(),
972 _delegate: Default::default(),
973 _additional_params: Default::default(),
974 _scopes: Default::default(),
975 }
976 }
977
978 /// Create a builder to help you perform the following task:
979 ///
980 /// Retrieves the list of groups contained within the specified project.
981 ///
982 /// # Arguments
983 ///
984 /// * `project` - Project ID for this request.
985 pub fn list(&self, project: &str) -> GroupListCall<'a, C> {
986 GroupListCall {
987 hub: self.hub,
988 _project: project.to_string(),
989 _page_token: Default::default(),
990 _order_by: Default::default(),
991 _max_results: Default::default(),
992 _filter: Default::default(),
993 _delegate: Default::default(),
994 _additional_params: Default::default(),
995 _scopes: Default::default(),
996 }
997 }
998
999 /// Create a builder to help you perform the following task:
1000 ///
1001 /// Removes users from the specified group.
1002 ///
1003 /// # Arguments
1004 ///
1005 /// * `request` - No description provided.
1006 /// * `project` - Project ID for this request.
1007 /// * `groupName` - Name of the group for this request.
1008 pub fn remove_member(
1009 &self,
1010 request: GroupsRemoveMemberRequest,
1011 project: &str,
1012 group_name: &str,
1013 ) -> GroupRemoveMemberCall<'a, C> {
1014 GroupRemoveMemberCall {
1015 hub: self.hub,
1016 _request: request,
1017 _project: project.to_string(),
1018 _group_name: group_name.to_string(),
1019 _delegate: Default::default(),
1020 _additional_params: Default::default(),
1021 _scopes: Default::default(),
1022 }
1023 }
1024}
1025
1026/// A builder providing access to all methods supported on *linux* resources.
1027/// It is not used directly, but through the [`CloudUserAccounts`] hub.
1028///
1029/// # Example
1030///
1031/// Instantiate a resource builder
1032///
1033/// ```test_harness,no_run
1034/// extern crate hyper;
1035/// extern crate hyper_rustls;
1036/// extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
1037///
1038/// # async fn dox() {
1039/// use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1040///
1041/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1042/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1043/// .with_native_roots()
1044/// .unwrap()
1045/// .https_only()
1046/// .enable_http2()
1047/// .build();
1048///
1049/// let executor = hyper_util::rt::TokioExecutor::new();
1050/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1051/// secret,
1052/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1053/// yup_oauth2::client::CustomHyperClientBuilder::from(
1054/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1055/// ),
1056/// ).build().await.unwrap();
1057///
1058/// let client = hyper_util::client::legacy::Client::builder(
1059/// hyper_util::rt::TokioExecutor::new()
1060/// )
1061/// .build(
1062/// hyper_rustls::HttpsConnectorBuilder::new()
1063/// .with_native_roots()
1064/// .unwrap()
1065/// .https_or_http()
1066/// .enable_http2()
1067/// .build()
1068/// );
1069/// let mut hub = CloudUserAccounts::new(client, auth);
1070/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1071/// // like `get_authorized_keys_view(...)` and `get_linux_account_views(...)`
1072/// // to build up your call.
1073/// let rb = hub.linux();
1074/// # }
1075/// ```
1076pub struct LinuxMethods<'a, C>
1077where
1078 C: 'a,
1079{
1080 hub: &'a CloudUserAccounts<C>,
1081}
1082
1083impl<'a, C> common::MethodsBuilder for LinuxMethods<'a, C> {}
1084
1085impl<'a, C> LinuxMethods<'a, C> {
1086 /// Create a builder to help you perform the following task:
1087 ///
1088 /// Returns a list of authorized public keys for a specific user account.
1089 ///
1090 /// # Arguments
1091 ///
1092 /// * `project` - Project ID for this request.
1093 /// * `zone` - Name of the zone for this request.
1094 /// * `user` - The user account for which you want to get a list of authorized public keys.
1095 /// * `instance` - The fully-qualified URL of the virtual machine requesting the view.
1096 pub fn get_authorized_keys_view(
1097 &self,
1098 project: &str,
1099 zone: &str,
1100 user: &str,
1101 instance: &str,
1102 ) -> LinuxGetAuthorizedKeysViewCall<'a, C> {
1103 LinuxGetAuthorizedKeysViewCall {
1104 hub: self.hub,
1105 _project: project.to_string(),
1106 _zone: zone.to_string(),
1107 _user: user.to_string(),
1108 _instance: instance.to_string(),
1109 _login: Default::default(),
1110 _delegate: Default::default(),
1111 _additional_params: Default::default(),
1112 _scopes: Default::default(),
1113 }
1114 }
1115
1116 /// Create a builder to help you perform the following task:
1117 ///
1118 /// Retrieves a list of user accounts for an instance within a specific project.
1119 ///
1120 /// # Arguments
1121 ///
1122 /// * `project` - Project ID for this request.
1123 /// * `zone` - Name of the zone for this request.
1124 /// * `instance` - The fully-qualified URL of the virtual machine requesting the views.
1125 pub fn get_linux_account_views(
1126 &self,
1127 project: &str,
1128 zone: &str,
1129 instance: &str,
1130 ) -> LinuxGetLinuxAccountViewCall<'a, C> {
1131 LinuxGetLinuxAccountViewCall {
1132 hub: self.hub,
1133 _project: project.to_string(),
1134 _zone: zone.to_string(),
1135 _instance: instance.to_string(),
1136 _page_token: Default::default(),
1137 _order_by: Default::default(),
1138 _max_results: Default::default(),
1139 _filter: Default::default(),
1140 _delegate: Default::default(),
1141 _additional_params: Default::default(),
1142 _scopes: Default::default(),
1143 }
1144 }
1145}
1146
1147/// A builder providing access to all methods supported on *user* resources.
1148/// It is not used directly, but through the [`CloudUserAccounts`] hub.
1149///
1150/// # Example
1151///
1152/// Instantiate a resource builder
1153///
1154/// ```test_harness,no_run
1155/// extern crate hyper;
1156/// extern crate hyper_rustls;
1157/// extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
1158///
1159/// # async fn dox() {
1160/// use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1161///
1162/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1163/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1164/// .with_native_roots()
1165/// .unwrap()
1166/// .https_only()
1167/// .enable_http2()
1168/// .build();
1169///
1170/// let executor = hyper_util::rt::TokioExecutor::new();
1171/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1172/// secret,
1173/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1174/// yup_oauth2::client::CustomHyperClientBuilder::from(
1175/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1176/// ),
1177/// ).build().await.unwrap();
1178///
1179/// let client = hyper_util::client::legacy::Client::builder(
1180/// hyper_util::rt::TokioExecutor::new()
1181/// )
1182/// .build(
1183/// hyper_rustls::HttpsConnectorBuilder::new()
1184/// .with_native_roots()
1185/// .unwrap()
1186/// .https_or_http()
1187/// .enable_http2()
1188/// .build()
1189/// );
1190/// let mut hub = CloudUserAccounts::new(client, auth);
1191/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1192/// // like `add_public_key(...)`, `delete(...)`, `get(...)`, `insert(...)`, `list(...)` and `remove_public_key(...)`
1193/// // to build up your call.
1194/// let rb = hub.users();
1195/// # }
1196/// ```
1197pub struct UserMethods<'a, C>
1198where
1199 C: 'a,
1200{
1201 hub: &'a CloudUserAccounts<C>,
1202}
1203
1204impl<'a, C> common::MethodsBuilder for UserMethods<'a, C> {}
1205
1206impl<'a, C> UserMethods<'a, C> {
1207 /// Create a builder to help you perform the following task:
1208 ///
1209 /// Adds a public key to the specified User resource with the data included in the request.
1210 ///
1211 /// # Arguments
1212 ///
1213 /// * `request` - No description provided.
1214 /// * `project` - Project ID for this request.
1215 /// * `user` - Name of the user for this request.
1216 pub fn add_public_key(
1217 &self,
1218 request: PublicKey,
1219 project: &str,
1220 user: &str,
1221 ) -> UserAddPublicKeyCall<'a, C> {
1222 UserAddPublicKeyCall {
1223 hub: self.hub,
1224 _request: request,
1225 _project: project.to_string(),
1226 _user: user.to_string(),
1227 _delegate: Default::default(),
1228 _additional_params: Default::default(),
1229 _scopes: Default::default(),
1230 }
1231 }
1232
1233 /// Create a builder to help you perform the following task:
1234 ///
1235 /// Deletes the specified User resource.
1236 ///
1237 /// # Arguments
1238 ///
1239 /// * `project` - Project ID for this request.
1240 /// * `user` - Name of the user resource to delete.
1241 pub fn delete(&self, project: &str, user: &str) -> UserDeleteCall<'a, C> {
1242 UserDeleteCall {
1243 hub: self.hub,
1244 _project: project.to_string(),
1245 _user: user.to_string(),
1246 _delegate: Default::default(),
1247 _additional_params: Default::default(),
1248 _scopes: Default::default(),
1249 }
1250 }
1251
1252 /// Create a builder to help you perform the following task:
1253 ///
1254 /// Returns the specified User resource.
1255 ///
1256 /// # Arguments
1257 ///
1258 /// * `project` - Project ID for this request.
1259 /// * `user` - Name of the user resource to return.
1260 pub fn get(&self, project: &str, user: &str) -> UserGetCall<'a, C> {
1261 UserGetCall {
1262 hub: self.hub,
1263 _project: project.to_string(),
1264 _user: user.to_string(),
1265 _delegate: Default::default(),
1266 _additional_params: Default::default(),
1267 _scopes: Default::default(),
1268 }
1269 }
1270
1271 /// Create a builder to help you perform the following task:
1272 ///
1273 /// Creates a User resource in the specified project using the data included in the request.
1274 ///
1275 /// # Arguments
1276 ///
1277 /// * `request` - No description provided.
1278 /// * `project` - Project ID for this request.
1279 pub fn insert(&self, request: User, project: &str) -> UserInsertCall<'a, C> {
1280 UserInsertCall {
1281 hub: self.hub,
1282 _request: request,
1283 _project: project.to_string(),
1284 _delegate: Default::default(),
1285 _additional_params: Default::default(),
1286 _scopes: Default::default(),
1287 }
1288 }
1289
1290 /// Create a builder to help you perform the following task:
1291 ///
1292 /// Retrieves a list of users contained within the specified project.
1293 ///
1294 /// # Arguments
1295 ///
1296 /// * `project` - Project ID for this request.
1297 pub fn list(&self, project: &str) -> UserListCall<'a, C> {
1298 UserListCall {
1299 hub: self.hub,
1300 _project: project.to_string(),
1301 _page_token: Default::default(),
1302 _order_by: Default::default(),
1303 _max_results: Default::default(),
1304 _filter: Default::default(),
1305 _delegate: Default::default(),
1306 _additional_params: Default::default(),
1307 _scopes: Default::default(),
1308 }
1309 }
1310
1311 /// Create a builder to help you perform the following task:
1312 ///
1313 /// Removes the specified public key from the user.
1314 ///
1315 /// # Arguments
1316 ///
1317 /// * `project` - Project ID for this request.
1318 /// * `user` - Name of the user for this request.
1319 /// * `fingerprint` - The fingerprint of the public key to delete. Public keys are identified by their fingerprint, which is defined by RFC4716 to be the MD5 digest of the public key.
1320 pub fn remove_public_key(
1321 &self,
1322 project: &str,
1323 user: &str,
1324 fingerprint: &str,
1325 ) -> UserRemovePublicKeyCall<'a, C> {
1326 UserRemovePublicKeyCall {
1327 hub: self.hub,
1328 _project: project.to_string(),
1329 _user: user.to_string(),
1330 _fingerprint: fingerprint.to_string(),
1331 _delegate: Default::default(),
1332 _additional_params: Default::default(),
1333 _scopes: Default::default(),
1334 }
1335 }
1336}
1337
1338// ###################
1339// CallBuilders ###
1340// #################
1341
1342/// Deletes the specified operation resource.
1343///
1344/// A builder for the *delete* method supported by a *globalAccountsOperation* resource.
1345/// It is not used directly, but through a [`GlobalAccountsOperationMethods`] instance.
1346///
1347/// # Example
1348///
1349/// Instantiate a resource method builder
1350///
1351/// ```test_harness,no_run
1352/// # extern crate hyper;
1353/// # extern crate hyper_rustls;
1354/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
1355/// # async fn dox() {
1356/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1357///
1358/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1359/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1360/// # .with_native_roots()
1361/// # .unwrap()
1362/// # .https_only()
1363/// # .enable_http2()
1364/// # .build();
1365///
1366/// # let executor = hyper_util::rt::TokioExecutor::new();
1367/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1368/// # secret,
1369/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1370/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1371/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1372/// # ),
1373/// # ).build().await.unwrap();
1374///
1375/// # let client = hyper_util::client::legacy::Client::builder(
1376/// # hyper_util::rt::TokioExecutor::new()
1377/// # )
1378/// # .build(
1379/// # hyper_rustls::HttpsConnectorBuilder::new()
1380/// # .with_native_roots()
1381/// # .unwrap()
1382/// # .https_or_http()
1383/// # .enable_http2()
1384/// # .build()
1385/// # );
1386/// # let mut hub = CloudUserAccounts::new(client, auth);
1387/// // You can configure optional parameters by calling the respective setters at will, and
1388/// // execute the final call using `doit()`.
1389/// // Values shown here are possibly random and not representative !
1390/// let result = hub.global_accounts_operations().delete("project", "operation")
1391/// .doit().await;
1392/// # }
1393/// ```
1394pub struct GlobalAccountsOperationDeleteCall<'a, C>
1395where
1396 C: 'a,
1397{
1398 hub: &'a CloudUserAccounts<C>,
1399 _project: String,
1400 _operation: String,
1401 _delegate: Option<&'a mut dyn common::Delegate>,
1402 _additional_params: HashMap<String, String>,
1403 _scopes: BTreeSet<String>,
1404}
1405
1406impl<'a, C> common::CallBuilder for GlobalAccountsOperationDeleteCall<'a, C> {}
1407
1408impl<'a, C> GlobalAccountsOperationDeleteCall<'a, C>
1409where
1410 C: common::Connector,
1411{
1412 /// Perform the operation you have build so far.
1413 pub async fn doit(mut self) -> common::Result<common::Response> {
1414 use std::borrow::Cow;
1415 use std::io::{Read, Seek};
1416
1417 use common::{url::Params, ToParts};
1418 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1419
1420 let mut dd = common::DefaultDelegate;
1421 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1422 dlg.begin(common::MethodInfo {
1423 id: "clouduseraccounts.globalAccountsOperations.delete",
1424 http_method: hyper::Method::DELETE,
1425 });
1426
1427 for &field in ["project", "operation"].iter() {
1428 if self._additional_params.contains_key(field) {
1429 dlg.finished(false);
1430 return Err(common::Error::FieldClash(field));
1431 }
1432 }
1433
1434 let mut params = Params::with_capacity(3 + self._additional_params.len());
1435 params.push("project", self._project);
1436 params.push("operation", self._operation);
1437
1438 params.extend(self._additional_params.iter());
1439
1440 let mut url = self.hub._base_url.clone() + "{project}/global/operations/{operation}";
1441 if self._scopes.is_empty() {
1442 self._scopes
1443 .insert(Scope::CloudPlatform.as_ref().to_string());
1444 }
1445
1446 #[allow(clippy::single_element_loop)]
1447 for &(find_this, param_name) in
1448 [("{project}", "project"), ("{operation}", "operation")].iter()
1449 {
1450 url = params.uri_replacement(url, param_name, find_this, false);
1451 }
1452 {
1453 let to_remove = ["operation", "project"];
1454 params.remove_params(&to_remove);
1455 }
1456
1457 let url = params.parse_with_url(&url);
1458
1459 loop {
1460 let token = match self
1461 .hub
1462 .auth
1463 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1464 .await
1465 {
1466 Ok(token) => token,
1467 Err(e) => match dlg.token(e) {
1468 Ok(token) => token,
1469 Err(e) => {
1470 dlg.finished(false);
1471 return Err(common::Error::MissingToken(e));
1472 }
1473 },
1474 };
1475 let mut req_result = {
1476 let client = &self.hub.client;
1477 dlg.pre_request();
1478 let mut req_builder = hyper::Request::builder()
1479 .method(hyper::Method::DELETE)
1480 .uri(url.as_str())
1481 .header(USER_AGENT, self.hub._user_agent.clone());
1482
1483 if let Some(token) = token.as_ref() {
1484 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1485 }
1486
1487 let request = req_builder
1488 .header(CONTENT_LENGTH, 0_u64)
1489 .body(common::to_body::<String>(None));
1490
1491 client.request(request.unwrap()).await
1492 };
1493
1494 match req_result {
1495 Err(err) => {
1496 if let common::Retry::After(d) = dlg.http_error(&err) {
1497 sleep(d).await;
1498 continue;
1499 }
1500 dlg.finished(false);
1501 return Err(common::Error::HttpError(err));
1502 }
1503 Ok(res) => {
1504 let (mut parts, body) = res.into_parts();
1505 let mut body = common::Body::new(body);
1506 if !parts.status.is_success() {
1507 let bytes = common::to_bytes(body).await.unwrap_or_default();
1508 let error = serde_json::from_str(&common::to_string(&bytes));
1509 let response = common::to_response(parts, bytes.into());
1510
1511 if let common::Retry::After(d) =
1512 dlg.http_failure(&response, error.as_ref().ok())
1513 {
1514 sleep(d).await;
1515 continue;
1516 }
1517
1518 dlg.finished(false);
1519
1520 return Err(match error {
1521 Ok(value) => common::Error::BadRequest(value),
1522 _ => common::Error::Failure(response),
1523 });
1524 }
1525 let response = common::Response::from_parts(parts, body);
1526
1527 dlg.finished(true);
1528 return Ok(response);
1529 }
1530 }
1531 }
1532 }
1533
1534 /// Project ID for this request.
1535 ///
1536 /// Sets the *project* path property to the given value.
1537 ///
1538 /// Even though the property as already been set when instantiating this call,
1539 /// we provide this method for API completeness.
1540 pub fn project(mut self, new_value: &str) -> GlobalAccountsOperationDeleteCall<'a, C> {
1541 self._project = new_value.to_string();
1542 self
1543 }
1544 /// Name of the Operations resource to delete.
1545 ///
1546 /// Sets the *operation* path property to the given value.
1547 ///
1548 /// Even though the property as already been set when instantiating this call,
1549 /// we provide this method for API completeness.
1550 pub fn operation(mut self, new_value: &str) -> GlobalAccountsOperationDeleteCall<'a, C> {
1551 self._operation = new_value.to_string();
1552 self
1553 }
1554 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1555 /// while executing the actual API request.
1556 ///
1557 /// ````text
1558 /// It should be used to handle progress information, and to implement a certain level of resilience.
1559 /// ````
1560 ///
1561 /// Sets the *delegate* property to the given value.
1562 pub fn delegate(
1563 mut self,
1564 new_value: &'a mut dyn common::Delegate,
1565 ) -> GlobalAccountsOperationDeleteCall<'a, C> {
1566 self._delegate = Some(new_value);
1567 self
1568 }
1569
1570 /// Set any additional parameter of the query string used in the request.
1571 /// It should be used to set parameters which are not yet available through their own
1572 /// setters.
1573 ///
1574 /// Please note that this method must not be used to set any of the known parameters
1575 /// which have their own setter method. If done anyway, the request will fail.
1576 ///
1577 /// # Additional Parameters
1578 ///
1579 /// * *alt* (query-string) - Data format for the response.
1580 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1581 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1582 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1583 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1584 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
1585 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
1586 pub fn param<T>(mut self, name: T, value: T) -> GlobalAccountsOperationDeleteCall<'a, C>
1587 where
1588 T: AsRef<str>,
1589 {
1590 self._additional_params
1591 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1592 self
1593 }
1594
1595 /// Identifies the authorization scope for the method you are building.
1596 ///
1597 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1598 /// [`Scope::CloudPlatform`].
1599 ///
1600 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1601 /// tokens for more than one scope.
1602 ///
1603 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1604 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1605 /// sufficient, a read-write scope will do as well.
1606 pub fn add_scope<St>(mut self, scope: St) -> GlobalAccountsOperationDeleteCall<'a, C>
1607 where
1608 St: AsRef<str>,
1609 {
1610 self._scopes.insert(String::from(scope.as_ref()));
1611 self
1612 }
1613 /// Identifies the authorization scope(s) for the method you are building.
1614 ///
1615 /// See [`Self::add_scope()`] for details.
1616 pub fn add_scopes<I, St>(mut self, scopes: I) -> GlobalAccountsOperationDeleteCall<'a, C>
1617 where
1618 I: IntoIterator<Item = St>,
1619 St: AsRef<str>,
1620 {
1621 self._scopes
1622 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1623 self
1624 }
1625
1626 /// Removes all scopes, and no default scope will be used either.
1627 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1628 /// for details).
1629 pub fn clear_scopes(mut self) -> GlobalAccountsOperationDeleteCall<'a, C> {
1630 self._scopes.clear();
1631 self
1632 }
1633}
1634
1635/// Retrieves the specified operation resource.
1636///
1637/// A builder for the *get* method supported by a *globalAccountsOperation* resource.
1638/// It is not used directly, but through a [`GlobalAccountsOperationMethods`] instance.
1639///
1640/// # Example
1641///
1642/// Instantiate a resource method builder
1643///
1644/// ```test_harness,no_run
1645/// # extern crate hyper;
1646/// # extern crate hyper_rustls;
1647/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
1648/// # async fn dox() {
1649/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1650///
1651/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1652/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1653/// # .with_native_roots()
1654/// # .unwrap()
1655/// # .https_only()
1656/// # .enable_http2()
1657/// # .build();
1658///
1659/// # let executor = hyper_util::rt::TokioExecutor::new();
1660/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1661/// # secret,
1662/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1663/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1664/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1665/// # ),
1666/// # ).build().await.unwrap();
1667///
1668/// # let client = hyper_util::client::legacy::Client::builder(
1669/// # hyper_util::rt::TokioExecutor::new()
1670/// # )
1671/// # .build(
1672/// # hyper_rustls::HttpsConnectorBuilder::new()
1673/// # .with_native_roots()
1674/// # .unwrap()
1675/// # .https_or_http()
1676/// # .enable_http2()
1677/// # .build()
1678/// # );
1679/// # let mut hub = CloudUserAccounts::new(client, auth);
1680/// // You can configure optional parameters by calling the respective setters at will, and
1681/// // execute the final call using `doit()`.
1682/// // Values shown here are possibly random and not representative !
1683/// let result = hub.global_accounts_operations().get("project", "operation")
1684/// .doit().await;
1685/// # }
1686/// ```
1687pub struct GlobalAccountsOperationGetCall<'a, C>
1688where
1689 C: 'a,
1690{
1691 hub: &'a CloudUserAccounts<C>,
1692 _project: String,
1693 _operation: String,
1694 _delegate: Option<&'a mut dyn common::Delegate>,
1695 _additional_params: HashMap<String, String>,
1696 _scopes: BTreeSet<String>,
1697}
1698
1699impl<'a, C> common::CallBuilder for GlobalAccountsOperationGetCall<'a, C> {}
1700
1701impl<'a, C> GlobalAccountsOperationGetCall<'a, C>
1702where
1703 C: common::Connector,
1704{
1705 /// Perform the operation you have build so far.
1706 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1707 use std::borrow::Cow;
1708 use std::io::{Read, Seek};
1709
1710 use common::{url::Params, ToParts};
1711 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1712
1713 let mut dd = common::DefaultDelegate;
1714 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1715 dlg.begin(common::MethodInfo {
1716 id: "clouduseraccounts.globalAccountsOperations.get",
1717 http_method: hyper::Method::GET,
1718 });
1719
1720 for &field in ["alt", "project", "operation"].iter() {
1721 if self._additional_params.contains_key(field) {
1722 dlg.finished(false);
1723 return Err(common::Error::FieldClash(field));
1724 }
1725 }
1726
1727 let mut params = Params::with_capacity(4 + self._additional_params.len());
1728 params.push("project", self._project);
1729 params.push("operation", self._operation);
1730
1731 params.extend(self._additional_params.iter());
1732
1733 params.push("alt", "json");
1734 let mut url = self.hub._base_url.clone() + "{project}/global/operations/{operation}";
1735 if self._scopes.is_empty() {
1736 self._scopes
1737 .insert(Scope::CloudUseraccountReadonly.as_ref().to_string());
1738 }
1739
1740 #[allow(clippy::single_element_loop)]
1741 for &(find_this, param_name) in
1742 [("{project}", "project"), ("{operation}", "operation")].iter()
1743 {
1744 url = params.uri_replacement(url, param_name, find_this, false);
1745 }
1746 {
1747 let to_remove = ["operation", "project"];
1748 params.remove_params(&to_remove);
1749 }
1750
1751 let url = params.parse_with_url(&url);
1752
1753 loop {
1754 let token = match self
1755 .hub
1756 .auth
1757 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1758 .await
1759 {
1760 Ok(token) => token,
1761 Err(e) => match dlg.token(e) {
1762 Ok(token) => token,
1763 Err(e) => {
1764 dlg.finished(false);
1765 return Err(common::Error::MissingToken(e));
1766 }
1767 },
1768 };
1769 let mut req_result = {
1770 let client = &self.hub.client;
1771 dlg.pre_request();
1772 let mut req_builder = hyper::Request::builder()
1773 .method(hyper::Method::GET)
1774 .uri(url.as_str())
1775 .header(USER_AGENT, self.hub._user_agent.clone());
1776
1777 if let Some(token) = token.as_ref() {
1778 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1779 }
1780
1781 let request = req_builder
1782 .header(CONTENT_LENGTH, 0_u64)
1783 .body(common::to_body::<String>(None));
1784
1785 client.request(request.unwrap()).await
1786 };
1787
1788 match req_result {
1789 Err(err) => {
1790 if let common::Retry::After(d) = dlg.http_error(&err) {
1791 sleep(d).await;
1792 continue;
1793 }
1794 dlg.finished(false);
1795 return Err(common::Error::HttpError(err));
1796 }
1797 Ok(res) => {
1798 let (mut parts, body) = res.into_parts();
1799 let mut body = common::Body::new(body);
1800 if !parts.status.is_success() {
1801 let bytes = common::to_bytes(body).await.unwrap_or_default();
1802 let error = serde_json::from_str(&common::to_string(&bytes));
1803 let response = common::to_response(parts, bytes.into());
1804
1805 if let common::Retry::After(d) =
1806 dlg.http_failure(&response, error.as_ref().ok())
1807 {
1808 sleep(d).await;
1809 continue;
1810 }
1811
1812 dlg.finished(false);
1813
1814 return Err(match error {
1815 Ok(value) => common::Error::BadRequest(value),
1816 _ => common::Error::Failure(response),
1817 });
1818 }
1819 let response = {
1820 let bytes = common::to_bytes(body).await.unwrap_or_default();
1821 let encoded = common::to_string(&bytes);
1822 match serde_json::from_str(&encoded) {
1823 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1824 Err(error) => {
1825 dlg.response_json_decode_error(&encoded, &error);
1826 return Err(common::Error::JsonDecodeError(
1827 encoded.to_string(),
1828 error,
1829 ));
1830 }
1831 }
1832 };
1833
1834 dlg.finished(true);
1835 return Ok(response);
1836 }
1837 }
1838 }
1839 }
1840
1841 /// Project ID for this request.
1842 ///
1843 /// Sets the *project* path property to the given value.
1844 ///
1845 /// Even though the property as already been set when instantiating this call,
1846 /// we provide this method for API completeness.
1847 pub fn project(mut self, new_value: &str) -> GlobalAccountsOperationGetCall<'a, C> {
1848 self._project = new_value.to_string();
1849 self
1850 }
1851 /// Name of the Operations resource to return.
1852 ///
1853 /// Sets the *operation* path property to the given value.
1854 ///
1855 /// Even though the property as already been set when instantiating this call,
1856 /// we provide this method for API completeness.
1857 pub fn operation(mut self, new_value: &str) -> GlobalAccountsOperationGetCall<'a, C> {
1858 self._operation = new_value.to_string();
1859 self
1860 }
1861 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1862 /// while executing the actual API request.
1863 ///
1864 /// ````text
1865 /// It should be used to handle progress information, and to implement a certain level of resilience.
1866 /// ````
1867 ///
1868 /// Sets the *delegate* property to the given value.
1869 pub fn delegate(
1870 mut self,
1871 new_value: &'a mut dyn common::Delegate,
1872 ) -> GlobalAccountsOperationGetCall<'a, C> {
1873 self._delegate = Some(new_value);
1874 self
1875 }
1876
1877 /// Set any additional parameter of the query string used in the request.
1878 /// It should be used to set parameters which are not yet available through their own
1879 /// setters.
1880 ///
1881 /// Please note that this method must not be used to set any of the known parameters
1882 /// which have their own setter method. If done anyway, the request will fail.
1883 ///
1884 /// # Additional Parameters
1885 ///
1886 /// * *alt* (query-string) - Data format for the response.
1887 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1888 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1889 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1890 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1891 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
1892 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
1893 pub fn param<T>(mut self, name: T, value: T) -> GlobalAccountsOperationGetCall<'a, C>
1894 where
1895 T: AsRef<str>,
1896 {
1897 self._additional_params
1898 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1899 self
1900 }
1901
1902 /// Identifies the authorization scope for the method you are building.
1903 ///
1904 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1905 /// [`Scope::CloudUseraccountReadonly`].
1906 ///
1907 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1908 /// tokens for more than one scope.
1909 ///
1910 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1911 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1912 /// sufficient, a read-write scope will do as well.
1913 pub fn add_scope<St>(mut self, scope: St) -> GlobalAccountsOperationGetCall<'a, C>
1914 where
1915 St: AsRef<str>,
1916 {
1917 self._scopes.insert(String::from(scope.as_ref()));
1918 self
1919 }
1920 /// Identifies the authorization scope(s) for the method you are building.
1921 ///
1922 /// See [`Self::add_scope()`] for details.
1923 pub fn add_scopes<I, St>(mut self, scopes: I) -> GlobalAccountsOperationGetCall<'a, C>
1924 where
1925 I: IntoIterator<Item = St>,
1926 St: AsRef<str>,
1927 {
1928 self._scopes
1929 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1930 self
1931 }
1932
1933 /// Removes all scopes, and no default scope will be used either.
1934 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1935 /// for details).
1936 pub fn clear_scopes(mut self) -> GlobalAccountsOperationGetCall<'a, C> {
1937 self._scopes.clear();
1938 self
1939 }
1940}
1941
1942/// Retrieves the list of operation resources contained within the specified project.
1943///
1944/// A builder for the *list* method supported by a *globalAccountsOperation* resource.
1945/// It is not used directly, but through a [`GlobalAccountsOperationMethods`] instance.
1946///
1947/// # Example
1948///
1949/// Instantiate a resource method builder
1950///
1951/// ```test_harness,no_run
1952/// # extern crate hyper;
1953/// # extern crate hyper_rustls;
1954/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
1955/// # async fn dox() {
1956/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1957///
1958/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1959/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1960/// # .with_native_roots()
1961/// # .unwrap()
1962/// # .https_only()
1963/// # .enable_http2()
1964/// # .build();
1965///
1966/// # let executor = hyper_util::rt::TokioExecutor::new();
1967/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1968/// # secret,
1969/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1970/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1971/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1972/// # ),
1973/// # ).build().await.unwrap();
1974///
1975/// # let client = hyper_util::client::legacy::Client::builder(
1976/// # hyper_util::rt::TokioExecutor::new()
1977/// # )
1978/// # .build(
1979/// # hyper_rustls::HttpsConnectorBuilder::new()
1980/// # .with_native_roots()
1981/// # .unwrap()
1982/// # .https_or_http()
1983/// # .enable_http2()
1984/// # .build()
1985/// # );
1986/// # let mut hub = CloudUserAccounts::new(client, auth);
1987/// // You can configure optional parameters by calling the respective setters at will, and
1988/// // execute the final call using `doit()`.
1989/// // Values shown here are possibly random and not representative !
1990/// let result = hub.global_accounts_operations().list("project")
1991/// .page_token("duo")
1992/// .order_by("ipsum")
1993/// .max_results(39)
1994/// .filter("Lorem")
1995/// .doit().await;
1996/// # }
1997/// ```
1998pub struct GlobalAccountsOperationListCall<'a, C>
1999where
2000 C: 'a,
2001{
2002 hub: &'a CloudUserAccounts<C>,
2003 _project: String,
2004 _page_token: Option<String>,
2005 _order_by: Option<String>,
2006 _max_results: Option<u32>,
2007 _filter: Option<String>,
2008 _delegate: Option<&'a mut dyn common::Delegate>,
2009 _additional_params: HashMap<String, String>,
2010 _scopes: BTreeSet<String>,
2011}
2012
2013impl<'a, C> common::CallBuilder for GlobalAccountsOperationListCall<'a, C> {}
2014
2015impl<'a, C> GlobalAccountsOperationListCall<'a, C>
2016where
2017 C: common::Connector,
2018{
2019 /// Perform the operation you have build so far.
2020 pub async fn doit(mut self) -> common::Result<(common::Response, OperationList)> {
2021 use std::borrow::Cow;
2022 use std::io::{Read, Seek};
2023
2024 use common::{url::Params, ToParts};
2025 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2026
2027 let mut dd = common::DefaultDelegate;
2028 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2029 dlg.begin(common::MethodInfo {
2030 id: "clouduseraccounts.globalAccountsOperations.list",
2031 http_method: hyper::Method::GET,
2032 });
2033
2034 for &field in [
2035 "alt",
2036 "project",
2037 "pageToken",
2038 "orderBy",
2039 "maxResults",
2040 "filter",
2041 ]
2042 .iter()
2043 {
2044 if self._additional_params.contains_key(field) {
2045 dlg.finished(false);
2046 return Err(common::Error::FieldClash(field));
2047 }
2048 }
2049
2050 let mut params = Params::with_capacity(7 + self._additional_params.len());
2051 params.push("project", self._project);
2052 if let Some(value) = self._page_token.as_ref() {
2053 params.push("pageToken", value);
2054 }
2055 if let Some(value) = self._order_by.as_ref() {
2056 params.push("orderBy", value);
2057 }
2058 if let Some(value) = self._max_results.as_ref() {
2059 params.push("maxResults", value.to_string());
2060 }
2061 if let Some(value) = self._filter.as_ref() {
2062 params.push("filter", value);
2063 }
2064
2065 params.extend(self._additional_params.iter());
2066
2067 params.push("alt", "json");
2068 let mut url = self.hub._base_url.clone() + "{project}/global/operations";
2069 if self._scopes.is_empty() {
2070 self._scopes
2071 .insert(Scope::CloudUseraccountReadonly.as_ref().to_string());
2072 }
2073
2074 #[allow(clippy::single_element_loop)]
2075 for &(find_this, param_name) in [("{project}", "project")].iter() {
2076 url = params.uri_replacement(url, param_name, find_this, false);
2077 }
2078 {
2079 let to_remove = ["project"];
2080 params.remove_params(&to_remove);
2081 }
2082
2083 let url = params.parse_with_url(&url);
2084
2085 loop {
2086 let token = match self
2087 .hub
2088 .auth
2089 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2090 .await
2091 {
2092 Ok(token) => token,
2093 Err(e) => match dlg.token(e) {
2094 Ok(token) => token,
2095 Err(e) => {
2096 dlg.finished(false);
2097 return Err(common::Error::MissingToken(e));
2098 }
2099 },
2100 };
2101 let mut req_result = {
2102 let client = &self.hub.client;
2103 dlg.pre_request();
2104 let mut req_builder = hyper::Request::builder()
2105 .method(hyper::Method::GET)
2106 .uri(url.as_str())
2107 .header(USER_AGENT, self.hub._user_agent.clone());
2108
2109 if let Some(token) = token.as_ref() {
2110 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2111 }
2112
2113 let request = req_builder
2114 .header(CONTENT_LENGTH, 0_u64)
2115 .body(common::to_body::<String>(None));
2116
2117 client.request(request.unwrap()).await
2118 };
2119
2120 match req_result {
2121 Err(err) => {
2122 if let common::Retry::After(d) = dlg.http_error(&err) {
2123 sleep(d).await;
2124 continue;
2125 }
2126 dlg.finished(false);
2127 return Err(common::Error::HttpError(err));
2128 }
2129 Ok(res) => {
2130 let (mut parts, body) = res.into_parts();
2131 let mut body = common::Body::new(body);
2132 if !parts.status.is_success() {
2133 let bytes = common::to_bytes(body).await.unwrap_or_default();
2134 let error = serde_json::from_str(&common::to_string(&bytes));
2135 let response = common::to_response(parts, bytes.into());
2136
2137 if let common::Retry::After(d) =
2138 dlg.http_failure(&response, error.as_ref().ok())
2139 {
2140 sleep(d).await;
2141 continue;
2142 }
2143
2144 dlg.finished(false);
2145
2146 return Err(match error {
2147 Ok(value) => common::Error::BadRequest(value),
2148 _ => common::Error::Failure(response),
2149 });
2150 }
2151 let response = {
2152 let bytes = common::to_bytes(body).await.unwrap_or_default();
2153 let encoded = common::to_string(&bytes);
2154 match serde_json::from_str(&encoded) {
2155 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2156 Err(error) => {
2157 dlg.response_json_decode_error(&encoded, &error);
2158 return Err(common::Error::JsonDecodeError(
2159 encoded.to_string(),
2160 error,
2161 ));
2162 }
2163 }
2164 };
2165
2166 dlg.finished(true);
2167 return Ok(response);
2168 }
2169 }
2170 }
2171 }
2172
2173 /// Project ID for this request.
2174 ///
2175 /// Sets the *project* path property to the given value.
2176 ///
2177 /// Even though the property as already been set when instantiating this call,
2178 /// we provide this method for API completeness.
2179 pub fn project(mut self, new_value: &str) -> GlobalAccountsOperationListCall<'a, C> {
2180 self._project = new_value.to_string();
2181 self
2182 }
2183 /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
2184 ///
2185 /// Sets the *page token* query property to the given value.
2186 pub fn page_token(mut self, new_value: &str) -> GlobalAccountsOperationListCall<'a, C> {
2187 self._page_token = Some(new_value.to_string());
2188 self
2189 }
2190 /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.
2191 ///
2192 /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.
2193 ///
2194 /// Currently, only sorting by name or creationTimestamp desc is supported.
2195 ///
2196 /// Sets the *order by* query property to the given value.
2197 pub fn order_by(mut self, new_value: &str) -> GlobalAccountsOperationListCall<'a, C> {
2198 self._order_by = Some(new_value.to_string());
2199 self
2200 }
2201 /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.
2202 ///
2203 /// Sets the *max results* query property to the given value.
2204 pub fn max_results(mut self, new_value: u32) -> GlobalAccountsOperationListCall<'a, C> {
2205 self._max_results = Some(new_value);
2206 self
2207 }
2208 /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.
2209 ///
2210 /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.
2211 ///
2212 /// For example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.
2213 ///
2214 /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values.
2215 ///
2216 /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.
2217 ///
2218 /// Sets the *filter* query property to the given value.
2219 pub fn filter(mut self, new_value: &str) -> GlobalAccountsOperationListCall<'a, C> {
2220 self._filter = Some(new_value.to_string());
2221 self
2222 }
2223 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2224 /// while executing the actual API request.
2225 ///
2226 /// ````text
2227 /// It should be used to handle progress information, and to implement a certain level of resilience.
2228 /// ````
2229 ///
2230 /// Sets the *delegate* property to the given value.
2231 pub fn delegate(
2232 mut self,
2233 new_value: &'a mut dyn common::Delegate,
2234 ) -> GlobalAccountsOperationListCall<'a, C> {
2235 self._delegate = Some(new_value);
2236 self
2237 }
2238
2239 /// Set any additional parameter of the query string used in the request.
2240 /// It should be used to set parameters which are not yet available through their own
2241 /// setters.
2242 ///
2243 /// Please note that this method must not be used to set any of the known parameters
2244 /// which have their own setter method. If done anyway, the request will fail.
2245 ///
2246 /// # Additional Parameters
2247 ///
2248 /// * *alt* (query-string) - Data format for the response.
2249 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2250 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2251 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2252 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2253 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
2254 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
2255 pub fn param<T>(mut self, name: T, value: T) -> GlobalAccountsOperationListCall<'a, C>
2256 where
2257 T: AsRef<str>,
2258 {
2259 self._additional_params
2260 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2261 self
2262 }
2263
2264 /// Identifies the authorization scope for the method you are building.
2265 ///
2266 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2267 /// [`Scope::CloudUseraccountReadonly`].
2268 ///
2269 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2270 /// tokens for more than one scope.
2271 ///
2272 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2273 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2274 /// sufficient, a read-write scope will do as well.
2275 pub fn add_scope<St>(mut self, scope: St) -> GlobalAccountsOperationListCall<'a, C>
2276 where
2277 St: AsRef<str>,
2278 {
2279 self._scopes.insert(String::from(scope.as_ref()));
2280 self
2281 }
2282 /// Identifies the authorization scope(s) for the method you are building.
2283 ///
2284 /// See [`Self::add_scope()`] for details.
2285 pub fn add_scopes<I, St>(mut self, scopes: I) -> GlobalAccountsOperationListCall<'a, C>
2286 where
2287 I: IntoIterator<Item = St>,
2288 St: AsRef<str>,
2289 {
2290 self._scopes
2291 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2292 self
2293 }
2294
2295 /// Removes all scopes, and no default scope will be used either.
2296 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2297 /// for details).
2298 pub fn clear_scopes(mut self) -> GlobalAccountsOperationListCall<'a, C> {
2299 self._scopes.clear();
2300 self
2301 }
2302}
2303
2304/// Adds users to the specified group.
2305///
2306/// A builder for the *addMember* method supported by a *group* resource.
2307/// It is not used directly, but through a [`GroupMethods`] instance.
2308///
2309/// # Example
2310///
2311/// Instantiate a resource method builder
2312///
2313/// ```test_harness,no_run
2314/// # extern crate hyper;
2315/// # extern crate hyper_rustls;
2316/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
2317/// use clouduseraccountsvm_beta::api::GroupsAddMemberRequest;
2318/// # async fn dox() {
2319/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2320///
2321/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2322/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2323/// # .with_native_roots()
2324/// # .unwrap()
2325/// # .https_only()
2326/// # .enable_http2()
2327/// # .build();
2328///
2329/// # let executor = hyper_util::rt::TokioExecutor::new();
2330/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2331/// # secret,
2332/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2333/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2334/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2335/// # ),
2336/// # ).build().await.unwrap();
2337///
2338/// # let client = hyper_util::client::legacy::Client::builder(
2339/// # hyper_util::rt::TokioExecutor::new()
2340/// # )
2341/// # .build(
2342/// # hyper_rustls::HttpsConnectorBuilder::new()
2343/// # .with_native_roots()
2344/// # .unwrap()
2345/// # .https_or_http()
2346/// # .enable_http2()
2347/// # .build()
2348/// # );
2349/// # let mut hub = CloudUserAccounts::new(client, auth);
2350/// // As the method needs a request, you would usually fill it with the desired information
2351/// // into the respective structure. Some of the parts shown here might not be applicable !
2352/// // Values shown here are possibly random and not representative !
2353/// let mut req = GroupsAddMemberRequest::default();
2354///
2355/// // You can configure optional parameters by calling the respective setters at will, and
2356/// // execute the final call using `doit()`.
2357/// // Values shown here are possibly random and not representative !
2358/// let result = hub.groups().add_member(req, "project", "groupName")
2359/// .doit().await;
2360/// # }
2361/// ```
2362pub struct GroupAddMemberCall<'a, C>
2363where
2364 C: 'a,
2365{
2366 hub: &'a CloudUserAccounts<C>,
2367 _request: GroupsAddMemberRequest,
2368 _project: String,
2369 _group_name: String,
2370 _delegate: Option<&'a mut dyn common::Delegate>,
2371 _additional_params: HashMap<String, String>,
2372 _scopes: BTreeSet<String>,
2373}
2374
2375impl<'a, C> common::CallBuilder for GroupAddMemberCall<'a, C> {}
2376
2377impl<'a, C> GroupAddMemberCall<'a, C>
2378where
2379 C: common::Connector,
2380{
2381 /// Perform the operation you have build so far.
2382 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2383 use std::borrow::Cow;
2384 use std::io::{Read, Seek};
2385
2386 use common::{url::Params, ToParts};
2387 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2388
2389 let mut dd = common::DefaultDelegate;
2390 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2391 dlg.begin(common::MethodInfo {
2392 id: "clouduseraccounts.groups.addMember",
2393 http_method: hyper::Method::POST,
2394 });
2395
2396 for &field in ["alt", "project", "groupName"].iter() {
2397 if self._additional_params.contains_key(field) {
2398 dlg.finished(false);
2399 return Err(common::Error::FieldClash(field));
2400 }
2401 }
2402
2403 let mut params = Params::with_capacity(5 + self._additional_params.len());
2404 params.push("project", self._project);
2405 params.push("groupName", self._group_name);
2406
2407 params.extend(self._additional_params.iter());
2408
2409 params.push("alt", "json");
2410 let mut url = self.hub._base_url.clone() + "{project}/global/groups/{groupName}/addMember";
2411 if self._scopes.is_empty() {
2412 self._scopes
2413 .insert(Scope::CloudPlatform.as_ref().to_string());
2414 }
2415
2416 #[allow(clippy::single_element_loop)]
2417 for &(find_this, param_name) in
2418 [("{project}", "project"), ("{groupName}", "groupName")].iter()
2419 {
2420 url = params.uri_replacement(url, param_name, find_this, false);
2421 }
2422 {
2423 let to_remove = ["groupName", "project"];
2424 params.remove_params(&to_remove);
2425 }
2426
2427 let url = params.parse_with_url(&url);
2428
2429 let mut json_mime_type = mime::APPLICATION_JSON;
2430 let mut request_value_reader = {
2431 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2432 common::remove_json_null_values(&mut value);
2433 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2434 serde_json::to_writer(&mut dst, &value).unwrap();
2435 dst
2436 };
2437 let request_size = request_value_reader
2438 .seek(std::io::SeekFrom::End(0))
2439 .unwrap();
2440 request_value_reader
2441 .seek(std::io::SeekFrom::Start(0))
2442 .unwrap();
2443
2444 loop {
2445 let token = match self
2446 .hub
2447 .auth
2448 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2449 .await
2450 {
2451 Ok(token) => token,
2452 Err(e) => match dlg.token(e) {
2453 Ok(token) => token,
2454 Err(e) => {
2455 dlg.finished(false);
2456 return Err(common::Error::MissingToken(e));
2457 }
2458 },
2459 };
2460 request_value_reader
2461 .seek(std::io::SeekFrom::Start(0))
2462 .unwrap();
2463 let mut req_result = {
2464 let client = &self.hub.client;
2465 dlg.pre_request();
2466 let mut req_builder = hyper::Request::builder()
2467 .method(hyper::Method::POST)
2468 .uri(url.as_str())
2469 .header(USER_AGENT, self.hub._user_agent.clone());
2470
2471 if let Some(token) = token.as_ref() {
2472 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2473 }
2474
2475 let request = req_builder
2476 .header(CONTENT_TYPE, json_mime_type.to_string())
2477 .header(CONTENT_LENGTH, request_size as u64)
2478 .body(common::to_body(
2479 request_value_reader.get_ref().clone().into(),
2480 ));
2481
2482 client.request(request.unwrap()).await
2483 };
2484
2485 match req_result {
2486 Err(err) => {
2487 if let common::Retry::After(d) = dlg.http_error(&err) {
2488 sleep(d).await;
2489 continue;
2490 }
2491 dlg.finished(false);
2492 return Err(common::Error::HttpError(err));
2493 }
2494 Ok(res) => {
2495 let (mut parts, body) = res.into_parts();
2496 let mut body = common::Body::new(body);
2497 if !parts.status.is_success() {
2498 let bytes = common::to_bytes(body).await.unwrap_or_default();
2499 let error = serde_json::from_str(&common::to_string(&bytes));
2500 let response = common::to_response(parts, bytes.into());
2501
2502 if let common::Retry::After(d) =
2503 dlg.http_failure(&response, error.as_ref().ok())
2504 {
2505 sleep(d).await;
2506 continue;
2507 }
2508
2509 dlg.finished(false);
2510
2511 return Err(match error {
2512 Ok(value) => common::Error::BadRequest(value),
2513 _ => common::Error::Failure(response),
2514 });
2515 }
2516 let response = {
2517 let bytes = common::to_bytes(body).await.unwrap_or_default();
2518 let encoded = common::to_string(&bytes);
2519 match serde_json::from_str(&encoded) {
2520 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2521 Err(error) => {
2522 dlg.response_json_decode_error(&encoded, &error);
2523 return Err(common::Error::JsonDecodeError(
2524 encoded.to_string(),
2525 error,
2526 ));
2527 }
2528 }
2529 };
2530
2531 dlg.finished(true);
2532 return Ok(response);
2533 }
2534 }
2535 }
2536 }
2537
2538 ///
2539 /// Sets the *request* property to the given value.
2540 ///
2541 /// Even though the property as already been set when instantiating this call,
2542 /// we provide this method for API completeness.
2543 pub fn request(mut self, new_value: GroupsAddMemberRequest) -> GroupAddMemberCall<'a, C> {
2544 self._request = new_value;
2545 self
2546 }
2547 /// Project ID for this request.
2548 ///
2549 /// Sets the *project* path property to the given value.
2550 ///
2551 /// Even though the property as already been set when instantiating this call,
2552 /// we provide this method for API completeness.
2553 pub fn project(mut self, new_value: &str) -> GroupAddMemberCall<'a, C> {
2554 self._project = new_value.to_string();
2555 self
2556 }
2557 /// Name of the group for this request.
2558 ///
2559 /// Sets the *group name* path property to the given value.
2560 ///
2561 /// Even though the property as already been set when instantiating this call,
2562 /// we provide this method for API completeness.
2563 pub fn group_name(mut self, new_value: &str) -> GroupAddMemberCall<'a, C> {
2564 self._group_name = new_value.to_string();
2565 self
2566 }
2567 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2568 /// while executing the actual API request.
2569 ///
2570 /// ````text
2571 /// It should be used to handle progress information, and to implement a certain level of resilience.
2572 /// ````
2573 ///
2574 /// Sets the *delegate* property to the given value.
2575 pub fn delegate(
2576 mut self,
2577 new_value: &'a mut dyn common::Delegate,
2578 ) -> GroupAddMemberCall<'a, C> {
2579 self._delegate = Some(new_value);
2580 self
2581 }
2582
2583 /// Set any additional parameter of the query string used in the request.
2584 /// It should be used to set parameters which are not yet available through their own
2585 /// setters.
2586 ///
2587 /// Please note that this method must not be used to set any of the known parameters
2588 /// which have their own setter method. If done anyway, the request will fail.
2589 ///
2590 /// # Additional Parameters
2591 ///
2592 /// * *alt* (query-string) - Data format for the response.
2593 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2594 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2595 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2596 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2597 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
2598 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
2599 pub fn param<T>(mut self, name: T, value: T) -> GroupAddMemberCall<'a, C>
2600 where
2601 T: AsRef<str>,
2602 {
2603 self._additional_params
2604 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2605 self
2606 }
2607
2608 /// Identifies the authorization scope for the method you are building.
2609 ///
2610 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2611 /// [`Scope::CloudPlatform`].
2612 ///
2613 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2614 /// tokens for more than one scope.
2615 ///
2616 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2617 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2618 /// sufficient, a read-write scope will do as well.
2619 pub fn add_scope<St>(mut self, scope: St) -> GroupAddMemberCall<'a, C>
2620 where
2621 St: AsRef<str>,
2622 {
2623 self._scopes.insert(String::from(scope.as_ref()));
2624 self
2625 }
2626 /// Identifies the authorization scope(s) for the method you are building.
2627 ///
2628 /// See [`Self::add_scope()`] for details.
2629 pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupAddMemberCall<'a, C>
2630 where
2631 I: IntoIterator<Item = St>,
2632 St: AsRef<str>,
2633 {
2634 self._scopes
2635 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2636 self
2637 }
2638
2639 /// Removes all scopes, and no default scope will be used either.
2640 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2641 /// for details).
2642 pub fn clear_scopes(mut self) -> GroupAddMemberCall<'a, C> {
2643 self._scopes.clear();
2644 self
2645 }
2646}
2647
2648/// Deletes the specified Group resource.
2649///
2650/// A builder for the *delete* method supported by a *group* resource.
2651/// It is not used directly, but through a [`GroupMethods`] instance.
2652///
2653/// # Example
2654///
2655/// Instantiate a resource method builder
2656///
2657/// ```test_harness,no_run
2658/// # extern crate hyper;
2659/// # extern crate hyper_rustls;
2660/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
2661/// # async fn dox() {
2662/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2663///
2664/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2665/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2666/// # .with_native_roots()
2667/// # .unwrap()
2668/// # .https_only()
2669/// # .enable_http2()
2670/// # .build();
2671///
2672/// # let executor = hyper_util::rt::TokioExecutor::new();
2673/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2674/// # secret,
2675/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2676/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2677/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2678/// # ),
2679/// # ).build().await.unwrap();
2680///
2681/// # let client = hyper_util::client::legacy::Client::builder(
2682/// # hyper_util::rt::TokioExecutor::new()
2683/// # )
2684/// # .build(
2685/// # hyper_rustls::HttpsConnectorBuilder::new()
2686/// # .with_native_roots()
2687/// # .unwrap()
2688/// # .https_or_http()
2689/// # .enable_http2()
2690/// # .build()
2691/// # );
2692/// # let mut hub = CloudUserAccounts::new(client, auth);
2693/// // You can configure optional parameters by calling the respective setters at will, and
2694/// // execute the final call using `doit()`.
2695/// // Values shown here are possibly random and not representative !
2696/// let result = hub.groups().delete("project", "groupName")
2697/// .doit().await;
2698/// # }
2699/// ```
2700pub struct GroupDeleteCall<'a, C>
2701where
2702 C: 'a,
2703{
2704 hub: &'a CloudUserAccounts<C>,
2705 _project: String,
2706 _group_name: String,
2707 _delegate: Option<&'a mut dyn common::Delegate>,
2708 _additional_params: HashMap<String, String>,
2709 _scopes: BTreeSet<String>,
2710}
2711
2712impl<'a, C> common::CallBuilder for GroupDeleteCall<'a, C> {}
2713
2714impl<'a, C> GroupDeleteCall<'a, C>
2715where
2716 C: common::Connector,
2717{
2718 /// Perform the operation you have build so far.
2719 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2720 use std::borrow::Cow;
2721 use std::io::{Read, Seek};
2722
2723 use common::{url::Params, ToParts};
2724 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2725
2726 let mut dd = common::DefaultDelegate;
2727 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2728 dlg.begin(common::MethodInfo {
2729 id: "clouduseraccounts.groups.delete",
2730 http_method: hyper::Method::DELETE,
2731 });
2732
2733 for &field in ["alt", "project", "groupName"].iter() {
2734 if self._additional_params.contains_key(field) {
2735 dlg.finished(false);
2736 return Err(common::Error::FieldClash(field));
2737 }
2738 }
2739
2740 let mut params = Params::with_capacity(4 + self._additional_params.len());
2741 params.push("project", self._project);
2742 params.push("groupName", self._group_name);
2743
2744 params.extend(self._additional_params.iter());
2745
2746 params.push("alt", "json");
2747 let mut url = self.hub._base_url.clone() + "{project}/global/groups/{groupName}";
2748 if self._scopes.is_empty() {
2749 self._scopes
2750 .insert(Scope::CloudPlatform.as_ref().to_string());
2751 }
2752
2753 #[allow(clippy::single_element_loop)]
2754 for &(find_this, param_name) in
2755 [("{project}", "project"), ("{groupName}", "groupName")].iter()
2756 {
2757 url = params.uri_replacement(url, param_name, find_this, false);
2758 }
2759 {
2760 let to_remove = ["groupName", "project"];
2761 params.remove_params(&to_remove);
2762 }
2763
2764 let url = params.parse_with_url(&url);
2765
2766 loop {
2767 let token = match self
2768 .hub
2769 .auth
2770 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2771 .await
2772 {
2773 Ok(token) => token,
2774 Err(e) => match dlg.token(e) {
2775 Ok(token) => token,
2776 Err(e) => {
2777 dlg.finished(false);
2778 return Err(common::Error::MissingToken(e));
2779 }
2780 },
2781 };
2782 let mut req_result = {
2783 let client = &self.hub.client;
2784 dlg.pre_request();
2785 let mut req_builder = hyper::Request::builder()
2786 .method(hyper::Method::DELETE)
2787 .uri(url.as_str())
2788 .header(USER_AGENT, self.hub._user_agent.clone());
2789
2790 if let Some(token) = token.as_ref() {
2791 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2792 }
2793
2794 let request = req_builder
2795 .header(CONTENT_LENGTH, 0_u64)
2796 .body(common::to_body::<String>(None));
2797
2798 client.request(request.unwrap()).await
2799 };
2800
2801 match req_result {
2802 Err(err) => {
2803 if let common::Retry::After(d) = dlg.http_error(&err) {
2804 sleep(d).await;
2805 continue;
2806 }
2807 dlg.finished(false);
2808 return Err(common::Error::HttpError(err));
2809 }
2810 Ok(res) => {
2811 let (mut parts, body) = res.into_parts();
2812 let mut body = common::Body::new(body);
2813 if !parts.status.is_success() {
2814 let bytes = common::to_bytes(body).await.unwrap_or_default();
2815 let error = serde_json::from_str(&common::to_string(&bytes));
2816 let response = common::to_response(parts, bytes.into());
2817
2818 if let common::Retry::After(d) =
2819 dlg.http_failure(&response, error.as_ref().ok())
2820 {
2821 sleep(d).await;
2822 continue;
2823 }
2824
2825 dlg.finished(false);
2826
2827 return Err(match error {
2828 Ok(value) => common::Error::BadRequest(value),
2829 _ => common::Error::Failure(response),
2830 });
2831 }
2832 let response = {
2833 let bytes = common::to_bytes(body).await.unwrap_or_default();
2834 let encoded = common::to_string(&bytes);
2835 match serde_json::from_str(&encoded) {
2836 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2837 Err(error) => {
2838 dlg.response_json_decode_error(&encoded, &error);
2839 return Err(common::Error::JsonDecodeError(
2840 encoded.to_string(),
2841 error,
2842 ));
2843 }
2844 }
2845 };
2846
2847 dlg.finished(true);
2848 return Ok(response);
2849 }
2850 }
2851 }
2852 }
2853
2854 /// Project ID for this request.
2855 ///
2856 /// Sets the *project* path property to the given value.
2857 ///
2858 /// Even though the property as already been set when instantiating this call,
2859 /// we provide this method for API completeness.
2860 pub fn project(mut self, new_value: &str) -> GroupDeleteCall<'a, C> {
2861 self._project = new_value.to_string();
2862 self
2863 }
2864 /// Name of the Group resource to delete.
2865 ///
2866 /// Sets the *group name* path property to the given value.
2867 ///
2868 /// Even though the property as already been set when instantiating this call,
2869 /// we provide this method for API completeness.
2870 pub fn group_name(mut self, new_value: &str) -> GroupDeleteCall<'a, C> {
2871 self._group_name = new_value.to_string();
2872 self
2873 }
2874 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2875 /// while executing the actual API request.
2876 ///
2877 /// ````text
2878 /// It should be used to handle progress information, and to implement a certain level of resilience.
2879 /// ````
2880 ///
2881 /// Sets the *delegate* property to the given value.
2882 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> GroupDeleteCall<'a, C> {
2883 self._delegate = Some(new_value);
2884 self
2885 }
2886
2887 /// Set any additional parameter of the query string used in the request.
2888 /// It should be used to set parameters which are not yet available through their own
2889 /// setters.
2890 ///
2891 /// Please note that this method must not be used to set any of the known parameters
2892 /// which have their own setter method. If done anyway, the request will fail.
2893 ///
2894 /// # Additional Parameters
2895 ///
2896 /// * *alt* (query-string) - Data format for the response.
2897 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2898 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2899 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2900 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2901 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
2902 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
2903 pub fn param<T>(mut self, name: T, value: T) -> GroupDeleteCall<'a, C>
2904 where
2905 T: AsRef<str>,
2906 {
2907 self._additional_params
2908 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2909 self
2910 }
2911
2912 /// Identifies the authorization scope for the method you are building.
2913 ///
2914 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2915 /// [`Scope::CloudPlatform`].
2916 ///
2917 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2918 /// tokens for more than one scope.
2919 ///
2920 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2921 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2922 /// sufficient, a read-write scope will do as well.
2923 pub fn add_scope<St>(mut self, scope: St) -> GroupDeleteCall<'a, C>
2924 where
2925 St: AsRef<str>,
2926 {
2927 self._scopes.insert(String::from(scope.as_ref()));
2928 self
2929 }
2930 /// Identifies the authorization scope(s) for the method you are building.
2931 ///
2932 /// See [`Self::add_scope()`] for details.
2933 pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupDeleteCall<'a, C>
2934 where
2935 I: IntoIterator<Item = St>,
2936 St: AsRef<str>,
2937 {
2938 self._scopes
2939 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2940 self
2941 }
2942
2943 /// Removes all scopes, and no default scope will be used either.
2944 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2945 /// for details).
2946 pub fn clear_scopes(mut self) -> GroupDeleteCall<'a, C> {
2947 self._scopes.clear();
2948 self
2949 }
2950}
2951
2952/// Returns the specified Group resource.
2953///
2954/// A builder for the *get* method supported by a *group* resource.
2955/// It is not used directly, but through a [`GroupMethods`] instance.
2956///
2957/// # Example
2958///
2959/// Instantiate a resource method builder
2960///
2961/// ```test_harness,no_run
2962/// # extern crate hyper;
2963/// # extern crate hyper_rustls;
2964/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
2965/// # async fn dox() {
2966/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2967///
2968/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2969/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2970/// # .with_native_roots()
2971/// # .unwrap()
2972/// # .https_only()
2973/// # .enable_http2()
2974/// # .build();
2975///
2976/// # let executor = hyper_util::rt::TokioExecutor::new();
2977/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2978/// # secret,
2979/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2980/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2981/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2982/// # ),
2983/// # ).build().await.unwrap();
2984///
2985/// # let client = hyper_util::client::legacy::Client::builder(
2986/// # hyper_util::rt::TokioExecutor::new()
2987/// # )
2988/// # .build(
2989/// # hyper_rustls::HttpsConnectorBuilder::new()
2990/// # .with_native_roots()
2991/// # .unwrap()
2992/// # .https_or_http()
2993/// # .enable_http2()
2994/// # .build()
2995/// # );
2996/// # let mut hub = CloudUserAccounts::new(client, auth);
2997/// // You can configure optional parameters by calling the respective setters at will, and
2998/// // execute the final call using `doit()`.
2999/// // Values shown here are possibly random and not representative !
3000/// let result = hub.groups().get("project", "groupName")
3001/// .doit().await;
3002/// # }
3003/// ```
3004pub struct GroupGetCall<'a, C>
3005where
3006 C: 'a,
3007{
3008 hub: &'a CloudUserAccounts<C>,
3009 _project: String,
3010 _group_name: String,
3011 _delegate: Option<&'a mut dyn common::Delegate>,
3012 _additional_params: HashMap<String, String>,
3013 _scopes: BTreeSet<String>,
3014}
3015
3016impl<'a, C> common::CallBuilder for GroupGetCall<'a, C> {}
3017
3018impl<'a, C> GroupGetCall<'a, C>
3019where
3020 C: common::Connector,
3021{
3022 /// Perform the operation you have build so far.
3023 pub async fn doit(mut self) -> common::Result<(common::Response, Group)> {
3024 use std::borrow::Cow;
3025 use std::io::{Read, Seek};
3026
3027 use common::{url::Params, ToParts};
3028 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3029
3030 let mut dd = common::DefaultDelegate;
3031 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3032 dlg.begin(common::MethodInfo {
3033 id: "clouduseraccounts.groups.get",
3034 http_method: hyper::Method::GET,
3035 });
3036
3037 for &field in ["alt", "project", "groupName"].iter() {
3038 if self._additional_params.contains_key(field) {
3039 dlg.finished(false);
3040 return Err(common::Error::FieldClash(field));
3041 }
3042 }
3043
3044 let mut params = Params::with_capacity(4 + self._additional_params.len());
3045 params.push("project", self._project);
3046 params.push("groupName", self._group_name);
3047
3048 params.extend(self._additional_params.iter());
3049
3050 params.push("alt", "json");
3051 let mut url = self.hub._base_url.clone() + "{project}/global/groups/{groupName}";
3052 if self._scopes.is_empty() {
3053 self._scopes
3054 .insert(Scope::CloudUseraccountReadonly.as_ref().to_string());
3055 }
3056
3057 #[allow(clippy::single_element_loop)]
3058 for &(find_this, param_name) in
3059 [("{project}", "project"), ("{groupName}", "groupName")].iter()
3060 {
3061 url = params.uri_replacement(url, param_name, find_this, false);
3062 }
3063 {
3064 let to_remove = ["groupName", "project"];
3065 params.remove_params(&to_remove);
3066 }
3067
3068 let url = params.parse_with_url(&url);
3069
3070 loop {
3071 let token = match self
3072 .hub
3073 .auth
3074 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3075 .await
3076 {
3077 Ok(token) => token,
3078 Err(e) => match dlg.token(e) {
3079 Ok(token) => token,
3080 Err(e) => {
3081 dlg.finished(false);
3082 return Err(common::Error::MissingToken(e));
3083 }
3084 },
3085 };
3086 let mut req_result = {
3087 let client = &self.hub.client;
3088 dlg.pre_request();
3089 let mut req_builder = hyper::Request::builder()
3090 .method(hyper::Method::GET)
3091 .uri(url.as_str())
3092 .header(USER_AGENT, self.hub._user_agent.clone());
3093
3094 if let Some(token) = token.as_ref() {
3095 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3096 }
3097
3098 let request = req_builder
3099 .header(CONTENT_LENGTH, 0_u64)
3100 .body(common::to_body::<String>(None));
3101
3102 client.request(request.unwrap()).await
3103 };
3104
3105 match req_result {
3106 Err(err) => {
3107 if let common::Retry::After(d) = dlg.http_error(&err) {
3108 sleep(d).await;
3109 continue;
3110 }
3111 dlg.finished(false);
3112 return Err(common::Error::HttpError(err));
3113 }
3114 Ok(res) => {
3115 let (mut parts, body) = res.into_parts();
3116 let mut body = common::Body::new(body);
3117 if !parts.status.is_success() {
3118 let bytes = common::to_bytes(body).await.unwrap_or_default();
3119 let error = serde_json::from_str(&common::to_string(&bytes));
3120 let response = common::to_response(parts, bytes.into());
3121
3122 if let common::Retry::After(d) =
3123 dlg.http_failure(&response, error.as_ref().ok())
3124 {
3125 sleep(d).await;
3126 continue;
3127 }
3128
3129 dlg.finished(false);
3130
3131 return Err(match error {
3132 Ok(value) => common::Error::BadRequest(value),
3133 _ => common::Error::Failure(response),
3134 });
3135 }
3136 let response = {
3137 let bytes = common::to_bytes(body).await.unwrap_or_default();
3138 let encoded = common::to_string(&bytes);
3139 match serde_json::from_str(&encoded) {
3140 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3141 Err(error) => {
3142 dlg.response_json_decode_error(&encoded, &error);
3143 return Err(common::Error::JsonDecodeError(
3144 encoded.to_string(),
3145 error,
3146 ));
3147 }
3148 }
3149 };
3150
3151 dlg.finished(true);
3152 return Ok(response);
3153 }
3154 }
3155 }
3156 }
3157
3158 /// Project ID for this request.
3159 ///
3160 /// Sets the *project* path property to the given value.
3161 ///
3162 /// Even though the property as already been set when instantiating this call,
3163 /// we provide this method for API completeness.
3164 pub fn project(mut self, new_value: &str) -> GroupGetCall<'a, C> {
3165 self._project = new_value.to_string();
3166 self
3167 }
3168 /// Name of the Group resource to return.
3169 ///
3170 /// Sets the *group name* path property to the given value.
3171 ///
3172 /// Even though the property as already been set when instantiating this call,
3173 /// we provide this method for API completeness.
3174 pub fn group_name(mut self, new_value: &str) -> GroupGetCall<'a, C> {
3175 self._group_name = new_value.to_string();
3176 self
3177 }
3178 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3179 /// while executing the actual API request.
3180 ///
3181 /// ````text
3182 /// It should be used to handle progress information, and to implement a certain level of resilience.
3183 /// ````
3184 ///
3185 /// Sets the *delegate* property to the given value.
3186 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> GroupGetCall<'a, C> {
3187 self._delegate = Some(new_value);
3188 self
3189 }
3190
3191 /// Set any additional parameter of the query string used in the request.
3192 /// It should be used to set parameters which are not yet available through their own
3193 /// setters.
3194 ///
3195 /// Please note that this method must not be used to set any of the known parameters
3196 /// which have their own setter method. If done anyway, the request will fail.
3197 ///
3198 /// # Additional Parameters
3199 ///
3200 /// * *alt* (query-string) - Data format for the response.
3201 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3202 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3203 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3204 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3205 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
3206 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
3207 pub fn param<T>(mut self, name: T, value: T) -> GroupGetCall<'a, C>
3208 where
3209 T: AsRef<str>,
3210 {
3211 self._additional_params
3212 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3213 self
3214 }
3215
3216 /// Identifies the authorization scope for the method you are building.
3217 ///
3218 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3219 /// [`Scope::CloudUseraccountReadonly`].
3220 ///
3221 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3222 /// tokens for more than one scope.
3223 ///
3224 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3225 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3226 /// sufficient, a read-write scope will do as well.
3227 pub fn add_scope<St>(mut self, scope: St) -> GroupGetCall<'a, C>
3228 where
3229 St: AsRef<str>,
3230 {
3231 self._scopes.insert(String::from(scope.as_ref()));
3232 self
3233 }
3234 /// Identifies the authorization scope(s) for the method you are building.
3235 ///
3236 /// See [`Self::add_scope()`] for details.
3237 pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupGetCall<'a, C>
3238 where
3239 I: IntoIterator<Item = St>,
3240 St: AsRef<str>,
3241 {
3242 self._scopes
3243 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3244 self
3245 }
3246
3247 /// Removes all scopes, and no default scope will be used either.
3248 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3249 /// for details).
3250 pub fn clear_scopes(mut self) -> GroupGetCall<'a, C> {
3251 self._scopes.clear();
3252 self
3253 }
3254}
3255
3256/// Creates a Group resource in the specified project using the data included in the request.
3257///
3258/// A builder for the *insert* method supported by a *group* resource.
3259/// It is not used directly, but through a [`GroupMethods`] instance.
3260///
3261/// # Example
3262///
3263/// Instantiate a resource method builder
3264///
3265/// ```test_harness,no_run
3266/// # extern crate hyper;
3267/// # extern crate hyper_rustls;
3268/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
3269/// use clouduseraccountsvm_beta::api::Group;
3270/// # async fn dox() {
3271/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3272///
3273/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3274/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3275/// # .with_native_roots()
3276/// # .unwrap()
3277/// # .https_only()
3278/// # .enable_http2()
3279/// # .build();
3280///
3281/// # let executor = hyper_util::rt::TokioExecutor::new();
3282/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3283/// # secret,
3284/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3285/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3286/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3287/// # ),
3288/// # ).build().await.unwrap();
3289///
3290/// # let client = hyper_util::client::legacy::Client::builder(
3291/// # hyper_util::rt::TokioExecutor::new()
3292/// # )
3293/// # .build(
3294/// # hyper_rustls::HttpsConnectorBuilder::new()
3295/// # .with_native_roots()
3296/// # .unwrap()
3297/// # .https_or_http()
3298/// # .enable_http2()
3299/// # .build()
3300/// # );
3301/// # let mut hub = CloudUserAccounts::new(client, auth);
3302/// // As the method needs a request, you would usually fill it with the desired information
3303/// // into the respective structure. Some of the parts shown here might not be applicable !
3304/// // Values shown here are possibly random and not representative !
3305/// let mut req = Group::default();
3306///
3307/// // You can configure optional parameters by calling the respective setters at will, and
3308/// // execute the final call using `doit()`.
3309/// // Values shown here are possibly random and not representative !
3310/// let result = hub.groups().insert(req, "project")
3311/// .doit().await;
3312/// # }
3313/// ```
3314pub struct GroupInsertCall<'a, C>
3315where
3316 C: 'a,
3317{
3318 hub: &'a CloudUserAccounts<C>,
3319 _request: Group,
3320 _project: String,
3321 _delegate: Option<&'a mut dyn common::Delegate>,
3322 _additional_params: HashMap<String, String>,
3323 _scopes: BTreeSet<String>,
3324}
3325
3326impl<'a, C> common::CallBuilder for GroupInsertCall<'a, C> {}
3327
3328impl<'a, C> GroupInsertCall<'a, C>
3329where
3330 C: common::Connector,
3331{
3332 /// Perform the operation you have build so far.
3333 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3334 use std::borrow::Cow;
3335 use std::io::{Read, Seek};
3336
3337 use common::{url::Params, ToParts};
3338 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3339
3340 let mut dd = common::DefaultDelegate;
3341 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3342 dlg.begin(common::MethodInfo {
3343 id: "clouduseraccounts.groups.insert",
3344 http_method: hyper::Method::POST,
3345 });
3346
3347 for &field in ["alt", "project"].iter() {
3348 if self._additional_params.contains_key(field) {
3349 dlg.finished(false);
3350 return Err(common::Error::FieldClash(field));
3351 }
3352 }
3353
3354 let mut params = Params::with_capacity(4 + self._additional_params.len());
3355 params.push("project", self._project);
3356
3357 params.extend(self._additional_params.iter());
3358
3359 params.push("alt", "json");
3360 let mut url = self.hub._base_url.clone() + "{project}/global/groups";
3361 if self._scopes.is_empty() {
3362 self._scopes
3363 .insert(Scope::CloudPlatform.as_ref().to_string());
3364 }
3365
3366 #[allow(clippy::single_element_loop)]
3367 for &(find_this, param_name) in [("{project}", "project")].iter() {
3368 url = params.uri_replacement(url, param_name, find_this, false);
3369 }
3370 {
3371 let to_remove = ["project"];
3372 params.remove_params(&to_remove);
3373 }
3374
3375 let url = params.parse_with_url(&url);
3376
3377 let mut json_mime_type = mime::APPLICATION_JSON;
3378 let mut request_value_reader = {
3379 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3380 common::remove_json_null_values(&mut value);
3381 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3382 serde_json::to_writer(&mut dst, &value).unwrap();
3383 dst
3384 };
3385 let request_size = request_value_reader
3386 .seek(std::io::SeekFrom::End(0))
3387 .unwrap();
3388 request_value_reader
3389 .seek(std::io::SeekFrom::Start(0))
3390 .unwrap();
3391
3392 loop {
3393 let token = match self
3394 .hub
3395 .auth
3396 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3397 .await
3398 {
3399 Ok(token) => token,
3400 Err(e) => match dlg.token(e) {
3401 Ok(token) => token,
3402 Err(e) => {
3403 dlg.finished(false);
3404 return Err(common::Error::MissingToken(e));
3405 }
3406 },
3407 };
3408 request_value_reader
3409 .seek(std::io::SeekFrom::Start(0))
3410 .unwrap();
3411 let mut req_result = {
3412 let client = &self.hub.client;
3413 dlg.pre_request();
3414 let mut req_builder = hyper::Request::builder()
3415 .method(hyper::Method::POST)
3416 .uri(url.as_str())
3417 .header(USER_AGENT, self.hub._user_agent.clone());
3418
3419 if let Some(token) = token.as_ref() {
3420 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3421 }
3422
3423 let request = req_builder
3424 .header(CONTENT_TYPE, json_mime_type.to_string())
3425 .header(CONTENT_LENGTH, request_size as u64)
3426 .body(common::to_body(
3427 request_value_reader.get_ref().clone().into(),
3428 ));
3429
3430 client.request(request.unwrap()).await
3431 };
3432
3433 match req_result {
3434 Err(err) => {
3435 if let common::Retry::After(d) = dlg.http_error(&err) {
3436 sleep(d).await;
3437 continue;
3438 }
3439 dlg.finished(false);
3440 return Err(common::Error::HttpError(err));
3441 }
3442 Ok(res) => {
3443 let (mut parts, body) = res.into_parts();
3444 let mut body = common::Body::new(body);
3445 if !parts.status.is_success() {
3446 let bytes = common::to_bytes(body).await.unwrap_or_default();
3447 let error = serde_json::from_str(&common::to_string(&bytes));
3448 let response = common::to_response(parts, bytes.into());
3449
3450 if let common::Retry::After(d) =
3451 dlg.http_failure(&response, error.as_ref().ok())
3452 {
3453 sleep(d).await;
3454 continue;
3455 }
3456
3457 dlg.finished(false);
3458
3459 return Err(match error {
3460 Ok(value) => common::Error::BadRequest(value),
3461 _ => common::Error::Failure(response),
3462 });
3463 }
3464 let response = {
3465 let bytes = common::to_bytes(body).await.unwrap_or_default();
3466 let encoded = common::to_string(&bytes);
3467 match serde_json::from_str(&encoded) {
3468 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3469 Err(error) => {
3470 dlg.response_json_decode_error(&encoded, &error);
3471 return Err(common::Error::JsonDecodeError(
3472 encoded.to_string(),
3473 error,
3474 ));
3475 }
3476 }
3477 };
3478
3479 dlg.finished(true);
3480 return Ok(response);
3481 }
3482 }
3483 }
3484 }
3485
3486 ///
3487 /// Sets the *request* property to the given value.
3488 ///
3489 /// Even though the property as already been set when instantiating this call,
3490 /// we provide this method for API completeness.
3491 pub fn request(mut self, new_value: Group) -> GroupInsertCall<'a, C> {
3492 self._request = new_value;
3493 self
3494 }
3495 /// Project ID for this request.
3496 ///
3497 /// Sets the *project* path property to the given value.
3498 ///
3499 /// Even though the property as already been set when instantiating this call,
3500 /// we provide this method for API completeness.
3501 pub fn project(mut self, new_value: &str) -> GroupInsertCall<'a, C> {
3502 self._project = new_value.to_string();
3503 self
3504 }
3505 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3506 /// while executing the actual API request.
3507 ///
3508 /// ````text
3509 /// It should be used to handle progress information, and to implement a certain level of resilience.
3510 /// ````
3511 ///
3512 /// Sets the *delegate* property to the given value.
3513 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> GroupInsertCall<'a, C> {
3514 self._delegate = Some(new_value);
3515 self
3516 }
3517
3518 /// Set any additional parameter of the query string used in the request.
3519 /// It should be used to set parameters which are not yet available through their own
3520 /// setters.
3521 ///
3522 /// Please note that this method must not be used to set any of the known parameters
3523 /// which have their own setter method. If done anyway, the request will fail.
3524 ///
3525 /// # Additional Parameters
3526 ///
3527 /// * *alt* (query-string) - Data format for the response.
3528 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3529 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3530 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3531 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3532 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
3533 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
3534 pub fn param<T>(mut self, name: T, value: T) -> GroupInsertCall<'a, C>
3535 where
3536 T: AsRef<str>,
3537 {
3538 self._additional_params
3539 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3540 self
3541 }
3542
3543 /// Identifies the authorization scope for the method you are building.
3544 ///
3545 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3546 /// [`Scope::CloudPlatform`].
3547 ///
3548 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3549 /// tokens for more than one scope.
3550 ///
3551 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3552 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3553 /// sufficient, a read-write scope will do as well.
3554 pub fn add_scope<St>(mut self, scope: St) -> GroupInsertCall<'a, C>
3555 where
3556 St: AsRef<str>,
3557 {
3558 self._scopes.insert(String::from(scope.as_ref()));
3559 self
3560 }
3561 /// Identifies the authorization scope(s) for the method you are building.
3562 ///
3563 /// See [`Self::add_scope()`] for details.
3564 pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupInsertCall<'a, C>
3565 where
3566 I: IntoIterator<Item = St>,
3567 St: AsRef<str>,
3568 {
3569 self._scopes
3570 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3571 self
3572 }
3573
3574 /// Removes all scopes, and no default scope will be used either.
3575 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3576 /// for details).
3577 pub fn clear_scopes(mut self) -> GroupInsertCall<'a, C> {
3578 self._scopes.clear();
3579 self
3580 }
3581}
3582
3583/// Retrieves the list of groups contained within the specified project.
3584///
3585/// A builder for the *list* method supported by a *group* resource.
3586/// It is not used directly, but through a [`GroupMethods`] instance.
3587///
3588/// # Example
3589///
3590/// Instantiate a resource method builder
3591///
3592/// ```test_harness,no_run
3593/// # extern crate hyper;
3594/// # extern crate hyper_rustls;
3595/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
3596/// # async fn dox() {
3597/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3598///
3599/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3600/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3601/// # .with_native_roots()
3602/// # .unwrap()
3603/// # .https_only()
3604/// # .enable_http2()
3605/// # .build();
3606///
3607/// # let executor = hyper_util::rt::TokioExecutor::new();
3608/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3609/// # secret,
3610/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3611/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3612/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3613/// # ),
3614/// # ).build().await.unwrap();
3615///
3616/// # let client = hyper_util::client::legacy::Client::builder(
3617/// # hyper_util::rt::TokioExecutor::new()
3618/// # )
3619/// # .build(
3620/// # hyper_rustls::HttpsConnectorBuilder::new()
3621/// # .with_native_roots()
3622/// # .unwrap()
3623/// # .https_or_http()
3624/// # .enable_http2()
3625/// # .build()
3626/// # );
3627/// # let mut hub = CloudUserAccounts::new(client, auth);
3628/// // You can configure optional parameters by calling the respective setters at will, and
3629/// // execute the final call using `doit()`.
3630/// // Values shown here are possibly random and not representative !
3631/// let result = hub.groups().list("project")
3632/// .page_token("ipsum")
3633/// .order_by("sed")
3634/// .max_results(64)
3635/// .filter("gubergren")
3636/// .doit().await;
3637/// # }
3638/// ```
3639pub struct GroupListCall<'a, C>
3640where
3641 C: 'a,
3642{
3643 hub: &'a CloudUserAccounts<C>,
3644 _project: String,
3645 _page_token: Option<String>,
3646 _order_by: Option<String>,
3647 _max_results: Option<u32>,
3648 _filter: Option<String>,
3649 _delegate: Option<&'a mut dyn common::Delegate>,
3650 _additional_params: HashMap<String, String>,
3651 _scopes: BTreeSet<String>,
3652}
3653
3654impl<'a, C> common::CallBuilder for GroupListCall<'a, C> {}
3655
3656impl<'a, C> GroupListCall<'a, C>
3657where
3658 C: common::Connector,
3659{
3660 /// Perform the operation you have build so far.
3661 pub async fn doit(mut self) -> common::Result<(common::Response, GroupList)> {
3662 use std::borrow::Cow;
3663 use std::io::{Read, Seek};
3664
3665 use common::{url::Params, ToParts};
3666 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3667
3668 let mut dd = common::DefaultDelegate;
3669 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3670 dlg.begin(common::MethodInfo {
3671 id: "clouduseraccounts.groups.list",
3672 http_method: hyper::Method::GET,
3673 });
3674
3675 for &field in [
3676 "alt",
3677 "project",
3678 "pageToken",
3679 "orderBy",
3680 "maxResults",
3681 "filter",
3682 ]
3683 .iter()
3684 {
3685 if self._additional_params.contains_key(field) {
3686 dlg.finished(false);
3687 return Err(common::Error::FieldClash(field));
3688 }
3689 }
3690
3691 let mut params = Params::with_capacity(7 + self._additional_params.len());
3692 params.push("project", self._project);
3693 if let Some(value) = self._page_token.as_ref() {
3694 params.push("pageToken", value);
3695 }
3696 if let Some(value) = self._order_by.as_ref() {
3697 params.push("orderBy", value);
3698 }
3699 if let Some(value) = self._max_results.as_ref() {
3700 params.push("maxResults", value.to_string());
3701 }
3702 if let Some(value) = self._filter.as_ref() {
3703 params.push("filter", value);
3704 }
3705
3706 params.extend(self._additional_params.iter());
3707
3708 params.push("alt", "json");
3709 let mut url = self.hub._base_url.clone() + "{project}/global/groups";
3710 if self._scopes.is_empty() {
3711 self._scopes
3712 .insert(Scope::CloudUseraccountReadonly.as_ref().to_string());
3713 }
3714
3715 #[allow(clippy::single_element_loop)]
3716 for &(find_this, param_name) in [("{project}", "project")].iter() {
3717 url = params.uri_replacement(url, param_name, find_this, false);
3718 }
3719 {
3720 let to_remove = ["project"];
3721 params.remove_params(&to_remove);
3722 }
3723
3724 let url = params.parse_with_url(&url);
3725
3726 loop {
3727 let token = match self
3728 .hub
3729 .auth
3730 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3731 .await
3732 {
3733 Ok(token) => token,
3734 Err(e) => match dlg.token(e) {
3735 Ok(token) => token,
3736 Err(e) => {
3737 dlg.finished(false);
3738 return Err(common::Error::MissingToken(e));
3739 }
3740 },
3741 };
3742 let mut req_result = {
3743 let client = &self.hub.client;
3744 dlg.pre_request();
3745 let mut req_builder = hyper::Request::builder()
3746 .method(hyper::Method::GET)
3747 .uri(url.as_str())
3748 .header(USER_AGENT, self.hub._user_agent.clone());
3749
3750 if let Some(token) = token.as_ref() {
3751 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3752 }
3753
3754 let request = req_builder
3755 .header(CONTENT_LENGTH, 0_u64)
3756 .body(common::to_body::<String>(None));
3757
3758 client.request(request.unwrap()).await
3759 };
3760
3761 match req_result {
3762 Err(err) => {
3763 if let common::Retry::After(d) = dlg.http_error(&err) {
3764 sleep(d).await;
3765 continue;
3766 }
3767 dlg.finished(false);
3768 return Err(common::Error::HttpError(err));
3769 }
3770 Ok(res) => {
3771 let (mut parts, body) = res.into_parts();
3772 let mut body = common::Body::new(body);
3773 if !parts.status.is_success() {
3774 let bytes = common::to_bytes(body).await.unwrap_or_default();
3775 let error = serde_json::from_str(&common::to_string(&bytes));
3776 let response = common::to_response(parts, bytes.into());
3777
3778 if let common::Retry::After(d) =
3779 dlg.http_failure(&response, error.as_ref().ok())
3780 {
3781 sleep(d).await;
3782 continue;
3783 }
3784
3785 dlg.finished(false);
3786
3787 return Err(match error {
3788 Ok(value) => common::Error::BadRequest(value),
3789 _ => common::Error::Failure(response),
3790 });
3791 }
3792 let response = {
3793 let bytes = common::to_bytes(body).await.unwrap_or_default();
3794 let encoded = common::to_string(&bytes);
3795 match serde_json::from_str(&encoded) {
3796 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3797 Err(error) => {
3798 dlg.response_json_decode_error(&encoded, &error);
3799 return Err(common::Error::JsonDecodeError(
3800 encoded.to_string(),
3801 error,
3802 ));
3803 }
3804 }
3805 };
3806
3807 dlg.finished(true);
3808 return Ok(response);
3809 }
3810 }
3811 }
3812 }
3813
3814 /// Project ID for this request.
3815 ///
3816 /// Sets the *project* path property to the given value.
3817 ///
3818 /// Even though the property as already been set when instantiating this call,
3819 /// we provide this method for API completeness.
3820 pub fn project(mut self, new_value: &str) -> GroupListCall<'a, C> {
3821 self._project = new_value.to_string();
3822 self
3823 }
3824 /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
3825 ///
3826 /// Sets the *page token* query property to the given value.
3827 pub fn page_token(mut self, new_value: &str) -> GroupListCall<'a, C> {
3828 self._page_token = Some(new_value.to_string());
3829 self
3830 }
3831 /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.
3832 ///
3833 /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.
3834 ///
3835 /// Currently, only sorting by name or creationTimestamp desc is supported.
3836 ///
3837 /// Sets the *order by* query property to the given value.
3838 pub fn order_by(mut self, new_value: &str) -> GroupListCall<'a, C> {
3839 self._order_by = Some(new_value.to_string());
3840 self
3841 }
3842 /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.
3843 ///
3844 /// Sets the *max results* query property to the given value.
3845 pub fn max_results(mut self, new_value: u32) -> GroupListCall<'a, C> {
3846 self._max_results = Some(new_value);
3847 self
3848 }
3849 /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.
3850 ///
3851 /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.
3852 ///
3853 /// For example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.
3854 ///
3855 /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values.
3856 ///
3857 /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.
3858 ///
3859 /// Sets the *filter* query property to the given value.
3860 pub fn filter(mut self, new_value: &str) -> GroupListCall<'a, C> {
3861 self._filter = Some(new_value.to_string());
3862 self
3863 }
3864 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3865 /// while executing the actual API request.
3866 ///
3867 /// ````text
3868 /// It should be used to handle progress information, and to implement a certain level of resilience.
3869 /// ````
3870 ///
3871 /// Sets the *delegate* property to the given value.
3872 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> GroupListCall<'a, C> {
3873 self._delegate = Some(new_value);
3874 self
3875 }
3876
3877 /// Set any additional parameter of the query string used in the request.
3878 /// It should be used to set parameters which are not yet available through their own
3879 /// setters.
3880 ///
3881 /// Please note that this method must not be used to set any of the known parameters
3882 /// which have their own setter method. If done anyway, the request will fail.
3883 ///
3884 /// # Additional Parameters
3885 ///
3886 /// * *alt* (query-string) - Data format for the response.
3887 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3888 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3889 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3890 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3891 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
3892 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
3893 pub fn param<T>(mut self, name: T, value: T) -> GroupListCall<'a, C>
3894 where
3895 T: AsRef<str>,
3896 {
3897 self._additional_params
3898 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3899 self
3900 }
3901
3902 /// Identifies the authorization scope for the method you are building.
3903 ///
3904 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3905 /// [`Scope::CloudUseraccountReadonly`].
3906 ///
3907 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3908 /// tokens for more than one scope.
3909 ///
3910 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3911 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3912 /// sufficient, a read-write scope will do as well.
3913 pub fn add_scope<St>(mut self, scope: St) -> GroupListCall<'a, C>
3914 where
3915 St: AsRef<str>,
3916 {
3917 self._scopes.insert(String::from(scope.as_ref()));
3918 self
3919 }
3920 /// Identifies the authorization scope(s) for the method you are building.
3921 ///
3922 /// See [`Self::add_scope()`] for details.
3923 pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupListCall<'a, C>
3924 where
3925 I: IntoIterator<Item = St>,
3926 St: AsRef<str>,
3927 {
3928 self._scopes
3929 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3930 self
3931 }
3932
3933 /// Removes all scopes, and no default scope will be used either.
3934 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3935 /// for details).
3936 pub fn clear_scopes(mut self) -> GroupListCall<'a, C> {
3937 self._scopes.clear();
3938 self
3939 }
3940}
3941
3942/// Removes users from the specified group.
3943///
3944/// A builder for the *removeMember* method supported by a *group* resource.
3945/// It is not used directly, but through a [`GroupMethods`] instance.
3946///
3947/// # Example
3948///
3949/// Instantiate a resource method builder
3950///
3951/// ```test_harness,no_run
3952/// # extern crate hyper;
3953/// # extern crate hyper_rustls;
3954/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
3955/// use clouduseraccountsvm_beta::api::GroupsRemoveMemberRequest;
3956/// # async fn dox() {
3957/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3958///
3959/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3960/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3961/// # .with_native_roots()
3962/// # .unwrap()
3963/// # .https_only()
3964/// # .enable_http2()
3965/// # .build();
3966///
3967/// # let executor = hyper_util::rt::TokioExecutor::new();
3968/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3969/// # secret,
3970/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3971/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3972/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3973/// # ),
3974/// # ).build().await.unwrap();
3975///
3976/// # let client = hyper_util::client::legacy::Client::builder(
3977/// # hyper_util::rt::TokioExecutor::new()
3978/// # )
3979/// # .build(
3980/// # hyper_rustls::HttpsConnectorBuilder::new()
3981/// # .with_native_roots()
3982/// # .unwrap()
3983/// # .https_or_http()
3984/// # .enable_http2()
3985/// # .build()
3986/// # );
3987/// # let mut hub = CloudUserAccounts::new(client, auth);
3988/// // As the method needs a request, you would usually fill it with the desired information
3989/// // into the respective structure. Some of the parts shown here might not be applicable !
3990/// // Values shown here are possibly random and not representative !
3991/// let mut req = GroupsRemoveMemberRequest::default();
3992///
3993/// // You can configure optional parameters by calling the respective setters at will, and
3994/// // execute the final call using `doit()`.
3995/// // Values shown here are possibly random and not representative !
3996/// let result = hub.groups().remove_member(req, "project", "groupName")
3997/// .doit().await;
3998/// # }
3999/// ```
4000pub struct GroupRemoveMemberCall<'a, C>
4001where
4002 C: 'a,
4003{
4004 hub: &'a CloudUserAccounts<C>,
4005 _request: GroupsRemoveMemberRequest,
4006 _project: String,
4007 _group_name: String,
4008 _delegate: Option<&'a mut dyn common::Delegate>,
4009 _additional_params: HashMap<String, String>,
4010 _scopes: BTreeSet<String>,
4011}
4012
4013impl<'a, C> common::CallBuilder for GroupRemoveMemberCall<'a, C> {}
4014
4015impl<'a, C> GroupRemoveMemberCall<'a, C>
4016where
4017 C: common::Connector,
4018{
4019 /// Perform the operation you have build so far.
4020 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4021 use std::borrow::Cow;
4022 use std::io::{Read, Seek};
4023
4024 use common::{url::Params, ToParts};
4025 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4026
4027 let mut dd = common::DefaultDelegate;
4028 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4029 dlg.begin(common::MethodInfo {
4030 id: "clouduseraccounts.groups.removeMember",
4031 http_method: hyper::Method::POST,
4032 });
4033
4034 for &field in ["alt", "project", "groupName"].iter() {
4035 if self._additional_params.contains_key(field) {
4036 dlg.finished(false);
4037 return Err(common::Error::FieldClash(field));
4038 }
4039 }
4040
4041 let mut params = Params::with_capacity(5 + self._additional_params.len());
4042 params.push("project", self._project);
4043 params.push("groupName", self._group_name);
4044
4045 params.extend(self._additional_params.iter());
4046
4047 params.push("alt", "json");
4048 let mut url =
4049 self.hub._base_url.clone() + "{project}/global/groups/{groupName}/removeMember";
4050 if self._scopes.is_empty() {
4051 self._scopes
4052 .insert(Scope::CloudPlatform.as_ref().to_string());
4053 }
4054
4055 #[allow(clippy::single_element_loop)]
4056 for &(find_this, param_name) in
4057 [("{project}", "project"), ("{groupName}", "groupName")].iter()
4058 {
4059 url = params.uri_replacement(url, param_name, find_this, false);
4060 }
4061 {
4062 let to_remove = ["groupName", "project"];
4063 params.remove_params(&to_remove);
4064 }
4065
4066 let url = params.parse_with_url(&url);
4067
4068 let mut json_mime_type = mime::APPLICATION_JSON;
4069 let mut request_value_reader = {
4070 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4071 common::remove_json_null_values(&mut value);
4072 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4073 serde_json::to_writer(&mut dst, &value).unwrap();
4074 dst
4075 };
4076 let request_size = request_value_reader
4077 .seek(std::io::SeekFrom::End(0))
4078 .unwrap();
4079 request_value_reader
4080 .seek(std::io::SeekFrom::Start(0))
4081 .unwrap();
4082
4083 loop {
4084 let token = match self
4085 .hub
4086 .auth
4087 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4088 .await
4089 {
4090 Ok(token) => token,
4091 Err(e) => match dlg.token(e) {
4092 Ok(token) => token,
4093 Err(e) => {
4094 dlg.finished(false);
4095 return Err(common::Error::MissingToken(e));
4096 }
4097 },
4098 };
4099 request_value_reader
4100 .seek(std::io::SeekFrom::Start(0))
4101 .unwrap();
4102 let mut req_result = {
4103 let client = &self.hub.client;
4104 dlg.pre_request();
4105 let mut req_builder = hyper::Request::builder()
4106 .method(hyper::Method::POST)
4107 .uri(url.as_str())
4108 .header(USER_AGENT, self.hub._user_agent.clone());
4109
4110 if let Some(token) = token.as_ref() {
4111 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4112 }
4113
4114 let request = req_builder
4115 .header(CONTENT_TYPE, json_mime_type.to_string())
4116 .header(CONTENT_LENGTH, request_size as u64)
4117 .body(common::to_body(
4118 request_value_reader.get_ref().clone().into(),
4119 ));
4120
4121 client.request(request.unwrap()).await
4122 };
4123
4124 match req_result {
4125 Err(err) => {
4126 if let common::Retry::After(d) = dlg.http_error(&err) {
4127 sleep(d).await;
4128 continue;
4129 }
4130 dlg.finished(false);
4131 return Err(common::Error::HttpError(err));
4132 }
4133 Ok(res) => {
4134 let (mut parts, body) = res.into_parts();
4135 let mut body = common::Body::new(body);
4136 if !parts.status.is_success() {
4137 let bytes = common::to_bytes(body).await.unwrap_or_default();
4138 let error = serde_json::from_str(&common::to_string(&bytes));
4139 let response = common::to_response(parts, bytes.into());
4140
4141 if let common::Retry::After(d) =
4142 dlg.http_failure(&response, error.as_ref().ok())
4143 {
4144 sleep(d).await;
4145 continue;
4146 }
4147
4148 dlg.finished(false);
4149
4150 return Err(match error {
4151 Ok(value) => common::Error::BadRequest(value),
4152 _ => common::Error::Failure(response),
4153 });
4154 }
4155 let response = {
4156 let bytes = common::to_bytes(body).await.unwrap_or_default();
4157 let encoded = common::to_string(&bytes);
4158 match serde_json::from_str(&encoded) {
4159 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4160 Err(error) => {
4161 dlg.response_json_decode_error(&encoded, &error);
4162 return Err(common::Error::JsonDecodeError(
4163 encoded.to_string(),
4164 error,
4165 ));
4166 }
4167 }
4168 };
4169
4170 dlg.finished(true);
4171 return Ok(response);
4172 }
4173 }
4174 }
4175 }
4176
4177 ///
4178 /// Sets the *request* property to the given value.
4179 ///
4180 /// Even though the property as already been set when instantiating this call,
4181 /// we provide this method for API completeness.
4182 pub fn request(mut self, new_value: GroupsRemoveMemberRequest) -> GroupRemoveMemberCall<'a, C> {
4183 self._request = new_value;
4184 self
4185 }
4186 /// Project ID for this request.
4187 ///
4188 /// Sets the *project* path property to the given value.
4189 ///
4190 /// Even though the property as already been set when instantiating this call,
4191 /// we provide this method for API completeness.
4192 pub fn project(mut self, new_value: &str) -> GroupRemoveMemberCall<'a, C> {
4193 self._project = new_value.to_string();
4194 self
4195 }
4196 /// Name of the group for this request.
4197 ///
4198 /// Sets the *group name* path property to the given value.
4199 ///
4200 /// Even though the property as already been set when instantiating this call,
4201 /// we provide this method for API completeness.
4202 pub fn group_name(mut self, new_value: &str) -> GroupRemoveMemberCall<'a, C> {
4203 self._group_name = new_value.to_string();
4204 self
4205 }
4206 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4207 /// while executing the actual API request.
4208 ///
4209 /// ````text
4210 /// It should be used to handle progress information, and to implement a certain level of resilience.
4211 /// ````
4212 ///
4213 /// Sets the *delegate* property to the given value.
4214 pub fn delegate(
4215 mut self,
4216 new_value: &'a mut dyn common::Delegate,
4217 ) -> GroupRemoveMemberCall<'a, C> {
4218 self._delegate = Some(new_value);
4219 self
4220 }
4221
4222 /// Set any additional parameter of the query string used in the request.
4223 /// It should be used to set parameters which are not yet available through their own
4224 /// setters.
4225 ///
4226 /// Please note that this method must not be used to set any of the known parameters
4227 /// which have their own setter method. If done anyway, the request will fail.
4228 ///
4229 /// # Additional Parameters
4230 ///
4231 /// * *alt* (query-string) - Data format for the response.
4232 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4233 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4234 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4235 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4236 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
4237 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
4238 pub fn param<T>(mut self, name: T, value: T) -> GroupRemoveMemberCall<'a, C>
4239 where
4240 T: AsRef<str>,
4241 {
4242 self._additional_params
4243 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4244 self
4245 }
4246
4247 /// Identifies the authorization scope for the method you are building.
4248 ///
4249 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4250 /// [`Scope::CloudPlatform`].
4251 ///
4252 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4253 /// tokens for more than one scope.
4254 ///
4255 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4256 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4257 /// sufficient, a read-write scope will do as well.
4258 pub fn add_scope<St>(mut self, scope: St) -> GroupRemoveMemberCall<'a, C>
4259 where
4260 St: AsRef<str>,
4261 {
4262 self._scopes.insert(String::from(scope.as_ref()));
4263 self
4264 }
4265 /// Identifies the authorization scope(s) for the method you are building.
4266 ///
4267 /// See [`Self::add_scope()`] for details.
4268 pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupRemoveMemberCall<'a, C>
4269 where
4270 I: IntoIterator<Item = St>,
4271 St: AsRef<str>,
4272 {
4273 self._scopes
4274 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4275 self
4276 }
4277
4278 /// Removes all scopes, and no default scope will be used either.
4279 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4280 /// for details).
4281 pub fn clear_scopes(mut self) -> GroupRemoveMemberCall<'a, C> {
4282 self._scopes.clear();
4283 self
4284 }
4285}
4286
4287/// Returns a list of authorized public keys for a specific user account.
4288///
4289/// A builder for the *getAuthorizedKeysView* method supported by a *linux* resource.
4290/// It is not used directly, but through a [`LinuxMethods`] instance.
4291///
4292/// # Example
4293///
4294/// Instantiate a resource method builder
4295///
4296/// ```test_harness,no_run
4297/// # extern crate hyper;
4298/// # extern crate hyper_rustls;
4299/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
4300/// # async fn dox() {
4301/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4302///
4303/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4304/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4305/// # .with_native_roots()
4306/// # .unwrap()
4307/// # .https_only()
4308/// # .enable_http2()
4309/// # .build();
4310///
4311/// # let executor = hyper_util::rt::TokioExecutor::new();
4312/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4313/// # secret,
4314/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4315/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4316/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4317/// # ),
4318/// # ).build().await.unwrap();
4319///
4320/// # let client = hyper_util::client::legacy::Client::builder(
4321/// # hyper_util::rt::TokioExecutor::new()
4322/// # )
4323/// # .build(
4324/// # hyper_rustls::HttpsConnectorBuilder::new()
4325/// # .with_native_roots()
4326/// # .unwrap()
4327/// # .https_or_http()
4328/// # .enable_http2()
4329/// # .build()
4330/// # );
4331/// # let mut hub = CloudUserAccounts::new(client, auth);
4332/// // You can configure optional parameters by calling the respective setters at will, and
4333/// // execute the final call using `doit()`.
4334/// // Values shown here are possibly random and not representative !
4335/// let result = hub.linux().get_authorized_keys_view("project", "zone", "user", "instance")
4336/// .login(false)
4337/// .doit().await;
4338/// # }
4339/// ```
4340pub struct LinuxGetAuthorizedKeysViewCall<'a, C>
4341where
4342 C: 'a,
4343{
4344 hub: &'a CloudUserAccounts<C>,
4345 _project: String,
4346 _zone: String,
4347 _user: String,
4348 _instance: String,
4349 _login: Option<bool>,
4350 _delegate: Option<&'a mut dyn common::Delegate>,
4351 _additional_params: HashMap<String, String>,
4352 _scopes: BTreeSet<String>,
4353}
4354
4355impl<'a, C> common::CallBuilder for LinuxGetAuthorizedKeysViewCall<'a, C> {}
4356
4357impl<'a, C> LinuxGetAuthorizedKeysViewCall<'a, C>
4358where
4359 C: common::Connector,
4360{
4361 /// Perform the operation you have build so far.
4362 pub async fn doit(
4363 mut self,
4364 ) -> common::Result<(common::Response, LinuxGetAuthorizedKeysViewResponse)> {
4365 use std::borrow::Cow;
4366 use std::io::{Read, Seek};
4367
4368 use common::{url::Params, ToParts};
4369 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4370
4371 let mut dd = common::DefaultDelegate;
4372 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4373 dlg.begin(common::MethodInfo {
4374 id: "clouduseraccounts.linux.getAuthorizedKeysView",
4375 http_method: hyper::Method::POST,
4376 });
4377
4378 for &field in ["alt", "project", "zone", "user", "instance", "login"].iter() {
4379 if self._additional_params.contains_key(field) {
4380 dlg.finished(false);
4381 return Err(common::Error::FieldClash(field));
4382 }
4383 }
4384
4385 let mut params = Params::with_capacity(7 + self._additional_params.len());
4386 params.push("project", self._project);
4387 params.push("zone", self._zone);
4388 params.push("user", self._user);
4389 params.push("instance", self._instance);
4390 if let Some(value) = self._login.as_ref() {
4391 params.push("login", value.to_string());
4392 }
4393
4394 params.extend(self._additional_params.iter());
4395
4396 params.push("alt", "json");
4397 let mut url =
4398 self.hub._base_url.clone() + "{project}/zones/{zone}/authorizedKeysView/{user}";
4399 if self._scopes.is_empty() {
4400 self._scopes
4401 .insert(Scope::CloudUseraccountReadonly.as_ref().to_string());
4402 }
4403
4404 #[allow(clippy::single_element_loop)]
4405 for &(find_this, param_name) in [
4406 ("{project}", "project"),
4407 ("{zone}", "zone"),
4408 ("{user}", "user"),
4409 ]
4410 .iter()
4411 {
4412 url = params.uri_replacement(url, param_name, find_this, false);
4413 }
4414 {
4415 let to_remove = ["user", "zone", "project"];
4416 params.remove_params(&to_remove);
4417 }
4418
4419 let url = params.parse_with_url(&url);
4420
4421 loop {
4422 let token = match self
4423 .hub
4424 .auth
4425 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4426 .await
4427 {
4428 Ok(token) => token,
4429 Err(e) => match dlg.token(e) {
4430 Ok(token) => token,
4431 Err(e) => {
4432 dlg.finished(false);
4433 return Err(common::Error::MissingToken(e));
4434 }
4435 },
4436 };
4437 let mut req_result = {
4438 let client = &self.hub.client;
4439 dlg.pre_request();
4440 let mut req_builder = hyper::Request::builder()
4441 .method(hyper::Method::POST)
4442 .uri(url.as_str())
4443 .header(USER_AGENT, self.hub._user_agent.clone());
4444
4445 if let Some(token) = token.as_ref() {
4446 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4447 }
4448
4449 let request = req_builder
4450 .header(CONTENT_LENGTH, 0_u64)
4451 .body(common::to_body::<String>(None));
4452
4453 client.request(request.unwrap()).await
4454 };
4455
4456 match req_result {
4457 Err(err) => {
4458 if let common::Retry::After(d) = dlg.http_error(&err) {
4459 sleep(d).await;
4460 continue;
4461 }
4462 dlg.finished(false);
4463 return Err(common::Error::HttpError(err));
4464 }
4465 Ok(res) => {
4466 let (mut parts, body) = res.into_parts();
4467 let mut body = common::Body::new(body);
4468 if !parts.status.is_success() {
4469 let bytes = common::to_bytes(body).await.unwrap_or_default();
4470 let error = serde_json::from_str(&common::to_string(&bytes));
4471 let response = common::to_response(parts, bytes.into());
4472
4473 if let common::Retry::After(d) =
4474 dlg.http_failure(&response, error.as_ref().ok())
4475 {
4476 sleep(d).await;
4477 continue;
4478 }
4479
4480 dlg.finished(false);
4481
4482 return Err(match error {
4483 Ok(value) => common::Error::BadRequest(value),
4484 _ => common::Error::Failure(response),
4485 });
4486 }
4487 let response = {
4488 let bytes = common::to_bytes(body).await.unwrap_or_default();
4489 let encoded = common::to_string(&bytes);
4490 match serde_json::from_str(&encoded) {
4491 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4492 Err(error) => {
4493 dlg.response_json_decode_error(&encoded, &error);
4494 return Err(common::Error::JsonDecodeError(
4495 encoded.to_string(),
4496 error,
4497 ));
4498 }
4499 }
4500 };
4501
4502 dlg.finished(true);
4503 return Ok(response);
4504 }
4505 }
4506 }
4507 }
4508
4509 /// Project ID for this request.
4510 ///
4511 /// Sets the *project* path property to the given value.
4512 ///
4513 /// Even though the property as already been set when instantiating this call,
4514 /// we provide this method for API completeness.
4515 pub fn project(mut self, new_value: &str) -> LinuxGetAuthorizedKeysViewCall<'a, C> {
4516 self._project = new_value.to_string();
4517 self
4518 }
4519 /// Name of the zone for this request.
4520 ///
4521 /// Sets the *zone* path property to the given value.
4522 ///
4523 /// Even though the property as already been set when instantiating this call,
4524 /// we provide this method for API completeness.
4525 pub fn zone(mut self, new_value: &str) -> LinuxGetAuthorizedKeysViewCall<'a, C> {
4526 self._zone = new_value.to_string();
4527 self
4528 }
4529 /// The user account for which you want to get a list of authorized public keys.
4530 ///
4531 /// Sets the *user* path property to the given value.
4532 ///
4533 /// Even though the property as already been set when instantiating this call,
4534 /// we provide this method for API completeness.
4535 pub fn user(mut self, new_value: &str) -> LinuxGetAuthorizedKeysViewCall<'a, C> {
4536 self._user = new_value.to_string();
4537 self
4538 }
4539 /// The fully-qualified URL of the virtual machine requesting the view.
4540 ///
4541 /// Sets the *instance* query property to the given value.
4542 ///
4543 /// Even though the property as already been set when instantiating this call,
4544 /// we provide this method for API completeness.
4545 pub fn instance(mut self, new_value: &str) -> LinuxGetAuthorizedKeysViewCall<'a, C> {
4546 self._instance = new_value.to_string();
4547 self
4548 }
4549 /// Whether the view was requested as part of a user-initiated login.
4550 ///
4551 /// Sets the *login* query property to the given value.
4552 pub fn login(mut self, new_value: bool) -> LinuxGetAuthorizedKeysViewCall<'a, C> {
4553 self._login = Some(new_value);
4554 self
4555 }
4556 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4557 /// while executing the actual API request.
4558 ///
4559 /// ````text
4560 /// It should be used to handle progress information, and to implement a certain level of resilience.
4561 /// ````
4562 ///
4563 /// Sets the *delegate* property to the given value.
4564 pub fn delegate(
4565 mut self,
4566 new_value: &'a mut dyn common::Delegate,
4567 ) -> LinuxGetAuthorizedKeysViewCall<'a, C> {
4568 self._delegate = Some(new_value);
4569 self
4570 }
4571
4572 /// Set any additional parameter of the query string used in the request.
4573 /// It should be used to set parameters which are not yet available through their own
4574 /// setters.
4575 ///
4576 /// Please note that this method must not be used to set any of the known parameters
4577 /// which have their own setter method. If done anyway, the request will fail.
4578 ///
4579 /// # Additional Parameters
4580 ///
4581 /// * *alt* (query-string) - Data format for the response.
4582 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4583 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4584 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4585 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4586 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
4587 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
4588 pub fn param<T>(mut self, name: T, value: T) -> LinuxGetAuthorizedKeysViewCall<'a, C>
4589 where
4590 T: AsRef<str>,
4591 {
4592 self._additional_params
4593 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4594 self
4595 }
4596
4597 /// Identifies the authorization scope for the method you are building.
4598 ///
4599 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4600 /// [`Scope::CloudUseraccountReadonly`].
4601 ///
4602 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4603 /// tokens for more than one scope.
4604 ///
4605 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4606 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4607 /// sufficient, a read-write scope will do as well.
4608 pub fn add_scope<St>(mut self, scope: St) -> LinuxGetAuthorizedKeysViewCall<'a, C>
4609 where
4610 St: AsRef<str>,
4611 {
4612 self._scopes.insert(String::from(scope.as_ref()));
4613 self
4614 }
4615 /// Identifies the authorization scope(s) for the method you are building.
4616 ///
4617 /// See [`Self::add_scope()`] for details.
4618 pub fn add_scopes<I, St>(mut self, scopes: I) -> LinuxGetAuthorizedKeysViewCall<'a, C>
4619 where
4620 I: IntoIterator<Item = St>,
4621 St: AsRef<str>,
4622 {
4623 self._scopes
4624 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4625 self
4626 }
4627
4628 /// Removes all scopes, and no default scope will be used either.
4629 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4630 /// for details).
4631 pub fn clear_scopes(mut self) -> LinuxGetAuthorizedKeysViewCall<'a, C> {
4632 self._scopes.clear();
4633 self
4634 }
4635}
4636
4637/// Retrieves a list of user accounts for an instance within a specific project.
4638///
4639/// A builder for the *getLinuxAccountViews* method supported by a *linux* resource.
4640/// It is not used directly, but through a [`LinuxMethods`] instance.
4641///
4642/// # Example
4643///
4644/// Instantiate a resource method builder
4645///
4646/// ```test_harness,no_run
4647/// # extern crate hyper;
4648/// # extern crate hyper_rustls;
4649/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
4650/// # async fn dox() {
4651/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4652///
4653/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4654/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4655/// # .with_native_roots()
4656/// # .unwrap()
4657/// # .https_only()
4658/// # .enable_http2()
4659/// # .build();
4660///
4661/// # let executor = hyper_util::rt::TokioExecutor::new();
4662/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4663/// # secret,
4664/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4665/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4666/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4667/// # ),
4668/// # ).build().await.unwrap();
4669///
4670/// # let client = hyper_util::client::legacy::Client::builder(
4671/// # hyper_util::rt::TokioExecutor::new()
4672/// # )
4673/// # .build(
4674/// # hyper_rustls::HttpsConnectorBuilder::new()
4675/// # .with_native_roots()
4676/// # .unwrap()
4677/// # .https_or_http()
4678/// # .enable_http2()
4679/// # .build()
4680/// # );
4681/// # let mut hub = CloudUserAccounts::new(client, auth);
4682/// // You can configure optional parameters by calling the respective setters at will, and
4683/// // execute the final call using `doit()`.
4684/// // Values shown here are possibly random and not representative !
4685/// let result = hub.linux().get_linux_account_views("project", "zone", "instance")
4686/// .page_token("sed")
4687/// .order_by("duo")
4688/// .max_results(21)
4689/// .filter("no")
4690/// .doit().await;
4691/// # }
4692/// ```
4693pub struct LinuxGetLinuxAccountViewCall<'a, C>
4694where
4695 C: 'a,
4696{
4697 hub: &'a CloudUserAccounts<C>,
4698 _project: String,
4699 _zone: String,
4700 _instance: String,
4701 _page_token: Option<String>,
4702 _order_by: Option<String>,
4703 _max_results: Option<u32>,
4704 _filter: Option<String>,
4705 _delegate: Option<&'a mut dyn common::Delegate>,
4706 _additional_params: HashMap<String, String>,
4707 _scopes: BTreeSet<String>,
4708}
4709
4710impl<'a, C> common::CallBuilder for LinuxGetLinuxAccountViewCall<'a, C> {}
4711
4712impl<'a, C> LinuxGetLinuxAccountViewCall<'a, C>
4713where
4714 C: common::Connector,
4715{
4716 /// Perform the operation you have build so far.
4717 pub async fn doit(
4718 mut self,
4719 ) -> common::Result<(common::Response, LinuxGetLinuxAccountViewsResponse)> {
4720 use std::borrow::Cow;
4721 use std::io::{Read, Seek};
4722
4723 use common::{url::Params, ToParts};
4724 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4725
4726 let mut dd = common::DefaultDelegate;
4727 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4728 dlg.begin(common::MethodInfo {
4729 id: "clouduseraccounts.linux.getLinuxAccountViews",
4730 http_method: hyper::Method::POST,
4731 });
4732
4733 for &field in [
4734 "alt",
4735 "project",
4736 "zone",
4737 "instance",
4738 "pageToken",
4739 "orderBy",
4740 "maxResults",
4741 "filter",
4742 ]
4743 .iter()
4744 {
4745 if self._additional_params.contains_key(field) {
4746 dlg.finished(false);
4747 return Err(common::Error::FieldClash(field));
4748 }
4749 }
4750
4751 let mut params = Params::with_capacity(9 + self._additional_params.len());
4752 params.push("project", self._project);
4753 params.push("zone", self._zone);
4754 params.push("instance", self._instance);
4755 if let Some(value) = self._page_token.as_ref() {
4756 params.push("pageToken", value);
4757 }
4758 if let Some(value) = self._order_by.as_ref() {
4759 params.push("orderBy", value);
4760 }
4761 if let Some(value) = self._max_results.as_ref() {
4762 params.push("maxResults", value.to_string());
4763 }
4764 if let Some(value) = self._filter.as_ref() {
4765 params.push("filter", value);
4766 }
4767
4768 params.extend(self._additional_params.iter());
4769
4770 params.push("alt", "json");
4771 let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/linuxAccountViews";
4772 if self._scopes.is_empty() {
4773 self._scopes
4774 .insert(Scope::CloudUseraccountReadonly.as_ref().to_string());
4775 }
4776
4777 #[allow(clippy::single_element_loop)]
4778 for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone")].iter() {
4779 url = params.uri_replacement(url, param_name, find_this, false);
4780 }
4781 {
4782 let to_remove = ["zone", "project"];
4783 params.remove_params(&to_remove);
4784 }
4785
4786 let url = params.parse_with_url(&url);
4787
4788 loop {
4789 let token = match self
4790 .hub
4791 .auth
4792 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4793 .await
4794 {
4795 Ok(token) => token,
4796 Err(e) => match dlg.token(e) {
4797 Ok(token) => token,
4798 Err(e) => {
4799 dlg.finished(false);
4800 return Err(common::Error::MissingToken(e));
4801 }
4802 },
4803 };
4804 let mut req_result = {
4805 let client = &self.hub.client;
4806 dlg.pre_request();
4807 let mut req_builder = hyper::Request::builder()
4808 .method(hyper::Method::POST)
4809 .uri(url.as_str())
4810 .header(USER_AGENT, self.hub._user_agent.clone());
4811
4812 if let Some(token) = token.as_ref() {
4813 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4814 }
4815
4816 let request = req_builder
4817 .header(CONTENT_LENGTH, 0_u64)
4818 .body(common::to_body::<String>(None));
4819
4820 client.request(request.unwrap()).await
4821 };
4822
4823 match req_result {
4824 Err(err) => {
4825 if let common::Retry::After(d) = dlg.http_error(&err) {
4826 sleep(d).await;
4827 continue;
4828 }
4829 dlg.finished(false);
4830 return Err(common::Error::HttpError(err));
4831 }
4832 Ok(res) => {
4833 let (mut parts, body) = res.into_parts();
4834 let mut body = common::Body::new(body);
4835 if !parts.status.is_success() {
4836 let bytes = common::to_bytes(body).await.unwrap_or_default();
4837 let error = serde_json::from_str(&common::to_string(&bytes));
4838 let response = common::to_response(parts, bytes.into());
4839
4840 if let common::Retry::After(d) =
4841 dlg.http_failure(&response, error.as_ref().ok())
4842 {
4843 sleep(d).await;
4844 continue;
4845 }
4846
4847 dlg.finished(false);
4848
4849 return Err(match error {
4850 Ok(value) => common::Error::BadRequest(value),
4851 _ => common::Error::Failure(response),
4852 });
4853 }
4854 let response = {
4855 let bytes = common::to_bytes(body).await.unwrap_or_default();
4856 let encoded = common::to_string(&bytes);
4857 match serde_json::from_str(&encoded) {
4858 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4859 Err(error) => {
4860 dlg.response_json_decode_error(&encoded, &error);
4861 return Err(common::Error::JsonDecodeError(
4862 encoded.to_string(),
4863 error,
4864 ));
4865 }
4866 }
4867 };
4868
4869 dlg.finished(true);
4870 return Ok(response);
4871 }
4872 }
4873 }
4874 }
4875
4876 /// Project ID for this request.
4877 ///
4878 /// Sets the *project* path property to the given value.
4879 ///
4880 /// Even though the property as already been set when instantiating this call,
4881 /// we provide this method for API completeness.
4882 pub fn project(mut self, new_value: &str) -> LinuxGetLinuxAccountViewCall<'a, C> {
4883 self._project = new_value.to_string();
4884 self
4885 }
4886 /// Name of the zone for this request.
4887 ///
4888 /// Sets the *zone* path property to the given value.
4889 ///
4890 /// Even though the property as already been set when instantiating this call,
4891 /// we provide this method for API completeness.
4892 pub fn zone(mut self, new_value: &str) -> LinuxGetLinuxAccountViewCall<'a, C> {
4893 self._zone = new_value.to_string();
4894 self
4895 }
4896 /// The fully-qualified URL of the virtual machine requesting the views.
4897 ///
4898 /// Sets the *instance* query property to the given value.
4899 ///
4900 /// Even though the property as already been set when instantiating this call,
4901 /// we provide this method for API completeness.
4902 pub fn instance(mut self, new_value: &str) -> LinuxGetLinuxAccountViewCall<'a, C> {
4903 self._instance = new_value.to_string();
4904 self
4905 }
4906 /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
4907 ///
4908 /// Sets the *page token* query property to the given value.
4909 pub fn page_token(mut self, new_value: &str) -> LinuxGetLinuxAccountViewCall<'a, C> {
4910 self._page_token = Some(new_value.to_string());
4911 self
4912 }
4913 /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.
4914 ///
4915 /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.
4916 ///
4917 /// Currently, only sorting by name or creationTimestamp desc is supported.
4918 ///
4919 /// Sets the *order by* query property to the given value.
4920 pub fn order_by(mut self, new_value: &str) -> LinuxGetLinuxAccountViewCall<'a, C> {
4921 self._order_by = Some(new_value.to_string());
4922 self
4923 }
4924 /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.
4925 ///
4926 /// Sets the *max results* query property to the given value.
4927 pub fn max_results(mut self, new_value: u32) -> LinuxGetLinuxAccountViewCall<'a, C> {
4928 self._max_results = Some(new_value);
4929 self
4930 }
4931 /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.
4932 ///
4933 /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.
4934 ///
4935 /// For example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.
4936 ///
4937 /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values.
4938 ///
4939 /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.
4940 ///
4941 /// Sets the *filter* query property to the given value.
4942 pub fn filter(mut self, new_value: &str) -> LinuxGetLinuxAccountViewCall<'a, C> {
4943 self._filter = Some(new_value.to_string());
4944 self
4945 }
4946 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4947 /// while executing the actual API request.
4948 ///
4949 /// ````text
4950 /// It should be used to handle progress information, and to implement a certain level of resilience.
4951 /// ````
4952 ///
4953 /// Sets the *delegate* property to the given value.
4954 pub fn delegate(
4955 mut self,
4956 new_value: &'a mut dyn common::Delegate,
4957 ) -> LinuxGetLinuxAccountViewCall<'a, C> {
4958 self._delegate = Some(new_value);
4959 self
4960 }
4961
4962 /// Set any additional parameter of the query string used in the request.
4963 /// It should be used to set parameters which are not yet available through their own
4964 /// setters.
4965 ///
4966 /// Please note that this method must not be used to set any of the known parameters
4967 /// which have their own setter method. If done anyway, the request will fail.
4968 ///
4969 /// # Additional Parameters
4970 ///
4971 /// * *alt* (query-string) - Data format for the response.
4972 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4973 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4974 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4975 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4976 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
4977 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
4978 pub fn param<T>(mut self, name: T, value: T) -> LinuxGetLinuxAccountViewCall<'a, C>
4979 where
4980 T: AsRef<str>,
4981 {
4982 self._additional_params
4983 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4984 self
4985 }
4986
4987 /// Identifies the authorization scope for the method you are building.
4988 ///
4989 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4990 /// [`Scope::CloudUseraccountReadonly`].
4991 ///
4992 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4993 /// tokens for more than one scope.
4994 ///
4995 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4996 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4997 /// sufficient, a read-write scope will do as well.
4998 pub fn add_scope<St>(mut self, scope: St) -> LinuxGetLinuxAccountViewCall<'a, C>
4999 where
5000 St: AsRef<str>,
5001 {
5002 self._scopes.insert(String::from(scope.as_ref()));
5003 self
5004 }
5005 /// Identifies the authorization scope(s) for the method you are building.
5006 ///
5007 /// See [`Self::add_scope()`] for details.
5008 pub fn add_scopes<I, St>(mut self, scopes: I) -> LinuxGetLinuxAccountViewCall<'a, C>
5009 where
5010 I: IntoIterator<Item = St>,
5011 St: AsRef<str>,
5012 {
5013 self._scopes
5014 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5015 self
5016 }
5017
5018 /// Removes all scopes, and no default scope will be used either.
5019 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5020 /// for details).
5021 pub fn clear_scopes(mut self) -> LinuxGetLinuxAccountViewCall<'a, C> {
5022 self._scopes.clear();
5023 self
5024 }
5025}
5026
5027/// Adds a public key to the specified User resource with the data included in the request.
5028///
5029/// A builder for the *addPublicKey* method supported by a *user* resource.
5030/// It is not used directly, but through a [`UserMethods`] instance.
5031///
5032/// # Example
5033///
5034/// Instantiate a resource method builder
5035///
5036/// ```test_harness,no_run
5037/// # extern crate hyper;
5038/// # extern crate hyper_rustls;
5039/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
5040/// use clouduseraccountsvm_beta::api::PublicKey;
5041/// # async fn dox() {
5042/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5043///
5044/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5045/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5046/// # .with_native_roots()
5047/// # .unwrap()
5048/// # .https_only()
5049/// # .enable_http2()
5050/// # .build();
5051///
5052/// # let executor = hyper_util::rt::TokioExecutor::new();
5053/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5054/// # secret,
5055/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5056/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5057/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5058/// # ),
5059/// # ).build().await.unwrap();
5060///
5061/// # let client = hyper_util::client::legacy::Client::builder(
5062/// # hyper_util::rt::TokioExecutor::new()
5063/// # )
5064/// # .build(
5065/// # hyper_rustls::HttpsConnectorBuilder::new()
5066/// # .with_native_roots()
5067/// # .unwrap()
5068/// # .https_or_http()
5069/// # .enable_http2()
5070/// # .build()
5071/// # );
5072/// # let mut hub = CloudUserAccounts::new(client, auth);
5073/// // As the method needs a request, you would usually fill it with the desired information
5074/// // into the respective structure. Some of the parts shown here might not be applicable !
5075/// // Values shown here are possibly random and not representative !
5076/// let mut req = PublicKey::default();
5077///
5078/// // You can configure optional parameters by calling the respective setters at will, and
5079/// // execute the final call using `doit()`.
5080/// // Values shown here are possibly random and not representative !
5081/// let result = hub.users().add_public_key(req, "project", "user")
5082/// .doit().await;
5083/// # }
5084/// ```
5085pub struct UserAddPublicKeyCall<'a, C>
5086where
5087 C: 'a,
5088{
5089 hub: &'a CloudUserAccounts<C>,
5090 _request: PublicKey,
5091 _project: String,
5092 _user: String,
5093 _delegate: Option<&'a mut dyn common::Delegate>,
5094 _additional_params: HashMap<String, String>,
5095 _scopes: BTreeSet<String>,
5096}
5097
5098impl<'a, C> common::CallBuilder for UserAddPublicKeyCall<'a, C> {}
5099
5100impl<'a, C> UserAddPublicKeyCall<'a, C>
5101where
5102 C: common::Connector,
5103{
5104 /// Perform the operation you have build so far.
5105 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5106 use std::borrow::Cow;
5107 use std::io::{Read, Seek};
5108
5109 use common::{url::Params, ToParts};
5110 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5111
5112 let mut dd = common::DefaultDelegate;
5113 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5114 dlg.begin(common::MethodInfo {
5115 id: "clouduseraccounts.users.addPublicKey",
5116 http_method: hyper::Method::POST,
5117 });
5118
5119 for &field in ["alt", "project", "user"].iter() {
5120 if self._additional_params.contains_key(field) {
5121 dlg.finished(false);
5122 return Err(common::Error::FieldClash(field));
5123 }
5124 }
5125
5126 let mut params = Params::with_capacity(5 + self._additional_params.len());
5127 params.push("project", self._project);
5128 params.push("user", self._user);
5129
5130 params.extend(self._additional_params.iter());
5131
5132 params.push("alt", "json");
5133 let mut url = self.hub._base_url.clone() + "{project}/global/users/{user}/addPublicKey";
5134 if self._scopes.is_empty() {
5135 self._scopes
5136 .insert(Scope::CloudPlatform.as_ref().to_string());
5137 }
5138
5139 #[allow(clippy::single_element_loop)]
5140 for &(find_this, param_name) in [("{project}", "project"), ("{user}", "user")].iter() {
5141 url = params.uri_replacement(url, param_name, find_this, false);
5142 }
5143 {
5144 let to_remove = ["user", "project"];
5145 params.remove_params(&to_remove);
5146 }
5147
5148 let url = params.parse_with_url(&url);
5149
5150 let mut json_mime_type = mime::APPLICATION_JSON;
5151 let mut request_value_reader = {
5152 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5153 common::remove_json_null_values(&mut value);
5154 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5155 serde_json::to_writer(&mut dst, &value).unwrap();
5156 dst
5157 };
5158 let request_size = request_value_reader
5159 .seek(std::io::SeekFrom::End(0))
5160 .unwrap();
5161 request_value_reader
5162 .seek(std::io::SeekFrom::Start(0))
5163 .unwrap();
5164
5165 loop {
5166 let token = match self
5167 .hub
5168 .auth
5169 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5170 .await
5171 {
5172 Ok(token) => token,
5173 Err(e) => match dlg.token(e) {
5174 Ok(token) => token,
5175 Err(e) => {
5176 dlg.finished(false);
5177 return Err(common::Error::MissingToken(e));
5178 }
5179 },
5180 };
5181 request_value_reader
5182 .seek(std::io::SeekFrom::Start(0))
5183 .unwrap();
5184 let mut req_result = {
5185 let client = &self.hub.client;
5186 dlg.pre_request();
5187 let mut req_builder = hyper::Request::builder()
5188 .method(hyper::Method::POST)
5189 .uri(url.as_str())
5190 .header(USER_AGENT, self.hub._user_agent.clone());
5191
5192 if let Some(token) = token.as_ref() {
5193 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5194 }
5195
5196 let request = req_builder
5197 .header(CONTENT_TYPE, json_mime_type.to_string())
5198 .header(CONTENT_LENGTH, request_size as u64)
5199 .body(common::to_body(
5200 request_value_reader.get_ref().clone().into(),
5201 ));
5202
5203 client.request(request.unwrap()).await
5204 };
5205
5206 match req_result {
5207 Err(err) => {
5208 if let common::Retry::After(d) = dlg.http_error(&err) {
5209 sleep(d).await;
5210 continue;
5211 }
5212 dlg.finished(false);
5213 return Err(common::Error::HttpError(err));
5214 }
5215 Ok(res) => {
5216 let (mut parts, body) = res.into_parts();
5217 let mut body = common::Body::new(body);
5218 if !parts.status.is_success() {
5219 let bytes = common::to_bytes(body).await.unwrap_or_default();
5220 let error = serde_json::from_str(&common::to_string(&bytes));
5221 let response = common::to_response(parts, bytes.into());
5222
5223 if let common::Retry::After(d) =
5224 dlg.http_failure(&response, error.as_ref().ok())
5225 {
5226 sleep(d).await;
5227 continue;
5228 }
5229
5230 dlg.finished(false);
5231
5232 return Err(match error {
5233 Ok(value) => common::Error::BadRequest(value),
5234 _ => common::Error::Failure(response),
5235 });
5236 }
5237 let response = {
5238 let bytes = common::to_bytes(body).await.unwrap_or_default();
5239 let encoded = common::to_string(&bytes);
5240 match serde_json::from_str(&encoded) {
5241 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5242 Err(error) => {
5243 dlg.response_json_decode_error(&encoded, &error);
5244 return Err(common::Error::JsonDecodeError(
5245 encoded.to_string(),
5246 error,
5247 ));
5248 }
5249 }
5250 };
5251
5252 dlg.finished(true);
5253 return Ok(response);
5254 }
5255 }
5256 }
5257 }
5258
5259 ///
5260 /// Sets the *request* property to the given value.
5261 ///
5262 /// Even though the property as already been set when instantiating this call,
5263 /// we provide this method for API completeness.
5264 pub fn request(mut self, new_value: PublicKey) -> UserAddPublicKeyCall<'a, C> {
5265 self._request = new_value;
5266 self
5267 }
5268 /// Project ID for this request.
5269 ///
5270 /// Sets the *project* path property to the given value.
5271 ///
5272 /// Even though the property as already been set when instantiating this call,
5273 /// we provide this method for API completeness.
5274 pub fn project(mut self, new_value: &str) -> UserAddPublicKeyCall<'a, C> {
5275 self._project = new_value.to_string();
5276 self
5277 }
5278 /// Name of the user for this request.
5279 ///
5280 /// Sets the *user* path property to the given value.
5281 ///
5282 /// Even though the property as already been set when instantiating this call,
5283 /// we provide this method for API completeness.
5284 pub fn user(mut self, new_value: &str) -> UserAddPublicKeyCall<'a, C> {
5285 self._user = new_value.to_string();
5286 self
5287 }
5288 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5289 /// while executing the actual API request.
5290 ///
5291 /// ````text
5292 /// It should be used to handle progress information, and to implement a certain level of resilience.
5293 /// ````
5294 ///
5295 /// Sets the *delegate* property to the given value.
5296 pub fn delegate(
5297 mut self,
5298 new_value: &'a mut dyn common::Delegate,
5299 ) -> UserAddPublicKeyCall<'a, C> {
5300 self._delegate = Some(new_value);
5301 self
5302 }
5303
5304 /// Set any additional parameter of the query string used in the request.
5305 /// It should be used to set parameters which are not yet available through their own
5306 /// setters.
5307 ///
5308 /// Please note that this method must not be used to set any of the known parameters
5309 /// which have their own setter method. If done anyway, the request will fail.
5310 ///
5311 /// # Additional Parameters
5312 ///
5313 /// * *alt* (query-string) - Data format for the response.
5314 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5315 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5316 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5317 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5318 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
5319 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
5320 pub fn param<T>(mut self, name: T, value: T) -> UserAddPublicKeyCall<'a, C>
5321 where
5322 T: AsRef<str>,
5323 {
5324 self._additional_params
5325 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5326 self
5327 }
5328
5329 /// Identifies the authorization scope for the method you are building.
5330 ///
5331 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5332 /// [`Scope::CloudPlatform`].
5333 ///
5334 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5335 /// tokens for more than one scope.
5336 ///
5337 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5338 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5339 /// sufficient, a read-write scope will do as well.
5340 pub fn add_scope<St>(mut self, scope: St) -> UserAddPublicKeyCall<'a, C>
5341 where
5342 St: AsRef<str>,
5343 {
5344 self._scopes.insert(String::from(scope.as_ref()));
5345 self
5346 }
5347 /// Identifies the authorization scope(s) for the method you are building.
5348 ///
5349 /// See [`Self::add_scope()`] for details.
5350 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserAddPublicKeyCall<'a, C>
5351 where
5352 I: IntoIterator<Item = St>,
5353 St: AsRef<str>,
5354 {
5355 self._scopes
5356 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5357 self
5358 }
5359
5360 /// Removes all scopes, and no default scope will be used either.
5361 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5362 /// for details).
5363 pub fn clear_scopes(mut self) -> UserAddPublicKeyCall<'a, C> {
5364 self._scopes.clear();
5365 self
5366 }
5367}
5368
5369/// Deletes the specified User resource.
5370///
5371/// A builder for the *delete* method supported by a *user* resource.
5372/// It is not used directly, but through a [`UserMethods`] instance.
5373///
5374/// # Example
5375///
5376/// Instantiate a resource method builder
5377///
5378/// ```test_harness,no_run
5379/// # extern crate hyper;
5380/// # extern crate hyper_rustls;
5381/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
5382/// # async fn dox() {
5383/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5384///
5385/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5386/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5387/// # .with_native_roots()
5388/// # .unwrap()
5389/// # .https_only()
5390/// # .enable_http2()
5391/// # .build();
5392///
5393/// # let executor = hyper_util::rt::TokioExecutor::new();
5394/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5395/// # secret,
5396/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5397/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5398/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5399/// # ),
5400/// # ).build().await.unwrap();
5401///
5402/// # let client = hyper_util::client::legacy::Client::builder(
5403/// # hyper_util::rt::TokioExecutor::new()
5404/// # )
5405/// # .build(
5406/// # hyper_rustls::HttpsConnectorBuilder::new()
5407/// # .with_native_roots()
5408/// # .unwrap()
5409/// # .https_or_http()
5410/// # .enable_http2()
5411/// # .build()
5412/// # );
5413/// # let mut hub = CloudUserAccounts::new(client, auth);
5414/// // You can configure optional parameters by calling the respective setters at will, and
5415/// // execute the final call using `doit()`.
5416/// // Values shown here are possibly random and not representative !
5417/// let result = hub.users().delete("project", "user")
5418/// .doit().await;
5419/// # }
5420/// ```
5421pub struct UserDeleteCall<'a, C>
5422where
5423 C: 'a,
5424{
5425 hub: &'a CloudUserAccounts<C>,
5426 _project: String,
5427 _user: String,
5428 _delegate: Option<&'a mut dyn common::Delegate>,
5429 _additional_params: HashMap<String, String>,
5430 _scopes: BTreeSet<String>,
5431}
5432
5433impl<'a, C> common::CallBuilder for UserDeleteCall<'a, C> {}
5434
5435impl<'a, C> UserDeleteCall<'a, C>
5436where
5437 C: common::Connector,
5438{
5439 /// Perform the operation you have build so far.
5440 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5441 use std::borrow::Cow;
5442 use std::io::{Read, Seek};
5443
5444 use common::{url::Params, ToParts};
5445 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5446
5447 let mut dd = common::DefaultDelegate;
5448 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5449 dlg.begin(common::MethodInfo {
5450 id: "clouduseraccounts.users.delete",
5451 http_method: hyper::Method::DELETE,
5452 });
5453
5454 for &field in ["alt", "project", "user"].iter() {
5455 if self._additional_params.contains_key(field) {
5456 dlg.finished(false);
5457 return Err(common::Error::FieldClash(field));
5458 }
5459 }
5460
5461 let mut params = Params::with_capacity(4 + self._additional_params.len());
5462 params.push("project", self._project);
5463 params.push("user", self._user);
5464
5465 params.extend(self._additional_params.iter());
5466
5467 params.push("alt", "json");
5468 let mut url = self.hub._base_url.clone() + "{project}/global/users/{user}";
5469 if self._scopes.is_empty() {
5470 self._scopes
5471 .insert(Scope::CloudPlatform.as_ref().to_string());
5472 }
5473
5474 #[allow(clippy::single_element_loop)]
5475 for &(find_this, param_name) in [("{project}", "project"), ("{user}", "user")].iter() {
5476 url = params.uri_replacement(url, param_name, find_this, false);
5477 }
5478 {
5479 let to_remove = ["user", "project"];
5480 params.remove_params(&to_remove);
5481 }
5482
5483 let url = params.parse_with_url(&url);
5484
5485 loop {
5486 let token = match self
5487 .hub
5488 .auth
5489 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5490 .await
5491 {
5492 Ok(token) => token,
5493 Err(e) => match dlg.token(e) {
5494 Ok(token) => token,
5495 Err(e) => {
5496 dlg.finished(false);
5497 return Err(common::Error::MissingToken(e));
5498 }
5499 },
5500 };
5501 let mut req_result = {
5502 let client = &self.hub.client;
5503 dlg.pre_request();
5504 let mut req_builder = hyper::Request::builder()
5505 .method(hyper::Method::DELETE)
5506 .uri(url.as_str())
5507 .header(USER_AGENT, self.hub._user_agent.clone());
5508
5509 if let Some(token) = token.as_ref() {
5510 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5511 }
5512
5513 let request = req_builder
5514 .header(CONTENT_LENGTH, 0_u64)
5515 .body(common::to_body::<String>(None));
5516
5517 client.request(request.unwrap()).await
5518 };
5519
5520 match req_result {
5521 Err(err) => {
5522 if let common::Retry::After(d) = dlg.http_error(&err) {
5523 sleep(d).await;
5524 continue;
5525 }
5526 dlg.finished(false);
5527 return Err(common::Error::HttpError(err));
5528 }
5529 Ok(res) => {
5530 let (mut parts, body) = res.into_parts();
5531 let mut body = common::Body::new(body);
5532 if !parts.status.is_success() {
5533 let bytes = common::to_bytes(body).await.unwrap_or_default();
5534 let error = serde_json::from_str(&common::to_string(&bytes));
5535 let response = common::to_response(parts, bytes.into());
5536
5537 if let common::Retry::After(d) =
5538 dlg.http_failure(&response, error.as_ref().ok())
5539 {
5540 sleep(d).await;
5541 continue;
5542 }
5543
5544 dlg.finished(false);
5545
5546 return Err(match error {
5547 Ok(value) => common::Error::BadRequest(value),
5548 _ => common::Error::Failure(response),
5549 });
5550 }
5551 let response = {
5552 let bytes = common::to_bytes(body).await.unwrap_or_default();
5553 let encoded = common::to_string(&bytes);
5554 match serde_json::from_str(&encoded) {
5555 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5556 Err(error) => {
5557 dlg.response_json_decode_error(&encoded, &error);
5558 return Err(common::Error::JsonDecodeError(
5559 encoded.to_string(),
5560 error,
5561 ));
5562 }
5563 }
5564 };
5565
5566 dlg.finished(true);
5567 return Ok(response);
5568 }
5569 }
5570 }
5571 }
5572
5573 /// Project ID for this request.
5574 ///
5575 /// Sets the *project* path property to the given value.
5576 ///
5577 /// Even though the property as already been set when instantiating this call,
5578 /// we provide this method for API completeness.
5579 pub fn project(mut self, new_value: &str) -> UserDeleteCall<'a, C> {
5580 self._project = new_value.to_string();
5581 self
5582 }
5583 /// Name of the user resource to delete.
5584 ///
5585 /// Sets the *user* path property to the given value.
5586 ///
5587 /// Even though the property as already been set when instantiating this call,
5588 /// we provide this method for API completeness.
5589 pub fn user(mut self, new_value: &str) -> UserDeleteCall<'a, C> {
5590 self._user = new_value.to_string();
5591 self
5592 }
5593 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5594 /// while executing the actual API request.
5595 ///
5596 /// ````text
5597 /// It should be used to handle progress information, and to implement a certain level of resilience.
5598 /// ````
5599 ///
5600 /// Sets the *delegate* property to the given value.
5601 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserDeleteCall<'a, C> {
5602 self._delegate = Some(new_value);
5603 self
5604 }
5605
5606 /// Set any additional parameter of the query string used in the request.
5607 /// It should be used to set parameters which are not yet available through their own
5608 /// setters.
5609 ///
5610 /// Please note that this method must not be used to set any of the known parameters
5611 /// which have their own setter method. If done anyway, the request will fail.
5612 ///
5613 /// # Additional Parameters
5614 ///
5615 /// * *alt* (query-string) - Data format for the response.
5616 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5617 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5618 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5619 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5620 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
5621 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
5622 pub fn param<T>(mut self, name: T, value: T) -> UserDeleteCall<'a, C>
5623 where
5624 T: AsRef<str>,
5625 {
5626 self._additional_params
5627 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5628 self
5629 }
5630
5631 /// Identifies the authorization scope for the method you are building.
5632 ///
5633 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5634 /// [`Scope::CloudPlatform`].
5635 ///
5636 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5637 /// tokens for more than one scope.
5638 ///
5639 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5640 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5641 /// sufficient, a read-write scope will do as well.
5642 pub fn add_scope<St>(mut self, scope: St) -> UserDeleteCall<'a, C>
5643 where
5644 St: AsRef<str>,
5645 {
5646 self._scopes.insert(String::from(scope.as_ref()));
5647 self
5648 }
5649 /// Identifies the authorization scope(s) for the method you are building.
5650 ///
5651 /// See [`Self::add_scope()`] for details.
5652 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserDeleteCall<'a, C>
5653 where
5654 I: IntoIterator<Item = St>,
5655 St: AsRef<str>,
5656 {
5657 self._scopes
5658 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5659 self
5660 }
5661
5662 /// Removes all scopes, and no default scope will be used either.
5663 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5664 /// for details).
5665 pub fn clear_scopes(mut self) -> UserDeleteCall<'a, C> {
5666 self._scopes.clear();
5667 self
5668 }
5669}
5670
5671/// Returns the specified User resource.
5672///
5673/// A builder for the *get* method supported by a *user* resource.
5674/// It is not used directly, but through a [`UserMethods`] instance.
5675///
5676/// # Example
5677///
5678/// Instantiate a resource method builder
5679///
5680/// ```test_harness,no_run
5681/// # extern crate hyper;
5682/// # extern crate hyper_rustls;
5683/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
5684/// # async fn dox() {
5685/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5686///
5687/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5688/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5689/// # .with_native_roots()
5690/// # .unwrap()
5691/// # .https_only()
5692/// # .enable_http2()
5693/// # .build();
5694///
5695/// # let executor = hyper_util::rt::TokioExecutor::new();
5696/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5697/// # secret,
5698/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5699/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5700/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5701/// # ),
5702/// # ).build().await.unwrap();
5703///
5704/// # let client = hyper_util::client::legacy::Client::builder(
5705/// # hyper_util::rt::TokioExecutor::new()
5706/// # )
5707/// # .build(
5708/// # hyper_rustls::HttpsConnectorBuilder::new()
5709/// # .with_native_roots()
5710/// # .unwrap()
5711/// # .https_or_http()
5712/// # .enable_http2()
5713/// # .build()
5714/// # );
5715/// # let mut hub = CloudUserAccounts::new(client, auth);
5716/// // You can configure optional parameters by calling the respective setters at will, and
5717/// // execute the final call using `doit()`.
5718/// // Values shown here are possibly random and not representative !
5719/// let result = hub.users().get("project", "user")
5720/// .doit().await;
5721/// # }
5722/// ```
5723pub struct UserGetCall<'a, C>
5724where
5725 C: 'a,
5726{
5727 hub: &'a CloudUserAccounts<C>,
5728 _project: String,
5729 _user: String,
5730 _delegate: Option<&'a mut dyn common::Delegate>,
5731 _additional_params: HashMap<String, String>,
5732 _scopes: BTreeSet<String>,
5733}
5734
5735impl<'a, C> common::CallBuilder for UserGetCall<'a, C> {}
5736
5737impl<'a, C> UserGetCall<'a, C>
5738where
5739 C: common::Connector,
5740{
5741 /// Perform the operation you have build so far.
5742 pub async fn doit(mut self) -> common::Result<(common::Response, User)> {
5743 use std::borrow::Cow;
5744 use std::io::{Read, Seek};
5745
5746 use common::{url::Params, ToParts};
5747 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5748
5749 let mut dd = common::DefaultDelegate;
5750 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5751 dlg.begin(common::MethodInfo {
5752 id: "clouduseraccounts.users.get",
5753 http_method: hyper::Method::GET,
5754 });
5755
5756 for &field in ["alt", "project", "user"].iter() {
5757 if self._additional_params.contains_key(field) {
5758 dlg.finished(false);
5759 return Err(common::Error::FieldClash(field));
5760 }
5761 }
5762
5763 let mut params = Params::with_capacity(4 + self._additional_params.len());
5764 params.push("project", self._project);
5765 params.push("user", self._user);
5766
5767 params.extend(self._additional_params.iter());
5768
5769 params.push("alt", "json");
5770 let mut url = self.hub._base_url.clone() + "{project}/global/users/{user}";
5771 if self._scopes.is_empty() {
5772 self._scopes
5773 .insert(Scope::CloudUseraccountReadonly.as_ref().to_string());
5774 }
5775
5776 #[allow(clippy::single_element_loop)]
5777 for &(find_this, param_name) in [("{project}", "project"), ("{user}", "user")].iter() {
5778 url = params.uri_replacement(url, param_name, find_this, false);
5779 }
5780 {
5781 let to_remove = ["user", "project"];
5782 params.remove_params(&to_remove);
5783 }
5784
5785 let url = params.parse_with_url(&url);
5786
5787 loop {
5788 let token = match self
5789 .hub
5790 .auth
5791 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5792 .await
5793 {
5794 Ok(token) => token,
5795 Err(e) => match dlg.token(e) {
5796 Ok(token) => token,
5797 Err(e) => {
5798 dlg.finished(false);
5799 return Err(common::Error::MissingToken(e));
5800 }
5801 },
5802 };
5803 let mut req_result = {
5804 let client = &self.hub.client;
5805 dlg.pre_request();
5806 let mut req_builder = hyper::Request::builder()
5807 .method(hyper::Method::GET)
5808 .uri(url.as_str())
5809 .header(USER_AGENT, self.hub._user_agent.clone());
5810
5811 if let Some(token) = token.as_ref() {
5812 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5813 }
5814
5815 let request = req_builder
5816 .header(CONTENT_LENGTH, 0_u64)
5817 .body(common::to_body::<String>(None));
5818
5819 client.request(request.unwrap()).await
5820 };
5821
5822 match req_result {
5823 Err(err) => {
5824 if let common::Retry::After(d) = dlg.http_error(&err) {
5825 sleep(d).await;
5826 continue;
5827 }
5828 dlg.finished(false);
5829 return Err(common::Error::HttpError(err));
5830 }
5831 Ok(res) => {
5832 let (mut parts, body) = res.into_parts();
5833 let mut body = common::Body::new(body);
5834 if !parts.status.is_success() {
5835 let bytes = common::to_bytes(body).await.unwrap_or_default();
5836 let error = serde_json::from_str(&common::to_string(&bytes));
5837 let response = common::to_response(parts, bytes.into());
5838
5839 if let common::Retry::After(d) =
5840 dlg.http_failure(&response, error.as_ref().ok())
5841 {
5842 sleep(d).await;
5843 continue;
5844 }
5845
5846 dlg.finished(false);
5847
5848 return Err(match error {
5849 Ok(value) => common::Error::BadRequest(value),
5850 _ => common::Error::Failure(response),
5851 });
5852 }
5853 let response = {
5854 let bytes = common::to_bytes(body).await.unwrap_or_default();
5855 let encoded = common::to_string(&bytes);
5856 match serde_json::from_str(&encoded) {
5857 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5858 Err(error) => {
5859 dlg.response_json_decode_error(&encoded, &error);
5860 return Err(common::Error::JsonDecodeError(
5861 encoded.to_string(),
5862 error,
5863 ));
5864 }
5865 }
5866 };
5867
5868 dlg.finished(true);
5869 return Ok(response);
5870 }
5871 }
5872 }
5873 }
5874
5875 /// Project ID for this request.
5876 ///
5877 /// Sets the *project* path property to the given value.
5878 ///
5879 /// Even though the property as already been set when instantiating this call,
5880 /// we provide this method for API completeness.
5881 pub fn project(mut self, new_value: &str) -> UserGetCall<'a, C> {
5882 self._project = new_value.to_string();
5883 self
5884 }
5885 /// Name of the user resource to return.
5886 ///
5887 /// Sets the *user* path property to the given value.
5888 ///
5889 /// Even though the property as already been set when instantiating this call,
5890 /// we provide this method for API completeness.
5891 pub fn user(mut self, new_value: &str) -> UserGetCall<'a, C> {
5892 self._user = new_value.to_string();
5893 self
5894 }
5895 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5896 /// while executing the actual API request.
5897 ///
5898 /// ````text
5899 /// It should be used to handle progress information, and to implement a certain level of resilience.
5900 /// ````
5901 ///
5902 /// Sets the *delegate* property to the given value.
5903 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserGetCall<'a, C> {
5904 self._delegate = Some(new_value);
5905 self
5906 }
5907
5908 /// Set any additional parameter of the query string used in the request.
5909 /// It should be used to set parameters which are not yet available through their own
5910 /// setters.
5911 ///
5912 /// Please note that this method must not be used to set any of the known parameters
5913 /// which have their own setter method. If done anyway, the request will fail.
5914 ///
5915 /// # Additional Parameters
5916 ///
5917 /// * *alt* (query-string) - Data format for the response.
5918 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5919 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5920 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5921 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5922 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
5923 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
5924 pub fn param<T>(mut self, name: T, value: T) -> UserGetCall<'a, C>
5925 where
5926 T: AsRef<str>,
5927 {
5928 self._additional_params
5929 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5930 self
5931 }
5932
5933 /// Identifies the authorization scope for the method you are building.
5934 ///
5935 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5936 /// [`Scope::CloudUseraccountReadonly`].
5937 ///
5938 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5939 /// tokens for more than one scope.
5940 ///
5941 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5942 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5943 /// sufficient, a read-write scope will do as well.
5944 pub fn add_scope<St>(mut self, scope: St) -> UserGetCall<'a, C>
5945 where
5946 St: AsRef<str>,
5947 {
5948 self._scopes.insert(String::from(scope.as_ref()));
5949 self
5950 }
5951 /// Identifies the authorization scope(s) for the method you are building.
5952 ///
5953 /// See [`Self::add_scope()`] for details.
5954 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserGetCall<'a, C>
5955 where
5956 I: IntoIterator<Item = St>,
5957 St: AsRef<str>,
5958 {
5959 self._scopes
5960 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5961 self
5962 }
5963
5964 /// Removes all scopes, and no default scope will be used either.
5965 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5966 /// for details).
5967 pub fn clear_scopes(mut self) -> UserGetCall<'a, C> {
5968 self._scopes.clear();
5969 self
5970 }
5971}
5972
5973/// Creates a User resource in the specified project using the data included in the request.
5974///
5975/// A builder for the *insert* method supported by a *user* resource.
5976/// It is not used directly, but through a [`UserMethods`] instance.
5977///
5978/// # Example
5979///
5980/// Instantiate a resource method builder
5981///
5982/// ```test_harness,no_run
5983/// # extern crate hyper;
5984/// # extern crate hyper_rustls;
5985/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
5986/// use clouduseraccountsvm_beta::api::User;
5987/// # async fn dox() {
5988/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5989///
5990/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5991/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5992/// # .with_native_roots()
5993/// # .unwrap()
5994/// # .https_only()
5995/// # .enable_http2()
5996/// # .build();
5997///
5998/// # let executor = hyper_util::rt::TokioExecutor::new();
5999/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6000/// # secret,
6001/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6002/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6003/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6004/// # ),
6005/// # ).build().await.unwrap();
6006///
6007/// # let client = hyper_util::client::legacy::Client::builder(
6008/// # hyper_util::rt::TokioExecutor::new()
6009/// # )
6010/// # .build(
6011/// # hyper_rustls::HttpsConnectorBuilder::new()
6012/// # .with_native_roots()
6013/// # .unwrap()
6014/// # .https_or_http()
6015/// # .enable_http2()
6016/// # .build()
6017/// # );
6018/// # let mut hub = CloudUserAccounts::new(client, auth);
6019/// // As the method needs a request, you would usually fill it with the desired information
6020/// // into the respective structure. Some of the parts shown here might not be applicable !
6021/// // Values shown here are possibly random and not representative !
6022/// let mut req = User::default();
6023///
6024/// // You can configure optional parameters by calling the respective setters at will, and
6025/// // execute the final call using `doit()`.
6026/// // Values shown here are possibly random and not representative !
6027/// let result = hub.users().insert(req, "project")
6028/// .doit().await;
6029/// # }
6030/// ```
6031pub struct UserInsertCall<'a, C>
6032where
6033 C: 'a,
6034{
6035 hub: &'a CloudUserAccounts<C>,
6036 _request: User,
6037 _project: String,
6038 _delegate: Option<&'a mut dyn common::Delegate>,
6039 _additional_params: HashMap<String, String>,
6040 _scopes: BTreeSet<String>,
6041}
6042
6043impl<'a, C> common::CallBuilder for UserInsertCall<'a, C> {}
6044
6045impl<'a, C> UserInsertCall<'a, C>
6046where
6047 C: common::Connector,
6048{
6049 /// Perform the operation you have build so far.
6050 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6051 use std::borrow::Cow;
6052 use std::io::{Read, Seek};
6053
6054 use common::{url::Params, ToParts};
6055 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6056
6057 let mut dd = common::DefaultDelegate;
6058 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6059 dlg.begin(common::MethodInfo {
6060 id: "clouduseraccounts.users.insert",
6061 http_method: hyper::Method::POST,
6062 });
6063
6064 for &field in ["alt", "project"].iter() {
6065 if self._additional_params.contains_key(field) {
6066 dlg.finished(false);
6067 return Err(common::Error::FieldClash(field));
6068 }
6069 }
6070
6071 let mut params = Params::with_capacity(4 + self._additional_params.len());
6072 params.push("project", self._project);
6073
6074 params.extend(self._additional_params.iter());
6075
6076 params.push("alt", "json");
6077 let mut url = self.hub._base_url.clone() + "{project}/global/users";
6078 if self._scopes.is_empty() {
6079 self._scopes
6080 .insert(Scope::CloudPlatform.as_ref().to_string());
6081 }
6082
6083 #[allow(clippy::single_element_loop)]
6084 for &(find_this, param_name) in [("{project}", "project")].iter() {
6085 url = params.uri_replacement(url, param_name, find_this, false);
6086 }
6087 {
6088 let to_remove = ["project"];
6089 params.remove_params(&to_remove);
6090 }
6091
6092 let url = params.parse_with_url(&url);
6093
6094 let mut json_mime_type = mime::APPLICATION_JSON;
6095 let mut request_value_reader = {
6096 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6097 common::remove_json_null_values(&mut value);
6098 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6099 serde_json::to_writer(&mut dst, &value).unwrap();
6100 dst
6101 };
6102 let request_size = request_value_reader
6103 .seek(std::io::SeekFrom::End(0))
6104 .unwrap();
6105 request_value_reader
6106 .seek(std::io::SeekFrom::Start(0))
6107 .unwrap();
6108
6109 loop {
6110 let token = match self
6111 .hub
6112 .auth
6113 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6114 .await
6115 {
6116 Ok(token) => token,
6117 Err(e) => match dlg.token(e) {
6118 Ok(token) => token,
6119 Err(e) => {
6120 dlg.finished(false);
6121 return Err(common::Error::MissingToken(e));
6122 }
6123 },
6124 };
6125 request_value_reader
6126 .seek(std::io::SeekFrom::Start(0))
6127 .unwrap();
6128 let mut req_result = {
6129 let client = &self.hub.client;
6130 dlg.pre_request();
6131 let mut req_builder = hyper::Request::builder()
6132 .method(hyper::Method::POST)
6133 .uri(url.as_str())
6134 .header(USER_AGENT, self.hub._user_agent.clone());
6135
6136 if let Some(token) = token.as_ref() {
6137 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6138 }
6139
6140 let request = req_builder
6141 .header(CONTENT_TYPE, json_mime_type.to_string())
6142 .header(CONTENT_LENGTH, request_size as u64)
6143 .body(common::to_body(
6144 request_value_reader.get_ref().clone().into(),
6145 ));
6146
6147 client.request(request.unwrap()).await
6148 };
6149
6150 match req_result {
6151 Err(err) => {
6152 if let common::Retry::After(d) = dlg.http_error(&err) {
6153 sleep(d).await;
6154 continue;
6155 }
6156 dlg.finished(false);
6157 return Err(common::Error::HttpError(err));
6158 }
6159 Ok(res) => {
6160 let (mut parts, body) = res.into_parts();
6161 let mut body = common::Body::new(body);
6162 if !parts.status.is_success() {
6163 let bytes = common::to_bytes(body).await.unwrap_or_default();
6164 let error = serde_json::from_str(&common::to_string(&bytes));
6165 let response = common::to_response(parts, bytes.into());
6166
6167 if let common::Retry::After(d) =
6168 dlg.http_failure(&response, error.as_ref().ok())
6169 {
6170 sleep(d).await;
6171 continue;
6172 }
6173
6174 dlg.finished(false);
6175
6176 return Err(match error {
6177 Ok(value) => common::Error::BadRequest(value),
6178 _ => common::Error::Failure(response),
6179 });
6180 }
6181 let response = {
6182 let bytes = common::to_bytes(body).await.unwrap_or_default();
6183 let encoded = common::to_string(&bytes);
6184 match serde_json::from_str(&encoded) {
6185 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6186 Err(error) => {
6187 dlg.response_json_decode_error(&encoded, &error);
6188 return Err(common::Error::JsonDecodeError(
6189 encoded.to_string(),
6190 error,
6191 ));
6192 }
6193 }
6194 };
6195
6196 dlg.finished(true);
6197 return Ok(response);
6198 }
6199 }
6200 }
6201 }
6202
6203 ///
6204 /// Sets the *request* property to the given value.
6205 ///
6206 /// Even though the property as already been set when instantiating this call,
6207 /// we provide this method for API completeness.
6208 pub fn request(mut self, new_value: User) -> UserInsertCall<'a, C> {
6209 self._request = new_value;
6210 self
6211 }
6212 /// Project ID for this request.
6213 ///
6214 /// Sets the *project* path property to the given value.
6215 ///
6216 /// Even though the property as already been set when instantiating this call,
6217 /// we provide this method for API completeness.
6218 pub fn project(mut self, new_value: &str) -> UserInsertCall<'a, C> {
6219 self._project = new_value.to_string();
6220 self
6221 }
6222 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6223 /// while executing the actual API request.
6224 ///
6225 /// ````text
6226 /// It should be used to handle progress information, and to implement a certain level of resilience.
6227 /// ````
6228 ///
6229 /// Sets the *delegate* property to the given value.
6230 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserInsertCall<'a, C> {
6231 self._delegate = Some(new_value);
6232 self
6233 }
6234
6235 /// Set any additional parameter of the query string used in the request.
6236 /// It should be used to set parameters which are not yet available through their own
6237 /// setters.
6238 ///
6239 /// Please note that this method must not be used to set any of the known parameters
6240 /// which have their own setter method. If done anyway, the request will fail.
6241 ///
6242 /// # Additional Parameters
6243 ///
6244 /// * *alt* (query-string) - Data format for the response.
6245 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6246 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6247 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6248 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6249 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
6250 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
6251 pub fn param<T>(mut self, name: T, value: T) -> UserInsertCall<'a, C>
6252 where
6253 T: AsRef<str>,
6254 {
6255 self._additional_params
6256 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6257 self
6258 }
6259
6260 /// Identifies the authorization scope for the method you are building.
6261 ///
6262 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6263 /// [`Scope::CloudPlatform`].
6264 ///
6265 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6266 /// tokens for more than one scope.
6267 ///
6268 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6269 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6270 /// sufficient, a read-write scope will do as well.
6271 pub fn add_scope<St>(mut self, scope: St) -> UserInsertCall<'a, C>
6272 where
6273 St: AsRef<str>,
6274 {
6275 self._scopes.insert(String::from(scope.as_ref()));
6276 self
6277 }
6278 /// Identifies the authorization scope(s) for the method you are building.
6279 ///
6280 /// See [`Self::add_scope()`] for details.
6281 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserInsertCall<'a, C>
6282 where
6283 I: IntoIterator<Item = St>,
6284 St: AsRef<str>,
6285 {
6286 self._scopes
6287 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6288 self
6289 }
6290
6291 /// Removes all scopes, and no default scope will be used either.
6292 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6293 /// for details).
6294 pub fn clear_scopes(mut self) -> UserInsertCall<'a, C> {
6295 self._scopes.clear();
6296 self
6297 }
6298}
6299
6300/// Retrieves a list of users contained within the specified project.
6301///
6302/// A builder for the *list* method supported by a *user* resource.
6303/// It is not used directly, but through a [`UserMethods`] instance.
6304///
6305/// # Example
6306///
6307/// Instantiate a resource method builder
6308///
6309/// ```test_harness,no_run
6310/// # extern crate hyper;
6311/// # extern crate hyper_rustls;
6312/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
6313/// # async fn dox() {
6314/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6315///
6316/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6317/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6318/// # .with_native_roots()
6319/// # .unwrap()
6320/// # .https_only()
6321/// # .enable_http2()
6322/// # .build();
6323///
6324/// # let executor = hyper_util::rt::TokioExecutor::new();
6325/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6326/// # secret,
6327/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6328/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6329/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6330/// # ),
6331/// # ).build().await.unwrap();
6332///
6333/// # let client = hyper_util::client::legacy::Client::builder(
6334/// # hyper_util::rt::TokioExecutor::new()
6335/// # )
6336/// # .build(
6337/// # hyper_rustls::HttpsConnectorBuilder::new()
6338/// # .with_native_roots()
6339/// # .unwrap()
6340/// # .https_or_http()
6341/// # .enable_http2()
6342/// # .build()
6343/// # );
6344/// # let mut hub = CloudUserAccounts::new(client, auth);
6345/// // You can configure optional parameters by calling the respective setters at will, and
6346/// // execute the final call using `doit()`.
6347/// // Values shown here are possibly random and not representative !
6348/// let result = hub.users().list("project")
6349/// .page_token("sed")
6350/// .order_by("duo")
6351/// .max_results(67)
6352/// .filter("et")
6353/// .doit().await;
6354/// # }
6355/// ```
6356pub struct UserListCall<'a, C>
6357where
6358 C: 'a,
6359{
6360 hub: &'a CloudUserAccounts<C>,
6361 _project: String,
6362 _page_token: Option<String>,
6363 _order_by: Option<String>,
6364 _max_results: Option<u32>,
6365 _filter: Option<String>,
6366 _delegate: Option<&'a mut dyn common::Delegate>,
6367 _additional_params: HashMap<String, String>,
6368 _scopes: BTreeSet<String>,
6369}
6370
6371impl<'a, C> common::CallBuilder for UserListCall<'a, C> {}
6372
6373impl<'a, C> UserListCall<'a, C>
6374where
6375 C: common::Connector,
6376{
6377 /// Perform the operation you have build so far.
6378 pub async fn doit(mut self) -> common::Result<(common::Response, UserList)> {
6379 use std::borrow::Cow;
6380 use std::io::{Read, Seek};
6381
6382 use common::{url::Params, ToParts};
6383 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6384
6385 let mut dd = common::DefaultDelegate;
6386 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6387 dlg.begin(common::MethodInfo {
6388 id: "clouduseraccounts.users.list",
6389 http_method: hyper::Method::GET,
6390 });
6391
6392 for &field in [
6393 "alt",
6394 "project",
6395 "pageToken",
6396 "orderBy",
6397 "maxResults",
6398 "filter",
6399 ]
6400 .iter()
6401 {
6402 if self._additional_params.contains_key(field) {
6403 dlg.finished(false);
6404 return Err(common::Error::FieldClash(field));
6405 }
6406 }
6407
6408 let mut params = Params::with_capacity(7 + self._additional_params.len());
6409 params.push("project", self._project);
6410 if let Some(value) = self._page_token.as_ref() {
6411 params.push("pageToken", value);
6412 }
6413 if let Some(value) = self._order_by.as_ref() {
6414 params.push("orderBy", value);
6415 }
6416 if let Some(value) = self._max_results.as_ref() {
6417 params.push("maxResults", value.to_string());
6418 }
6419 if let Some(value) = self._filter.as_ref() {
6420 params.push("filter", value);
6421 }
6422
6423 params.extend(self._additional_params.iter());
6424
6425 params.push("alt", "json");
6426 let mut url = self.hub._base_url.clone() + "{project}/global/users";
6427 if self._scopes.is_empty() {
6428 self._scopes
6429 .insert(Scope::CloudUseraccountReadonly.as_ref().to_string());
6430 }
6431
6432 #[allow(clippy::single_element_loop)]
6433 for &(find_this, param_name) in [("{project}", "project")].iter() {
6434 url = params.uri_replacement(url, param_name, find_this, false);
6435 }
6436 {
6437 let to_remove = ["project"];
6438 params.remove_params(&to_remove);
6439 }
6440
6441 let url = params.parse_with_url(&url);
6442
6443 loop {
6444 let token = match self
6445 .hub
6446 .auth
6447 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6448 .await
6449 {
6450 Ok(token) => token,
6451 Err(e) => match dlg.token(e) {
6452 Ok(token) => token,
6453 Err(e) => {
6454 dlg.finished(false);
6455 return Err(common::Error::MissingToken(e));
6456 }
6457 },
6458 };
6459 let mut req_result = {
6460 let client = &self.hub.client;
6461 dlg.pre_request();
6462 let mut req_builder = hyper::Request::builder()
6463 .method(hyper::Method::GET)
6464 .uri(url.as_str())
6465 .header(USER_AGENT, self.hub._user_agent.clone());
6466
6467 if let Some(token) = token.as_ref() {
6468 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6469 }
6470
6471 let request = req_builder
6472 .header(CONTENT_LENGTH, 0_u64)
6473 .body(common::to_body::<String>(None));
6474
6475 client.request(request.unwrap()).await
6476 };
6477
6478 match req_result {
6479 Err(err) => {
6480 if let common::Retry::After(d) = dlg.http_error(&err) {
6481 sleep(d).await;
6482 continue;
6483 }
6484 dlg.finished(false);
6485 return Err(common::Error::HttpError(err));
6486 }
6487 Ok(res) => {
6488 let (mut parts, body) = res.into_parts();
6489 let mut body = common::Body::new(body);
6490 if !parts.status.is_success() {
6491 let bytes = common::to_bytes(body).await.unwrap_or_default();
6492 let error = serde_json::from_str(&common::to_string(&bytes));
6493 let response = common::to_response(parts, bytes.into());
6494
6495 if let common::Retry::After(d) =
6496 dlg.http_failure(&response, error.as_ref().ok())
6497 {
6498 sleep(d).await;
6499 continue;
6500 }
6501
6502 dlg.finished(false);
6503
6504 return Err(match error {
6505 Ok(value) => common::Error::BadRequest(value),
6506 _ => common::Error::Failure(response),
6507 });
6508 }
6509 let response = {
6510 let bytes = common::to_bytes(body).await.unwrap_or_default();
6511 let encoded = common::to_string(&bytes);
6512 match serde_json::from_str(&encoded) {
6513 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6514 Err(error) => {
6515 dlg.response_json_decode_error(&encoded, &error);
6516 return Err(common::Error::JsonDecodeError(
6517 encoded.to_string(),
6518 error,
6519 ));
6520 }
6521 }
6522 };
6523
6524 dlg.finished(true);
6525 return Ok(response);
6526 }
6527 }
6528 }
6529 }
6530
6531 /// Project ID for this request.
6532 ///
6533 /// Sets the *project* path property to the given value.
6534 ///
6535 /// Even though the property as already been set when instantiating this call,
6536 /// we provide this method for API completeness.
6537 pub fn project(mut self, new_value: &str) -> UserListCall<'a, C> {
6538 self._project = new_value.to_string();
6539 self
6540 }
6541 /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
6542 ///
6543 /// Sets the *page token* query property to the given value.
6544 pub fn page_token(mut self, new_value: &str) -> UserListCall<'a, C> {
6545 self._page_token = Some(new_value.to_string());
6546 self
6547 }
6548 /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.
6549 ///
6550 /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.
6551 ///
6552 /// Currently, only sorting by name or creationTimestamp desc is supported.
6553 ///
6554 /// Sets the *order by* query property to the given value.
6555 pub fn order_by(mut self, new_value: &str) -> UserListCall<'a, C> {
6556 self._order_by = Some(new_value.to_string());
6557 self
6558 }
6559 /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.
6560 ///
6561 /// Sets the *max results* query property to the given value.
6562 pub fn max_results(mut self, new_value: u32) -> UserListCall<'a, C> {
6563 self._max_results = Some(new_value);
6564 self
6565 }
6566 /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.
6567 ///
6568 /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.
6569 ///
6570 /// For example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.
6571 ///
6572 /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values.
6573 ///
6574 /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.
6575 ///
6576 /// Sets the *filter* query property to the given value.
6577 pub fn filter(mut self, new_value: &str) -> UserListCall<'a, C> {
6578 self._filter = Some(new_value.to_string());
6579 self
6580 }
6581 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6582 /// while executing the actual API request.
6583 ///
6584 /// ````text
6585 /// It should be used to handle progress information, and to implement a certain level of resilience.
6586 /// ````
6587 ///
6588 /// Sets the *delegate* property to the given value.
6589 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserListCall<'a, C> {
6590 self._delegate = Some(new_value);
6591 self
6592 }
6593
6594 /// Set any additional parameter of the query string used in the request.
6595 /// It should be used to set parameters which are not yet available through their own
6596 /// setters.
6597 ///
6598 /// Please note that this method must not be used to set any of the known parameters
6599 /// which have their own setter method. If done anyway, the request will fail.
6600 ///
6601 /// # Additional Parameters
6602 ///
6603 /// * *alt* (query-string) - Data format for the response.
6604 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6605 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6606 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6607 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6608 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
6609 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
6610 pub fn param<T>(mut self, name: T, value: T) -> UserListCall<'a, C>
6611 where
6612 T: AsRef<str>,
6613 {
6614 self._additional_params
6615 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6616 self
6617 }
6618
6619 /// Identifies the authorization scope for the method you are building.
6620 ///
6621 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6622 /// [`Scope::CloudUseraccountReadonly`].
6623 ///
6624 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6625 /// tokens for more than one scope.
6626 ///
6627 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6628 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6629 /// sufficient, a read-write scope will do as well.
6630 pub fn add_scope<St>(mut self, scope: St) -> UserListCall<'a, C>
6631 where
6632 St: AsRef<str>,
6633 {
6634 self._scopes.insert(String::from(scope.as_ref()));
6635 self
6636 }
6637 /// Identifies the authorization scope(s) for the method you are building.
6638 ///
6639 /// See [`Self::add_scope()`] for details.
6640 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserListCall<'a, C>
6641 where
6642 I: IntoIterator<Item = St>,
6643 St: AsRef<str>,
6644 {
6645 self._scopes
6646 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6647 self
6648 }
6649
6650 /// Removes all scopes, and no default scope will be used either.
6651 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6652 /// for details).
6653 pub fn clear_scopes(mut self) -> UserListCall<'a, C> {
6654 self._scopes.clear();
6655 self
6656 }
6657}
6658
6659/// Removes the specified public key from the user.
6660///
6661/// A builder for the *removePublicKey* method supported by a *user* resource.
6662/// It is not used directly, but through a [`UserMethods`] instance.
6663///
6664/// # Example
6665///
6666/// Instantiate a resource method builder
6667///
6668/// ```test_harness,no_run
6669/// # extern crate hyper;
6670/// # extern crate hyper_rustls;
6671/// # extern crate google_clouduseraccountsvm_beta as clouduseraccountsvm_beta;
6672/// # async fn dox() {
6673/// # use clouduseraccountsvm_beta::{CloudUserAccounts, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6674///
6675/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6676/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6677/// # .with_native_roots()
6678/// # .unwrap()
6679/// # .https_only()
6680/// # .enable_http2()
6681/// # .build();
6682///
6683/// # let executor = hyper_util::rt::TokioExecutor::new();
6684/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6685/// # secret,
6686/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6687/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6688/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6689/// # ),
6690/// # ).build().await.unwrap();
6691///
6692/// # let client = hyper_util::client::legacy::Client::builder(
6693/// # hyper_util::rt::TokioExecutor::new()
6694/// # )
6695/// # .build(
6696/// # hyper_rustls::HttpsConnectorBuilder::new()
6697/// # .with_native_roots()
6698/// # .unwrap()
6699/// # .https_or_http()
6700/// # .enable_http2()
6701/// # .build()
6702/// # );
6703/// # let mut hub = CloudUserAccounts::new(client, auth);
6704/// // You can configure optional parameters by calling the respective setters at will, and
6705/// // execute the final call using `doit()`.
6706/// // Values shown here are possibly random and not representative !
6707/// let result = hub.users().remove_public_key("project", "user", "fingerprint")
6708/// .doit().await;
6709/// # }
6710/// ```
6711pub struct UserRemovePublicKeyCall<'a, C>
6712where
6713 C: 'a,
6714{
6715 hub: &'a CloudUserAccounts<C>,
6716 _project: String,
6717 _user: String,
6718 _fingerprint: String,
6719 _delegate: Option<&'a mut dyn common::Delegate>,
6720 _additional_params: HashMap<String, String>,
6721 _scopes: BTreeSet<String>,
6722}
6723
6724impl<'a, C> common::CallBuilder for UserRemovePublicKeyCall<'a, C> {}
6725
6726impl<'a, C> UserRemovePublicKeyCall<'a, C>
6727where
6728 C: common::Connector,
6729{
6730 /// Perform the operation you have build so far.
6731 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6732 use std::borrow::Cow;
6733 use std::io::{Read, Seek};
6734
6735 use common::{url::Params, ToParts};
6736 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6737
6738 let mut dd = common::DefaultDelegate;
6739 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6740 dlg.begin(common::MethodInfo {
6741 id: "clouduseraccounts.users.removePublicKey",
6742 http_method: hyper::Method::POST,
6743 });
6744
6745 for &field in ["alt", "project", "user", "fingerprint"].iter() {
6746 if self._additional_params.contains_key(field) {
6747 dlg.finished(false);
6748 return Err(common::Error::FieldClash(field));
6749 }
6750 }
6751
6752 let mut params = Params::with_capacity(5 + self._additional_params.len());
6753 params.push("project", self._project);
6754 params.push("user", self._user);
6755 params.push("fingerprint", self._fingerprint);
6756
6757 params.extend(self._additional_params.iter());
6758
6759 params.push("alt", "json");
6760 let mut url = self.hub._base_url.clone() + "{project}/global/users/{user}/removePublicKey";
6761 if self._scopes.is_empty() {
6762 self._scopes
6763 .insert(Scope::CloudPlatform.as_ref().to_string());
6764 }
6765
6766 #[allow(clippy::single_element_loop)]
6767 for &(find_this, param_name) in [("{project}", "project"), ("{user}", "user")].iter() {
6768 url = params.uri_replacement(url, param_name, find_this, false);
6769 }
6770 {
6771 let to_remove = ["user", "project"];
6772 params.remove_params(&to_remove);
6773 }
6774
6775 let url = params.parse_with_url(&url);
6776
6777 loop {
6778 let token = match self
6779 .hub
6780 .auth
6781 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6782 .await
6783 {
6784 Ok(token) => token,
6785 Err(e) => match dlg.token(e) {
6786 Ok(token) => token,
6787 Err(e) => {
6788 dlg.finished(false);
6789 return Err(common::Error::MissingToken(e));
6790 }
6791 },
6792 };
6793 let mut req_result = {
6794 let client = &self.hub.client;
6795 dlg.pre_request();
6796 let mut req_builder = hyper::Request::builder()
6797 .method(hyper::Method::POST)
6798 .uri(url.as_str())
6799 .header(USER_AGENT, self.hub._user_agent.clone());
6800
6801 if let Some(token) = token.as_ref() {
6802 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6803 }
6804
6805 let request = req_builder
6806 .header(CONTENT_LENGTH, 0_u64)
6807 .body(common::to_body::<String>(None));
6808
6809 client.request(request.unwrap()).await
6810 };
6811
6812 match req_result {
6813 Err(err) => {
6814 if let common::Retry::After(d) = dlg.http_error(&err) {
6815 sleep(d).await;
6816 continue;
6817 }
6818 dlg.finished(false);
6819 return Err(common::Error::HttpError(err));
6820 }
6821 Ok(res) => {
6822 let (mut parts, body) = res.into_parts();
6823 let mut body = common::Body::new(body);
6824 if !parts.status.is_success() {
6825 let bytes = common::to_bytes(body).await.unwrap_or_default();
6826 let error = serde_json::from_str(&common::to_string(&bytes));
6827 let response = common::to_response(parts, bytes.into());
6828
6829 if let common::Retry::After(d) =
6830 dlg.http_failure(&response, error.as_ref().ok())
6831 {
6832 sleep(d).await;
6833 continue;
6834 }
6835
6836 dlg.finished(false);
6837
6838 return Err(match error {
6839 Ok(value) => common::Error::BadRequest(value),
6840 _ => common::Error::Failure(response),
6841 });
6842 }
6843 let response = {
6844 let bytes = common::to_bytes(body).await.unwrap_or_default();
6845 let encoded = common::to_string(&bytes);
6846 match serde_json::from_str(&encoded) {
6847 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6848 Err(error) => {
6849 dlg.response_json_decode_error(&encoded, &error);
6850 return Err(common::Error::JsonDecodeError(
6851 encoded.to_string(),
6852 error,
6853 ));
6854 }
6855 }
6856 };
6857
6858 dlg.finished(true);
6859 return Ok(response);
6860 }
6861 }
6862 }
6863 }
6864
6865 /// Project ID for this request.
6866 ///
6867 /// Sets the *project* path property to the given value.
6868 ///
6869 /// Even though the property as already been set when instantiating this call,
6870 /// we provide this method for API completeness.
6871 pub fn project(mut self, new_value: &str) -> UserRemovePublicKeyCall<'a, C> {
6872 self._project = new_value.to_string();
6873 self
6874 }
6875 /// Name of the user for this request.
6876 ///
6877 /// Sets the *user* path property to the given value.
6878 ///
6879 /// Even though the property as already been set when instantiating this call,
6880 /// we provide this method for API completeness.
6881 pub fn user(mut self, new_value: &str) -> UserRemovePublicKeyCall<'a, C> {
6882 self._user = new_value.to_string();
6883 self
6884 }
6885 /// The fingerprint of the public key to delete. Public keys are identified by their fingerprint, which is defined by RFC4716 to be the MD5 digest of the public key.
6886 ///
6887 /// Sets the *fingerprint* query property to the given value.
6888 ///
6889 /// Even though the property as already been set when instantiating this call,
6890 /// we provide this method for API completeness.
6891 pub fn fingerprint(mut self, new_value: &str) -> UserRemovePublicKeyCall<'a, C> {
6892 self._fingerprint = new_value.to_string();
6893 self
6894 }
6895 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6896 /// while executing the actual API request.
6897 ///
6898 /// ````text
6899 /// It should be used to handle progress information, and to implement a certain level of resilience.
6900 /// ````
6901 ///
6902 /// Sets the *delegate* property to the given value.
6903 pub fn delegate(
6904 mut self,
6905 new_value: &'a mut dyn common::Delegate,
6906 ) -> UserRemovePublicKeyCall<'a, C> {
6907 self._delegate = Some(new_value);
6908 self
6909 }
6910
6911 /// Set any additional parameter of the query string used in the request.
6912 /// It should be used to set parameters which are not yet available through their own
6913 /// setters.
6914 ///
6915 /// Please note that this method must not be used to set any of the known parameters
6916 /// which have their own setter method. If done anyway, the request will fail.
6917 ///
6918 /// # Additional Parameters
6919 ///
6920 /// * *alt* (query-string) - Data format for the response.
6921 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6922 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6923 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6924 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6925 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
6926 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
6927 pub fn param<T>(mut self, name: T, value: T) -> UserRemovePublicKeyCall<'a, C>
6928 where
6929 T: AsRef<str>,
6930 {
6931 self._additional_params
6932 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6933 self
6934 }
6935
6936 /// Identifies the authorization scope for the method you are building.
6937 ///
6938 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6939 /// [`Scope::CloudPlatform`].
6940 ///
6941 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6942 /// tokens for more than one scope.
6943 ///
6944 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6945 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6946 /// sufficient, a read-write scope will do as well.
6947 pub fn add_scope<St>(mut self, scope: St) -> UserRemovePublicKeyCall<'a, C>
6948 where
6949 St: AsRef<str>,
6950 {
6951 self._scopes.insert(String::from(scope.as_ref()));
6952 self
6953 }
6954 /// Identifies the authorization scope(s) for the method you are building.
6955 ///
6956 /// See [`Self::add_scope()`] for details.
6957 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserRemovePublicKeyCall<'a, C>
6958 where
6959 I: IntoIterator<Item = St>,
6960 St: AsRef<str>,
6961 {
6962 self._scopes
6963 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6964 self
6965 }
6966
6967 /// Removes all scopes, and no default scope will be used either.
6968 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6969 /// for details).
6970 pub fn clear_scopes(mut self) -> UserRemovePublicKeyCall<'a, C> {
6971 self._scopes.clear();
6972 self
6973 }
6974}